AT_CLEANUP
+## -------------- ##
+## Symbol names. ##
+## -------------- ##
+
+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"
+%token WITH.PERIOD
+%token WITHOUT_PERIOD "WITHOUT.PERIOD"
+%code {
+ void yyerror (char const *);
+ int yylex (void);
+}
+%%
+start: with-dash without_dash with.period without_period;
+with-dash: WITH-DASH;
+without_dash: "WITHOUT-DASH";
+with.period: WITH.PERIOD;
+without_period: "WITHOUT.PERIOD";
+%%
+]])
+
+# POSIX Yacc accept periods, but not dashes.
+AT_BISON_CHECK([--yacc input.y], [1], [],
+[[input.y:9.8-16: POSIX Yacc forbids dashes in symbol names: WITH-DASH
+input.y:18.8-16: POSIX Yacc forbids dashes in symbol names: with-dash
+]])
+
+# So warn about them.
+AT_BISON_CHECK([-Wyacc input.y], [], [],
+[[input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH
+input.y:18.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash
+]])
+
+# Dashes are fine for GNU Bison.
+AT_BISON_CHECK([-o input.c input.y])
+
+# Make sure we don't export silly token identifiers with periods or dashes.
+AT_COMPILE([input.o], [-c input.c])
+
+
+# Period are genuine letters, they can start identifiers. Dashes
+# and digits can't.
+AT_DATA_GRAMMAR([input.y],
+[[%token .good
+%token -wrong
+%token 1nv4l1d
+%%
+start: .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>
+]])
+
+AT_CLEANUP
+
+
## --------------------- ##
## Unclosed constructs. ##
## --------------------- ##
AT_SETUP([[%define enum variables]])
+# Front-end.
AT_DATA([[input.y]],
-[[%define api.push_pull "neither"
+[[%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: 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