[antlr-interest] Token types
Jim Idle
jimi at temporal-wave.com
Sat May 26 13:23:40 PDT 2007
These are just the pre-defined ones, so you will need to enumerate the
rest when the template is called, but you shodl be able to generate an
enum where the template code starts out with the those, then fills in
the rest dynamically, something like this
headerFile...
package Token is
Token_Type is (
EOF, -- (-1)
INVALID, -- ( 0)
EOR, -- ( 1) No idea what this means.
DOWN, -- ( 2) Something to do with parse trees?
UP, -- ( 3) Something to do with parse trees?
<tokens:{ <it.name> = <it.type>}; separator = ",\n">
end Token;
Jim
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Luke A. Guest
> Sent: Saturday, May 26, 2007 10:30 AM
> To: ANTR Interest
> Subject: [antlr-interest] Token types
>
> Hi,
>
> Are token types as defined in Token.java supposed to be a limited set,
> i.e. can I define these inside an enumeration or are they allowed to
be
> extended via subclassing?
>
> I'm considering:
>
> package Token is
>
> Token_Type is (
> EOF, -- (-1)
> INVALID, -- ( 0)
> EOR, -- ( 1) No idea what this means.
> DOWN, -- ( 2) Something to do with parse trees?
> UP); -- ( 3) Something to do with parse trees?
>
> end Token;
>
> Which means that they cannot be extended, and thus I don't actually
> need
> to assign the same values to the enumeration as the Java
> implementation.
>
> Thanks,
> Luke.
>
More information about the antlr-interest
mailing list