[Top][All Lists]

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

Re: [Bison-Announce] Bison 3.3.1 released [stable]

From: Frank Heckenbach
Subject: Re: [Bison-Announce] Bison 3.3.1 released [stable]
Date: Tue, 29 Jan 2019 21:30:08 +0100

Bison 3.3.1 works for me without problems or warnings.

My only suggestion is about the wording in this announcement
(and also in the manual):

> *** ? C++: Actual token constructors
>   For instance with these declarations
>     %token           ':'
>        <std::string> ID
>        <int>         INT;
>   you may use these constructors:
>     symbol_type (int token, const std::string&);
>     symbol_type (int token, const int&);
>     symbol_type (int token);
>   which should be used in a Flex-scanner as follows.
>     %%
>     [a-z]+   return yy::parser::symbol_type (ID, yytext);
>     [0-9]+   return yy::parser::symbol_type (INT, text_to_int (yytext);
>     ":"      return yy::parser::symbol_type (':');
>     <<EOF>>  return yy::parser::symbol_type (0);

This might be read as suggesting to use the new constructors in
cases like these, which was probably not your intention; when the
token kind is known at compile time, such as here, I think the named
token constructors (make_FOO) are still pereferable. The new
constructors are needed when the kind is only determined at runtime,
such as in a hypothetical example like this:

  [a-z]+   if (auto i = lookup_keyword (yytext))
             return yy::parser::symbol_type (i);
           return yy::parser::make_ID (yytext);


reply via email to

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