]> git.saurik.com Git - bison.git/commitdiff
variables: use singular in %define variable names
authorAkim Demaille <akim@lrde.epita.fr>
Tue, 16 Oct 2012 11:57:31 +0000 (13:57 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Tue, 16 Oct 2012 12:08:21 +0000 (14:08 +0200)
See http://lists.gnu.org/archive/html/bison-patches/2012-02/msg00045.html

* doc/bison.texi, src/lalr.c, src/main.c, src/muscle-tab.c,
* src/print.c, src/reader.c, src/tables.c, tests/conflicts.at,
* tests/input.at, tests/reduce.at:
s/lr.default-reductions/lr.default-reduction/
s/lr.keep-unreachable-states/lr.keep-unreachable-state/.
* NEWS: Document.

NEWS
doc/bison.texi
src/lalr.c
src/main.c
src/muscle-tab.c
src/print.c
src/reader.c
src/tables.c
tests/conflicts.at
tests/input.at
tests/reduce.at

diff --git a/NEWS b/NEWS
index 29b6b3230ebac5ae128a77d43a9c16496ce6988b..8cc360247015329bd8ddf7f87b97e3a939fa0195 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -211,11 +211,15 @@ GNU Bison NEWS
   use these prefixed token names, although the grammar itself still
   uses the short names (as in the sample rule given above).
 
-** Variable api.namespace
+** Renamed %define variables
 
-  The 'namespace' variable is renamed 'api.namespace'.  Backward
+  The following variables have been renamed for consistency.  Backward
   compatibility is ensured, but upgrading is recommended.
 
+    lr.default-reductions      -> lr.default-reduction
+    lr.keep-unreachable-states -> lr.keep-unreachable-state
+    namespace                  -> api.namespace
+
 ** Variable parse.error
 
   This variable controls the verbosity of error messages.  The use of the
index 0428c78c47b403f0d3e3bbb3ae1de628087abf30..674aef7087efe3bc9552dcfe2bf3ea61fed930f1 100644 (file)
@@ -5608,10 +5608,10 @@ Boolean.
 @c lex_symbol
 
 
-@c ================================================== lr.default-reductions
+@c ================================================== lr.default-reduction
 
-@item lr.default-reductions
-@findex %define lr.default-reductions
+@item lr.default-reduction
+@findex %define lr.default-reduction
 
 @itemize @bullet
 @item Language(s): all
@@ -5627,12 +5627,15 @@ feedback will help to stabilize it.)
 @item @code{accepting} if @code{lr.type} is @code{canonical-lr}.
 @item @code{most} otherwise.
 @end itemize
+@item History:
+introduced as @code{lr.default-reduction} in 2.5, renamed as
+@code{lr.default-reduction} in 2.8.
 @end itemize
 
-@c ============================================ lr.keep-unreachable-states
+@c ============================================ lr.keep-unreachable-state
 
-@item lr.keep-unreachable-states
-@findex %define lr.keep-unreachable-states
+@item lr.keep-unreachable-state
+@findex %define lr.keep-unreachable-state
 
 @itemize @bullet
 @item Language(s): all
@@ -5641,7 +5644,10 @@ remain in the parser tables.  @xref{Unreachable States}.
 @item Accepted Values: Boolean
 @item Default Value: @code{false}
 @end itemize
-@c lr.keep-unreachable-states
+introduced as @code{lr.keep_unreachable_states} in 2.3b, renamed as
+@code{lr.keep-unreachable-state} in 2.5, and as
+@code{lr.keep-unreachable-state} in 2.8.
+@c lr.keep-unreachable-state
 
 @c ================================================== lr.type
 
@@ -7685,7 +7691,7 @@ and the benefits of IELR, @pxref{Bibliography,,Denny 2008 March}, and
 @node Default Reductions
 @subsection Default Reductions
 @cindex default reductions
