mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 13:23:04 +00:00
variables: use singular in %define variable names
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.
This commit is contained in:
@@ -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]])
|
||||
|
||||
|
||||
@@ -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]],
|
||||
|
||||
@@ -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])
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user