[antlr-interest] AST losing leaves in v3.3
Mike Allbright
mike at metaorb.com
Sun Dec 5 11:19:53 PST 2010
With v2.7.7, the AST has all the expected nodes, but with v3.3, the
limit_val nodes get dropped. Am I overlooking some obvious mistake here?
Regards,
--Mike
Here's my input:
----------------------
mm-T_minute:bbc-xyzzy
And the v3.3 output:
------------------------
(FIELD mm (var T_minute) limits)
Here's the grammar
---------------------------
grammar sfield;
options
{
output=AST;
ASTLabelType=CommonTree;
}
tokens
{
NAME;
FIELD;
}
sfield
: field_name '-' var qualifier* ->
^(FIELD field_name var qualifier*)
;
field_name
: ID
;
var
: ID -> ^(NAME["var"] ID)
;
qualifier
: ':' limits -> ^(limits)
;
limits
: limit_val '-' limit_val ->
^(NAME["limits"] limit_val+)
;
limit_val
: ID -> ID
;
ID: (LETTER|'_')(LETTER|'_'|DIGIT)*;
fragment LETTER: LOWER | UPPER;
fragment LOWER: 'a'..'z';
fragment UPPER: 'A'..'Z';
fragment DIGIT: '0'..'9';
fragment SPACE: ' ' | '\t';
fragment SIGN: '+' | '-';
NEWLINE: ('\r'? '\n')+ { $channel = HIDDEN; };
WHITESPACE: SPACE+ { $channel = HIDDEN; };
OTHER : . ;
More information about the antlr-interest
mailing list