bug-bison
[Top][All Lists]
Advanced

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

Re: Dynamic token kinds


From: Frank Heckenbach
Subject: Re: Dynamic token kinds
Date: Thu, 29 Nov 2018 01:12:01 +0100

Akim Demaille wrote:

> Wrt to the symbol constructor, you are right to be worried: I don't
> consider it (so far?) to be part of the public API.  I do understand
> something like it is needed, but I don't like that it looks safe
> to use.
> 
> Would you be ok with parser::unsafe_make_symbol, or something like
> this?

Sure, though for my taste "unsafe" sounds a bit harsh, perhaps
"unchecked"? If you put in the next release, I'll change my code to
use it.

Here's what I had as "make_token" in my patches, now renamed as
"unchecked_make_symbol", perhaps you can use it as is:

In b4_symbol_constructor_declare:

  static inline
  symbol_type
  unchecked_make_symbol (token_type type, b4_locations_if([const location_type& 
l, ])semantic_type&& v = { });

In b4_symbol_constructor_define:

  b4_parser_class_name::symbol_type
  b4_parser_class_name::unchecked_make_symbol (token_type type, 
b4_locations_if([const location_type& l, ])semantic_type&& v)
  {
    return symbol_type (type, std::move (v)b4_locations_if([, l]));
  }

Cheers,
Frank



reply via email to

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