Commit Graph

1134 Commits

Author SHA1 Message Date
Akim Demaille
18d192f0ea * doc/bison.texinfo (Initial Action Decl): New. 2004-09-20 14:29:31 +00:00
Akim Demaille
b8458aa5cc * data/yacc.c (YY_LOCATION_PRINT): Use YYLTYPE_IS_TRIVIAL as a
clearer criterion to define it.
(parse): Initialize the initial location when YYLTYPE_IS_TRIVIAL.
When reducing on an empty RHS, use the latest stacked location as
location.
yylloc is not always available.
* data/glr.c: Likewise.
Also, honor initial-actions.
2004-09-20 12:24:45 +00:00
Akim Demaille
3fc16193d9 * data/yacc.c (YY_LOCATION_PRINT): New.
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.
2004-09-20 09:32:55 +00:00
Akim Demaille
ecfe33e799 * data/lalr1.cc (Stack::Iterator, Stack::ConstIterator): Rename as...
(iterator, const_iterator): these, to be more in the C++ spirit.
Also, return reverse iterators so that when displaying the stack
we display its bottom first.
(Parser::stack_print_, Parser::reduce_print_): Match the messages
from yacc.c.
We should probably use vector here though.
2004-09-16 14:41:18 +00:00
Akim Demaille
1576d44dce Have more complete shift traces.
* 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.
2004-09-16 14:14:27 +00:00
Akim Demaille
9c66f418c4 * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Move the
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.
2004-09-08 14:36:25 +00:00
Akim Demaille
52d5733ff0 * data/lalr1.cc: Adjust the indentation of the labels.
Use it.
2004-09-06 14:32:05 +00:00
Akim Demaille
a0e68930d8 * data/yacc.cc, data/glr.cc (yydestruct): Accept an additional
argument, an informative message.
Call YY_SYMBOL_PRINT.
Adjust all callers: integrate the associated YY_SYMBOL_PRINT.
* data/lalr1.cc (destruct_): Likewise.
In addition, no longer depend on b4_yysymprint_generate and
b4_yydestruct_generate to generate these functions, do it "by
hand".
2004-09-06 10:29:52 +00:00
Akim Demaille
e757bb10bc * data/glr.c, data/lalr1.cc, data/yacc.c: When YYABORT was
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.
2004-09-06 07:48:20 +00:00
Akim Demaille
0fe1f06d36 * data/lalr1.cc (translate_, destruct_): No reason to be static. 2004-09-02 14:30:55 +00:00
Akim Demaille
284acc8ba7 * data/glr.c, yacc.c (YYDSYMPRINT): Remove, not used.
(YYDSYMPRINTF): Rename as...
(YY_SYMBOL_PRINT): this.
* data/lalr1.cc (YY_SYMBOL_PRINT): New, modeled after the previous
two.
Use it instead of direct symprint_ calls.
(yybackup): Tweak the "Now at end of input" case to match yacc.c's
one.
2004-09-02 14:27:02 +00:00
Akim Demaille
b7c72fe1c4 Fix ChangeLog. 2004-09-02 13:25:23 +00:00
Akim Demaille
a5eb1ed262 * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Adjust
%printer calls to use cdebug_ when using lalr1.cc.
* data/lalr1.cc (b4_yysymprint_generate): New.
2004-09-02 13:04:11 +00:00
Akim Demaille
417141dd61 * data/glr.c: Guard the declarations of yypstack and yypdumpstack
with #ifdef YYDEBUG.
2004-08-30 07:50:08 +00:00
Akim Demaille
2fa09258b1 * doc/bison.texinfo (Implementing Loops): Rename as...
(Implementing Gotos/Loops): this.
2004-08-26 13:05:41 +00:00
Paul Eggert
9378b5082b Adjust to latest gnulib. 2004-08-13 14:29:05 +00:00
Paul Eggert
87a8ad5cd3 Remove src/scan-action.l. 2004-08-11 04:19:14 +00:00
Paul Eggert
dca81a78f8 uniqstr wasn't being used for handle_syncline like it should. 2004-08-08 04:57:06 +00:00
Paul Eggert
c9cbf7c58e Fix bug with non-%union parsers that have printers or destructors,
which led to a Bison core dump.
2004-07-22 14:42:11 +00:00
Paul Eggert
fa7e68c397 Reorganize GLR section a bit. 2004-06-22 06:50:29 +00:00
Paul Eggert
99a9344e77 New section "Simple GLR Parsers". 2004-06-21 20:55:20 +00:00
Paul Eggert
8dd162d3ff Use "look-ahead" instead of "lookahead", consistently. 2004-06-21 20:20:31 +00:00
Paul Eggert
57a90331bd Update location of patched M4 distribution. 2004-06-03 22:38:23 +00:00
Paul Eggert
8ed3234a14 Don't assume the C++ compiler takes the same arguments as the C compiler. 2004-05-30 18:58:00 +00:00
Paul Eggert
0797198341 Fix some "make check" problems with Tru64 C++. 2004-05-30 00:56:57 +00:00
Paul Eggert
2905865228 Workaround for SGI C++ compiler. 2004-05-29 07:16:29 +00:00
Paul Eggert
fd418816b9 Increase prerequisite version numbers to match what the code really needs. 2004-05-27 20:51:16 +00:00
Paul Eggert
62cb8a9920 * src/parse-gram.y (lloc_default): Rewrite to avoid compiler bug.
* configure.ac (AC_PREREQ): Bump to 2.58.
2004-05-27 07:38:17 +00:00
Paul Eggert
caa52c10c5 * configure.ac (AM_GNU_GETTEXT_VERSION): Lower it from 0.14.1 to 0.11.5.
* bootstrap: Remove gettext version checking.
2004-05-26 19:25:21 +00:00
Paul Eggert
2cef3017cd * README: Mention GNU m4 1.4 bugs and Akim's patched version.
* README-alpha: Don't tell people not to package this.
2004-05-26 07:20:06 +00:00
Paul Eggert
b9c85d5cef * bootstrap: Don't assume $(...) works; use ... instead. 2004-05-26 06:46:02 +00:00
Paul Eggert
4bfd5e4e53 * doc/bison.texinfo (Decl Summary, Bison Options): Clarify what's put into
the -d output file.
2004-05-25 19:09:01 +00:00
Paul Eggert
6712933e0f Undo change made earlier today: it caused autopoint to not bring
in ABOUT-NLS.  Ouch.  Instead, substitute our own diagnostic for
autopoint's.
2004-05-25 05:43:14 +00:00
Paul Eggert
6a36ff9495 The gettext version checking is causing more trouble than it's curing;
remove it.
2004-05-24 20:08:54 +00:00
Paul Eggert
209ea708c4 Ensure that the C++ compiler used for testing actually works on a
simple test program; if not, skip the C++-related tests.
2004-05-24 06:58:02 +00:00
Paul Eggert
383e69dc79 Output yylloc macro defn in glr.c even if locations are not being generated. 2004-05-21 22:23:04 +00:00
Paul Eggert
41ca25499e * configure.ac (AC_INIT): Update to 1.875e. 2004-05-21 22:12:21 +00:00
Paul Eggert
e476c87d93 Version 1.875d. 2004-05-21 21:03:41 +00:00
Paul Eggert
233a88ad11 Use size_t (not unsigned int) for hashes, since the gnulib hash module
now uses size_t.
2004-05-07 07:35:10 +00:00
Paul Eggert
9668e2be96 Don't DEFUN AM_INTL_SUBDIR twice. 2004-05-03 23:10:25 +00:00
Paul Eggert
12ffdd2835 * src/parse-gram.y: Put copyright notice inside %{ %} so it
gets copied to the output file.
2004-05-03 07:57:06 +00:00
Paul Eggert
1f65350a16 Get files from the gnulib and po repositories, instead of relying
on them being in our CVS.  Upgrade to latest versions of gnulib and Automake.
2004-04-28 20:00:56 +00:00
Paul Eggert
4f16766c00 * src/conflicts.c (conflicts_print): Correct format string typo:
use `%%' to produce literal `%'.  (trivial change)
2004-04-13 17:42:59 +00:00
Paul Eggert
779e7ceb93 Use 'short int' rather than 'short', and similarly for 'long', 'unsigned', etc. 2004-03-31 00:37:21 +00:00
Paul Hilfinger
d63282419d * src/parse-gram.y: Define PERCENT_EXPECT_RR.
(declaration): Replace expected_conflicts with expected_sr_conflicts.
Add %expect-rr rule.

