This is an FAQ I think. Your start rule does not end in EOF and so  
ANTLR stops parsing when the next token is not predicted.

Jim

On Jan 15, 2010, at 0:57, Arne Schröder <[email protected]>  
wrote:

> Hello,
>
> I am trying to write a parser for an initialization-file. This file is
> devided in sections which are not embraced but have a keyword to  
> start them.
>
> Unfortunately the parser stops when encountering a problem and just  
> ends the
> parsing-process, not even reporting an error.
>
> For demostration of the problem I wrote the following example-grammar:
>
> file    : section1 section2?
>        ;
>
> section1: 'Section1'
>        ;
>
> section2: 'Section2'
>        ;
>
> ID      : ('a'..'z'|'A'..'Z')+
>        ;
>
> SPACE   : ' ' {$channel = HIDDEN;}
>        ;
>
> Now using the input "Section1 bla Section2", I would expect the  
> parser to
> stop at "bla", throw an UnwantedTokenException, do a  
> SingleTokenDeletion as
> error-recovery and just continue parsing "Section2".
> What happens is that it stops at "bla", does not recognize it as  
> section2
> and just terminates, leaving the two tokens unparsed and not  
> reporting any
> error.
>
> So my question is: How can I avoid my parser doing stuff like that  
> without
> changing my files' syntax?
>
>
> Thanks in advance
>
> Arne
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/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 [email protected].
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