-@findex %define lr.default-reductions
+@findex %define lr.default-reduction
 @findex %nonassoc
 
 After parser table construction, Bison identifies the reduction with the
@@ -7767,9 +7773,9 @@ token for which there is a conflict.  The correct action in this case is to
 split the parse instead.
 
 To adjust which states have default reductions enabled, use the
-@code{%define lr.default-reductions} directive.
+@code{%define lr.default-reduction} directive.
 
-@deffn {Directive} {%define lr.default-reductions @var{WHERE}}
+@deffn {Directive} {%define lr.default-reduction @var{WHERE}}
 Specify the kind of states that are permitted to contain default reductions.
 The accepted values of @var{WHERE} are:
 @itemize
@@ -7892,7 +7898,7 @@ parser community for years, for the publication that introduces LAC,
 
 @node Unreachable States
 @subsection Unreachable States
-@findex %define lr.keep-unreachable-states
+@findex %define lr.keep-unreachable-state
 @cindex unreachable states
 
 If there exists no sequence of transitions from the parser's start state to
@@ -7905,7 +7911,7 @@ resolution because they are useless in the generated parser.  However,
 keeping unreachable states is sometimes useful when trying to understand the
 relationship between the parser and the grammar.
 
-@deffn {Directive} {%define lr.keep-unreachable-states @var{VALUE}}
+@deffn {Directive} {%define lr.keep-unreachable-state @var{VALUE}}
 Request that Bison allow unreachable states to remain in the parser tables.
 @var{VALUE} must be a Boolean.  The default is @code{false}.
 @end deffn
index 1ceda002b454fcddd9993da74c665c3d3f84040f..53a5dbfddaa66bb391439dac2c04acc3d2977fb6 100644 (file)
@@ -371,7 +371,7 @@ initialize_LA (void)
   bool default_reduction_only_for_accept;
   {
     char *default_reductions =
-      muscle_percent_define_get ("lr.default-reductions");
+      muscle_percent_define_get ("lr.default-reduction");
     default_reduction_only_for_accept = STREQ (default_reductions, "accepting");
     free (default_reductions);
   }
index 093e9cb26674aeb0502b16e892f2c2906ae97e43..9a03630d8d732d5a6b62d9dc0630fd1ddc42ea8a 100644 (file)
@@ -125,7 +125,7 @@ main (int argc, char *argv[])
      declarations.  */
   timevar_push (TV_CONFLICTS);
   conflicts_solve ();
-  if (!muscle_percent_define_flag_if ("lr.keep-unreachable-states"))
+  if (!muscle_percent_define_flag_if ("lr.keep-unreachable-state"))
     {
       state_number *old_to_new = xnmalloc (nstates, sizeof *old_to_new);
       state_number nstates_old = nstates;
index 9fe32ea1c453cdbdad88c8f6028e1c92646d81b7..f3933c3faf02412f37bd3d792c165ecfe6c7a4ce 100644 (file)
@@ -400,7 +400,9 @@ muscle_percent_variable_update (char const *variable, location variable_loc)
       { "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", },
+      { "lr.default-reductions", "lr.default-reduction", },
+      { "lr.keep-unreachable-states", "lr.keep-unreachable-state", },
+      { "lr.keep_unreachable_states", "lr.keep-unreachable-state", },
       { "namespace", "api.namespace", },
     };
   char const *res = variable;
