[antlr-interest] unexpected NoViableAltException
Dieter Frej
dieter_frej at gmx.net
Sun Nov 19 11:07:56 PST 2006
Hi everybody,
I need your help because I am totally puzzled about my very easy grammar.
The grammar contains three parser rules
ml
: exp 'mit' with
;
exp
: (IDENT '=' SEMI)*
;
with
: (IDENT '=' SEMI)*
;
I used the interpreter of antlrworks for the
- rule 'with' and the input 'bla=;' (without ')
-> everything works fine
- rule 'exp' and the (same) input 'bla=;'
-> I get a NoViableAltException
- rule 'exp' and the input 'bla =; mit blubb=;'
-> works fine
- rule 'ml' and the input 'bla =; mit blubb=;'
-> works fine (as expected)
I have not idea what the problem is. I know that the order of rules
appearing in the grammar has effect, so I changed it, but still the
same... :-(
Thanks in advance,
- Didi
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
-------------- next part --------------
grammar noviablealtexception;
options {
output = AST;
}
@members {
public static final CommonToken IGNORE_TOKEN = new CommonToken(null,0,99,0,0);
}
ml
: exp 'mit' with
;
exp
: (IDENT '=' SEMI)*
;
with
: (IDENT '=' SEMI)*
;
SEMI : ';'
;
IDENT
: ('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')*
;
WS : (' ' | '\t' | '\n' | '\r') { channel=99;}
;
More information about the antlr-interest
mailing list