%define: accept unquoted values.

* NEWS (2.5): Group all %define changes together, and document
this one.  Remove quotes in IELR and canonical LR entry.
* doc/bison.texinfo: Remove quotes in most examples throughout.
(Decl Summary): Update %define documentation.
(Table of Symbols): Likewise.
* src/ielr.c (LrType): Update documentation.
* src/parse-gram.y (content.opt): Add production for ID.
* tests/actions.at: Remove quotes in most tests.
* tests/calc.at: Likewise.
* tests/existing.at: Likewise.
* tests/input.at: Likewise.
* tests/local.at: Likewise.
* tests/push.at: Likewise.
* tests/reduce.at: Likewise.
* tests/torture.at: Likewise.
This commit is contained in:
Joel E. Denny
2009-08-28 03:46:37 -04:00
parent 6ba9640406
commit cf499cff31
15 changed files with 263 additions and 216 deletions

View File

@@ -29,7 +29,7 @@ AT_SETUP([Mid-rule actions])
# action.
AT_DATA_GRAMMAR([[input.y]],
[[%define parse.error "verbose"
[[%define parse.error verbose
%debug
%{
# include <stdio.h>
@@ -93,7 +93,7 @@ AT_CLEANUP
AT_SETUP([Exotic Dollars])
AT_DATA_GRAMMAR([[input.y]],
[[%define parse.error "verbose"
[[%define parse.error verbose
%debug
%{
# include <stdio.h>
@@ -557,7 +557,7 @@ m4_define([AT_CHECK_PRINTER_AND_DESTRUCTOR],
$3
_AT_CHECK_PRINTER_AND_DESTRUCTOR($[1], $[2], $[3], $[4],
[%define parse.error "verbose"
[%define parse.error verbose
%debug
%verbose
%locations
@@ -588,7 +588,7 @@ AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [with union])
AT_SETUP([Default tagless %printer and %destructor])
AT_DATA_GRAMMAR([[input.y]],
[[%define parse.error "verbose"
[[%define parse.error verbose
%debug
%locations
%initial-action {
@@ -706,7 +706,7 @@ AT_CLEANUP
AT_SETUP([Default tagged and per-type %printer and %destructor])
AT_DATA_GRAMMAR([[input.y]],
[[%define parse.error "verbose"
[[%define parse.error verbose
%debug
%{
@@ -850,7 +850,7 @@ m4_define([_AT_CHECK_DEFAULT_PRINTER_AND_DESTRUCTOR_FOR_END_TOKEN],
[m4_pushdef([kind], [*]) m4_pushdef([not_kind], [])])
AT_DATA_GRAMMAR([[input]]$1[[.y]],
[[%define parse.error "verbose"
[[%define parse.error verbose
%debug
%locations
%initial-action {

View File

@@ -401,7 +401,7 @@ AT_PARSER_CHECK([./calc input], 0, [], [stderr])
# If BISON-OPTIONS contains `%location', then make sure the ERROR-LOCATION
# is correctly output on stderr.
#
# If BISON-OPTIONS contains `%define parse.error "verbose"', then make sure the
# If BISON-OPTIONS contains `%define parse.error verbose', then make sure the
# IF-YYERROR-VERBOSE message is properly output after `syntax error, '
# on STDERR.
#
@@ -443,7 +443,7 @@ AT_YYERROR_SEES_LOC_IF([],
[[sed 's/^[-0-9.]*: //' expout >at-expout
mv at-expout expout]])
# 4. If error-verbose is not used, strip the`, unexpected....' part.
m4_bmatch([$1], [%define parse.error "verbose"], [],
m4_bmatch([$1], [%define parse.error verbose], [],
[[sed 's/syntax error, .*$/syntax error/' expout >at-expout
mv at-expout expout]])
# 5. Check
@@ -572,22 +572,22 @@ AT_CHECK_CALC_LALR([%locations])
AT_CHECK_CALC_LALR([%name-prefix="calc"]) dnl test deprecated `='
AT_CHECK_CALC_LALR([%verbose])
AT_CHECK_CALC_LALR([%yacc])
AT_CHECK_CALC_LALR([%define parse.error "verbose"])
AT_CHECK_CALC_LALR([%define parse.error verbose])
AT_CHECK_CALC_LALR([%define api.pure %locations])
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 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 %name-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" %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([%debug])
AT_CHECK_CALC_LALR([%define parse.error "verbose" %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.pure %define parse.error "verbose" %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.push-pull "both" %define api.pure %define parse.error "verbose" %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.pure %define parse.error "verbose" %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
# ----------------------- #
@@ -611,20 +611,20 @@ AT_CHECK_CALC_GLR([%locations])
AT_CHECK_CALC_GLR([%name-prefix "calc"])
AT_CHECK_CALC_GLR([%verbose])
AT_CHECK_CALC_GLR([%yacc])
AT_CHECK_CALC_GLR([%define parse.error "verbose"])
AT_CHECK_CALC_GLR([%define parse.error verbose])
AT_CHECK_CALC_GLR([%define api.pure %locations])
AT_CHECK_CALC_GLR([%define parse.error "verbose" %locations])
AT_CHECK_CALC_GLR([%define parse.error verbose %locations])
AT_CHECK_CALC_GLR([%define parse.error "verbose" %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_GLR([%define parse.error verbose %locations %defines %name-prefix "calc" %verbose %yacc])
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 %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
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 %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
AT_CHECK_CALC_GLR([%define api.pure %define parse.error "verbose" %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_GLR([%define api.pure %define parse.error "verbose" %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
# ----------------------------- #
@@ -645,14 +645,14 @@ m4_define([AT_CHECK_CALC_LALR1_CC],
AT_CHECK_CALC_LALR1_CC([])
AT_CHECK_CALC_LALR1_CC([%locations])
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error "verbose" %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error "verbose" %debug %name-prefix "calc" %verbose %yacc])
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 %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error "verbose" %debug %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error "verbose" %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
@@ -673,12 +673,12 @@ m4_define([AT_CHECK_CALC_GLR_CC],
[AT_CHECK_CALC([%language "C++" %glr-parser %defines %locations] $@)])
AT_CHECK_CALC_GLR_CC([])
AT_CHECK_CALC_GLR_CC([%define parse.error "verbose" %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %name-prefix "calc" %verbose %yacc])
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([%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" %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" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])

View File

@@ -42,18 +42,18 @@ AT_CHECK([[diff -u input-lalr.output input.output \
[[0]], [$1])])
AT_TEST_TABLES_AND_PARSE([$2[: LALR(1)]], [[LALR]], [[last-state]],
[[%define lr.type "lalr"
[[%define lr.type lalr
]$3],
[$4], [$5], [$6], [$7],
[AT_LALR1_DIFF_CHECK([$8])$9], [$10], [$11], [$12])
AT_TEST_TABLES_AND_PARSE([$2[: IELR(1)]], [[IELR]], [[last-state]],
[[%define lr.type "ielr"
[[%define lr.type ielr
]$3],
[$4], [$5], [$6], [$7],
[AT_LALR1_DIFF_CHECK([$8])$9], [$10], [$11], [$12])
AT_TEST_TABLES_AND_PARSE([$2[: Canonical LR(1)]], [[canonical LR]],
[[last-state,no-xml]],
[[%define lr.type "canonical-lr"
[[%define lr.type canonical-lr
]$3],
[$4], [$5], [$6], [$7],
[$9], [$10], [$11], [$12])

View File

@@ -999,7 +999,7 @@ AT_SETUP([[%define enum variables]])
# Front-end.
AT_DATA([[input.y]],
[[%define lr.default-reductions "bogus"
[[%define lr.default-reductions bogus
%%
start: ;
]])
@@ -1012,7 +1012,7 @@ input.y:1.9-29: accepted value: `accepting'
# Back-end.
AT_DATA([[input.y]],
[[%define api.push-pull "neither"
[[%define api.push-pull neither
%%
start: ;
]])
@@ -1047,7 +1047,7 @@ input.y:1.9-21: accepted value: `both'
]])
AT_DATA([[input.y]],
[[%define lr.keep_unreachable_states "maybe"
[[%define lr.keep_unreachable_states maybe
%%
start: ;
]])
@@ -1102,11 +1102,11 @@ AT_BISON_CHECK([[input.y]], [0], [],
])
AT_CHECK_API_PURE([[%language "c++" %defines]], [[]])
AT_CHECK_API_PURE([[%language "c++" %defines]], [["false"]])
AT_CHECK_API_PURE([[%language "c++" %defines]], [[false]])
AT_CHECK_API_PURE([[%language "c++" %defines %glr-parser]], [[""]])
AT_CHECK_API_PURE([[%language "c++" %defines %glr-parser]], [["false"]])
AT_CHECK_API_PURE([[%language "java"]], [["true"]])
AT_CHECK_API_PURE([[%language "java"]], [["false"]])
AT_CHECK_API_PURE([[%language "c++" %defines %glr-parser]], [[false]])
AT_CHECK_API_PURE([[%language "java"]], [[true]])
AT_CHECK_API_PURE([[%language "java"]], [[false]])
AT_CLEANUP

View File

@@ -77,7 +77,7 @@ m4_pushdef([AT_LOCATION_IF],
[m4_bmatch([$3], [%locations], [$1], [$2])])
m4_pushdef([AT_PURE_IF],
[m4_bmatch([$3], [%define *api\.pure\|%pure-parser],
[m4_bmatch([$3], [%define *api\.pure *"false"], [$2], [$1])],
[m4_bmatch([$3], [%define *api\.pure *"?false"?], [$2], [$1])],
[$2])])
m4_pushdef([AT_PURE_AND_LOC_IF],
[m4_bmatch([$3], [%locations], [AT_PURE_IF($@)], [$2])])

View File

@@ -33,7 +33,7 @@ AT_DATA_GRAMMAR([[input.y]],
void yyerror (char const *msg);
%}
%define api.pure %define api.push-pull "push"
%define api.pure %define api.push-pull push
%%
@@ -93,7 +93,7 @@ AT_DATA_GRAMMAR([[input.y]],
int yylex (void);
%}
%define api.push-pull "]$1["
%define api.push-pull ]$1[
%%
@@ -156,7 +156,7 @@ AT_SETUP([[Push Parsing: Unsupported Skeletons]])
AT_DATA([[input.y]],
[[%glr-parser
%define api.push-pull "push"
%define api.push-pull push
%%
start: ;
]])

View File

@@ -375,19 +375,19 @@ m4_define([AT_TEST_LR_TYPE],
AT_TEST_TABLES_AND_PARSE([[no %define lr.type: ]$1],
[[LALR]], [[]],
[$2], m4_shiftn(2, $@))
AT_TEST_TABLES_AND_PARSE([[%define lr.type "lalr": ]$1],
AT_TEST_TABLES_AND_PARSE([[%define lr.type lalr: ]$1],
[[LALR]], [[]],
[[%define lr.type "lalr"
[[%define lr.type lalr
]$2],
m4_shiftn(2, $@))
AT_TEST_TABLES_AND_PARSE([[%define lr.type "ielr": ]$1],
AT_TEST_TABLES_AND_PARSE([[%define lr.type ielr: ]$1],
[[IELR]], [[]],
[[%define lr.type "ielr"
[[%define lr.type ielr
]$2],
m4_shiftn(2, $@))
AT_TEST_TABLES_AND_PARSE([[%define lr.type "canonical-lr": ]$1],
AT_TEST_TABLES_AND_PARSE([[%define lr.type canonical-lr: ]$1],
[[canonical LR]], [[]],
[[%define lr.type "canonical-lr"
[[%define lr.type canonical-lr
]$2],
m4_shiftn(2, $@))
])
@@ -1454,17 +1454,17 @@ AT_TEST_TABLES_AND_PARSE([[no %define lr.default-reductions]],
[[all]], [[]],
[[]],
[$1], [$2], [[]], [$3])
AT_TEST_TABLES_AND_PARSE([[%define lr.default-reductions "all"]],
AT_TEST_TABLES_AND_PARSE([[%define lr.default-reductions all]],
[[all]], [[]],
[[%define lr.default-reductions "all"]],
[[%define lr.default-reductions all]],
[$1], [$2], [[]], [$3])
AT_TEST_TABLES_AND_PARSE([[%define lr.default-reductions "consistent"]],
AT_TEST_TABLES_AND_PARSE([[%define lr.default-reductions consistent]],
[[consistent]], [[]],
[[%define lr.default-reductions "consistent"]],
[[%define lr.default-reductions consistent]],
[$1], [$2], [[]], [$3])
AT_TEST_TABLES_AND_PARSE([[%define lr.default-reductions "accepting"]],
AT_TEST_TABLES_AND_PARSE([[%define lr.default-reductions accepting]],
[[accepting]], [[]],
[[%define lr.default-reductions "accepting"]],
[[%define lr.default-reductions accepting]],
[$1], [$2], [[]], [$3])
])

View File

@@ -496,7 +496,7 @@ AT_PARSER_CHECK([./input 10000], 2, [], [ignore],
# just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect
# push parsers.
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
[[%define api.push-pull "both"
[[%define api.push-pull both
]])
AT_PARSER_CHECK([./input 20], 0, [], [ignore],
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
@@ -534,7 +534,7 @@ AT_PARSER_CHECK([./input 10000], 2, [], [ignore],
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
[[%define api.push-pull "both"
[[%define api.push-pull both
]])
AT_PARSER_CHECK([./input 20], 0, [], [ignore],
[[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])