Commit Graph

2716 Commits

Author SHA1 Message Date
Akim Demaille
9ecafbbfe7 * data/glr.c: Reformat whitespace with tabs.
(b4_lpure_formals): Remove this unused m4 macro.
* tests/cxx-type.at: Reformat whitespace with tabs.
(_AT_TEST_GLR_CXXTYPES): In union Node, rename node_info to nodeInfo
since it's a member.  Rename type to isNterm for clarity.
2006-01-02 15:28:03 +00:00
Akim Demaille
c4d497a010 Let glr.cc catch up with symbol_value_print.
* data/glr.cc (b4_yysymprint_generate): Replace by...
(b4_yy_symbol_print_generate): this.
(yy_symbol_print, yy_symbol_value_print): Declare them.
2005-12-29 11:06:33 +00:00
Paul Eggert
a51d426a63 Update copyright. 2005-12-28 08:51:34 +00:00
Paul Eggert
4517da3757 * src/location.h (boundary): Note that a line or column equal
to INT_MAX indicates an overflow.
* src/scan-gram.l: Include verify.h.  Don't include get-errno.h.
(rule_length_overflow, increment_rule_length, add_column_width):
New functions.
(<INITIAL>{id}, <SC_ESCAPED_STRING>"\"", <SC_ESCAPED_CHARACTER>"'"):
(<SC_BRACED_CODE>"}"):
Use increment_rule_length rather than incrementing it by hand.
(adjust_location, handle_syncline): Diagnose overflow.
(handle_action_dollar, handle_action_at):
Fix bug with monstrosities like $-2147483648.
Remove now-unnecessary checks.
(scan_integer): Verify assumptions and remove now-unnecessary checks.
(convert_ucn_to_byte): Verify assumptions.
(handle_syncline): New arg LOC.  All callers changed.
Don't store through a value derived from char const * pointer.
2005-12-28 08:45:47 +00:00
Paul Eggert
668c5d1927 (grammar_rule_check): Rewrite slightly to avoid GCC warnings. 2005-12-28 08:31:22 +00:00
Paul Eggert
e3233bf6b6 * src/reader.c (grammar_midrule_action, grammar_symbol_append):
Remove unnecessary forward static decls.
2005-12-27 19:54:41 +00:00
Akim Demaille
8f3596a633 * src/reader.c (grammar_current_rule_check): Also check that $$
is used.
Take the rule to check as argument, hence rename as...
(grammar_rule_check): this.
* src/reader.h, src/reader.c (grammar_rule_begin, grammar_rule_end):
Rename as...
(grammar_rule_begin, grammar_rule_end): these, for consistency.
(grammar_midrule_action, grammar_symbol_append): Now static.
* tests/torture.at (input): Don't rely on the default action
being always performed.
* tests/calc.at: "Set" $$ even when the action is "cut" with
YYERROR or other.
* tests/actions.at (Exotic Dollars): Instead of using unused
values, check that the warning is issued.
2005-12-27 17:50:00 +00:00
Akim Demaille
f8e1c9e55b Some wrapping. 2005-12-27 15:42:44 +00:00
Paul Eggert
3b0ffc7ec1 Regenerate. 2005-12-23 00:24:39 +00:00
Paul Eggert
721be13c5b * NEWS: Improve wording for unused-value warnings. 2005-12-23 00:13:11 +00:00
Akim Demaille
a0af42fce6 * data/lalr1.cc, data/yacc.c, data/glr.c, data/c.m4
(b4_yysymprint_generate): Rename as...
(b4_yy_symbol_print_generate): this.
Generate yy_symbol_print instead of yysymprint.
Generate also yy_symbol_value_print, and use it.
2005-12-22 13:01:50 +00:00
Akim Demaille
affac6132a Warn about unused values.
* src/symlist.h, src/symlist.c (symbol_list, symbol_list_new): Add
a `used' member.
(symbol_list_n_get, symbol_list_n_used_set): New.
(symbol_list_n_type_name_get): Use symbol_list_n_get.
* src/scan-gram.l (handle_action_dollar): Flag used symbols.
* src/reader.c (grammar_current_rule_check): Check that values are
used.
* src/symtab.c (symbol_print): Accept 0.
* tests/existing.at: Remove the type information.
Empty the actions.
Remove useless actions (beware of mid-rule actions: perl -000
-pi -e 's/s*{}(?=[ns]*[|;])//g').
* tests/actions.at (Exotic Dollars): Use unused values.
* tests/calc.at: Likewise.
* tests/glr-regression.at (No users destructors if stack 0 deleted):
Likewise.
* src/gram.c (rule_useful_p, rule_never_reduced_p): Use
rule_useful_p.
2005-12-22 11:40:05 +00:00
Paul Eggert
8bb4c753e2 Undo 2005-12-01 tentative license wording change. 2005-12-22 04:38:26 +00:00
Paul Eggert
9d9b8b7006 * NEWS: Reword %destructor vs YYABORT etc.
* data/glr.c: Use American spacing, for consistency.
* data/glr.cc: Likewise.
* data/lalr1.cc: Likewise.
* data/yacc.c: Likewise.
* data/yacc.c: Reformat comments slightly.
* doc/bison.texinfo: Replace "non-" with "non" when that makes sense,
for consistency.  Fix some spelling errors and reword recently-included
text slightly.
* tests/cxx-type.at: Cast results of malloc, for C++.
2005-12-22 00:24:40 +00:00
Akim Demaille
2c3b392a9a * tests/cxx-type.at: Construct a tree, count the parents of shared
nodes, and free each node once and only once.  Previously, the memory
for semantic values was leaked instead.
2005-12-21 15:45:17 +00:00
Akim Demaille
d6cff4dc6f * data/glr.c (struct yyGLRStack): If pure, add yyval and yyloc members.
(yylval, yylloc): If pure, #define to yystackp->yyval and
yystackp->yyloc similar to yychar and yynerrs.
(yyparse): If pure, remove local yylval and yylloc. Add local
yystackp to accommodate pure definitions of yylval and yylloc.
(b4_lex_param, b4_lyyerror_args, b4_lpure_args): If pure, change
yylvalp and yyllocp to &yylval and &yylloc.
(nerrs, char, lval, lloc): If pure, add #define's for b4_prefix[]
namespace. Previously, nerrs and char were missing, but lval and lloc
weren't necessary.
(yyprocessOneStack, yyreportSyntaxError, yyrecoverSyntaxError): Remove
yylvalp and yyllocp parameters since, if pure, these are now always
accessible through yystackp.  If not pure, they are still accessible
globally.
* data/glr.c, data/yacc.c (YYLLOC_DEFAULT): Change `if (N)' to
`if (YYID (N))' to pacify lint.
2005-12-21 15:33:13 +00:00
Akim Demaille
a85284cfbd YYACCEPT, YYERROR, and YYABORT, as user actions, should not
destroy the RHS symbols of a rule.
* data/yacc.c (yylen): Initialize to 0.
Keep its value to the number of items to possibly shift.
In particular, a regular successful parse that ends on YYFINAL by
a (internal) YYACCEPT must not have yylen != 0.
(yyerrorlab, yyreturn): Pop the RHS.
Reorder a bit to emphasize the `shifting' bits of code.
(YYPOPSTACK): Now accept a number of items to pop.
* data/lalr1.cc: Likewise.
* data/glr.c: Formatting changes.
Use goto instead of fall through.
* doc/bison.texinfo (Destructor Decl): Complete.
2005-12-21 15:28:30 +00:00
Akim Demaille
e14d0ab687 Fix NEWS. 2005-12-21 13:49:44 +00:00
Juan Manuel Guerrero
d508c2816f * Makefile.am: DJGPP specific files added to EXTRA_DIST.
* djgpp/Makefile.maint: Fix PACKAGE variable computation.
* djgpp/config.bat: Replace every occurence of the file name
scan-gram-c.c with c-scan-gram.c. The same for scan-skel-c.c with
c-scan-skel.c to conform with the 8.3 file name restriction on MSDOS.
* djgpp/config.sed: Replace every occurence of the file name
scan-gram-c.c with c-scan-gram.c. The same for scan-skel-c.c with
c-scan-skel.c to conform with the 8.3 file name restriction on MSDOS.
* djgpp/djunpack.bat: DJGPP specific file.
* djgpp/fnchange.lst: DJGPP specific file.
* djgpp/README.in: Add new information about how to unpack the bison
source on MSDOS and other systems which have 8.3 file name restrictions
using djunpack.bat and fnchange.lst.
2005-12-21 00:24:54 +00:00
Juan Manuel Guerrero
375234d9ff DJGPP specific files added to EXTRA_DIST. 2005-12-21 00:11:44 +00:00
Juan Manuel Guerrero
bf60087f69 Add new information about how to unpack the bison source on
MSDOS and other systems which have 8.3 file name restrictions
using djunpack.bat and fnchange.lst.
2005-12-21 00:01:40 +00:00
Juan Manuel Guerrero
90ddbd5eed Replace file name scan-gram-c.c with scangram-c.c and
scan-skel-c.c with /src/scanskel-c.c to conform with
the 8.3 file name restriction on MSDOS.
2005-12-21 00:01:28 +00:00
Juan Manuel Guerrero
69474954ac Fix PACKAGE variable computation. 2005-12-20 23:59:50 +00:00
Juan Manuel Guerrero
b09a18c50d DJGPP specific file. 2005-12-20 23:58:00 +00:00
Paul Eggert
3e7a2cd95f * data/glr.c: Reorder typedef declarations for structs to match order
of struct declarations.
Rename yystack everywhere to yystackp except in yyparse where it's not
a pointer.
(yyglrShift): Change parameter YYSTYPE yysval to YYSTYPE* yyvalp for
consistency.
(yyis_table_ninf): Change 0 to YYID (0) to pacify lint.
(yyreportSyntaxError): Add /*ARGSUSED*/ to pacify lint.
(yyparse): Change while (yytrue) to while ( YYID (yytrue)) to pacify
lint.
2005-12-12 21:04:39 +00:00
Paul Eggert
26546b4258 (build_cvs_prefix): Remove; unused.
(CVS_PREFIX): Adjust to yesterday's Savannah reorganization
when getting gnulib.
2005-12-12 20:59:30 +00:00
Paul Eggert
0eca5a39a7 * tests/sets.at (Accept): Fix typos in regular expression used to
sed out the final state number.
2005-12-10 00:25:27 +00:00
Paul Eggert
72c4d3365a Regenerate. 2005-12-09 23:53:57 +00:00
Paul Eggert
6c65b1525f Work around flex portability bug. 2005-12-09 23:53:14 +00:00
Paul Eggert
2cec9080f6 Work around portability problem on Solaris 10: flex-generated
files include <stdio.h> before <config.h>, which messes up
because the latter defines __EXTENSIONS__.  Address the problem
by creating two new little files that include <config.h> first,
then include the flex-generated files.  Rewrite everyone else
to include <config.h> first, as well.
* lib/timevar.c: Always include "config.h".
* src/Makefile.am (bison_SOURCES): Replace scan-gram.l with
scan-gram-c.c, and scan-skel.l with scan-skel-c.c.
(EXTRA_bison_SOURCES): New macro.
* src/scan-gram-c.c, src/scan-skel-c.c: New files.
* src/system.h: Don't include config.h.
* src/LR0.c: Include <config.h> first.
* src/assoc.c: Likewise.
* src/closure.c: Likewise.
* src/complain.c: Likewise.
* src/conflicts.c: Likewise.
* src/derives.c: Likewise.
* src/files.c: Likewise.
* src/getargs.c: Likewise.
* src/gram.c: Likewise.
* src/lalr.c: Likewise.
* src/location.c: Likewise.
* src/main.c: Likewise.
* src/muscle_tab.c: Likewise.
* src/nullable.c: Likewise.
* src/output.c: Likewise.
* src/parse-gram.y: Likewise.
* src/print.c: Likewise.
* src/print_graph.c: Likewise.
* src/reader.c: Likewise.
* src/reduce.c: Likewise.
* src/relation.c: Likewise.
* src/state.c: Likewise.
* src/symlist.c: Likewise.
* src/symtab.c: Likewise.
* src/tables.c: Likewise.
* src/uniqstr.c: Likewise.
* src/vcg.c: Likewise.
2005-12-09 23:51:26 +00:00
Paul Eggert
7029f8927f Regenerate. 2005-12-09 22:44:37 +00:00
Paul Eggert
877519f839 * src/parse-gram.y: Fix minor problems uncovered by lint.
(current_lhs, current_lhs_location): Now static.
(current_assoc): Remove unused variable.
2005-12-09 22:43:00 +00:00
Paul Eggert
12ce2df60d Cleanups so that Bison-generated parsers have less lint.
* data/c.m4 (b4_yydestruct_generate, b4_yysymprint_generate):
Prepend /*ARGSUSED*/, for lint's sake.
* data/glr.c (YYUSE): Properly parenthesize, and use an alternate
definition if 'lint' is defined.
(YYID): New macro (or function, if lint).
All uses of /*CONSTCOND*/0 replaced by YYID(0).
* data/yacc.c: Likewise.
* data/glr.c (yyuserAction, yyuserMerge, yy_reduce_print):
(yyrecoverSyntaxError): Prepend /*ARGSUSED*/.
* data/glr.cc (YYLLOC_DEFAULT): Omit /*CONSTCOND*/ since this code
is C++ only.
* data/lalr1.cc (YYUSE): Just use a cast, since this code is C++ only.
* data/yacc.c (YYSTACK_FREE) [defined YYSTACK_ALLOC]:
Use YYID(0) rather than 0, for lint.
(yystrlen): Rewrite to avoid lint warning about ptrdiff_t overflow.
(yysyntax_error): Rewrite to avoid lint warnings about parenthesization.
2005-12-09 22:14:36 +00:00
Paul Eggert
f5228370c5 * tests/glr-regression.at
(Improper handling of embedded actions and dollar(-N) in GLR parsers):
Close memory leak reported by twlevo.
2005-12-08 06:52:43 +00:00
Paul Eggert
6ff9971122 Mention yyparse, too. 2005-12-07 07:47:52 +00:00
Paul Eggert
69ce078b8c * data/glr.c (yyprocessOneStack): Synchronize the shift for all
stacks, and iterate another stack in order to call user
destructors.
* tests/glr-regression.at (No users destructors if stack 0 deleted):
New test case.
(Duplicated user destructor for lookahead): This test now is expected
to succeed.
2005-12-06 19:38:25 +00:00
Paul Eggert
32b5b719e4 Document the license change. 2005-12-01 20:08:35 +00:00
Paul Eggert
66809587a7 Regenerate. 2005-12-01 20:04:06 +00:00
Paul Eggert
af3412cdea * data/yacc.c: Say "parser skeleton" rather than "file", since
it's no longer just a file.
* data/glr.c: Grant a special exception for C GLR parsers, that
reads like the already-existing exception for C LALR(1) parsers.
* data/glr.cc: Likewise.
* data/lalr1.cc: Likewise.
* data/location.cc: Likewise.
* data/yacc.c: Reword the "written by" statement to clarify that
it was the parser skeleton, not the entire output file.
* data/glr.c: Written by Paul Hilfinger.
* data/glr.cc: Written by Akim Demaille.
* data/lalr1.cc: Likewise.
2005-12-01 20:03:55 +00:00
Paul Eggert
d9963c8597 * data/yacc.c (yy_reduce_print, YY_REDUCE_PRINT):
Fix typos in previous change that broke 'make check'.
YY_REDUCE_PRINT cannot be a pseudo-varargs macro; that isn't
supported in C.
* tests/calc.at (_AT_CHECK_CALC,_AT_CHECK_CALC_ERROR):
Don't check NUM-STDERR-LINES, since the output format is fluctuating.
We can revert this once things settle down.
2005-11-18 19:37:13 +00:00
Paul Eggert
035aa4a0bb * src/conflicts.c (conflicts_print): Don't print file name twice
when %expect fails because there were no conflicts.
* doc/bison.texinfo (Expect Decl): Tighten up wording in previous
change.
* tests/conflicts.at (%expect not enough, %expect too much):
(%expect with reduce conflicts): Adjust to new behavior.

