summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* lalr1.cc: provide %printer-based syntax-error messages.candidates/semantic-error-messagesAkim Demaille2009-08-263-37/+94
| | | | | | * data/c++.m4: . * data/lalr1.cc: . * data/variant.hh: .
* lalr1.cc: pass the full lookahead to yysyntax_error_.Akim Demaille2009-08-261-6/+8
| | | | | * data/lalr1.cc (yysyntax_error_): Instead of only taking the kind of the guilty token, take the full lookahead.
* lalr1.cc: minor changes.Akim Demaille2009-08-262-2/+2
| | | | | * data/c++.m4: Space changes. * data/lalr1.cc (yysyntax_error_): Adjust signature.
* examples: fix variant.Akim Demaille2009-08-261-2/+2
| | | | * examples/variant.yy: Update to parse.assert and parse.trace.
* tests: portability fix.Akim Demaille2009-08-262-1/+14
| | | | | * tests/input.at (Bad escapes in literals): Don't expect "echo '\0'" to output \ then 0.
* Actually handle the yytable zero value correctly this time.Joel E. Denny2009-08-2610-332/+353
| | | | | | | | | | | | | * data/bison.m4 (b4_integral_parser_tables_map): Don't mention zero values in the YYTABLE comments. * data/glr.c (yytable_value_is_error): Don't check for zero value. * data/lalr1.cc (yy_table_value_is_error_): Likewise. * data/yacc.c (yytable_value_is_error): Likewise. * data/lalr1.java (yy_table_value_is_error_): Likewise. (yysyntax_error): Fix typo in code: use yytable_ not yycheck_. * src/tables.h: In header comments, explain why it's useless to check for a zero value in yytable.
* More fixes related to last two patches.Joel E. Denny2009-08-2510-278/+367
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * data/bison.m4 (b4_integral_parser_tables_map): Fix YYTABLE comments: zero indicates syntax error not default action. * data/c.m4 (b4_table_value_equals): Comment that YYID must be defined. * data/glr.c (yyis_pact_ninf): Rename to... (yypact_value_is_default): ... this. (yyisDefaultedState): Update for rename. (yyis_table_ninf): Rename to... (yytable_value_is_error): ... this, and check for value zero besides just YYTABLE_NINF. (yygetLRActions): Check for default value from yypact. It appears that this check is always performed before this function is invoked, and so adding the check here is probably redundant. However, the code may evolve after this subtlety is forgotten. Also, update for rename to yytable_value_is_error. Because that macro now checks for zero, a different but equivalent branch of the if-then-else here is evaluated. (yyreportSyntaxError): Update for rename to yytable_value_is_error. The zero condition was mishandled before. (yyrecoverSyntaxError): Update for renames. No behavioral changes. * data/lalr1.cc, data/lalr1.java (yy_pact_value_is_default_): New function. (yy_table_value_is_error_): New function. (parse): Use new functions where possible. No behavioral changes. (yysyntax_error_, yysyntax_error): Use yy_table_value_is_error_. The zero condition was mishandled before. * data/yacc.c (yyis_pact_ninf): Rename to... (yypact_value_is_default): ... this. (yyis_table_ninf): Rename to... (yytable_value_is_error): ... this, and check for value zero besides just YYTABLE_NINF. (yysyntax_error): Update for rename to yytable_value_is_error. The zero condition was mishandled before. (yyparse): Update for renames. No behavioral changes. * src/tables.h: Improve comments about yypact, yytable, etc. more. Most importantly, say yytable value of zero means syntax error not default action.
* Fix %error-verbose for conflicts resolved by %nonassoc.Joel E. Denny2009-08-259-337/+369
| | | | | | | | | | | | * NEWS (2.5): Document. * data/glr.c (yyreportSyntaxError): Fix this by checking yyis_table_ninf. * data/yacc.c (yysyntax_error): Likewise. * data/lalr1.cc (yysyntax_error_): Fix this by checking yytable_ninf_. * data/lalr1.java (yysyntax_error): Likewise. * tests/conflicts.at (%nonassoc and eof): Update expected output and remove FIXME.
* Some code and documentation improvements.Joel E. Denny2009-08-257-15/+56
| | | | | | | | | | | | | | | * data/c.m4 (b4_table_value_equals): New macro to capture some repeated code. * data/glr.c (yyis_pact_ninf): Use it here. (yyis_table_ninf): Likewise. (yyreportSyntaxError): Improve internal comments. * data/yacc.c (yyis_pact_ninf): New macro copied from glr.c. Use it everywhere possible. (yyis_table_ninf): Likewise. (yysyntax_error): Improve internal comments. * data/lalr1.cc (yysyntax_error_): Likewise. * data/lalr1.java (yysyntax_error): Likewise. * src/tables.h: Improve comments about yypact, yytable, etc.
* Use locale when quoting.Joel E. Denny2009-08-212-5/+8
| | | | | * src/scan-gram.l (SC_ESCAPED_STRING, SC_ESCAPED_CHARACTER): Use quote rather than implementing quoting here.
* Make previous patch more robust.Eric Blake2009-08-202-14/+23
| | | | | | | | | | * src/output.c (ARRAY_CARDINALITY): New macro, copied from argmatch.h. (output_skeleton): Use it. Suggested by Akim Demaille. Signed-off-by: Eric Blake <ebb9@byu.net> (cherry picked from commit 1266b636740f0c6719d8cc11a5d569084fa37009)
* Import latest m4/m4.m4.Eric Blake2009-08-205-19/+26
| | | | | | | | | | * submodules/autoconf: Update to autoconf 2.64. * configure.ac (M4_GNU_OPTION): New define. * src/output.c (output_skeleton): Use it to resolve FIXME. * NEWS: Mention this. Signed-off-by: Eric Blake <ebb9@byu.net> (cherry picked from commit b9ad39c1fb2482e1513cdf9800b31e71b7986b39)
* Fix complaints about escape sequences.Joel E. Denny2009-08-193-14/+83
| | | | | | | | | | | | | | | | | | | Discussed starting at <http://lists.gnu.org/archive/html/bison-patches/2009-08/msg00036.html>. * src/scan-gram.l (SC_ESCAPED_STRING, SC_ESCAPED_CHARACTER): For a \0 and similar escape sequences meaning the null character, report an invalid escape sequence instead of an invalid null character because the latter does not actually appear in the user's input. In all escape sequence complaints, don't escape the initial backslash, and don't quote when the sequence appears at the end of the complaint line unless there's whitespace that quotearg won't escape. Consistently say "invalid" not "unrecognized". Consistently prefer "empty character literal" over "extra characters in character literal" warning for invalid escape sequences; that is, consistently discard those sequences. * tests/input.at (Bad escapes in literals): New.
* doc: fixes.Akim Demaille2009-08-192-2/+7
| | | | * doc/bison.texinfo: Fix minor Texinfo errors.
* tests: distcc compliance.Akim Demaille2009-08-192-1/+15
| | | | | * tests/synclines.at (AT_SYNCLINES_COMPILE): Discard distcc's error messages from the output.
* variables: simplify the upgrade of namespace into api.namespace.Akim Demaille2009-08-195-46/+57
| | | | | | | | | | | | | | | | | This patch simplifies "variables: rename namespace as api.namespace", commit 67501061076ba46355cfd9f9361c7eed861b389c. Suggested by Joel E. Denny in http://lists.gnu.org/archive/html/bison-patches/2009-07/msg00006.html * src/muscle-tab.c (muscle_percent_variable_update): New. (muscle_percent_define_insert): Use it in replacement of the previous tr invocation. Remove variable_tr, no longer needed. * data/bison.m4 (b4_percent_define_copy_, b4_percent_define_copy): Remove. * data/c++.m4: No longer handle namespace -> api.namespace. * tests/input.at (%define backward compatibility): Check that namespace is treated as api.namespace.
* 2009-08-19 Akim Demaille <demaille@gostai.com>Akim Demaille2009-08-193-2/+18
| | | | | | | | doc: %initial-action to initialize yylloc. Reported by Bill Allombert. * doc/bison.texinfo: Set fill-column to 76. (Location Type): Document the use of %initial-action to initialize yylloc.
* lalr1.cc: use state_type.Akim Demaille2009-08-192-6/+12
| | | | | * data/lalr1.cc (yysyntax_error_): Use state_type. Move argument names into yy*.
* lalr1.cc: get rid of yyparse's yystate.Akim Demaille2009-08-193-25/+41
| | | | | | | | | | | | | | yystate and yystack_[0].state are equal, keep only the latter. The former was also used as a temporary variable to compute the post-reduction state. Move this computation into an auxiliary function. * data/glr.c (yyLRgotoState): Fuse variable definition and first assignment. * data/lalr1.cc (yy_lr_goto_state_): New. (yyparse): Use it. Replace remaining uses of yystate by yystate_[0].state. Remove the former.
* lalr1.cc: destroy $$ when YYERROR is called.Akim Demaille2009-08-193-17/+25
| | | | | | | | * data/lalr1.cc (yyreduce): Compute the resulting state before running the user action so that yylhs is a valid symbol. (yyerrorlab): Since yylhs is complete (it knows its type), we can simply call yy_destroy_ to destroy $$ on YYERROR invocations. * tests/c++.at (AT_CHECK_VARIANTS): Test YYERROR with variants.
* maint: update for gnulib's recent update-copyright changesJoel E. Denny2009-08-184-1/+11
| | | | | | | | * gnulib: Update. * .x-update-copyright (COPYING): Add as it's no longer implied when .x-update-copyright is present. * cfg.mk (update-copyright-local): Remove, now ignored. (update-copyright): Declare update-b4-copyright as a dependency.
* build: require gettext 0.17.Akim Demaille2009-08-172-2/+12
| | | | | | | | Suggested by Bruno Haible. http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00009.html * configure.ac: require gettext 0.17 to ensure compatibility with gnulib.
* build: lower gettext requirements.Akim Demaille2009-08-174-12/+44
| | | | | | | | | | | | | | | Bison was uselessly requiring the formatstring macros from gettext, which resulted in mo files not being installed on systems that perfectly supported Bison mo files. Lower the requirement. http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html * configure.ac: Require need-ngettext instead of need-formatstring-macros. Reported by Martin Jabocs. Suggested by Bruno Haible. * INSTALL: Restructure. (Internationalization): New. (cherry picked from commit b9e42bb439643b6b193ba44696c370bbb35d2ec0)
* gnulib: update.Akim Demaille2009-08-171-1/+1
| | | | * gnulib: Update to newest.
* maint: fix use of copyright year intervals.Joel E. Denny2009-08-149-16/+33
| | | | | | | | | * gnulib: Update. * bootstrap.conf (gnulib_modules): Update getopt to getopt-gnu as now recommended in gnulib/NEWS. * build-aux/update-b4-copyright: Fix. * cfg.mk (update-copyright-env): Configure update-copyright. (cherry picked from commit 75ac158b82be1fab5157b140287368165a50ec82)
* Make it easier to write deterministic tests.Joel E. Denny2009-08-134-33/+72
| | | | | | | | | | | | | | | | Continues Akim's work from his 2009-06-10 commits. * src/reader.c (check_and_convert_grammar): Don't add any symbols after the first symbols_do invocation. * src/symtab.c (symbols_sorted): New static global. (user_token_number_redeclaration): Update comments. (symbol_from_uniqstr): If a new symbol is being created, assert that symbols_sorted hasn't been allocated yet. (symbols_free): Free symbols_sorted. (symbols_cmp, symbols_cmp_qsort): New functions. (symbols_do): Sort symbol_table into symbols_sorted on first invocation. * tests/input.at (Numbered tokens): Recombine tests now that the output should be deterministic across multiple numbers.
* tests: GCC 4.5 compliance.Akim Demaille2009-08-122-1/+18
| | | | | * tests/synclines.at (AT_SYNCLINES_COMPILE): Adjust to GCC 4.5's messages about #error.
* build: fix the generation of the documentation.Akim Demaille2009-08-129-37/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | Some of our targets use "bison --help", but they can't depend on "bison" itself (to avoid additional requirements on the user), so they used to call "make src/bison" in the commands. Then concurrent builds may fail: one make might be aiming one of its jobs at compiling src/bison, and another job at generating the man page. If the latter is faster than the former, then we have two makes that concurrently try to compile src/bison. This might also be a more convincing explanation for the failure described in the patch "build: fix paths". * Makefile.am (SUFFIXES): Initialize. * build-aux/move-if-change: New, symlink to gnulib's. * build-aux/local.mk: Ship it. * doc/common.x: Remove, merged into... * doc/bison.x: here. * doc/local.mk (doc/bison.help): New. ($(CROSS_OPTIONS_TEXI)): Depend on it. Use src/bison. (.x.1): Replace with... (doc/bison.1): this explicit, simpler, target. (common_dep): Remove, inlined where appropriate. (SUFFIXES, PREPATH): Remove, unused.
* gnulib: improve prefixing.Akim Demaille2009-08-123-10/+29
| | | | | | | | | | | | | * configure.ac (gl_PREFIXED_LIBOBJS): Don't rename it, rather, change the value of... (gl_LIBOBJS): this. Adjust more variables. * etc/prefix-gnulib-mk (prefix_assignment): Don't rename gl_LIBOBJS. (prefix): Also transform rules whose targets have slashes. Use $prefix liberally. Map @MKDIR_P@ to $(MKDIR_P). Prefix directories that are mkdir'd.
* build: fix paths.Akim Demaille2009-08-123-3/+21
| | | | | | | | | | | | | | | | | When using $(top_builddir) inconsistently, Make (including GNU Make) is sometimes confused. As a result it may want to build lib/libbison.la and $(top_builddir)/lib/libbison.la (the same file, different names) concurrently, which, amusingly enough, might end with: ranlib lib/libbison.a ranlib lib/libbison.a make[2]: *** [lib/libbison.a] Segmentation fault on OS X. * doc/local.mk, src/local.mk: Do not use $(top_builddir) when not needed.
* distcheck: fix.Akim Demaille2009-08-122-1/+10
| | | | * examples/calc++/Makefile.am: (EXTRA_DIST): Ship calc.stamp.
* * tests/local.mk (TESTSUITE_AT): Add named-refs.at.Joel E. Denny2009-08-102-0/+5
| | | | | | | | (cherry picked from commit 36dfe4662ef5eb96073034b9eb80113b0c2a204e) Conflicts: tests/Makefile.am
* Miscellaneous code readability improvements.Joel E. Denny2009-08-106-77/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/reader.c (reader): Move %define front-end variable defaults and checking into... (prepare_percent_define_front_end_variables): ... this new function. * src/scan-gram.l (INITIAL): For consistency with string literals, don't store open quote on character literal. It's discarded before returning anyway. (SC_ESCAPED_CHARACTER): Similarly, don't store close quote. Make length test more readable, and make the character stored for an empty literal more obvious while consistent with the previous behavior. * src/symtab.c, src/symtab.h: Rename USER_NUMBER_ALIAS to USER_NUMBER_HAS_STRING_ALIAS throughout. * src/symtab.c (symbol_make_alias): Remove comment from symtab.c that is repeated in symtab.h. Improve argument names to make it clear which side of the symbol-string alias pair is which. (symbol_check_alias_consistency): Improve local variable names for the same purpose. * src/symtab.h (struct symbol): Make comments about aliases clearer. (symbol_make_alias): Improve comments and argument name. * src/output.c (token_definitions_output): Update for rename to USER_NUMBER_HAS_STRING_ALIAS and improve comments about aliases.
* Convert "misleading reference" messages to warnings.Alex Rozenman2009-08-083-100/+129
| | | | | | * src/scan-code.l: New function 'show_sub_messages', more factoring. * tests/named-ref.at: Adjust tests.
* maint: run "make update-copyright"Joel E. Denny2009-08-0698-115/+149
|
* maint: make update-b4-copyright easier to useJoel E. Denny2009-08-064-10/+26
| | | | | | | | * build-aux/update-b4-copyright: In warnings, report line numbers rather than character positions. * cfg.mk (update-copyright-local): Set to update-b4-copyright so that update-copyright runs it. * gnulib: Update.
* maint: clean up update-b4-copyright codeJoel E. Denny2009-08-052-49/+79
| | | | | | | | * build-aux/update-b4-copyright: Do not accept 2-digit UPDATE_COPYRIGHT_YEAR, which was not handled correctly. Don't accept a `[' in a b4_copyright argument. Format code more consistently. Don't assume b4*copyright never occurs.
* maint: automate b4_copyright updates.Joel E. Denny2009-08-045-3/+143
| | | | | | | | * Makefile.am (update-b4-copyright): New target rule. * build-aux/local.mk (EXTRA_DIST): Add update-b4-copyright. * build-aux/update-b4-copyright: New. * data/yacc.c: Remove stray characters around b4_copyright invocations.
* maint: automate annual package-wide copyright-year update.Joel E. Denny2009-08-0423-898/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * .x-update-copyright: New. * Makefile.am (EXTRA_DIST): Remove maint.mk. * bootstrap.conf (gnulib_modules): Add maintainer-makefile and update-copyright. Remove gnumakefile, which is implied by maintainer-makefile. * cfg.mk (bootstrap-tools): Copy from old maint.mk. * gnulib: Update. * maint.mk: Remove, now copied from gnulib. * examples/extexi: Add missing "(C)" in copyright statement so update-copyright can recognize it. * src/LR0.h: Likewise. * src/print.h: Likewise. * src/print_graph.h: Likewise. * src/named-ref.c: Likewise. * src/named-ref.h: Likewise. * src/gram.c: Add missing comma in copyright statement. * src/gram.h: Likewise. (cherry picked from commit dbbb64f09180b8749e3a91d3559e13b933cd15c8) Conflicts: Makefile.am gnulib maint.mk src/gram.h
* Fix "make distcheck".Joel E. Denny2009-08-042-2/+8
| | | | | | * examples/calc++/Makefile.am: Say $(srcdir)/calc.stamp instead of just calc.stamp. (cherry picked from commit cfc9e431c31f7f7291dd16a4a505d6a41e662d0c)
* Pacify "gcc -Wunused" for the input function from Flex.Joel E. Denny2009-08-014-3/+17
| | | | | | | | | | | | | | Reported by Alex Rozenman. This warning shows up with gcc-4.3.0 and later. * src/scan-code.l: Add "%option noinput", which I cannot find in the Flex manual, but which Flex has supported since at least as far back as 2.5.4. However, if any of our developers still use Flex 2.5.4, they'll need to stop configuring with --enable-gcc-warnings because "%option noinput" didn't work correctly until Flex 2.5.6. * src/scan-gram.l: Likewise. * src/scan-skel.l: Likewise. (cherry picked from commit 42f8609bbd033edf6cca102ca080eade94ed08ef)
* Fix mail address in ChangeLog.Alex Rozenman2009-07-311-3/+3
|
* Fix --enable-gcc-warnings problems.Alex Rozenman2009-07-314-73/+80
| | | | | | * src/reader.c: Adjust variable names. * src/scan-code.l: Fix prototypes and adjust names. * src/named-ref.c: Remove redundant "if".
* Fix a --enable-gcc-warnings problem.Joel E. Denny2009-07-292-2/+8
| | | | | | * src/scan-gram.l (SC_ESCAPED_CHARACTER): Actually use length variable. (cherry picked from commit a1ed2b71faac0de1db1c0e279ee3203115ec70d8)
* Warn about character literals not of length one.Joel E. Denny2009-07-244-8/+108
| | | | | | | | | * NEWS (2.5): Document. * src/scan-gram.l (INITIAL): Remove comment that we don't check the length. (SC_ESCAPED_CHARACTER): Warn if length is wrong. * tests/input.at (Bad character literals): New test group. (cherry picked from commit ac9b0e954b1d3aed514a3bbd363da1514202af0f)
* Fix some memory leaks.Alex Rozenman2009-07-244-2/+29
| | | | | | | * src/named-ref.c: Add a pointer check (named_ref_free). * src/scan-code.l: New function (variant_table_free). Called in code_scanner_free. * src/symlist.c: Call to named_ref_free (symbol_list_free).
* * src/lalr.c (state_lookahead_tokens_count): Correct comment.Joel E. Denny2009-07-242-4/+9
| | | | (cherry picked from commit 2de160e12ea0b0313a3a4f2120b30a3eeaad0c76)
* Some M4 cleanup in the testsuite.Joel E. Denny2009-07-223-40/+43
| | | | | | | | | | | | | | | | | | | | Suggested by Eric Blake at <http://lists.gnu.org/archive/html/bison-patches/2009-04/msg00083.html>. * tests/existing.at (_AT_TEST_EXISTING_GRAMMAR): Do not complicate the code by distinguishing between a missing value and an empty string value for an optional argument. This fix is allowed by the similar fix in AT_TEST_TABLES_AND_PARSE below. * tests/local.at (_AT_TEST_TABLES_AND_PARSE): Merge into... (AT_TEST_TABLES_AND_PARSE): ... this now that the special arguments are not needed because of the following changes. Fix stale comments. Bison developers should use GNU M4 and should not use POSIXLY_CORRECT when building the test suite, so do not complicate the code by avoiding $10 and above. Do not quote an empty string value for an optional argument, and do not distinguish between a missing value and an empty string value. (cherry picked from commit cba975069a746bccdd2f2a954954ac7e43a47ac2)
* Revert unnecessary column realignment in --help output.Joel E. Denny2009-07-152-16/+23
| | | | | | | Reported by Akim Demaille at <http://lists.gnu.org/archive/html/bison-patches/2009-06/msg00010.html>. * src/getargs.c (usage): Here. (cherry picked from commit 620b2e3691598e057e24a7965fd268d0495cf9f5)
* Alphabetical order in src/local.mk.Alex Rozenman2009-07-042-3/+8
| | | | * src/local.mk: Adjust.