tags:

views:

49

answers:

2
+1  A: 

I don't have much experience with AntLR, but my guess is that the lexer is producing a token for the newline and it's not matched in your grammar.

Normally when you're writing a parser you have to tell the lexer explicitly to ignore whitespace and line endings. But I could be wrong, that could be something that AntLR is supposed to do for you.

Nate C-K
+3  A: 

You usually want to tell ANTLR to ignore whitespace with a lexer rule:

WHITESPACE
    :   ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+
        { $channel = HIDDEN; } ;
Kaleb Pederson
+1 - you said what I said except you actually know what you're doing
Nate C-K
@Nate C-K - perhaps... or maybe I just got lucky ;)
Kaleb Pederson