index e3795a945301edb211784b60f2f9e0fe4ca44dee..f21aade5116f1c4b6d184c1b2d12c2ea0021e78e 100644 (file)
@@ -334,7 +334,7 @@ print_reductions (FILE *out, state *s)
   if (default_reduction)
     {
       char *default_reductions =
-        muscle_percent_define_get ("lr.default-reductions");
+        muscle_percent_define_get ("lr.default-reduction");
       print_reduction (out, width, _("$default"), default_reduction, true);
       aver (STREQ (default_reductions, "most")
             || (STREQ (default_reductions, "consistent")
index a3f8668524a8eccaa03f8c82d894bab6f66b5228..f18b5b82ceb67486c4271be5542151b5d0a8ba53 100644 (file)
@@ -641,7 +641,7 @@ static void
 prepare_percent_define_front_end_variables (void)
 {
   /* Set %define front-end variable defaults.  */
-  muscle_percent_define_default ("lr.keep-unreachable-states", "false");
+  muscle_percent_define_default ("lr.keep-unreachable-state", "false");
   {
     char *lr_type;
     /* IELR would be a better default, but LALR is historically the
@@ -649,9 +649,9 @@ prepare_percent_define_front_end_variables (void)
     muscle_percent_define_default ("lr.type", "lalr");
     lr_type = muscle_percent_define_get ("lr.type");
     if (STRNEQ (lr_type, "canonical-lr"))
-      muscle_percent_define_default ("lr.default-reductions", "most");
+      muscle_percent_define_default ("lr.default-reduction", "most");
     else
-      muscle_percent_define_default ("lr.default-reductions", "accepting");
+      muscle_percent_define_default ("lr.default-reduction", "accepting");
     free (lr_type);
   }
 
@@ -659,7 +659,7 @@ prepare_percent_define_front_end_variables (void)
   {
     static char const * const values[] = {
       "lr.type", "lalr", "ielr", "canonical-lr", NULL,
-      "lr.default-reductions", "most", "consistent", "accepting", NULL,
+      "lr.default-reduction", "most", "consistent", "accepting", NULL,
       NULL
     };
     muscle_percent_define_check_values (values);
index 96354b1a225d136922e7d571f6deae0f33efa6aa..186702b4c4a3bbacda769cd51f48385a969c2abb 100644 (file)
@@ -308,7 +308,7 @@ action_row (state *s)
      labeled as consistent.  */
   {
     char *default_reductions =
-      muscle_percent_define_get ("lr.default-reductions");
+      muscle_percent_define_get ("lr.default-reduction");
     if (STRNEQ (default_reductions, "most") && !s->consistent)
       nodefault = true;
     free (default_reductions);
index b3f67098afa2bf6deaced4029f85d685900fe93d..37c54050ca3f508e4c05c6816e5cf6fca3967cb5 100644 (file)
@@ -117,10 +117,10 @@ AT_NONASSOC_AND_EOF_CHECK([], [[incorrect]])
 
 # We must disable default reductions in inconsistent states in order to
 # have an explicit list of all expected tokens.
-AT_NONASSOC_AND_EOF_CHECK([[-Dlr.default-reductions=consistent]],
+AT_NONASSOC_AND_EOF_CHECK([[-Dlr.default-reduction=consistent]],
                           [[correct]])
 
-# lr.default-reductions=consistent happens to work for this test case.
+# lr.default-reduction=consistent happens to work for this test case.
 # However, for other grammars, lookahead sets can be merged for
 # different left contexts, so it is still possible to have an incorrect
 # expected list.  Canonical LR is almost a general solution (that is, it
@@ -310,12 +310,12 @@ AT_CONSISTENT_ERRORS_CHECK([[%define lr.type ielr
 
 # Even canonical LR doesn't foresee the error for 'a'!
 AT_CONSISTENT_ERRORS_CHECK([[%define lr.type ielr
-                             %define lr.default-reductions consistent]],
+                             %define lr.default-reduction consistent]],
                            [AT_PREVIOUS_STATE_GRAMMAR],
                            [AT_PREVIOUS_STATE_INPUT],
                            [[$end]], [[ab]])
 AT_CONSISTENT_ERRORS_CHECK([[%define lr.type ielr
-                             %define lr.default-reductions accepting]],
+                             %define lr.default-reduction accepting]],
                            [AT_PREVIOUS_STATE_GRAMMAR],
                            [AT_PREVIOUS_STATE_INPUT],
                            [[$end]], [[ab]])
@@ -396,13 +396,13 @@ AT_CONSISTENT_ERRORS_CHECK([[%glr-parser]],
                            [['b']], [[none]])
 # No C++ or Java test because yychar cannot be manipulated by users.
 
-AT_CONSISTENT_ERRORS_CHECK([[%define lr.default-reductions consistent]],
+AT_CONSISTENT_ERRORS_CHECK([[%define lr.default-reduction consistent]],
                            [AT_USER_ACTION_GRAMMAR],
                            [AT_USER_ACTION_INPUT],
                            [['b']], [[none]])
 
 # Canonical LR doesn't foresee the error for 'a'!
-AT_CONSISTENT_ERRORS_CHECK([[%define lr.default-reductions accepting]],
+AT_CONSISTENT_ERRORS_CHECK([[%define lr.default-reduction accepting]],
                            [AT_USER_ACTION_GRAMMAR],
                            [AT_USER_ACTION_INPUT],
                            [[$end]], [[a]])
@@ -416,7 +416,7 @@ AT_CONSISTENT_ERRORS_CHECK([[%define parse.lac full]],
                            [AT_USER_ACTION_INPUT],
                            [['b']], [[none]])
 AT_CONSISTENT_ERRORS_CHECK([[%define parse.lac full
-                             %define lr.default-reductions accepting]],
+                             %define lr.default-reduction accepting]],
                            [AT_USER_ACTION_GRAMMAR],
                            [AT_USER_ACTION_INPUT],
                            [[$end]], [[none]])
@@ -1293,7 +1293,7 @@ state 7
 ]])
 
 AT_DATA([[input-keep.y]],
-[[%define lr.keep-unreachable-states
+[[%define lr.keep-unreachable-state
 ]])
 AT_CHECK([[cat input.y >> input-keep.y]])
 
index 736ee2524fb0f07e611d90fe4162b7837573b85c..b2a4fc596812b91ff71dfec6ab6cb571288de445 100644 (file)
@@ -1139,15 +1139,15 @@ AT_SETUP([[%define enum variables]])
 
 # Front-end.
 AT_DATA([[input.y]],
-[[%define lr.default-reductions bogus
+[[%define lr.default-reduction bogus
 %%
 start: ;
 ]])
 AT_BISON_CHECK([[input.y]], [[1]], [[]],
-[[input.y:1.9-29: error: invalid value for %define variable 'lr.default-reductions': 'bogus'
-input.y:1.9-29:     accepted value: 'most'
-input.y:1.9-29:     accepted value: 'consistent'
-input.y:1.9-29:     accepted value: 'accepting'
+[[input.y:1.9-28: error: invalid value for %define variable 'lr.default-reduction': 'bogus'
+input.y:1.9-28:     accepted value: 'most'
+input.y:1.9-28:     accepted value: 'consistent'
+input.y:1.9-28:     accepted value: 'accepting'
 ]])
 
 # Back-end.
@@ -1194,8 +1194,8 @@ AT_DATA([[input.y]],
 start: ;
 ]])
 AT_BISON_CHECK([[input.y]], [1], [],
-[[input.y:1.9-34: warning: deprecated %define variable name: 'lr.keep_unreachable_states', use 'lr.keep-unreachable-states' [-Wdeprecated]
-input.y:1.9-34: error: invalid value for %define Boolean variable 'lr.keep-unreachable-states'
+[[input.y:1.9-34: warning: deprecated %define variable name: 'lr.keep_unreachable_states', use 'lr.keep-unreachable-state' [-Wdeprecated]
+input.y:1.9-34: error: invalid value for %define Boolean variable 'lr.keep-unreachable-state'
 ]])
 
 AT_DATA([[input.y]],
index 25ce83f7c38a25340d02232ec9020efa03bc53c6..d2a5c554698c1ce1213b2b9789cb8c8f0bccd7ff 100644 (file)
@@ -396,7 +396,7 @@ AT_TEST_LR_TYPE([[Single State Split]],
 [[%left 'a'
 // Conflict resolution renders state 12 unreachable for canonical LR(1).  We
 // keep it so that the paser table diff is easier to code.
-%define lr.keep-unreachable-states]],
+%define lr.keep-unreachable-state]],
 [[
 S: 'a' A 'a' /* rule 1 */
  | 'b' A 'b' /* rule 2 */
@@ -629,7 +629,7 @@ AT_TEST_LR_TYPE([[Lane Split]],
 [[%left 'a'
 // Conflict resolution renders state 16 unreachable for canonical LR(1).  We
 // keep it so that the paser table diff is easier to code.
-%define lr.keep-unreachable-states]],
+%define lr.keep-unreachable-state]],
 [[
 /* Similar to the last test case set but two states must be split.  */
 S: 'a' A 'a' /* rule 1 */
@@ -873,7 +873,7 @@ AT_TEST_LR_TYPE([[Complex Lane Split]],
 [[%left 'a'
 // Conflict resolution renders state 16 unreachable for canonical LR(1).  We
 // keep it so that the paser table diff is easier to code.
-%define lr.keep-unreachable-states]],
+%define lr.keep-unreachable-state]],
 [[
 /* Similar to the last test case set but forseeing the S/R conflict from the
    first state that must be split is becoming difficult.  Imagine if B were
@@ -1139,7 +1139,7 @@ dnl PARSER-EXIT-VALUE, PARSER-STDOUT, PARSER-STDERR
 ]])])
 
 AT_TEST_LR_TYPE([[Split During Added Lookahead Propagation]],
-[[%define lr.keep-unreachable-states]],
+[[%define lr.keep-unreachable-state]],
 [[
 /* The partial state chart diagram below is for LALR(1).  State 0 is the start
    state.  States are iterated for successor construction in numerical order.
@@ -1443,28 +1443,28 @@ dnl PARSER-EXIT-VALUE, PARSER-STDOUT, PARSER-STDERR
 
 
 ## ------------------------------- ##
-## %define lr.default-reductions.  ##
+## %define lr.default-reduction.  ##
 ## ------------------------------- ##
 
 # AT_TEST_LR_DEFAULT_REDUCTIONS(GRAMMAR, INPUT, TABLES)
 # -----------------------------------------------------
 m4_define([AT_TEST_LR_DEFAULT_REDUCTIONS],
 [
-AT_TEST_TABLES_AND_PARSE([[no %define lr.default-reductions]],
+AT_TEST_TABLES_AND_PARSE([[no %define lr.default-reduction]],
                          [[most]], [[]],
                          [[]],
                          [$1], [$2], [[]], [$3])
-AT_TEST_TABLES_AND_PARSE([[%define lr.default-reductions most]],
+AT_TEST_TABLES_AND_PARSE([[%define lr.default-reduction most]],
                          [[most]], [[]],
-                         [[%define lr.default-reductions most]],
+                         [[%define lr.default-reduction most]],
                          [$1], [$2], [[]], [$3])
-AT_TEST_TABLES_AND_PARSE([[%define lr.default-reductions consistent]],
+AT_TEST_TABLES_AND_PARSE([[%define lr.default-reduction consistent]],
                          [[consistent]], [[]],
-                         [[%define lr.default-reductions consistent]],
+                         [[%define lr.default-reduction consistent]],
                          [$1], [$2], [[]], [$3])
-AT_TEST_TABLES_AND_PARSE([[%define lr.default-reductions accepting]],
+AT_TEST_TABLES_AND_PARSE([[%define lr.default-reduction accepting]],
                          [[accepting]], [[]],
-                         [[%define lr.default-reductions accepting]],
+                         [[%define lr.default-reduction accepting]],
                          [$1], [$2], [[]], [$3])
 ])