[antlr-interest] Dealing With "missing attribute access on rule scope"

Randall R Schulz rschulz at sonic.net
Thu Sep 6 12:14:51 PDT 2007


Hello again,

I see one problem with my parser is that tree parsers don't deal in 
Tokens, they deal in Trees. (I had to put dummies in the place of the 
erroneous, unqualified access so I could generate code to examine.)

However, I'd still like to get at that Tree returned by this rule:

interpretableName
    :   BareName
    |   EnclosedName
    ;


Is that possible? If so, how?

Randall Schulz


On Thursday 06 September 2007 11:22, Randall R Schulz wrote:
> Hi,
>
> I have this grammar rule
>
> interpretableName
>     :   BareName
>     |   EnclosedName
>     ;
>
>
> There are a few places in my grammar where I want to take the Token
> yielded by this rule and pass it to some Java action code:
>
> binding
> returns [ Variable var ]
>
>     :   interpretableName
>
>         {
>             $var = makeIndividualVariable($interpretableName);
>         }
>
>
> But I get the ever-popular diagnostic:
>
> error(117): CLIFBuilder.g:0:0: missing attribute access on rule
> scope: interpretableName
>
>
> This is a tree parser:
>
> tree grammar        CLIFBuilder;
>
> ...


More information about the antlr-interest mailing list