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."

However, the TokenStream interface can reconstruct the text of one or a 
sub-sequence of the tokens it has produced (based on ordinal indexes or 
particular Token instances produced by that TokenStream). You may be 
able to find a way to use that to reconstruct an input line or, more 
probably, a fragment of the input corresponding to some syntactically 
significant entity.


> thanks for answering,
>  Michael


Randall Schulz

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


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to