summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Don't impose std::string for filenames.Akim Demaille2004-12-211-3/+3
| | | | | | | | | | | * data/lalr1.cc (b4_filename_type): New. (position::filename): Use it. (parser.hh): Move the inclusion of stack.hh and location.hh below the user code, so that needed headers for the filename type can be included first. Forward declare them before the user code. * tests/Makefile.am (check-local, installcheck-local): Pass TESTSUITEFLAGS to the TESTSUITE.
* Use more STL like names: my_class instead of MyClass.Akim Demaille2004-12-203-9/+9
| | | | | | | | | | | * data/lalr1.cc (LocationStack, LocationType, RhsNumberType) (SemanticStack, SemanticType, StateStack, StateType) (TokenNumberType, Stack, Slice, Traits, Parser::location) (Parser::value): Rename as... (location_stack, location_type, rhs_number_type, semantic_stack) (semantic_type, state_stack, state_type, token_number_type, stack) (slice, traits, parser::yylloc, parser::yylval): these. * tests/calc.at, tests/regression.at, tests/actions.at: Adjust.
* * data/lalr1.cc: Extensive Doxygenation.Akim Demaille2004-12-174-7/+8
| | | | | | | | | | | (error_): Rename as... (error): this, since it is visible to the user. Adjust callers. (Parser::message): Now an automatic variable from... (Parser::yyreport_syntax_error_): here. * tests/actions.at, tests/calc.at, tests/regression.at: Adjust to Parser::error. * tests/input.at: Escape $.
* * data/lalr1.cc (yyreport_syntax_error_): Catch up with glr.c andAkim Demaille2004-12-161-4/+2
| | | | | yacc.c: be sure to stay within yycheck_. * tests/actions.at: Re-enable C++ tests.
* Simplify the C++ parser constructor.Akim Demaille2004-12-153-3/+6
| | | | | | | | | | | | | | | * data/lalr1.cc (debug_): Rename as... (yydebug_): so that the parser's internals are always in the yy* pseudo namespace. Adjust uses. (b4_parse_param_decl): Remove the leading comma as it is now only called as unique argument list. (Parser::Parser): Remove the constructor accepting a location and an initial debugging level. Remove from the other ctor the argument for the debugging level. (debug_level_type, debug_level, set_debug_level): New. * tests/actions.at, tests/calc.at, tests/regression.at: Adjust constructor calls.
* (_AT_CHECK_PRINTER_AND_DESTRUCTOR): New argPaul Eggert2004-12-111-4/+9
| | | | | | specifying whether the test should be skipped. Use it tp specify that the [%defines %skeleton "lalr1.cc"] tests currently fail on some hosts, and should be skipped.
* (_AT_CHECK_PRINTER_AND_DESTRUCTOR): New argPaul Eggert2004-12-111-4/+7
| | | | | | specifying whether the test is expected to fail. Use it tp specify that the [%defines %skeleton "lalr1.cc"] tests currently fail.
* Alexandre Duret-Lutz <adl@gnu.org>Akim Demaille2004-11-171-1/+1
| | | | | | | | | | | | * data/lalr1.cc (Parser::yycdebug_): New, a pointer, to allow changes. (YYCDEBUG): Adjust. Use it instead of cdebug_. (Parser::debug_stream, Parser::set_debug_stream): New. (Parser::symprint_): Define cdebug_ for temporary backward compatibility. * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Use debug_stream ().
* * data/lalr1.cc (Parser:print_): Remove, use %printer instead.Akim Demaille2004-11-173-24/+3
| | | | | | * tests/regression.at (_AT_DATA_DANCER_Y): Adjust. * tests/calc.at (_AT_DATA_CALC_Y): Ditto. * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Likewise.
* * data/glr.c (YYRHSLOC): Move its definition next to its uses.Akim Demaille2004-10-251-23/+22
| | | | | | | | | | | | | | | | Introduce another definition to address simple location arrays. (yyGLRStack): New member: yyerror_range. (yyrecoverSyntaxError, yyparse): Update it. (yyrecoverSyntaxError): Use it when shifting the error token to have an accurate range, equivalent to the one computed by both yacc.c and lalr1.cc. * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Change its yylex so that column numbers start at column 0, as per GNU Coding Standards, the others tests, and the doc. (_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_AMBIG_GLR_OUTPUT_WITH_LOC): Adjust to the above change (first column is 0). And adjust the location of the "<error>", now covering the whole line.
* * src/symtab.c (symbol_check_alias_consistency): Also checkAkim Demaille2004-10-111-1/+38
| | | | | | | | | | | | | | | | | type names, destructors, and printers. Reported by Alexandre Duret-Lutz. Recode the handling of associativity and precedence in terms of symbol_precedence_set. Accept no redeclaration at all, not even equal to the previous value. (redeclaration): New. Use it to factor redeclaration complaints. (symbol_make_alias): Don't set the type of the alias, let symbol_check_alias_consistency do it as for other features. * src/symtab.h (symbol): Add new member prec_location, and type_location. * src/symtab.c (symbol_precedence_set, symbol_type_set): Set them. * tests/input.at (Incompatible Aliases): New.
* Word changes.Akim Demaille2004-10-051-1/+1
|
* In Bison 1.875's yacc.c, YYLLOC_DEFAULT was called regardlessAkim Demaille2004-10-051-6/+6
| | | | | | | | | | | | | | | whether the reducion was empty or not. This leaves room to improve the use of YYLLOC_DEFAULT in such a case. lalr1.cc is still experimental, so changing this is acceptable. And finally, there are probably not many users who changed the handling of locations in GLR, so changing is admissible too. * data/glr.c, data/lalr1.cc, data/yacc.c (YYLLOC_DEFAULT): On an empty reduction, set @$ to an empty location ending the previously stacked symbol. Adjust uses to make sure the code is triggered on empty reductions. * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Adjust the expected output: empty reductions have empty locations.
* Let the initial-action act on the look-ahead, and use it for theAkim Demaille2004-09-202-2/+2
| | | | | | | | | | | | | | | | | "initial push" (corresponding to an hypothetical beginning-of-file). And let lalr1.cc honor %initial-action. * doc/bison.texinfo (Initial Action Decl): Clarify, and add an example. * data/lalr1.cc (Parser::initlocation_): Remove, bad experiment. (Parser::Parser): Remove the ctor that used to initialize it. (Parser::parse): Like in the other skeletons, issue the "starting parse" message before any action. Honor %initial-action. Initialize the stacks with the lookahead. * data/yacc.c: Let $$ and @$ in %initial-action designate the look-ahead. Push them in the stacks. * tests/actions.at, tests/calc.at: Adjust the C++ ctor invocations.
* * data/yacc.c (YY_LOCATION_PRINT): New.Akim Demaille2004-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Define when we know YYLTYPE's structure, i.e., when the default YYLLOC_DEFAULT is used. * data/c.m4 (b4_yysymprint_generate): Use it. * data/lalr1.cc (YYLLOC_DEFAULT): Stop relying on the initial value of the result. (error_start_): Replace with... (error_range_): this location array. This allows to replace code relying on the implementation of locations by portable code. * data/yacc.c (yylerrsp): Replace with... (yyerror_range): this. Every time a token is popped, update yyerror_range[0], to have an accurate location for the error token. * data/glr.c (YY_LOCATION_PRINT): New. (yyprocessOneStack): Fix an invocation of YY_SYMBOL_PRINT: deference a pointer. * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): No longer report the location in %printers. * src/scan-skel.l: Instead of abort, report error messages to ease understanding skeleton scanning failures.
* Have more complete shift traces.Akim Demaille2004-09-162-14/+12
| | | | | | | | | | | | | * data/yacc.c, data/lalr1.c, data/glr.c: Use YY_SYMBOL_PRINT to report Shifts instead of ad hoc YYDPRINTF invocations, including for the error token. * data/lalr1.cc (symprint_): Output the location. * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): In C++, don't output the location within the %printer. Activate GLR tests, at least to make sure they compile properly. They still don't pass though. * tests/calc.at: Adjust expect verbose output, since now "Entering state..." is on a different line than the "Shifting" message.
* * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Move theAkim Demaille2004-09-081-230/+136
| | | | | | | | | | | | | | | | | | | | | | | | | Bison directive from the Bison file to the invocation of this macro, so that these directives are passed to AT_BISON_OPTION_PUSHDEFS to get correct help macros. Use these helping macros (e.g., AT_LOC, AT_VAL and so forth). Move the AT_SETUP/AT_CLEANUP outside, to report as test title the extra Bison directives instead of the whole series. Change the grammar so that there are recoverable errors, and unrecoverable errors. Now we can have the parser give up before consuming the whole input. As a result we now can observe that the lookahead is freed when needed. Change the parser source to parse argv[1] instead of a hard coded string. Simplify yylex, and give a value and location to EOF. Simplify some invocations of AT_CHECK_PRINTER_AND_DESTRUCTOR that passed directives already coded in the file. Add some tests to check the location of "error". For some tests, the C++ parser is correct, and not yacc.c. For other tests, they provide different, but unsatisfying, values, so keep the C++ value so that at least one parser is "correct" according to the test suite. (Actions after errors): Remove, this is subsumed by the AT_CHECK_PRINTER_AND_DESTRUCTOR series.
* * data/glr.c, data/lalr1.cc, data/yacc.c: When YYABORT wasAkim Demaille2004-09-061-6/+6
| | | | | | | | invoked, yydestruct the lookahead. * tests/calc.at (Calculator $1): Update the expected lengths of traces: there is an added line for the discarded lookahead. * doc/bison.texinfo (Destructor Decl): Some rewording. Define "discarded" symbols.
* * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): AdjustAkim Demaille2004-09-021-2/+6
| | | | | %printer calls to use cdebug_ when using lalr1.cc. * data/lalr1.cc (b4_yysymprint_generate): New.
* (_AT_CHECK_PRINTER_AND_DESTRUCTOR,Paul Eggert2004-07-221-22/+27
| | | | | | | | | AT_CHECK_PRINTER_AND_DESTRUCTOR): New argument UNION-FLAG. All callers changed. (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Don't assume %union. Use type char, not unsigned int, when declaring an array of char; this lets us remove a cast. (Printers and Destructors): Add non-%union test cases.
* Use "look-ahead" instead of "lookahead", consistently.Paul Eggert2004-06-212-12/+12
|
* Don't assume the C++ compiler takes the same arguments as the C compiler.Paul Eggert2004-05-301-1/+1
|
* Fix some "make check" problems with Tru64 C++.Paul Eggert2004-05-304-12/+17
|
* Workaround for SGI C++ compiler.Paul Eggert2004-05-292-2/+2
|
* Ensure that the C++ compiler used for testing actually works on aPaul Eggert2004-05-242-5/+8
| | | | simple test program; if not, skip the C++-related tests.
* Remove more K&R C support.Paul Eggert2004-04-282-12/+5
|
* (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Don'tPaul Eggert2004-04-281-2/+2
| | | | | declare yyerror when using lalr.cc, as GCC 3.4.0 warns about the unused declaration.
* (%union synch line): Put a dummy member inPaul Eggert2004-04-281-1/+2
| | | | | the union, because empty unions aren't allowed in C. Caught by GCC 3.4.0.
* Update copyright to 2004.Paul Eggert2004-04-131-1/+1
|
* Use 'short int' rather than 'short', and similarly for 'long', 'unsigned', etc.Paul Eggert2004-03-312-7/+7
|
* (AT_COMPILE, AT_COMPILE_CXX): Ignore stdout from compilers.Paul Eggert2004-02-251-2/+2
|
* Support %destructor and merge error locations in lalr1.cc.Alexandre Duret-Lutz2004-02-091-12/+55
| | | | | | | | | | | | | | | | * data/lalr1.cc (b4_cxx_destruct_def): New macro. (Parser::stos_): Define unconditionally. (Parser::destruct_): New method. Generate its body with b4_yydestruct_generate. (Parser::error_start_): New attribute. (Parser::parse) <yyerrlab, yyerrlab1>: Call destruct_ on erroneous token which are discarded. (Parser::parse) <yyerrlab, yyerrorlab, yyerrlab1>: Update error_start_ when erroneous token are discarded. (Parser::parse) <yyerrlab1>: Compute the location of the error token so that it covers all the discarded tokens. * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Adjust so it can be called with `%skeleton "lalr1.cc"', and do that.
* ($(TESTSUITE)): Remove warning about ignoringPaul Eggert2003-12-241-1/+0
| | | | multiple inclusion warnings.
* Require Autoconf 2.59, and don't include local.at twice sincePaul Eggert2003-12-242-6/+1
| | | | Autoconf 2.59 yells about it for some reason.
* (Torturing the Scanner): Don't use \x0 or \0 inPaul Eggert2003-12-241-1/+1
| | | | | Bison tokens, as this runs afoul of the 2003-10-07 change that disallowed NUL bytes in character constants or string literals.
* Don't run 'testsuite --clean' if testsuite doesn't exist.Paul Eggert2003-10-071-1/+1
|
* Use "%no-default-prec" instead of "%default-prec 0".Paul Eggert2003-10-011-13/+13
|
* Add %default-prec.Paul Eggert2003-09-301-0/+74
|
* Include local.at, not input.at, fixing a typo in the 2003-08-25 patch.Paul Eggert2003-09-301-1/+1
|
* Have lalr1.cc catch with Paul Eggert's patch to fix the infiniteAkim Demaille2003-08-251-1/+1
| | | | | | | | | | | | | | | | | | | error recovery loops. This patch is based on <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00000.html>. Also, augment the similarity between lalr1.cc and yacc.c. Note: the locations of error recovery rules are not correct yet. * data/lalr1.cc: Comment changes to augment the similarity between lalr1.cc and yacc.c. (YYERROR): Goto to yyerrorlab, not yyerrlab1. (yyerrlab1): Remove, but where it used to be (now the bottom part of yyerrlab), when hitting EOF, pop the whole stack here instead of merely falling thru the default error handling mechanism. (yyerrorlab): New label, with the old contents of YYERROR, plus the following change: pop the stack of rhs corresponding to the production that invoked YYERROR. That is how Yacc behaves (required by POSIX). * tests/calc.at (AT_CHECK_CALC_LALR1_CC): No longer expected to fail.
* Tune local.at so that people can "autom4te -l autotest calc.at -oAkim Demaille2003-08-253-8/+19
| | | | | | | | | | | calc" for instance, to extract a sub test suite. * tests/testsuite.at: Move the initialization, Autotest version requirement, and AT_TESTED invocation into... * tests/local.at: here. * tests/testsuite.at: Include it for compatibility with Autoconf 2.57. * tests/Makefile.am ($(TESTSUITE)): Report that the warning should be ignore.
* Minor white space issues, e.g. trailing white space at end of line.Paul Eggert2003-06-161-10/+10
|
* (AT_CHECK_CALC): New option EXPECTED-TO-FAIL.Paul Eggert2003-06-161-2/+5
| | | | | (AT_CHECK_CALC_LALR1_CC): Use it, since the C++ LALR parser fails the tests right now.
* (_AT_TEST_GLR_CXXTYPES): Ensure yylex andPaul Eggert2003-06-161-12/+23
| | | | yyerror are declared before use; C99 requires this.
* * data/glr.c (YYERROR): Update definition.Paul Hilfinger2003-06-101-87/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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.
* (_AT_DATA_DANCER_Y): Declare yylex to takePaul Eggert2003-06-041-5/+5
| | | | | (void) as arg when not pure, since we now assume C89 when building Bison. Pacify GCC by using parameter.
* (Improper handling of embedded actions and $-N in GLR parsers): RemovePaul Eggert2003-06-041-1/+0
| | | | unused local variable from yylex.
* (AT_COMPILE_CXX): Use it instead of CFLAGS.Paul Eggert2003-06-021-1/+1
|
* (CXXFLAGS): New var.Paul Eggert2003-06-021-0/+3
|
* (_AT_DATA_CALC_Y): Include unistd.h if available.Paul Eggert2003-06-021-2/+14
| | | | | | | | | | 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.