Commit Graph

286 Commits

Author SHA1 Message Date
Paul Eggert
671881d12d Minor white space issues, e.g. trailing white space at end of line. 2003-06-16 19:17:38 +00:00
Paul Eggert
907e3bc851 (AT_CHECK_CALC): New option EXPECTED-TO-FAIL.
(AT_CHECK_CALC_LALR1_CC): Use it, since the C++ LALR parser fails
the tests right now.
2003-06-16 18:42:49 +00:00
Paul Eggert
b8a204c09b (_AT_TEST_GLR_CXXTYPES): Ensure yylex and
yyerror are declared before use; C99 requires this.
2003-06-16 18:37:55 +00:00
Paul Hilfinger
25005f6ab0 * data/glr.c (YYERROR): Update definition.
(yyrecoverSyntaxError): Correct yyerrState logic. Correct comment.
Allow states with only a default reduction.

Fixes to avoid problem that $-N rules in GLR parsers can cause
buffer overruns, corrupting state.

* src/output.c (prepare_rules): Output max_left_semantic_context.
* src/reader.h (max_left_semantic_context): New
* src/scan-gram.l (max_left_semantic_context): Define.
(handle_action_dollar): Update max_left_semantic_context.
* data/glr.c (YYMAXLEFT): New.
(yydoAction): Increase yyrhsVals size.
(yyresolveAction): Ditto.

Fixes to problems with location handling in GLR parsers reported by
Frank Heckenbach (2003/06/05).

* data/glr.c (YYLTYPE): Make trivial if locations not used.
(YYRHSLOC): Add parentheses, make depend on whether locations used.
(YYLLOC_DEFAULT): Ditto.
(yyuserAction): Use YYLLOC_DEFAULT.
(yydoAction): Remove redundant code.

