AT_SETUP([Symbols])
-# Bison once thought a character token and its alias were different
-# symbols with the same user token number.
-
AT_DATA_GRAMMAR([input.y],
[[%token WITH-DASH
%token WITHOUT_DASH "WITHOUT-DASH"
AT_COMPILE([input.o], [-c input.c])
-# Period are genuine letters, they can start identifiers. Dashes
-# and digits can't.
+# Periods and dashes are genuine letters, they can start identifiers.
+# Digits cannot.
AT_DATA_GRAMMAR([input.y],
-[[%token .good
-%token -wrong
-%token 1nv4l1d
+[[%token .GOOD
+%token -GOOD
+%token 1NV4L1D
%%
-start: .good
+start: .GOOD -GOOD
]])
AT_BISON_CHECK([-o input.c input.y], [1], [],
-[[input.y:10.8: invalid character: `-'
-input.y:11.8: syntax error, unexpected integer, expecting char or identifier or <tag>
+[[input.y:11.8: syntax error, unexpected integer, expecting char or identifier or <tag>
]])
AT_CLEANUP
# Front-end.
AT_DATA([[input.y]],
-[[%define lr.default_reductions "bogus"
+[[%define lr.default-reductions "bogus"
%%
start: ;
]])
AT_BISON_CHECK([[input.y]], [[1]], [[]],
-[[input.y:1.9-29: invalid value for %define variable `lr.default_reductions': `bogus'
+[[input.y:1.9-29: invalid value for %define variable `lr.default-reductions': `bogus'
input.y:1.9-29: accepted value: `all'
input.y:1.9-29: accepted value: `consistent'
input.y:1.9-29: accepted value: `accepting'
]])
# Back-end.
+AT_DATA([[input.y]],
+[[%define api.push-pull "neither"
+%%
+start: ;
+]])
+AT_BISON_CHECK([[input.y]], [1], [],
+[[input.y:1.9-21: invalid value for %define variable `api.push-pull': `neither'
+input.y:1.9-21: accepted value: `pull'
+input.y:1.9-21: accepted value: `push'
+input.y:1.9-21: accepted value: `both'
+]])
+
+AT_CLEANUP
+
+## -------------------------------- ##
+## %define backward compatibility. ##
+## -------------------------------- ##
+
+AT_SETUP([[%define backward compatibility]])
+
+# The error messages tell us whether underscores in these variables are
+# being converted to dashes.
+
AT_DATA([[input.y]],
[[%define api.push_pull "neither"
%%
start: ;
]])
AT_BISON_CHECK([[input.y]], [1], [],
-[[input.y:1.9-21: invalid value for %define variable `api.push_pull': `neither'
+[[input.y:1.9-21: invalid value for %define variable `api.push-pull': `neither'
input.y:1.9-21: accepted value: `pull'
input.y:1.9-21: accepted value: `push'
input.y:1.9-21: accepted value: `both'
]])
+AT_DATA([[input.y]],
+[[%define lr.keep_unreachable_states "maybe"
+%%
+start: ;
+]])
+AT_BISON_CHECK([[input.y]], [1], [],
+[[input.y:1.9-34: invalid value for %define Boolean variable `lr.keep-unreachable-states'
+]])
+
+AT_DATA([[input.y]],
+[[%define foo_bar "baz"
+%%
+start: ;
+]])
+AT_BISON_CHECK([[input.y]], [0], [],
+[[input.y:1.9-15: warning: %define variable `foo_bar' is not used
+]])
+
AT_CLEANUP
## ------------------------- ##