[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to change the default action for selected rules?
From: |
Markus Elfring |
Subject: |
How to change the default action for selected rules? |
Date: |
Mon, 30 Sep 2013 11:01:56 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- How to change the default action for selected rules?,
Markus Elfring <=