bison-patches
[Top][All Lists]
Advanced

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

Re: FYI: lalr1.cc: Move tokens and YYSTYPE into the class


From: Hans Aberg
Subject: Re: FYI: lalr1.cc: Move tokens and YYSTYPE into the class
Date: Wed, 5 Oct 2005 10:02:52 +0200


On 5 Oct 2005, at 08:57, Akim Demaille wrote:

"Hans" == Hans Aberg <address@hidden> writes:



On 3 Oct 2005, at 21:23, Paul Eggert wrote:

http://lists.gnu.org/archive/html/bison-patches/2005-09/ msg00114.html



Thank you. I looked for it, but could not find it.



It looks fine to me -- I did something similar in my skeleton
file. :-) (I got worried that the token or semantic value definitions
would have been in the parser class.)


Which is indeed the case.

When the user defines YYSTYPE via a macro, it looks like you only have a semantic type declaration within the parser class. I see that you have put the union definition within the class, as well as the token values.

It worries me that this latter might cause problems when used with Flex in a traditional C/C++ header style setup. One then needs (I think) in the lexer class to know the size of these types, which is not possible if they are put in a class coming after it. This move would cause having to work with references in the lexer class.

So the token enum or struct, as well the union definition should be put in a special header so that one can, in the lexer source file, write:
  #include "<token_header>" /* contains union in applicable cases */
  #include "<lexer_header>"
  #include "<parser_header>"
One can perhaps not achieve this with the current Flex lexer header; I tweaked mine.

  Hans Aberg






reply via email to

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