mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
api.namespace: demonstrate and use {...} values instead of "..." values
* tests/c++.at, tests/input.at: Use "%define api.namespace {foo}" instead
of using quotes.
* tests/local.at (AT_SETUP_STRIP, AT_NAME_PREFIX): Recognize uses of
braces instead of quotes.
* doc/bison.texi: Use braces for api.namespace's values.
This commit is contained in:
@@ -5586,7 +5586,7 @@ Summary,,%skeleton}).
|
||||
Unaccepted @var{variable}s produce an error.
|
||||
Some of the accepted @var{variable}s are described below.
|
||||
|
||||
@deffn Directive {%define api.namespace} "@var{namespace}"
|
||||
@deffn Directive {%define api.namespace} @{@var{namespace}@}
|
||||
@itemize
|
||||
@item Languages(s): C++
|
||||
|
||||
@@ -5594,7 +5594,7 @@ Some of the accepted @var{variable}s are described below.
|
||||
For example, if you specify:
|
||||
|
||||
@example
|
||||
%define api.namespace "foo::bar"
|
||||
%define api.namespace @{foo::bar@}
|
||||
@end example
|
||||
|
||||
Bison uses @code{foo::bar} verbatim in references such as:
|
||||
@@ -5627,7 +5627,7 @@ api.namespace} so that @code{%name-prefix} @emph{only} affects the
|
||||
lexical analyzer function. For example, if you specify:
|
||||
|
||||
@example
|
||||
%define api.namespace "foo"
|
||||
%define api.namespace @{foo@}
|
||||
%name-prefix "bar::"
|
||||
@end example
|
||||
|
||||
@@ -5894,7 +5894,7 @@ More user feedback will help to stabilize it.)
|
||||
@end deffn
|
||||
|
||||
@c ================================================== namespace
|
||||
@deffn Directive %define namespace @var{namespace}
|
||||
@deffn Directive %define namespace @{@var{namespace}@}
|
||||
Obsoleted by @code{api.namespace}
|
||||
@c namespace
|
||||
@end deffn
|
||||
|
||||
@@ -361,10 +361,10 @@ AT_CHECK_DOXYGEN([Private])
|
||||
# is specified, then Bison should accept the input, but compilation will fail,
|
||||
# so don't check compilation.
|
||||
m4_pushdef([AT_TEST],
|
||||
[AT_BISON_OPTION_PUSHDEFS([%language "C++" %define api.namespace "$1"])
|
||||
[AT_BISON_OPTION_PUSHDEFS([%language "C++" %define api.namespace {$1}])
|
||||
AT_DATA_GRAMMAR([[input.y]],
|
||||
[[%language "C++"
|
||||
%define api.namespace "]$1["
|
||||
%define api.namespace {]$1[}
|
||||
%union { int i; }
|
||||
%define global_tokens_and_yystype
|
||||
%locations
|
||||
|
||||
@@ -1448,7 +1448,7 @@ AT_DATA([[input.y]],
|
||||
[[%define api.push_pull both
|
||||
%define lr.keep_unreachable_states maybe
|
||||
%define namespace "foo"
|
||||
%define api.namespace "foo"
|
||||
%define api.namespace {foo}
|
||||
%define variant
|
||||
%%
|
||||
start: %empty;
|
||||
@@ -1464,7 +1464,7 @@ input.y:3.9-17: warning: deprecated directive, use '%define api.namespace foo' [
|
||||
%define namespace "foo"
|
||||
^^^^^^^^^
|
||||
input.y:4.9-21: error: %define variable 'api.namespace' redefined
|
||||
%define api.namespace "foo"
|
||||
%define api.namespace {foo}
|
||||
^^^^^^^^^^^^^
|
||||
input.y:3.9-17: previous definition
|
||||
%define namespace "foo"
|
||||
@@ -1523,7 +1523,7 @@ m4_define([AT_CHECK_NAMESPACE_ERROR],
|
||||
AT_DATA([[input.y]],
|
||||
[[%language "C++"
|
||||
%defines
|
||||
%define api.namespace "]$1["
|
||||
%define api.namespace {]$1[}
|
||||
%%
|
||||
start: %empty;
|
||||
]])
|
||||
|
||||
@@ -37,7 +37,7 @@ m4_define([AT_SETUP_STRIP],
|
||||
[m4_bpatsubsts([$1],
|
||||
[%\(language\|skeleton\) "?\([^\" ]*\)"?],
|
||||
[\2],
|
||||
[%define "?\([-A-Za-z0-9_.]+\)"? \("[^\"]+"\|[-A-Za-z0-9_.]+\)],
|
||||
[%define "?\([-A-Za-z0-9_.]+\)"? \({[^\}]+}\|"[^\"]+"\|[-A-Za-z0-9_.]+\)],
|
||||
[\1=\2],
|
||||
[%define "?\([-A-Za-z0-9_.]+\)"?],
|
||||
[\1],
|
||||
@@ -182,9 +182,11 @@ m4_pushdef([AT_PURE_IF],
|
||||
[$2])])
|
||||
# AT_NAME_PREFIX: also consider api.namespace.
|
||||
m4_pushdef([AT_NAME_PREFIX],
|
||||
[m4_bmatch([$3], [\(%define api\.\(namespace\|prefix\)\|%name-prefix\) ".*"],
|
||||
[m4_bregexp([$3], [\(%define api\.\(namespace\|prefix\)\|%name-prefix\) "\([^""]*\)"], [\3])],
|
||||
[yy])])
|
||||
[m4_bmatch([$3], [\(%define api\.\(namespace\|prefix\)\|%name-prefix\) .*],
|
||||
[m4_bregexp([$3],
|
||||
[\(%define api\.\(namespace\|prefix\)\|%name-prefix\) [\{\"]\([^""]*\)[\"\}]],
|
||||
[\3])],
|
||||
[yy])])
|
||||
m4_pushdef([AT_TOKEN_CTOR_IF],
|
||||
[m4_bmatch([$3], [%define api\.token\.constructor], [$1], [$2])])
|
||||
m4_pushdef([AT_TOKEN_PREFIX],
|
||||
|
||||
Reference in New Issue
Block a user