[antlr-interest] Expr.text null?
Terence Parr
parrt at cs.usfca.edu
Tue Aug 12 16:39:02 PDT 2008
On Aug 12, 2008, at 4:34 PM, Foust wrote:
>> From: Terence Parr [mailto:parrt at cs.usfca.edu]
>> Sent: Tuesday, August 12, 2008 3:32 PM
>> To: Foust
>> Cc: antlr-interest at antlr.org
>> Subject: Re: [antlr-interest] Expr.text null?
>>
>> should work. java target right? did you setTokenStream on the node
>> stream?
>> Ter
>
> Yes, Java target, ASTLabelType set like this:
>
> tree grammar RunModl;
> options {
> tokenVocab=Modl;
> ASTLabelType=CommonTree;
> }
>
> And the rule is just a little more complicated, in that
> expr: a? b;
>
> is actually more like:
>
> expr: ^(EXPR_TOKEN a? b)
> { $a.text is also null here }
>
> a options {backtrack=true; memoize=true;}
> : ^(PART1_TOKEN IDENT ...)
> { $IDENT.text is correct here }
Likely PART1_TOKEN has no token indexes set.
Do you create PART1_TOKEN as a root of a rule in parser? If not,
indexes probably not set.
Ter
More information about the antlr-interest
mailing list