* tests/cxx-type.at: Exercise location information.
(yylex): Track locations.
(stmtMerge): Return value rather than printing.
2003-06-10 02:44:58 +00:00
Paul Eggert
848dc439cb (_AT_DATA_DANCER_Y): Declare yylex to take
(void) as arg when not pure, since we now assume C89 when building
Bison.  Pacify GCC by using parameter.
2003-06-04 05:54:16 +00:00
Paul Eggert
f56f6d78b0 (Improper handling of embedded actions and $-N in GLR parsers): Remove
unused local variable from yylex.
2003-06-04 05:53:44 +00:00
Paul Eggert
57f5199797 (AT_COMPILE_CXX): Use it instead of CFLAGS. 2003-06-02 07:26:17 +00:00
Paul Eggert
713535c232 (CXXFLAGS): New var. 2003-06-02 07:25:54 +00:00
Paul Eggert
82c53be476 (_AT_DATA_CALC_Y): Include unistd.h if available.
Define 'alarm' to do nothing if unistd.h is not available.
Add a new rule "exp: '-' error;" to test the above change to
data/yacc.c.  Use 'alarm' to abort any test taking longer than
10 seconds, as it's probably looping.
(AT_CHECK_CALC): Test recovery from error in new grammar rule.
Also, the new yacc.c generates two fewer diagnostics for an
existing test.
2003-06-02 03:58:34 +00:00
Paul Eggert
087b9fdf03 (Torturing the Scanner): Add tests for ";|" in a grammar. 2003-05-14 19:26:52 +00:00
Alexandre Duret-Lutz
caf37a3666 %parse-param support for lalr1.cc.
* data/lalr1.cc (b4_parse_param_decl, b4_parse_param_cons,
b4_cc_constructor_calls, b4_cc_constructor_call,
b4_parse_param_vars, b4_cc_var_decls, b4_cc_var_decl): New m4
definitions.
(yy::b4_parser_class_name::b4_parser_class_name): Take extra
parse-param arguments.
(yy::b4_parser_class_name): Declare instance variables to
hold parse-param arguments.
* tests/calc.at: s/value/semantic_value/ because value clashes
with a member of yy::b4_parser_class_name.  Adjust C++ code
to handle %parse-param.  Enable %parse-param test in C++.
2003-05-14 18:41:48 +00:00
Akim Demaille
211074caca * tests/calc.at: Also test yacc.c and glr.c (but not lalr1.cc yet)
with %pure-parser and %locations to exercise the patch from Yakov
Markovitch below.
2003-04-29 08:41:13 +00:00
Paul Eggert
47e7600a21 (Invalid inputs): Remove cascaded diagnostic that is no longer emitted. 2003-04-18 07:26:46 +00:00
Paul Eggert
2740f1691f (GNU pic Grammar): New test case, taken from
<http://mail.gnu.org/archive/html/bug-bison/2003-04/msg00026.html>.
2003-04-18 05:10:58 +00:00
Paul Eggert
0eadf43ccc Add testsuite.log 2003-03-14 01:31:24 +00:00
Paul Eggert
4a99c66490 Update copyright. 2003-03-13 07:05:44 +00:00
Paul Eggert
0baf7c50ed (Torturing the Scanner): Test the scanner on
an empty input file, which was Tim Van Holder's test case.
2003-03-13 07:03:17 +00:00
Akim Demaille
d5286af19b * tests/regression.at (_AT_DATA_DANCER_Y): Fix the expected error
message.
2003-03-02 13:36:55 +00:00
Akim Demaille
22e304a6da Write a test the yycheck overrun reported by Andrew Suffield.
* tests/regression.at (_AT_DATA_DANCER_Y, AT_CHECK_DANCER): New.
Use them to exercise yycheck overrun.
Based on Andrew Suffield's grammar.
2003-03-02 11:22:19 +00:00
Akim Demaille
67a25fed4c Create tests/local.at for Bison generic testing macros.
* tests/calc.at (AT_CHECK_PUSHDEFS, AT_CHECK_POPDEFS): Move to...
* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
This new file.
* tests/calc.at (AT_CHECK_CALC): Adjust.
* tests/testsuite.at (AT_DATA_GRAMMAR_PROLOGUE, AT_DATA_GRAMMAR)
(AT_COMPILE, AT_COMPILE_CXX, AT_PARSER_CHECK): Move to...
* tests/local.at: here.
(AT_COMPILE_CXX): Tags the tests using it as c++.
Ignore the test if CXX is not functional.
2003-03-02 11:14:07 +00:00
Akim Demaille
d02b25f99b * tests/calc.at (AT_CHECK_PUSHDEFS, AT_CHECK_POPDEFS): Define
AT_YACC_IF.
Redefine AT_YYERROR_SEES_LOC_IF using it.
(_AT_DATA_CALC_Y): Don't declare yyerror when lalr1.cc, as it is
not defined.
Don't use the location in yy::Parser::error_ and
yy::Parser::print_ when not %locations.
Activate more lalr1.cc tests.
2003-02-20 08:14:27 +00:00
Akim Demaille
60a777aa24 * data/lalr1.cc (b4_stack_depth_init, yy::Parser::initdepth_):
Remove, useless.
(YYABORT, YYACCEPT, YYERROR): New.
* tests/calc.at: Renable the lalr1.cc test.
2003-02-19 14:33:27 +00:00
Akim Demaille
0b86fc416c * tests/calc.at (AT_CHECK_CALC): Check different scenarios of
error recovery, mixing with/without pops and discarding of the
lookahead.
Exercise YYERROR.
Disable the lalr1.cc tests as currently it doesn't support YYERROR.
2003-02-19 13:40:53 +00:00
Paul Eggert
97c9a05ecd (AT_COMPILE): Use new LDFLAGS, LIBS vars, to avoid testing problems
for installations that set these vars at configure-time.
2003-02-18 05:09:44 +00:00
Paul Eggert
9d56d2940a (LDFLAGS, LIBS): New vars. 2003-02-18 05:08:55 +00:00
Akim Demaille
7548fed236 * configure.ac (GXX): Rename as...
(CXX): this, to keep the original Autoconf semantics.
Require 2.57.
* data/lalr1.cc: Fix b4_copyright invocations.
If YYDEBUG is not defined, don't depend upon name_ being defined.
(location.hh): Include string and iostream.
(Position::filename): New member.
(Position::Position ()): New.
(operator<< (Position)): New.
(operator- (Position, int)): New.
(Location::first, Location::last): Rename as...
(Location::begin, Location::end): these, to mock the conventional
iterator names.
(operator<< (Location)): New.
* tests/atlocal.in (CXX): New.
* tests/testsuite.at (AT_COMPILE_CXX): New.
* tests/calc.at (_AT_DATA_CALC_Y): Adjust yyerror to report the
locations in a more synthetic way.
(AT_CHECK_PUSHDEFS): AT_YYERROR_SEES_LOC_IF is positive if
lalr1.cc is used.
Adjust the C locations to match those from Emacs: first column is
column 0.
Change all the expected results.
Conform to the GCS: simplify the locations when applicable.
(LOC, VAL, YYLLOC_FORMAL, YYLLOC_ARG, USE_YYLLOC, LEX_FORMALS)
(LEX_ARGS, USE_LEX_ARGS, LEX_PRE_FORMALS, LEX_PRE_ARGS): Replace
these CPP macros with the m4 macros new defined by...
(AT_CHECK_PUSHDEFS): this, i.e.:
(AT_LALR1_CC_IF, AT_PURE_LEX_IF, AT_LOC, AT_VAL, AT_LEX_FORMALS)
(AT_LEX_ARGS, AT_USE_LEX_ARGS, AT_LEX_PRE_FORMALSm AT_LEX_PRE_ARGS)
New macros.
(AT_CHECK_POPDEFS): Undefine them.
(AT_CHECK_CALC_LALR1_CC): New.
Use it for the first lalr1.cc test.
2003-02-06 10:04:29 +00:00
Paul Eggert
9a2b42a3ff Update copyright date to 2003. 2003-02-01 08:16:17 +00:00
Paul Hilfinger
ede3d3bcbc Rename tests/glr-regr1.at to tests/glr-regression.at.
tests/glr-regression.at: Add new regression test for the problems
 reported by S. Eken with semantic values for embedded rules.
