[antlr-interest] assign optional rule values into a list

OJAY78 at gmx.de OJAY78 at gmx.de
Tue Oct 9 05:40:57 PDT 2007


Hi,

I have a rule in my grammar which can contain one parameter or more than one seperated by '|' sign. Now I have the problem that I want to add those parameters into a list.

I tried it with the += but this does not work, when I look into the generated code I can see that there will be generated a list, but it will be not filled

infiniteParameterList returns[List lst]
	:	ps += parameter ('|' parameter) *
{
}
	;
Then I tried this variant, but this will result in a grammar syntax failure
infiniteParameterList returns[List lst]
	:	ps += parameter ('|' ps+=parameter) *
{
}
	;

Does anyone can tell me how I can make this assignment?

Thanks
-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail


More information about the antlr-interest mailing list