[antlr-interest] Quick Question

Hill, Robert rhill03 at eds.com
Mon Jul 3 04:43:35 PDT 2006


Recently revisiting an old parser, and came across this

QUOTE 	(i1:WORD | i2:IDENT) {if (i1==null)
returnString.Append(i2.getText()); else
returnString.Append(i1.getText()); } 

So, is it acceptable (good form?) to replace the above with 

QUOTE 	{returnString = LT(1).getText(); } (WORD | IDENT) 

I can't see any problem with the generated code, other than possibly the
return string not having the correct token on a mismatch which isn't an
issue in this case. I just want to cut down on the clutter.

Or am I missing something ? 
Cheers,

Rob


--
Rob Hill
EDS - Hallamshire Business Park
F1E/045
Sheffield	
T:	+44 (0) 114 291 1928
M:	+44 (0) 791 732 1227
E:	rhill03 at eds.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060703/0989da73/attachment.html


More information about the antlr-interest mailing list