[antlr-interest] problems with label

Terence Parr parrt at cs.usfca.edu
Mon Jan 17 09:30:33 PST 2005


Hi,

[please switch to antlr.org's mailing list now] :)

Anyway, yes.  Use LT(1) before the subrule or in an init action.  That 
will get the token for the next symbol.

Ter
On Jan 17, 2005, at 5:58 AM, Krishanu Debnath wrote:
> id returns [_return_type *idObj]
> {
>     // initialized code
> }
>     :
>         tId:ID
>         {
>             // retrieve the token that has been set in lexer using 
> $setToken()
>             pIdObj = (_return_type *)... //label tId is used to access
> the _return_type node
>         }
>     |
>         // Followings are the keywords
>        (
>           tKeyword:""index"
>        |  tKeyword:"out"
>        |
>        ... // other keywords ..
>
>        )
>        {
>             // C++ code using label 'tKeyword'
>        }
>
>
> But Antlr reports error 'already defined label tKeyword' for this. Is 
> there any
> options/work around available to by pass this error?
>
> Krishanu
>
> -- 
> "When I have to rely on inadequacy, I prefer it to be my own."
> --Richard Heathfield
>
>
>
> Yahoo! Groups Links
>
> <*> To visit your group on the web, go to:
>     http://groups.yahoo.com/group/antlr-interest/
>
> <*> To unsubscribe from this group, send an email to:
>     antlr-interest-unsubscribe at yahoogroups.com
>
> <*> Your use of Yahoo! Groups is subject to:
>     http://docs.yahoo.com/info/terms/
>
>
>
>





More information about the antlr-interest mailing list