mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
api.tokens.prefix -> api.token.prefix
See http://lists.gnu.org/archive/html/bison-patches/2012-02/msg00045.html Note that api.tokens.prefix has not been released, yet. * NEWS, data/bison.m4, doc/bison.texi, tests/c++.at, * tests/calc.at, tests/java.at, tests/local.at: Do it. * src/muscle-tab.c (muscle_percent_variable_update): Ensure backward compatibility.
This commit is contained in:
6
NEWS
6
NEWS
@@ -195,14 +195,14 @@ GNU Bison NEWS
|
||||
used by the scanner, or rejecting invalid combinations from a
|
||||
factory invoked by the user actions).
|
||||
|
||||
** Variable api.tokens.prefix
|
||||
** Variable api.token.prefix
|
||||
|
||||
The variable api.tokens.prefix changes the way tokens are identified in
|
||||
The variable api.token.prefix changes the way tokens are identified in
|
||||
the generated files. This is especially useful to avoid collisions
|
||||
with identifiers in the target language. For instance
|
||||
|
||||
%token FILE for ERROR
|
||||
%define api.tokens.prefix "TOK_"
|
||||
%define api.token.prefix "TOK_"
|
||||
%%
|
||||
start: FILE for ERROR;
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ m4_define([b4_symbol_],
|
||||
# undefined. If FIELD = id, prepend the prefix.
|
||||
m4_define([b4_symbol],
|
||||
[m4_case([$2],
|
||||
[id], [m4_do([b4_percent_define_get([api.tokens.prefix])],
|
||||
[id], [m4_do([b4_percent_define_get([api.token.prefix])],
|
||||
[b4_symbol_([$1], [id])])],
|
||||
[b4_symbol_($@)])])
|
||||
|
||||
@@ -790,8 +790,8 @@ m4_define([b4_percent_code_ifdef],
|
||||
|
||||
# Default values for %define.
|
||||
# ---------------------------
|
||||
# If the api.tokens.prefix, it is empty.
|
||||
m4_percent_define_default([[api.tokens.prefix]], [[]])
|
||||
# If the api.token.prefix, it is empty.
|
||||
m4_percent_define_default([[api.token.prefix]], [[]])
|
||||
|
||||
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
||||
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
||||
|
||||
@@ -5546,9 +5546,9 @@ More user feedback will help to stabilize it.)
|
||||
|
||||
|
||||
|
||||
@c ================================================== api.tokens.prefix
|
||||
@item api.tokens.prefix
|
||||
@findex %define api.tokens.prefix
|
||||
@c ================================================== api.token.prefix
|
||||
@item api.token.prefix
|
||||
@findex %define api.token.prefix
|
||||
|
||||
@itemize
|
||||
@item Languages(s): all
|
||||
@@ -5559,7 +5559,7 @@ target language. For instance
|
||||
|
||||
@example
|
||||
%token FILE for ERROR
|
||||
%define api.tokens.prefix "TOK_"
|
||||
%define api.token.prefix "TOK_"
|
||||
%%
|
||||
start: FILE for ERROR;
|
||||
@end example
|
||||
@@ -5580,8 +5580,10 @@ letters, underscores, and ---not at the beginning--- digits).
|
||||
|
||||
@item Default Value:
|
||||
empty
|
||||
@item History:
|
||||
introduced in Bison 2.8
|
||||
@end itemize
|
||||
@c api.tokens.prefix
|
||||
@c api.token.prefix
|
||||
|
||||
|
||||
@c ================================================== lex_symbol
|
||||
@@ -10098,7 +10100,7 @@ So for each token type, Bison generates named constructors as follows.
|
||||
@deftypemethod {symbol_type} {} make_@var{token} (const @var{value_type}& @var{value}, const location_type& @var{location})
|
||||
@deftypemethodx {symbol_type} {} make_@var{token} (const location_type& @var{location})
|
||||
Build a complete terminal symbol for the token type @var{token} (not
|
||||
including the @code{api.tokens.prefix}) whose possible semantic value is
|
||||
including the @code{api.token.prefix}) whose possible semantic value is
|
||||
@var{value} of adequate @var{value_type}. If location tracking is enabled,
|
||||
also pass the @var{location}.
|
||||
@end deftypemethod
|
||||
@@ -10106,7 +10108,7 @@ also pass the @var{location}.
|
||||
For instance, given the following declarations:
|
||||
|
||||
@example
|
||||
%define api.tokens.prefix "TOK_"
|
||||
%define api.token.prefix "TOK_"
|
||||
%token <std::string> IDENTIFIER;
|
||||
%token <int> INTEGER;
|
||||
%token COLON;
|
||||
@@ -10428,11 +10430,11 @@ The token numbered as 0 corresponds to end of file; the following line
|
||||
allows for nicer error messages referring to ``end of file'' instead of
|
||||
``$end''. Similarly user friendly names are provided for each symbol. To
|
||||
avoid name clashes in the generated files (@pxref{Calc++ Scanner}), prefix
|
||||
tokens with @code{TOK_} (@pxref{%define Summary,,api.tokens.prefix}).
|
||||
tokens with @code{TOK_} (@pxref{%define Summary,,api.token.prefix}).
|
||||
|
||||
@comment file: calc++-parser.yy
|
||||
@example
|
||||
%define api.tokens.prefix "TOK_"
|
||||
%define api.token.prefix "TOK_"
|
||||
%token
|
||||
END 0 "end of file"
|
||||
ASSIGN ":="
|
||||
|
||||
@@ -398,6 +398,7 @@ muscle_percent_variable_update (char const *variable, location variable_loc)
|
||||
const conversion_type conversion[] =
|
||||
{
|
||||
{ "api.push_pull", "api.push-pull", },
|
||||
{ "api.tokens.prefix", "api.token.prefix", },
|
||||
{ "location_type", "api.location.type", },
|
||||
{ "lr.keep_unreachable_states", "lr.keep-unreachable-states", },
|
||||
{ "namespace", "api.namespace", },
|
||||
|
||||
@@ -202,7 +202,7 @@ AT_CHECK_VARIANTS([])
|
||||
AT_CHECK_VARIANTS([%define parse.assert])
|
||||
AT_CHECK_VARIANTS([[%define parse.assert %code {\n#define ONE_STAGE_BUILD\n}]])
|
||||
AT_CHECK_VARIANTS([[%define parse.assert %define lex_symbol %code {\n#define USE_LEX_SYMBOL\n}]])
|
||||
AT_CHECK_VARIANTS([[%define parse.assert %define lex_symbol %code {\n#define USE_LEX_SYMBOL\n} %define api.tokens.prefix "TOK_"]])
|
||||
AT_CHECK_VARIANTS([[%define parse.assert %define lex_symbol %code {\n#define USE_LEX_SYMBOL\n} %define api.token.prefix "TOK_"]])
|
||||
|
||||
|
||||
## ----------------------- ##
|
||||
|
||||
@@ -647,7 +647,7 @@ AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %locations])
|
||||
AT_CHECK_CALC_LALR([%define parse.error verbose %locations])
|
||||
|
||||
AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %define api.prefix "calc" %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %name-prefix "calc" %define api.token.prefix "TOK_" %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_LALR([%debug])
|
||||
AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||
@@ -690,7 +690,7 @@ AT_CHECK_CALC_GLR([%define parse.error verbose %locations %defines %name-prefix
|
||||
|
||||
AT_CHECK_CALC_GLR([%debug])
|
||||
AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||
AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %define api.prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
|
||||
AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %define api.prefix "calc" %define api.token.prefix "TOK_" %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||
|
||||
@@ -723,7 +723,7 @@ AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %define api.prefi
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %define api.token.prefix "TOK_" %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_LALR1_CC([%defines %locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} {int *count}])
|
||||
|
||||
@@ -758,7 +758,7 @@ AT_CHECK_CALC_GLR_CC([%debug])
|
||||
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
|
||||
AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
|
||||
AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %define api.token.prefix "TOK_" %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_GLR_CC([%locations %defines %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} {int *count}])
|
||||
AT_CHECK_CALC_GLR_CC([%locations %defines %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} {int *count}])
|
||||
|
||||
@@ -461,7 +461,7 @@ AT_CHECK_JAVA_GREP([[class YYParser]])
|
||||
AT_CHECK_JAVA_MINIMAL([[%name-prefix "Prefix"]])
|
||||
AT_CHECK_JAVA_GREP([[class PrefixParser]])
|
||||
|
||||
AT_CHECK_JAVA_MINIMAL([[%define api.tokens.prefix "TOK_"]])
|
||||
AT_CHECK_JAVA_MINIMAL([[%define api.token.prefix "TOK_"]])
|
||||
AT_CHECK_JAVA_GREP([[.*TOK_END.*]])
|
||||
|
||||
AT_CHECK_JAVA_MINIMAL([[%define parser_class_name "ParserClassName"]])
|
||||
|
||||
@@ -153,8 +153,8 @@ m4_pushdef([AT_NAME_PREFIX],
|
||||
[m4_bregexp([$3], [\(%define api\.prefix\|%name-prefix\) "\([^""]*\)"], [\2])],
|
||||
[yy])])
|
||||
m4_pushdef([AT_TOKEN_PREFIX],
|
||||
[m4_bmatch([$3], [%define api.tokens.prefix ".*"],
|
||||
[m4_bregexp([$3], [%define api.tokens.prefix "\(.*\)"], [\1])])])
|
||||
[m4_bmatch([$3], [%define api.token.prefix ".*"],
|
||||
[m4_bregexp([$3], [%define api.token.prefix "\(.*\)"], [\1])])])
|
||||
m4_pushdef([AT_API_prefix],
|
||||
[m4_bmatch([$3], [%define api\.prefix ".*"],
|
||||
[m4_bregexp([$3], [%define api\.prefix "\([^""]*\)"], [\1])],
|
||||
|
||||
Reference in New Issue
Block a user