* src/conflicts.c (conflicts_print): Unsatisfied %expectation are
errors.
* NEWS: Document this.
* doc/bison.texinfo (Expect Decl): Likewise.
2005-11-18 18:16:44 +00:00
Akim Demaille
d1ff7a7cc6 Generalize the display of semantic values and locations in traces.
* data/glr.c (yy_reduce_print): Fix indices (again).
* data/c++.m4 (b4_rhs_value, b4_rhs_location): Don't expect
literal integers.
* data/lalr1.cc (yyreduce_print): Rename as...
(yy_reduce_print): this.
Display values and locations.
* data/yacc.c (yy_reduce_print): Likewise.
(YY_REDUCE_PRINT): Adjust to pass the required arguments.
(yysymprint): Move higher to be visible from yy_reduce_print).
(yyparse): Adjust.
* tests/calc.at: Adjust the expected length of the traces.
2005-11-16 14:20:48 +00:00
Akim Demaille
6de5398de3 * data/glr.c (yy_reduce_print): The loop was quite wrong: type are
from 1 to N, while values and location start at 0.
(b4_rhs_location, b4_rhs_value): Add parens around $1 and $2.
2005-11-14 17:20:28 +00:00
Akim Demaille
a1373f559a * data/glr.c (yy_reduce_print): Fix the $ number. 2005-11-14 15:33:18 +00:00
Akim Demaille
3dc4aa8c36 Fix incorrect comment. 2005-11-14 15:19:16 +00:00
Akim Demaille
613d8952e3 "Use" parse parameters.
* data/c.m4 (b4_parse_param_for, b4_parse_param_use): New.
* data/glr.c, data/glr.cc: Use them.
* data/glr.c (YYUSE): Have a C++ definition that supports
non-pointer types.
2005-11-14 15:18:34 +00:00
Akim Demaille
b2741627b1 * data/glr.c (yyexpandGLRStack): Declare only if defined. 2005-11-14 14:34:38 +00:00
Akim Demaille
422494834c * data/glr.cc: New.
* data/m4sugar/m4sugar.m4 (m4_prepend): New.
2005-11-14 08:13:07 +00:00
Akim Demaille
5059b5c887 Have glr.c include its header file when created.
* data/glr.c (b4_shared_declarations): New.
Output them verbatim in the parser if !%defines, otherwise
output then in the header file, and include it instead.
2005-11-14 08:09:00 +00:00
Akim Demaille
4626a15dd1 Let position and location be PODs.
* data/location.cc (position::initialize, location::initialize): New.
(position::position, location::location): Define only if
b4_location_constructors is defined.
* data/lalr1.cc (b4_location_constructors): Define it for backward
compatibility.
* doc/bison.texinfo (Initial Action Decl): Use initialize.
2005-11-12 14:13:03 +00:00