mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 15:23:02 +00:00
deprecate %defines in favor of %header
This is consistent with --defines being deprecated in favor of --header. The directive %defines is also too similar to %define. And %header matches nicely with api.header.name. * src/scan-gram.l (%defines): Deprecate to %header. (%header): Scan it. * src/parse-gram.y (PERCENT_DEFINES): Replace with... (PERCENT_HEADER): this. * data/skeletons/lalr1.java * doc/bison.texi * tests/actions.at, tests/c++.at, tests/calc.at, tests/conflicts.at, * tests/input.at, tests/java.at, tests/local.at, tests/output.at, * tests/synclines.at, tests/types.at: Convert most tests to check %header instead of %defines.
This commit is contained in:
@@ -1050,14 +1050,14 @@ AT_CHECK_PRINTER_AND_DESTRUCTOR([], [ with union])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [ with union])
|
||||
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [ with union])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "lalr1.cc"])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "lalr1.cc"], [ with union])
|
||||
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "glr.cc"])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "glr.cc"], [ with union])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "glr.cc"])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "glr.cc"], [ with union])
|
||||
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "glr2.cc"])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "glr2.cc"], [ with union])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "glr2.cc"])
|
||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%header %skeleton "glr2.cc"], [ with union])
|
||||
|
||||
|
||||
|
||||
|
||||
10
tests/c++.at
10
tests/c++.at
@@ -593,7 +593,7 @@ AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc"])
|
||||
|
||||
AT_DATA_GRAMMAR([[input.y]],
|
||||
[[%skeleton "lalr1.cc"
|
||||
%defines
|
||||
%header
|
||||
|
||||
%debug
|
||||
%define parse.assert
|
||||
@@ -727,7 +727,7 @@ AT_DATA([input.yy],
|
||||
[[%require "3.2"
|
||||
%skeleton "lalr1.cc"
|
||||
%locations
|
||||
%defines
|
||||
%header
|
||||
%debug
|
||||
%%
|
||||
exp: %empty;
|
||||
@@ -964,7 +964,7 @@ AT_BISON_OPTION_PUSHDEFS([$1 %debug])
|
||||
|
||||
AT_DATA_GRAMMAR([[input.yy]],
|
||||
[[$1
|
||||
%defines
|
||||
%header
|
||||
|
||||
%code
|
||||
{
|
||||
@@ -1453,7 +1453,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
mkdir -p include/ast
|
||||
|
||||
AT_TEST([x1],
|
||||
[%defines
|
||||
[%header
|
||||
%locations
|
||||
%define api.location.file "include/ast/loc.hh"
|
||||
%define api.location.include {<ast/loc.hh>}])
|
||||
@@ -1468,7 +1468,7 @@ AT_CHECK([sed -ne '/INCLUDED/p;/\\file/{p;n;p;}' include/ast/loc.hh], [],
|
||||
]])
|
||||
|
||||
AT_TEST([x2],
|
||||
[%defines
|
||||
[%header
|
||||
%locations
|
||||
%code requires {#include <ast/loc.hh>}
|
||||
%define api.location.type {x1::location}])
|
||||
|
||||
@@ -422,14 +422,14 @@ m4_define([AT_CALC_YYLEX(java)],
|
||||
|
||||
# _AT_DATA_CALC_Y($1, $2, $3, [BISON-DIRECTIVES])
|
||||
# -----------------------------------------------
|
||||
# Produce 'calc.y' and, if %defines was specified, 'calc-lex.c' or
|
||||
# Produce 'calc.y' and, if %header was specified, 'calc-lex.c' or
|
||||
# 'calc-lex.cc'.
|
||||
#
|
||||
# Don't call this macro directly, because it contains some occurrences
|
||||
# of '$1' etc. which will be interpreted by m4. So you should call it
|
||||
# with $1, $2, and $3 as arguments, which is what AT_DATA_CALC_Y does.
|
||||
#
|
||||
# When %defines is not passed, generate a single self-contained file.
|
||||
# When %header is not passed, generate a single self-contained file.
|
||||
# Otherwise, generate three: calc.y with the parser, calc-lex.c with
|
||||
# the scanner, and calc-main.c with "main()". This is in order to
|
||||
# stress the use of the generated parser header. To avoid code
|
||||
@@ -647,11 +647,11 @@ location_print (FILE *o, Span s)
|
||||
}
|
||||
]])])[
|
||||
]AT_YYERROR_DEFINE[
|
||||
]AT_DEFINES_IF([],
|
||||
]AT_HEADER_IF([],
|
||||
[AT_CALC_YYLEX
|
||||
AT_CALC_MAIN])])
|
||||
|
||||
AT_DEFINES_IF([AT_DATA_SOURCE([[calc-lex.]AT_LANG_EXT],
|
||||
AT_HEADER_IF([AT_DATA_SOURCE([[calc-lex.]AT_LANG_EXT],
|
||||
[[#include "calc.]AT_LANG_HDR["
|
||||
|
||||
]AT_CALC_YYLEX])
|
||||
@@ -752,7 +752,7 @@ exp:
|
||||
|
||||
# AT_DATA_CALC_Y([BISON-OPTIONS])
|
||||
# -------------------------------
|
||||
# Produce 'calc.y' and, if %defines was specified, 'calc-lex.c' or
|
||||
# Produce 'calc.y' and, if %header was specified, 'calc-lex.c' or
|
||||
# 'calc-lex.cc'.
|
||||
m4_define([AT_DATA_CALC_Y],
|
||||
[_AT_DATA_CALC_Y($[1], $[2], $[3], [$1])
|
||||
@@ -914,7 +914,7 @@ AT_SETUP([Calculator $1 $2])
|
||||
AT_BISON_OPTION_PUSHDEFS([$1])
|
||||
|
||||
AT_DATA_CALC_Y([$1])
|
||||
AT_FULL_COMPILE(AT_JAVA_IF([[Calc]], [[calc]]), AT_DEFINES_IF([[lex], [main]], [[], []]), [$2], [-Wno-deprecated])
|
||||
AT_FULL_COMPILE(AT_JAVA_IF([[Calc]], [[calc]]), AT_HEADER_IF([[lex], [main]], [[], []]), [$2], [-Wno-deprecated])
|
||||
|
||||
AT_YACC_IF(
|
||||
[# No direct calls to malloc/free.
|
||||
@@ -926,7 +926,7 @@ AT_PUSH_IF([AT_JAVA_IF(
|
||||
AT_CHECK_JAVA_GREP([[Calc.java]],
|
||||
[[.*public void push_parse_initialize ().*]])])])
|
||||
|
||||
AT_CHECK_SPACES([AT_JAVA_IF([Calc], [calc]).AT_LANG_EXT AT_DEFINES_IF([AT_JAVA_IF([Calc], [calc]).AT_LANG_HDR])])
|
||||
AT_CHECK_SPACES([AT_JAVA_IF([Calc], [calc]).AT_LANG_EXT AT_HEADER_IF([AT_JAVA_IF([Calc], [calc]).AT_LANG_HDR])])
|
||||
|
||||
# Test the precedences.
|
||||
# The Java traces do not show the clean up sequence at the end,
|
||||
@@ -1081,7 +1081,7 @@ m4_define([AT_CHECK_CALC_LALR],
|
||||
|
||||
AT_CHECK_CALC_LALR([%define parse.trace])
|
||||
|
||||
AT_CHECK_CALC_LALR([%defines])
|
||||
AT_CHECK_CALC_LALR([%header])
|
||||
AT_CHECK_CALC_LALR([%debug %locations])
|
||||
AT_CHECK_CALC_LALR([%locations %define api.location.type {Span}])
|
||||
|
||||
@@ -1095,19 +1095,20 @@ AT_CHECK_CALC_LALR([%define api.pure full %locations])
|
||||
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %locations])
|
||||
AT_CHECK_CALC_LALR([%define parse.error detailed %locations])
|
||||
|
||||
AT_CHECK_CALC_LALR([%define parse.error detailed %locations %defines %define api.prefix {calc} %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define parse.error detailed %locations %defines %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define parse.error detailed %locations %header %define api.prefix {calc} %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define parse.error detailed %locations %header %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_LALR([%debug])
|
||||
AT_CHECK_CALC_LALR([%define parse.error detailed %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define parse.error detailed %debug %locations %header %name-prefix "calc" %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_LALR([%define api.pure full %define parse.error detailed %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define api.pure full %define parse.error detailed %debug %locations %header %name-prefix "calc" %verbose %yacc])
|
||||
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_LALR([%define api.pure %define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_LALR([%define api.pure %define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
|
||||
AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error verbose %debug %locations %header %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
|
||||
|
||||
@@ -1128,7 +1129,7 @@ m4_define([AT_CHECK_CALC_GLR],
|
||||
|
||||
AT_CHECK_CALC_GLR()
|
||||
|
||||
AT_CHECK_CALC_GLR([%defines])
|
||||
AT_CHECK_CALC_GLR([%header])
|
||||
AT_CHECK_CALC_GLR([%locations])
|
||||
AT_CHECK_CALC_GLR([%locations %define api.location.type {Span}])
|
||||
AT_CHECK_CALC_GLR([%name-prefix "calc"])
|
||||
@@ -1139,20 +1140,20 @@ 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 custom %locations %defines %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR([%define parse.error detailed %locations %defines %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR([%define parse.error verbose %locations %defines %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR([%define parse.error custom %locations %header %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR([%define parse.error detailed %locations %header %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR([%define parse.error verbose %locations %header %name-prefix "calc" %verbose])
|
||||
|
||||
AT_CHECK_CALC_GLR([%debug])
|
||||
AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %define api.prefix {calc} %define api.token.prefix {TOK_} %verbose])
|
||||
AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %header %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %header %define api.prefix {calc} %define api.token.prefix {TOK_} %verbose])
|
||||
|
||||
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %header %name-prefix "calc" %verbose])
|
||||
|
||||
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %header %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %header %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
|
||||
AT_CHECK_CALC_GLR([%no-lines %define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_GLR([%no-lines %define api.pure %define parse.error verbose %debug %locations %header %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
|
||||
|
||||
# ---------------------- #
|
||||
@@ -1162,7 +1163,7 @@ AT_CHECK_CALC_GLR([%no-lines %define api.pure %define parse.error verbose %debug
|
||||
AT_BANNER([[LALR(1) C++ Calculator.]])
|
||||
|
||||
# First let's try using %skeleton
|
||||
AT_CHECK_CALC([%skeleton "lalr1.cc" %defines])
|
||||
AT_CHECK_CALC([%skeleton "lalr1.cc" %header])
|
||||
|
||||
m4_define([AT_CHECK_CALC_LALR1_CC],
|
||||
[AT_CHECK_CALC([%language "C++" $1], [$2])])
|
||||
@@ -1171,7 +1172,7 @@ AT_CHECK_CALC_LALR1_CC([])
|
||||
AT_CHECK_CALC_LALR1_CC([%locations])
|
||||
AT_CHECK_CALC_LALR1_CC([%locations], [$NO_EXCEPTIONS_CXXFLAGS])
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %define api.location.type {Span}])
|
||||
AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_LALR1_CC([%header %locations %define parse.error verbose %name-prefix "calc" %verbose])
|
||||
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %define api.prefix {calc} %verbose])
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-prefix "calc" %verbose])
|
||||
@@ -1179,15 +1180,15 @@ AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-pref
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %define api.prefix {calc} %verbose])
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %define api.prefix {calc} %define api.token.prefix {TOK_} %verbose])
|
||||
|
||||
AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_LALR1_CC([%header %locations %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
|
||||
AT_CHECK_CALC_LALR1_CC([%define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_LALR1_CC([%header %locations %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
|
||||
AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.location.file none])
|
||||
AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.location.file "my-location.hh"])
|
||||
AT_CHECK_CALC_LALR1_CC([%header %locations %define api.location.file none])
|
||||
AT_CHECK_CALC_LALR1_CC([%header %locations %define api.location.file "my-location.hh"])
|
||||
|
||||
AT_CHECK_CALC_LALR1_CC([%no-lines %defines %locations %define api.location.file "my-location.hh"])
|
||||
AT_CHECK_CALC_LALR1_CC([%no-lines %header %locations %define api.location.file "my-location.hh"])
|
||||
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %define parse.lac full %define parse.error verbose])
|
||||
AT_CHECK_CALC_LALR1_CC([%locations %define parse.lac full %define parse.error detailed])
|
||||
@@ -1212,7 +1213,7 @@ m4_define([AT_CHECK_CALC_GLR_CC],
|
||||
AT_CHECK_CALC_GLR_CC([])
|
||||
AT_CHECK_CALC_GLR_CC([%locations])
|
||||
AT_CHECK_CALC_GLR_CC([%locations %define api.location.type {Span}])
|
||||
AT_CHECK_CALC_GLR_CC([%defines %define parse.error verbose %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR_CC([%header %define parse.error verbose %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %define api.prefix {calc} %verbose])
|
||||
|
||||
AT_CHECK_CALC_GLR_CC([%debug])
|
||||
@@ -1220,10 +1221,10 @@ AT_CHECK_CALC_GLR_CC([%debug])
|
||||
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %verbose])
|
||||
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %define api.token.prefix {TOK_} %verbose])
|
||||
|
||||
AT_CHECK_CALC_GLR_CC([%locations %defines %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_GLR_CC([%locations %defines %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_GLR_CC([%locations %header %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_GLR_CC([%locations %header %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
|
||||
AT_CHECK_CALC_GLR_CC([%no-lines %locations %defines %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
AT_CHECK_CALC_GLR_CC([%no-lines %locations %header %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
|
||||
|
||||
|
||||
# -------------------- #
|
||||
|
||||
@@ -405,7 +405,7 @@ m4_pushdef([AT_CONSISTENT_ERRORS_CHECK], [
|
||||
|
||||
AT_SETUP([[parse.error=verbose and consistent errors: ]$1])
|
||||
|
||||
AT_BISON_OPTION_PUSHDEFS([$1 AT_CXX_IF([[%defines]], [[%define api.pure]])])
|
||||
AT_BISON_OPTION_PUSHDEFS([$1 AT_CXX_IF([[%header]], [[%define api.pure]])])
|
||||
|
||||
AT_DATA_GRAMMAR([input.y],
|
||||
[AT_JAVA_IF([[
|
||||
@@ -421,7 +421,7 @@ AT_DATA_GRAMMAR([input.y],
|
||||
#define USE(Var)
|
||||
}
|
||||
|
||||
]AT_CXX_IF([[%defines]], [[%define api.pure]])])[
|
||||
]AT_CXX_IF([[%header]], [[%define api.pure]])])[
|
||||
|
||||
]AT_YACC_IF([[
|
||||
%code {
|
||||
|
||||
@@ -2361,7 +2361,7 @@ m4_define([AT_CHECK_NAMESPACE_ERROR],
|
||||
[
|
||||
AT_DATA([[input.y]],
|
||||
[[%language "C++"
|
||||
%defines
|
||||
%header
|
||||
%define api.namespace {]$1[}
|
||||
%%
|
||||
start: %empty;
|
||||
@@ -2908,6 +2908,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
||||
%error-verbose
|
||||
%glr-parser
|
||||
%name-prefix "bar"
|
||||
%defines "header.h"
|
||||
%%
|
||||
exp : '0'
|
||||
]])
|
||||
@@ -2991,6 +2992,7 @@ AT_CHECK([sed -e '1,8d' input.y], [],
|
||||
%define api.pure
|
||||
%token-table
|
||||
%glr-parser
|
||||
%defines "header.h"
|
||||
%%
|
||||
exp : '0'
|
||||
]])
|
||||
|
||||
@@ -24,6 +24,21 @@ AT_BANNER([[Java Calculator.]])
|
||||
|
||||
AT_SETUP([Java invalid directives])
|
||||
|
||||
AT_DATA([[YYParser.y]], [
|
||||
%language "Java"
|
||||
%header
|
||||
%destructor { /* Nothing. */ } exp
|
||||
%%
|
||||
exp:
|
||||
])
|
||||
|
||||
AT_BISON_CHECK([[-fcaret YYParser.y]], [1], [],
|
||||
[[YYParser.y: error: %header/%defines does not make sense in Java
|
||||
YYParser.y:4.13-30: error: %destructor does not make sense in Java
|
||||
4 | %destructor { /* Nothing. */ } exp
|
||||
| ^~~~~~~~~~~~~~~~~~
|
||||
]])
|
||||
|
||||
AT_DATA([[YYParser.y]], [
|
||||
%language "Java"
|
||||
%defines
|
||||
@@ -33,7 +48,7 @@ exp:
|
||||
])
|
||||
|
||||
AT_BISON_CHECK([[-fcaret YYParser.y]], [1], [],
|
||||
[[YYParser.y: error: %defines does not make sense in Java
|
||||
[[YYParser.y: error: %header/%defines does not make sense in Java
|
||||
YYParser.y:4.13-30: error: %destructor does not make sense in Java
|
||||
4 | %destructor { /* Nothing. */ } exp
|
||||
| ^~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -210,8 +210,8 @@ m4_if([$1$2], $[1]$[2], [],
|
||||
[m4_fatal([$0: invalid arguments: $@])])dnl
|
||||
m4_pushdef([AT_AUTOMOVE_IF],
|
||||
[m4_bmatch([$3], [%define api\.value\.automove], [$1], [$2])])
|
||||
m4_pushdef([AT_DEFINES_IF],
|
||||
[m4_bmatch([$3], [%defines], [$1], [$2])])
|
||||
m4_pushdef([AT_HEADER_IF],
|
||||
[m4_bmatch([$3], [%defines\|%header], [$1], [$2])])
|
||||
m4_pushdef([AT_DEBUG_IF],
|
||||
[m4_bmatch([$3], [%debug\|%define parse.trace], [$1], [$2])])
|
||||
m4_pushdef([AT_ERROR_CUSTOM_IF],
|
||||
@@ -442,7 +442,7 @@ m4_popdef([AT_ERROR_VERBOSE_IF])
|
||||
m4_popdef([AT_ERROR_DETAILED_IF])
|
||||
m4_popdef([AT_ERROR_CUSTOM_IF])
|
||||
m4_popdef([AT_DEBUG_IF])
|
||||
m4_popdef([AT_DEFINES_IF])
|
||||
m4_popdef([AT_HEADER_IF])
|
||||
m4_popdef([AT_AUTOMOVE_IF])
|
||||
AT_LOC_POPDEF])dnl
|
||||
])# AT_BISON_OPTION_POPDEFS
|
||||
|
||||
@@ -106,30 +106,30 @@ AT_CHECK_OUTPUT([foo.y], [], [-dv -g -o foo.c],
|
||||
[foo.c foo.dot foo.h foo.output])
|
||||
|
||||
|
||||
AT_CHECK_OUTPUT([foo.y], [%defines %verbose], [],
|
||||
AT_CHECK_OUTPUT([foo.y], [%header %verbose], [],
|
||||
[foo.output foo.tab.c foo.tab.h])
|
||||
AT_CHECK_OUTPUT([foo.y], [%defines %verbose %yacc],[],
|
||||
AT_CHECK_OUTPUT([foo.y], [%header %verbose %yacc],[],
|
||||
[y.output y.tab.c y.tab.h])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy], [%defines %verbose %yacc],[],
|
||||
AT_CHECK_OUTPUT([foo.yy], [%header %verbose %yacc],[],
|
||||
[y.output y.tab.c y.tab.h])
|
||||
|
||||
# Exercise %output and %file-prefix including deprecated '='
|
||||
AT_CHECK_OUTPUT([foo.y], [%file-prefix "bar" %defines %verbose], [],
|
||||
AT_CHECK_OUTPUT([foo.y], [%file-prefix "bar" %header %verbose], [],
|
||||
[bar.output bar.tab.c bar.tab.h])
|
||||
AT_CHECK_OUTPUT([foo.y], [%output "bar.c" %defines %verbose %yacc],[],
|
||||
AT_CHECK_OUTPUT([foo.y], [%output "bar.c" %header %verbose %yacc],[],
|
||||
[bar.c bar.h bar.output])
|
||||
AT_CHECK_OUTPUT([foo.y],
|
||||
[%file-prefix "baz" %output "bar.c" %defines %verbose %yacc],
|
||||
[%file-prefix "baz" %output "bar.c" %header %verbose %yacc],
|
||||
[],
|
||||
[bar.c bar.h bar.output])
|
||||
|
||||
|
||||
# Check priorities of extension control.
|
||||
AT_CHECK_OUTPUT([foo.yy], [%defines %verbose], [],
|
||||
AT_CHECK_OUTPUT([foo.yy], [%header %verbose], [],
|
||||
[foo.output foo.tab.cc foo.tab.hh])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy], [%defines %verbose ], [-o foo.c],
|
||||
AT_CHECK_OUTPUT([foo.yy], [%header %verbose ], [-o foo.c],
|
||||
[foo.c foo.h foo.output])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy], [],
|
||||
@@ -137,10 +137,10 @@ AT_CHECK_OUTPUT([foo.yy], [],
|
||||
[foo.c++ foo.hpp])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy], [],
|
||||
[--defines=foo.hpp -o foo.c++],
|
||||
[--header=foo.hpp -o foo.c++],
|
||||
[foo.c++ foo.hpp])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy], [%defines "foo.hpp"],
|
||||
AT_CHECK_OUTPUT([foo.yy], [%header "foo.hpp"],
|
||||
[-o foo.c++],
|
||||
[foo.c++ foo.hpp])
|
||||
|
||||
@@ -162,6 +162,14 @@ AT_CHECK_OUTPUT([foo.y], [%define useless],
|
||||
[foo.dot foo.output foo.xml],
|
||||
[1])
|
||||
|
||||
# %header was spelled %defines before.
|
||||
AT_CHECK_OUTPUT([foo.yy], [%defines],
|
||||
[-o foo.c++],
|
||||
[foo.c++ foo.h++])
|
||||
AT_CHECK_OUTPUT([foo.yy], [%defines "foo.hpp"],
|
||||
[-o foo.c++],
|
||||
[foo.c++ foo.hpp])
|
||||
|
||||
|
||||
## ------------ ##
|
||||
## C++ output. ##
|
||||
@@ -179,48 +187,48 @@ AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc"], [],
|
||||
AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %verbose], [],
|
||||
[foo.output foo.tab.cc])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %defines %verbose], [],
|
||||
AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %header %verbose], [],
|
||||
[foo.output foo.tab.cc foo.tab.hh stack.hh])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %verbose %locations], [],
|
||||
[foo.output foo.tab.cc])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %defines %verbose %locations], [],
|
||||
AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %header %verbose %locations], [],
|
||||
[foo.output foo.tab.cc foo.tab.hh location.hh position.hh stack.hh])
|
||||
|
||||
AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose], [],
|
||||
AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %header %verbose], [],
|
||||
[foo.output foo.tab.cc foo.tab.hh stack.hh],
|
||||
[], [AT_CHECK_NO_SUBDIR_PART([foo.tab])])
|
||||
|
||||
AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose %locations],
|
||||
AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %header %verbose %locations],
|
||||
[-o subdir/foo.cc],
|
||||
[subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/position.hh subdir/stack.hh],
|
||||
[], [AT_CHECK_NO_SUBDIR_PART([subdir/foo])])
|
||||
|
||||
AT_CHECK_OUTPUT([gram_dir/foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %verbose %file-prefix "output_dir/foo"],
|
||||
[%skeleton "lalr1.cc" %header %verbose %file-prefix "output_dir/foo"],
|
||||
[],
|
||||
[output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/stack.hh])
|
||||
|
||||
AT_CHECK_OUTPUT([gram_dir/foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %locations %verbose %file-prefix "output_dir/foo"],
|
||||
[%skeleton "lalr1.cc" %header %locations %verbose %file-prefix "output_dir/foo"],
|
||||
[],
|
||||
[output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/location.hh output_dir/position.hh output_dir/stack.hh])
|
||||
|
||||
# %require "3.2" => no position.hh not stack.hh.
|
||||
AT_CHECK_OUTPUT([foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %locations %define api.location.file none %require "3.2"],
|
||||
[%skeleton "lalr1.cc" %header %locations %define api.location.file none %require "3.2"],
|
||||
[],
|
||||
[foo.tab.cc foo.tab.hh])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %locations %define api.location.file "foo.loc.hh" %require "3.2"],
|
||||
[%skeleton "lalr1.cc" %header %locations %define api.location.file "foo.loc.hh" %require "3.2"],
|
||||
[],
|
||||
[foo.loc.hh foo.tab.cc foo.tab.hh])
|
||||
|
||||
# Absolute paths.
|
||||
AT_CHECK_OUTPUT([foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %locations %define api.location.file "$at_dir/foo.loc.hh" %require "3.2"],
|
||||
[%skeleton "lalr1.cc" %header %locations %define api.location.file "$at_dir/foo.loc.hh" %require "3.2"],
|
||||
[],
|
||||
[foo.loc.hh foo.tab.cc foo.tab.hh])
|
||||
|
||||
@@ -255,12 +263,12 @@ AT_CHECK_CONFLICTING_OUTPUT([foo.y],
|
||||
]])
|
||||
|
||||
AT_CHECK_CONFLICTING_OUTPUT([foo.y],
|
||||
[%defines "foo.output"], [-v],
|
||||
[%header "foo.output"], [-v],
|
||||
[[foo.y: warning: conflicting outputs to file 'foo.output' [-Wother]
|
||||
]])
|
||||
|
||||
AT_CHECK_CONFLICTING_OUTPUT([foo.y],
|
||||
[%skeleton "lalr1.cc" %defines %locations], [--graph="location.hh"],
|
||||
[%skeleton "lalr1.cc" %header %locations], [--graph="location.hh"],
|
||||
[[foo.y: warning: conflicting outputs to file 'location.hh' [-Wother]
|
||||
]])
|
||||
|
||||
@@ -757,7 +765,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
mkdir -p out/include/ast
|
||||
|
||||
AT_TEST([x1],
|
||||
[%defines
|
||||
[%header
|
||||
%locations
|
||||
%define api.location.file "include/ast/loc.hh"
|
||||
])
|
||||
@@ -788,7 +796,7 @@ AT_CHECK([[sed -ne 's/^#line [0-9][0-9]* "/#line "/p;/INCLUDED/p;/\\file/{p;n;p;
|
||||
]])
|
||||
|
||||
AT_TEST([x2],
|
||||
[%defines
|
||||
[%header
|
||||
%locations
|
||||
%code requires {#include "include/ast/loc.hh"}
|
||||
%define api.location.type {x1::location}])
|
||||
|
||||
@@ -1505,7 +1505,7 @@ m4_pushdef([AT_TEST],
|
||||
AT_BISON_OPTION_PUSHDEFS([%locations %skeleton "$1" %parse-param { int x } %parse-param { int y }])
|
||||
|
||||
AT_DATA_GRAMMAR([input.y],
|
||||
[[%defines
|
||||
[[%header
|
||||
%locations
|
||||
%skeleton "$1"
|
||||
%union { int ival; }
|
||||
|
||||
@@ -452,9 +452,9 @@ m4_popdef([AT_TEST])
|
||||
m4_pushdef([AT_TEST],
|
||||
[AT_SETUP([%no-lines: $1])
|
||||
|
||||
AT_BISON_OPTION_PUSHDEFS([%skeleton "$1" %defines])
|
||||
AT_BISON_OPTION_PUSHDEFS([%skeleton "$1" %header])
|
||||
AT_DATA_GRAMMAR([input.y],
|
||||
[[%skeleton "$1" %defines
|
||||
[[%skeleton "$1" %header
|
||||
%{
|
||||
]AT_YYERROR_DECLARE_EXTERN[
|
||||
]AT_YYLEX_DECLARE_EXTERN[
|
||||
|
||||
@@ -123,7 +123,7 @@ AT_CLEANUP
|
||||
# $6: RESULT,
|
||||
# $7: REQUIREMENT)
|
||||
# --------------------------------------
|
||||
# Check with and without %defines, to avoid regressions. It turns out
|
||||
# Check with and without %header, to avoid regressions. It turns out
|
||||
# that in that case yacc.c calls the set-up of the %union twice,
|
||||
# because YYSTYPE is defined once in the header, and once in the
|
||||
# implementation file (eventually it'd be better to include the header
|
||||
@@ -131,8 +131,8 @@ AT_CLEANUP
|
||||
# a second time doubled the side-effects and resulted in a double
|
||||
# definition of the union members.
|
||||
m4_pushdef([AT_TEST],
|
||||
[_AT_TEST([$1], [$2], [$3], [$4], [$5], [$6], [$7])
|
||||
_AT_TEST([$1 %defines], [$2], [$3], [$4], [$5], [$6], [$7])
|
||||
[_AT_TEST([$1], [$2], [$3], [$4], [$5], [$6], [$7])
|
||||
_AT_TEST([$1 %header], [$2], [$3], [$4], [$5], [$6], [$7])
|
||||
])
|
||||
|
||||
m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc], [glr2.cc]],
|
||||
|
||||
Reference in New Issue
Block a user