[antlr-interest] Assign words to a variable inside a rule ????

OJAY78 at gmx.de OJAY78 at gmx.de
Tue Oct 30 07:34:05 PDT 2007


Hi,

I have a problem with assigning words to variables inside a rule. This is the function:

fillStrFunction returns[String value]
	:
	'fill' '(' source = parameter '|' ( mode='left' | mode ='right')  '|' replace = STRING_CONST '|' length = STRING_CONST ')' 
	{
		$value = FELHelper.fillStrFunction($source.value, $mode.text, $replace.text, $length.text);
	}
	;

and here is the call of my function:
fill( "678" | left | "0" | 8 ) -> "00000678"


It results in a NoViableAltException, but why? Can anyone explain me I can access such words inside a rule?

Thanks


-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


More information about the antlr-interest mailing list