[antlr-interest] Trouble with ANTLR 3 grammar

Emond Papegaaij e.papegaaij at student.utwente.nl
Fri Jun 30 11:43:32 PDT 2006


On Friday 30 June 2006 18:43, Terence Parr wrote:
> On Jun 30, 2006, at 12:03 AM, Emond Papegaaij wrote:
> >> If you print out the tokens, is WS really on channel 99?  If so, then
> >> something really strange is happening with the token buffer.  Can you
> >> try a diff on your generated lexer between ea10 and b1?
> >
> > I've compared it to the version you sent me last week. The output is
> > identical, except for the synpreds. I've also added a println
> > statement in
> > the lexer, next to channel = 99. The channel is set correctly.
> > Exactly 12
> > messages are printed and 12 WS tokens are visible in the output. It
> > seems
> > some other part of ANTLR is responsible for this to stop working.
>
> Hmm...that is very odd...i was thinking the backtracking was
> preventing it.  Are you printing the tokens after they come out of
> the lexer nextToken()?  If those are ok, then something weird changed
> in the parser or more likely tokenstream.
>
> Just looked at the filtering nextToken() method.  Looks fine.
> Hmm...all of my filter tests work, but I don't try to parse with the
> resulting token stream...

I'm printing the tokens (for debugging) before parsing with a simple while 
loop. Maybe this is causing the problem? I've included the Main.java that, 
together with the grammar included in my first mail in this thread, triggers 
the problem.

Best regards
Emond
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Main.java
Type: text/x-java
Size: 492 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20060630/093accb5/Main.bin


More information about the antlr-interest mailing list