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




_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to