mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 05:43:03 +00:00
glr.cc: no longer require location support
* data/glr.cc: Use b4_locations_if where appropriate. * data/lalr1.cc: M4 quotation changes to highlight code duplication with glr.cc. * tests/calc.at: Check glr.cc with and without %location. While at it, fuse multiple %parse-params into one. * tests/actions.at: Simplify. * NEWS: Doc this. Some other wording changes.
This commit is contained in:
@@ -1273,12 +1273,11 @@ AT_CHECK_ACTION_LOCATIONS([[%printer]])
|
||||
m4_pushdef([AT_TEST],
|
||||
[AT_SETUP([[Qualified $$ in actions: $1]])
|
||||
|
||||
AT_BISON_OPTION_PUSHDEFS([%locations %skeleton "$1"])
|
||||
AT_BISON_OPTION_PUSHDEFS([%skeleton "$1"])
|
||||
|
||||
AT_DATA_GRAMMAR([[input.y]],
|
||||
[[%skeleton "$1"
|
||||
%defines // FIXME: Mandated by lalr1.cc in Bison 2.6.
|
||||
%locations // FIXME: Mandated by lalr1.cc in Bison 2.6.
|
||||
%debug
|
||||
%code requires
|
||||
{
|
||||
@@ -1321,17 +1320,6 @@ AT_DATA_GRAMMAR([[input.y]],
|
||||
%printer { report (yyo, $<ival>$, $$ ); } <fval>;
|
||||
%printer { report (yyo, $<ival>$, $<fval>$); } <>;
|
||||
|
||||
]AT_SKEL_CC_IF([[
|
||||
/* The lalr1.cc skeleton, for backward compatibility, defines
|
||||
a constructor for position that initializes the filename. The
|
||||
glr.cc skeleton does not (and in fact cannot: location/position
|
||||
are stored in a union, from which objects with constructors are
|
||||
excluded in C++). */
|
||||
%initial-action {
|
||||
@$.initialize ();
|
||||
}
|
||||
]])[
|
||||
|
||||
%initial-action
|
||||
{
|
||||
$<ival>$ = 42;
|
||||
@@ -1366,10 +1354,7 @@ AT_FULL_COMPILE([[input]])
|
||||
AT_PARSER_CHECK([./input], 0, [], [stderr])
|
||||
# Don't be too picky on the traces, GLR is not exactly the same. Keep
|
||||
# only the lines from the printer.
|
||||
#
|
||||
# Don't care about locations. FIXME: remove their removal when Bison
|
||||
# supports C++ without locations.
|
||||
AT_CHECK([[sed -ne 's/([-0-9.]*: /(/;/ival:/p' stderr]], 0,
|
||||
AT_CHECK([[sed -ne '/ival:/p' stderr]], 0,
|
||||
[[Reading a token: Next token is token UNTYPED (ival: 10, fval: 0.1)
|
||||
Shifting token UNTYPED (ival: 10, fval: 0.1)
|
||||
Reading a token: Next token is token INT (ival: 20, fval: 0.2)
|
||||
|
||||
@@ -637,7 +637,7 @@ AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %defi
|
||||
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 %define api.prefix "calc" %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.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 %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} {int *count}])
|
||||
|
||||
|
||||
# ----------------------- #
|
||||
@@ -675,8 +675,8 @@ AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %defin
|
||||
|
||||
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 %define api.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} {int *count}])
|
||||
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} {int *count}])
|
||||
|
||||
|
||||
# ----------------------------- #
|
||||
@@ -686,7 +686,7 @@ AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %location
|
||||
AT_BANNER([[Simple LALR(1) C++ Calculator.]])
|
||||
|
||||
# First let's try using %skeleton
|
||||
AT_CHECK_CALC([%skeleton "lalr1.cc" %defines %locations])
|
||||
AT_CHECK_CALC([%skeleton "lalr1.cc" %defines])
|
||||
|
||||
# AT_CHECK_CALC_LALR1_CC([BISON-OPTIONS])
|
||||
# ---------------------------------------
|
||||
@@ -706,8 +706,10 @@ AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-pref
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.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 %define api.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} {int *count}])
|
||||
|
||||
AT_CHECK_CALC_LALR1_CC([%pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} {int *count}])
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} {int *count}])
|
||||
|
||||
|
||||
|
||||
@@ -718,7 +720,7 @@ AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %deb
|
||||
AT_BANNER([[Simple GLR C++ Calculator.]])
|
||||
|
||||
# Again, we try also using %skeleton.
|
||||
AT_CHECK_CALC([%skeleton "glr.cc" %defines %locations])
|
||||
AT_CHECK_CALC([%skeleton "glr.cc" %defines])
|
||||
|
||||
# AT_CHECK_CALC_GLR_CC([BISON-OPTIONS])
|
||||
# -------------------------------------
|
||||
@@ -728,7 +730,8 @@ 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 location_type Span])
|
||||
AT_CHECK_CALC_GLR_CC([%locations])
|
||||
AT_CHECK_CALC_GLR_CC([%locations %define location_type Span])
|
||||
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %name-prefix "calc" %verbose %yacc])
|
||||
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %define api.prefix "calc" %verbose %yacc])
|
||||
|
||||
@@ -738,5 +741,5 @@ AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %ve
|
||||
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 %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||
AT_CHECK_CALC_GLR_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} {int *count}])
|
||||
AT_CHECK_CALC_GLR_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} {int *count}])
|
||||
|
||||
Reference in New Issue
Block a user