Hi,

I’m writing a parser where the lexer already has #defines or enum values
for all the tokens.  So I’d like to write, say:

  %token YCPP_NAME CPP_NAME

or just

  %token CPP_NAME

where ‘CPP_NAME’ is a CPP macro expanding to an integer constant, or an
enum value, already defined elsewhere.

However, ‘%token CPP_NAME’ yields a new #define CPP_NAME, and in
‘%token YCPP_NAME CPP_NAME’ the second argument is interpreted as an
alternate name for the token.

Any idea how to achieve this?

Thanks,
Ludo’.

Reply via email to