[antlr-interest] Use of multimap in grammar file.

Gordon Tyler Gordon.Tyler at quest.com
Wed Jan 26 10:55:23 PST 2011


rule: TRANSITION id1=IDENTIFIER TO id2=IDENTIFIER transFlags

Then you can use id1 and id2 as references to their respective tokens in the post-rule code block.

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Alfredo Perez J.
> Sent: Wednesday, January 26, 2011 12:41 PM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Use of multimap in grammar file.
> 
> Nevermind that previous post (accidentally doubled btw). My mind  after
> many
> hours couldn't see an extra ; that was  there which caused the error.
> 
> Now I have a different quesiton if you mind.
> 
> I have some expression like this:
> 
> TRANSITION IDENTIFIER TO IDENTIFIER transFlags
> 
> Now what I want in this step is store IDENTIFIER.text from the left
> side and
> IDENTIFIER.text from the right side, but how can I tell one from the
> other?
> Tried something like this:
> 
> TRANSITION IDENTIFIER {Auxiliar = {$IDENTIFIER.text}} TO IDENTIFIER
> transFlags
> 
> Auxiliar beign a String but I get the error: IDENTIFIER is a non-unique
> reference.
> I can't define some sort of "LeftIdentifier" because it's the same rule
> and
> it won't be matched.
> 
> Any idea how can I differenciate these Identifiers?
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list