On Fri, 2008-11-28 at 15:53 -0800, Randall R Schulz wrote:

> On Friday 28 November 2008 04:30, micha wrote:
> > Hi,
> >
> > maybe I'm not seeing the obvious, but how can I output the whole
> > source line, when an error occurs (while parsing) ?
> 
> Well, the lexer counts newlines (or CR+LF pairs) so as to provide a line 
> count associated with each token it emits, but lines per se are not 
> something that it otherwise deals in. Lines are, in effect, a 
> completely separate partitioning of the input sequence and rarely 
> correspond to a syntactically significant entity.
> 
> So the answer is basically "no."


Or, more accurately, ANTLR does not do this because it cannot
generically 'know' what a line of your input is. However, the error
message objects give you the token at which an error occurred and it is
easy to use this positional information to locate the start of your
'line' in the input stream and print it out, with a caret underneath the
error and so on.

Jim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address

Reply via email to