[antlr-interest] Problem with this antlr grammar.
doctlo-antlr at yahoo.com
doctlo-antlr at yahoo.com
Mon Feb 28 23:24:14 PST 2005
header {
}
class MyLexer extends Lexer;
options
{
k=3;
}
WS : ('\n' | '\r')
{ _ttype = Token.SKIP; };
DIGIT : '0'..'9';
UPPER : 'A'..'Z';
LOWER : 'a'..'z';
//NUMBER : ('+'|'-')(DIGIT)+;
//REAL : NUMBER '.' (DIGIT)*;
OPENP : '(';
CLOSEP : ')';
SEMI : ';';
OPENB : '[';
CLOSEB : ']';
COLON : ':';
PERIOD : '.';
ESC : '\\' ']';
PROP_VALUE : OPENB ( ESC | ~']')* CLOSEB;
PROP_IDENT : UPPER (UPPER|DIGIT)?;
class MyParser extends Parser;
options
{
k=3;
}
collection : (game_tree)+;
game_tree : OPENP sequence (game_tree)* CLOSEP;
sequence : (node)+ ;
node : SEMI (property)*;
property : PROP_IDENT PROP_VALUE;
For some reason when I feed it the following:
(;GM[1])
line 1:3: expecting CLOSEP but found 'G'.
I have no idea why.
Can someone help?
Thanks
T.L.Olczyk
2.7.4
More information about the antlr-interest
mailing list