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