bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using existing token values


From: Ludovic Courtès
Subject: Using existing token values
Date: Mon, 18 Jul 2011 10:45:48 +0200
User-agent: Gnus/5.110017 (No Gnus v0.17) Emacs/24.0.50 (gnu/linux)

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

[Prev in Thread] Current Thread [Next in Thread]