[antlr-interest] Returning from a sub-parser with no end token.

Terence Parr parrt at jguru.com
Fri Dec 28 14:06:42 PST 2001


On Friday, December 28, 2001, at 01:50  AM, Remi Koutcherawy wrote:

> OK, looking at the generated code, I found a solution.
> Rather simple, just four added lines of code, works well even with AST.
>
> Nevertheless I feel awkward to reference "parse_AST" which is a 
> variable in the generated code not
> declared in the grammar, clumsy also to throw an exception and catch 
> another ;-)
>
> Any other idea ?
> Albeit modifying the generator to add a new option to generate such a 
> behavior can be considered.
>
I don't see what code you added...

basically if you make a sentinel token optional a lexer has a problem 
switching back to another lexer.  It has to get a token to test it (to 
see if it's BBB), right?  If not BBB then it is incorrectly accessing 
the stream of chars associated with the other lexer.

Ter


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list