Hi Joel, hi all, In order to implement Joel's suggestion for api.value.type, some preliminary work is needed to extend Bison to accept more types of %define variable values, and to record how these values were defined. See
http://lists.gnu.org/archive/html/bison-patches/2013-03/msg00016.html for more context, but to quote Joel: > In general for %define, I wonder if we should continue to require quotes > for values that are keywords (such as variant, full, none). For values > that are code in the target language, braces seem nice. (For other > arbitrary values, such as file names maybe, quotes do seem appropriate.) > Applying that in the case of api.value.type, we'd have: > > %define api.value.type union-directive > %define api.value.type union > %define api.value.type variant > %define api.value.type {int} > %define api.value.type {variant} What follows is a first, incomplete, step. It is incomplete because there are not enough tests, the documentation is not properly updated, and NEWS is not changed. The options -D/-F also need to become brace-aware, and maybe quotes aware. The M4 code should start to "typecheck" some of the values (e.g., it should warn for %define api.namespace "foo" instead of {foo}). But before going any further, I'd like to receive opinions, obviously especially Joel's :) Akim Demaille (11): muscle: minor refactoring style: comment changes muscle: refactor grammar: split %union to group together related aspects grammar: style changes regen style: fix comments grammar: record the kind of %define variable values regen grammar: do not add a \n at the end of blocks of code api.namespace: demonstrate and use {...} values instead of "..." values doc/bison.texi | 8 +- src/getargs.c | 4 +- src/muscle-tab.c | 164 +++++----- src/muscle-tab.h | 47 ++- src/parse-gram.c | 912 ++++++++++++++++++++++++++++--------------------------- src/parse-gram.h | 150 ++++----- src/parse-gram.y | 89 +++--- tests/c++.at | 4 +- tests/input.at | 6 +- tests/local.at | 10 +- 10 files changed, 737 insertions(+), 657 deletions(-) -- 1.8.2
