[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to use our own token ?
From: |
Hans Aberg |
Subject: |
Re: How to use our own token ? |
Date: |
Thu, 28 Jan 2010 21:46:00 +0100 |
On 28 Jan 2010, at 07:34, Aurelien Tran wrote:
I have my own lexer which is returning me a token_type identifier
define as
follow:
namespace mynamespace {
enum token_type {
mytoken1 = 123,
mytoken2 = 456,
mytoken3 = 789
};
}
When I tried to write the parser, how do I need to write the bison
script to
use my token system ?
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.
Hans