Update copyright notice.
tests/testsuite.at, tests/Makefile.am: Rename glr-regr1.at to
 glr-regression.at.
2003-01-29 23:39:11 +00:00
Paul Eggert
69363a9e4d * NEWS: %expect-violations are now just warnings, reverting
to Bison 1.30 and 1.75 behavior.  This fixes the GCC 3.2
bootstrapping problem reported by Matthias Klose; see
<http://mail.gnu.org/archive/html/bug-bison/2003-01/msg00053.html>.
* src/conflicts.c (conflicts_print): Likewise.
* tests/conflicts.at (%expect not enough, %expect too much,
%expect with reduce conflicts): Likewise.
* doc/bison.texinfo (Expect Decl): Document this.  Also mention
that the warning is enabled if the number of conflicts changes
(not necessarily increases).
2003-01-13 06:41:29 +00:00
Paul Eggert
00c378a21f (Badly Collapsed GLR States): Switch to Yacc-style conflict reports. 2002-12-29 02:00:20 +00:00
Paul Eggert
a4b746ea04 (GNU Cim Grammar): Switch to Yacc-style reports. 2002-12-29 01:59:40 +00:00
Paul Eggert
2c8ba4cd59 (Unresolved SR Conflicts, Defaulted
Conflicted Reduction, %expect not enough, %expect too much,
%expect with reduce conflicts): Switch to Yacc-style reports.
2002-12-29 01:59:13 +00:00
Paul Eggert
120f129d67 (_AT_CHECK_PRINTER_AND_DESTRUCTOR):
Error locations include the locations of all the tokens that were
discarded, not just the last token.
2002-12-28 08:38:14 +00:00
Paul Eggert
6876ecd36e (%expect with reduce conflicts): New test. 2002-12-26 22:21:23 +00:00
Paul Eggert
051ade8391 (Torturing the Scanner): Rename value_t -> value,
value_t_as_yystype -> value_as_yystype.
2002-12-11 07:00:15 +00:00
Paul Eggert
e3aa2baac6 (_AT_DATA_CALC_Y, Simple LALR Calculator):
Rename value_t -> value.
2002-12-11 06:59:39 +00:00
Paul Eggert
050931e3f9 (Invalid inputs): No longer `expecting ";"
or "|"' now that so many other tokens are allowed by the new grammar.
2002-12-07 06:16:58 +00:00
Paul Eggert
e551232efa (Useless Rules, Reduced Automaton, Underivable Rules): Adjust reported
locations to match the more-precise results now expected.
2002-12-07 06:16:30 +00:00
Paul Eggert
b06af56f55 (Invalid $n, Invalid @n, Type Clashes):
Adjust reported locations to match the more-precise
results now expected.
2002-12-07 06:15:55 +00:00
Paul Eggert
2bf21a8322 (S/R in initial, Defaulted Conflicted Reduction):
Adjust reported locations to match the more-precise
results now expected.
2002-12-07 06:15:18 +00:00
Paul Eggert
38e71ff8c8 (Type Clashes): Expect warnings, not complaints. 2002-11-30 09:51:50 +00:00
Paul Eggert
da90e18c6e (Simple LALR Calculator): Adopt new convention for %parse-param
and %lex-param.
2002-11-29 08:45:14 +00:00
Paul Eggert
136d65300d (_AT_CHECK_PRINTER_AND_DESTRUCTOR): yyout -> yyoutput,
to avoid collision with lex macro described by Bruce Lilly in
<http://mail.gnu.org/pipermail/bug-bison/2002-November/001929.html>.
2002-11-27 18:31:27 +00:00
Paul Eggert
16f37b35a5 (Actions after errors): Use an output format
more similar to that of the Printers and Destructors test.
Test the position of the ';' token too.
(Printers and Destructors): Likewise.
(Printers and Destructors: %glr-parser): Remove for now, to avoid
unnecessarily alarming people when the test fails.
2002-11-25 07:36:54 +00:00
Paul Eggert
500bbfcd81 (_AT_TEST_GLR_CXXTYPES): Do not include <assert.h>.
Replace all instances of assert with abort.
2002-11-21 05:28:44 +00:00
Paul Eggert
63d0fb9ce4 (_AT_DATA_CALC_Y): Do not include <assert.h>.
Replace all instances of assert with abort.
2002-11-21 05:28:09 +00:00
Paul Eggert
7a86d7eba9 (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Do not include <assert.h>. 2002-11-21 05:27:28 +00:00
Paul Eggert
4e8c79eb7f (_AT_DATA_CALC_Y): Make vars static instead of
extern when possible.  Remove unused initializations.
2002-11-18 07:52:13 +00:00
Akim Demaille
4c6cc1db75 Make the ``Printers and Destructors'' test more verbose, taking
`yacc.c''s behavior as (possibly wrong) reference.
* tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Use printf
instead of fprint on stdout.
Set and report the last_line of the symbols.
Consistently display values and locations.
2002-11-16 12:30:23 +00:00
Paul Eggert
5dac0025f6 (Actions after errors): New test case. 2002-11-16 07:31:35 +00:00