Another minor bug found in grammar

Dec 21, 2010 at 4:16 PM

The lexer rule below:

LINE_COMMENT
    : ('//' ~('\n'|'\r')*  ('\r' | '\n')+)
    { Skip(); } ;

It works when the comment statement appears in the MIDDLE of code. However, if the comment is at the last line of code and there's no newline symbol ('\r') in this line, Antlr will pop up an EarlyExitException.

The fix is obvious: just replace + with * outside the ('\r' | '\n') block.

There're several similar cases in the lexer rule section that may need to be fixed as well.

It's a minor issue, though.

Coordinator
Dec 21, 2010 at 11:25 PM

I think there's an EOF constant or something like that.  I'll track that down, thanks.