X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/ad60e80f3d13e8c4306a22a9d15863f73c576a27..e94ca80bbb9e2fe181a0c5376403113c4d3bc153:/tests/calc.at diff --git a/tests/calc.at b/tests/calc.at index e4cb07f1..647d6589 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -288,16 +288,16 @@ static int power (int base, int exponent); ]AT_YYLEX_DECLARE_EXTERN[ } -]AT_SKEL_CC_IF([AT_LOCATION_TYPE_IF([], [ +]AT_SKEL_CC_IF([AT_LOCATION_TYPE_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++. */ + excluded in C++). */ %initial-action { @$.initialize (); } -])])[ +]])])[ /* Bison Declarations */ %token CALC_EOF 0 "end of input" @@ -386,11 +386,9 @@ AT_YYERROR_SEES_LOC_IF([ fprintf (stderr, ": ");]) fprintf (stderr, "%s\n", s); }])[ - ]AT_DEFINES_IF([], [AT_CALC_LEX -AT_CALC_MAIN])[ -]]) +AT_CALC_MAIN])]) AT_DEFINES_IF([AT_DATA_SOURCE([[calc-lex.c]AT_SKEL_CC_IF([[c]])], [[#include "calc.h]AT_SKEL_CC_IF([[h]])[" @@ -500,6 +498,23 @@ AT_CHECK([cat stderr], 0, [expout]) ]) +# AT_CHECK_SPACES([FILE]) +# ----------------------- +# Make sure we did not introduce bad spaces. Checked here because all +# the skeletons are (or should be) exercized here. +m4_define([AT_CHECK_SPACES], +[AT_CHECK([$PERL -ne ' + chomp; + print "$.: {$_}\n" + if (# No starting/ending empty lines. + (eof || $. == 1) && /^\s*$/ + # No trailing space. FIXME: not ready for "maint". + # || /\s$/ + )' $1 +])dnl +]) + + # AT_CHECK_CALC([BISON-OPTIONS]) # ------------------------------ # Start a testing chunk which compiles `calc' grammar with @@ -514,6 +529,8 @@ AT_BISON_OPTION_PUSHDEFS([$1]) AT_DATA_CALC_Y([$1]) AT_FULL_COMPILE([calc], AT_DEFINES_IF([[lex], [main]])) +AT_CHECK_SPACES([calc.AT_SKEL_CC_IF([cc], [c])]) +AT_DEFINES_IF([AT_CHECK_SPACES([calc.AT_SKEL_CC_IF([hh], [h])])]) # Test the priorities. _AT_CHECK_CALC([$1], @@ -696,7 +713,7 @@ m4_define([AT_CHECK_CALC_LALR1_CC], [AT_CHECK_CALC([%language "C++" %defines %locations] $@)]) AT_CHECK_CALC_LALR1_CC([]) -AT_CHECK_CALC_LALR1_CC([%define location_type Span]) +AT_CHECK_CALC_LALR1_CC([%define api.location.type Span]) AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR1_CC([%error-verbose %define api.prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR1_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc]) @@ -725,7 +742,7 @@ 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([%define api.location.type Span]) AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_GLR_CC([%error-verbose %define api.prefix "calc" %verbose %yacc])