* src/scan-gram.l: Recognize %expect-rr.

* src/conflicts.h (expected_sr_conflicts): Rename from
expected_conflicts.
(expected_rr_conflicts): Declare.

* src/conflicts.c (expected_sr_conflicts): Rename from
expected_conflicts.
(expected_rr_conflicts): Define.
(conflicts_print): Check r/r conflicts against expected_rr_conflicts
for GLR parsers.
Use expected_sr_conflicts in place of expected_conflicts.
Warn if expected_rr_conflicts used in non-GLR parser.

* doc/bison.texinfo: Add documentation for %expect-rr.
2004-03-26 22:41:16 +00:00
Paul Eggert
1452af69b4 Add support for hex token numbers. 2004-03-08 20:49:34 +00:00
Paul Eggert
006d217ddd (AT_COMPILE, AT_COMPILE_CXX): Ignore stdout from compilers. 2004-02-25 21:13:00 +00:00
Paul Eggert
6a60c4cf45 Add a marker for when 1.875c was published. 2004-02-25 20:23:33 +00:00
Alexandre Duret-Lutz
c2729758f2 Support %destructor and merge error locations in lalr1.cc.
* 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.
2004-02-09 21:31:42 +00:00
Paul Eggert
dd0e0635ec Replace INCLUDES with AM_CPPFLAGS, fixing a bug in src/Makefile.am
reported by Paul Hilfinger.
2004-02-02 22:36:49 +00:00