[antlr-interest] How to ignore TOKEN in a String

Hiten R antlr3 at gmail.com
Tue Mar 22 14:40:00 PDT 2011


John/All

I followed 'antlr wiki' example but then it stopped working completely.
Previous way it was complaining about the second line but after the change
it could not get past the first line 'funny boys are Tom Hardy Donald '.

*Exception*
line 1:0 no viable alternative at input 'funny'

I am not much familiar with ANTLR but can you give me another example or
point me to getting quoted string resolved.

Thx
Hitender

BEFORE [ignore caps please]
start
  : 'funny' call_funny_parse
  | 'serious' call_serious_parse
  ;

AFTER - ANTLR WIKI [ignore caps please]
start
 : lexer_funny
 | lexer_serious
 ;

lexer_funny : {input.LT(1).getText().equals("funny")}? call_funny_parse;
lexer_serious : {input.LT(1).getText().equals("serious")}?
call_serious_parse;


More information about the antlr-interest mailing list