[antlr-interest] need some advice
Dietmar Schaefer
dietmar-s at online.de
Fri Apr 9 01:56:07 PDT 2010
Hi !
I just cannot figure out what is wrong with my grammar.
Here it is:
grammar Test;
scenario :
statement;
statement :
sequenceStatement ;
sequenceStatement
: 'DefSequence' ID WHITESPACE* '{' VALUE '}' ';'? '\n'? ;
ID : LETTER (LETTER | DIGIT | '_' )* ;
fragment DIGIT : '0'..'9';
fragment LETTER : 'a'..'z' | 'A'..'Z';
WHITESPACE : ( '\t' | ' ' | '\n'|'\r')+ {$channel = HIDDEN;} ;
VALUE
: ('\u0041'|'\u0042'|'\u0043') DIGIT DIGIT DIGIT DIGIT | ('-')*
{System.out.println("VALUE detected: ");};
---------------------------------------------------------
I cut my original grammar down to the bare minimum.
DefSequence L { -- } works
DefSequence L { A1200} gives me MismatchedTokenException: line 1:16
mismatched input 'A1200' expecting '\u0006'
Do I have to mention, that I am new to ANTLR ? I don't think so !
regards
Dietmar
More information about the antlr-interest
mailing list