[antlr-interest] A question about literals
mzukowski at yci.com
mzukowski at yci.com
Fri Aug 30 12:39:24 PDT 2002
I should add that antlr is trying to protect itself from creating a variable
name that won't work in the target language. It constructs the name from
your prefix "LITERAL_" and then the keyword.
First: does this cause a problem for you, or are you just curious?
Second: I believe you can use the tokens section to add a keyword and a
token name for it.
>>From http://www.antlr.org/doc/metalang.html#_bb1:
You can also define literals in this section and, most importantly, assign
to them a valid label as in the following example.
tokens {
KEYWORD_VOID="void";
EXPR;
DECL;
INT="int";
}
Monty
> -----Original Message-----
> From: mzukowski at yci.com [mailto:mzukowski at yci.com]
> Sent: Friday, August 30, 2002 12:31 PM
> To: antlr-interest at yahoogroups.com
> Subject: RE: [antlr-interest] A question about literals
>
>
> That's weird. It probably doesn't like the '2' in varchar2. Try
> varchar_two maybe?
>
> Monty
>
> > -----Original Message-----
> > From: richardhensley99 [mailto:richard.hensley at mckesson.com]
> > Sent: Friday, August 30, 2002 12:21 PM
> > To: antlr-interest at yahoogroups.com
> > Subject: [antlr-interest] A question about literals
> >
> >
> > My grammar generates the following TokenTypes, however the varchar2
> > is commented, instead of being LITERAL_varchar2 = 16. Why does this
> > happen?
> >
> > public interface OracleDDLTokenTypes {
> > int EOF = 1;
> > int NULL_TREE_LOOKAHEAD = 3;
> > int LITERAL_execute = 4;
> > int COMMANDEND = 5;
> > int ID = 6;
> > int LPAREN = 7;
> > int RPAREN = 8;
> > int COMMA = 9;
> > int QUOTED_STRING = 10;
> > int LITERAL_whenever = 11;
> > int LITERAL_sqlerror = 12;
> > int LITERAL_create = 13;
> > int LITERAL_table = 14;
> > int LITERAL_tablespace = 15;
> > // "varchar2" = 16
> > int LITERAL_varchar = 17;
> > int LITERAL_number = 18;
> > int LITERAL_date = 19;
> > int LITERAL_integer = 20;
> > int LITERAL_long = 21;
> > int LITERAL_raw = 22;
> > int CARDINAL = 23;
> > int LITERAL_index = 24;
> > int LITERAL_view = 25;
> > int LITERAL_drop = 26;
> > int LITERAL_insert = 27;
> > int WS = 28;
> > int SL_COMMENT = 29;
> > }
> >
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
>
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list