On 29 Jan 2010, at 03:11, Aurelien Tran wrote:
Use 'bison --defines' - see manual or 'bison --help', which then
writes a header .tab.h, which contains stuff like:
enum yytokentype {
token_error = 258,
help_key = 259,
quit_key = 260,
...
}
Include this header in the lexer file, and use those names.
I know that this is the general way to do this but the lexer is in
fact an
external module that I cant modify. I would like to avoid rewriting
all the
token and their value in another file. If need to I will but I would
to
avoid it in order to have more maintainable source code.
I just want to be sure that Bison do not support this kind of
feature (Which
is actually the real purpose of my post here).
As you see from the numbers above, Bison just numbers the tokens
sequentially, and it is used shifted in parser lookup tables as
indices, for speed simply. So Bison does not support that, I feel
sure, and it would not be easy to fit with the implementation model.
So you need some translation table of sort, I think.
Hans
_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison