[antlr-interest] Token types

Luke A. Guest laguest at archangeli.co.uk
Sat May 26 14:20:40 PDT 2007


On Sat, 2007-05-26 at 13:23 -0700, Jim Idle wrote:
> 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;

True, this could be done rather than defining the Token package in the
runtime.

Thanks,
Luke.




More information about the antlr-interest mailing list