Hello,

I try to develop a small grammar. Unfortunately, I stumble on error messages
like the following during the build process on my openSUSE system.

...
Building parser with bison 3.0
parser.ypp:68.18-20: warning: type clash on default action: <char> != <> 
[-Wother]
 value_character: '0'
                  ^^^
parser.ypp:69.21-23: warning: type clash on default action: <char> != <> 
[-Wother]
                   | '1'
                     ^^^
...


I guess that this happens because of this setting for better C++ support.
%define api.value.type variant
http://www.gnu.org/software/bison/manual/bison.html#C_002b_002b-Variants


I have found the following comment in a source file.
http://git.savannah.gnu.org/cgit/bison.git/tree/data/lalr1.cc?id=cc8962bdde81b04aa728aef21e53b4a08a0debfe#n818
    /* Variants are always initialized to an empty instance of the
       correct type. The default $$=$1 action is NOT applied when using
       variants.  */


Now I am interested in further solutions.
- Can the used variant template class be extended?

- Is a conversion possible without the specification of a specific data type in
a directive like "%token"?

- The character list can become long in my use case here. I would like to avoid
the repetition of similar actions behind them. It would be more "convenient" to
choose a different default action for selected rules, wouldn't it?

Regards,
Markus

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

Reply via email to