b4_percent_define_if_define_([$1], [$2], $[1], $[2])])
+# b4_percent_define_check_kind(VARIABLE, KIND, [DIAGNOSTIC = complain])
+# ---------------------------------------------------------------------
+m4_define([b4_percent_define_check_kind],
+[b4_percent_define_ifdef_([$1],
+ [m4_if(b4_percent_define_get_kind([[$1]]), [$2], [],
+ [b4_error([m4_default([$3], [complain])],
+ b4_percent_define_get_loc([$1]),
+ [m4_case([$2],
+ [code], [[%%define variable '%s' requires '{...}' values]],
+ [keyword], [[%%define variable '%s' requires '...' values]],
+ [string], [[%%define variable '%s' requires '"..."' values]])],
+ [$1])])])dnl
+])
+
+
# b4_percent_define_check_values(VALUES)
# --------------------------------------
# Mimic muscle_percent_define_check_values in ../src/muscle-tab.h exactly
# api.token.prefix={...}
# Make it a warning for those who used betas of Bison 3.0.
-b4_percent_define_ifdef([api.token.prefix],
- [m4_if(b4_percent_define_get_kind([[api.token.prefix]]), [code], [],
- [b4_error([deprecated],
- b4_percent_define_get_loc([api.token.prefix]),
- [[%%define variable '%s' requires '{...}' values]],
- [api.token.prefix])])])
+b4_percent_define_check_kind([api.token.prefix], [code], [deprecated])
# api.value.type >< %union.
b4_percent_define_ifdef([api.value.type],
m4_define([b4_comment],
[b4_comment_([$1], [$2// ], [$2// ])])
+## -------- ##
+## Checks. ##
+## -------- ##
+
+b4_percent_define_check_kind([api.namespace], [code], [deprecated])
## ---------------- ##
## Default values. ##
# b4_percent_define_default([[api.location.type]], [[location]])
b4_percent_define_default([[filename_type]], [[std::string]])
+# Make it a warning for those who used betas of Bison 3.0.
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
@code{yypstate_new} and @code{yypstate_delete} will also be renamed. For
example, if you use @samp{%name-prefix "c_"}, the names become
@code{c_parse}, @code{c_lex}, and so on. For C++ parsers, see the
-@code{%define namespace} documentation in this section.
+@code{%define api.namespace} documentation in this section.
@end deffn
AT_SETUP([["%define" code variables]])
m4_pushdef([AT_TEST],
-[AT_DATA([input.y],
-[[%define api.token.prefix ]$1[
+[AT_DATA([input.yy],
+[[%skeleton "lalr1.cc"
+%define api.namespace ]$1[quux]$2[
+%define api.token.prefix ]$1[quux]$2[
+%token TOK // Otherwise api.token.prefix is unused.
%%
-start: %empty;
+start: TOK;
]])
-AT_BISON_CHECK([[input.y]], [0], [],
-[[input.y:1.9-24: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated]
+AT_BISON_CHECK([[input.yy]], [0], [],
+[[input.yy:3.9-24: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated]
+input.yy:2.9-21: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated]
]])
])
-AT_TEST(["abc"])
-AT_TEST([abcde])
+AT_TEST([], [])
+AT_TEST(["], ["])
m4_popdef([AT_TEST])
AT_CLEANUP