[antlr-interest] Performing an action based on alternative result
Olivier Dragon
dragonoe at mcmaster.ca
Wed Sep 14 15:44:39 PDT 2005
Hi,
I'd like to be able to define a single label for many alternatives and
then use the result in an action. Something like this:
foobar :
(
t:"function" |
t:"subroutine" |
t:"program"
)
{ doSomethingWith(t) ; }
But ANTLR gives me an error "Label 't' has already been defined". Is
there an easy way to do this so that I don't have to specify different
label for each alternative and the same action for each as well?
Thanks,
-Olivier
--
__-/| ? ? |\-__
__--/ / \ (^^) / \ \--__
_-/ / / /\ / ( ) /\ \ \ \-_
/ / / / / ( ^^ ~ \ \ \ \ \
/ Oli Dragon ( dragonoe at mcmaster.ca \
/ B.Eng. Sfwr ( ) \ \ \ \
/ / / /__--_ ( ) __--__\ \ \ \
| / / _/ \_ \_ \_ \ \ |
\/ / _/ \_ \_ \_ \ \/
\_/ / -\_\ \ \_/
\/ ) \/
*~
___--<***************>--___
[http://dragon.homelinux.org]
~~~--<***************>--~~~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20050914/3a1954c8/attachment-0001.bin
More information about the antlr-interest
mailing list