[antlr-interest] Fixing grammar rule with trailing optional token

angryal2000 <angryal2000 at yahoo.ca> angryal2000 at yahoo.ca
Fri Jan 17 14:50:00 PST 2003


I am having difficulty trying to fix the following rule:

data_type: FLOAT (OPENBRACKET INTEGER CLOSEBRACKET)? ;

FLOAT="float";
OPENBRACKET='(';
CLOSEBRACKET=')';
INTEGER=('0'..'9')+;

e.g.
"float" is accept by the rule data_type
as is
"float(23)"


i know my rule is wrong, i am just not sure how to go about fixing it.
 any ideas?  thanks.


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list