[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Rename variant and lex_symbols options
From: |
Akim Demaille |
Subject: |
Re: Rename variant and lex_symbols options |
Date: |
Tue, 16 Oct 2012 10:58:20 +0200 |
hi Joel,
Le 17 févr. 2012 à 03:57, Joel E. Denny a écrit :
>> Again, it has an influence on the API, so may
>> api.tokens.constructors (we already have api.tokens.prefix
>> which probably should have been api.token.prefix),
>
> This is my fault. My logic was to use plural when there's more than one
> of something. However, I now see that always using singular is probably a
> simpler rule to remember and not really so misleading as I thought. For
> example, lr.default-reduction, lr.keep-unreachable-state, and
> api.token.prefix would all have been fine.
Part I, in master.
commit 2a6b66c5fd063c8868f239a78ecfb11c899fd22c
Author: Akim Demaille <address@hidden>
Date: Tue Oct 16 10:51:38 2012 +0200
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.
diff --git a/NEWS b/NEWS
index d3a860b..29b6b32 100644
--- a/NEWS
+++ b/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;
diff --git a/data/bison.m4 b/data/bison.m4
index 1907e42..0d2a39e 100644
--- a/data/bison.m4
+++ b/data/bison.m4
@@ -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])
diff --git a/doc/bison.texi b/doc/bison.texi
index d18167f..0428c78 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -5546,9 +5546,9 @@ More user feedback will help to stabilize it.)
address@hidden ==================================================
api.tokens.prefix
address@hidden api.tokens.prefix
address@hidden %define api.tokens.prefix
address@hidden ==================================================
api.token.prefix
address@hidden api.token.prefix
address@hidden %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
address@hidden History:
+introduced in Bison 2.8
@end itemize
address@hidden api.tokens.prefix
address@hidden api.token.prefix
@c ================================================== lex_symbol
@@ -10098,7 +10100,7 @@ So for each token type, Bison generates named
constructors as follows.
@deftypemethod {symbol_type} {} address@hidden (const @var{value_type}&
@var{value}, const location_type& @var{location})
@deftypemethodx {symbol_type} {} address@hidden (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 ":="
diff --git a/src/muscle-tab.c b/src/muscle-tab.c
index 1789280..9fe32ea 100644
--- a/src/muscle-tab.c
+++ b/src/muscle-tab.c
@@ -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", },
diff --git a/tests/c++.at b/tests/c++.at
index 0d49170..d5e7596 100644
--- a/tests/c++.at
+++ b/tests/c++.at
@@ -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_"]])
## ----------------------- ##
diff --git a/tests/calc.at b/tests/calc.at
index b959bfa..a6c6742 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -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}])
diff --git a/tests/java.at b/tests/java.at
index 9b48453..5b0c152 100644
--- a/tests/java.at
+++ b/tests/java.at
@@ -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"]])
diff --git a/tests/local.at b/tests/local.at
index 7458412..ac266da 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -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])],
- Re: Rename variant and lex_symbols options,
Akim Demaille <=