[antlr-interest] Expr.text null?
    Foust 
    javafoust at gmail.com
       
    Tue Aug 12 15:23:46 PDT 2008
    
    
  
Does it make sense that a matched sub-rule returns null for its text
attribute?
 
That is, the following rule matches the input AST just fine.
 
tree grammar;
expr : a? b;
 
a : ^(SOME_TOKEN someargs)
b: ^(etc.)
 
 
But when the text of a is desired, it always returns null, whether in the
rule action, or in a sub-rule action, as below:
 
expr : (a {System.out.println($a.text); } )?  b  ;
 
prints "null".
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080812/a75c8e84/attachment.html 
    
    
More information about the antlr-interest
mailing list