Commit Graph

585 Commits

Author SHA1 Message Date
Joel E. Denny
abcc7c03cc Fix handling of yychar manipulation in user semantic actions.
The problem was that yacc.c didn't always update the yychar
translation afterwards.  However, other skeletons appear to be
fine.  glr.c appears to already translate yychar before every
use.  lalr1.cc does not define yychar and does not document its
replacement, yyla, for users.  It does provide yyclearin, but
that does not manipulate yyla and thus requires no translation
update.  In lalr1.java, yychar is out of scope during semantic
actions.
* NEWS (2.5): Document.
* data/yacc.c (YYBACKUP): Don't bother translating yychar into
yytoken here.
(yyparse, yypush_parse): Instead, translate before every use of
yytoken, and add comments explaining this approach.
* tests/actions.at (Destroying lookahead assigned by semantic
action): New test group checking that translation happens before
lookahead destructor calls at parser return.  Previously,
incorrect destructors were called.
* tests/conflicts.at (%error-verbose and consistent
errors): New test group checking that translation happens at
syntax error detection before the associated verbose error
message and the associated lookahead destructor calls.  While
the destructor call is fixed by this patch, the verbose error
message is currently incorrect due to another bug (see
comments in test group), so this is an expected failure for now.
(cherry picked from commit df222dfaf4)

Conflicts:

	src/parse-gram.c
	src/parse-gram.h
2009-12-22 14:50:45 -05:00
Joel E. Denny
62efdd2a85 YYFAIL: warn about uses and remove from lalr1.java.
* NEWS (2.5): Document.
* data/lalr1.java (parser::YYStack::YYFAIL): Rename to YYERRLAB,
and make it private.  Update all uses.
* src/scan-code.l (SC_RULE_ACTION): Implement warning.
(cherry picked from commit 4395a9ff4f)

Conflicts:

	data/lalr1.java
2009-12-22 13:01:19 -05:00
Joel E. Denny
41d35e54d5 YYFAIL: deprecate.
* NEWS (2.4.2): Document deprecation and the phase-out plan.
* data/lalr1.java (parser::YYStack::YYFAIL): Add comment about
deprecation.
* data/yacc.c (YYFAIL): Likewise, and suppress warnings about
YYFAIL from GCC cpp's -Wunused-macros.
* doc/bison.texinfo (Java Action Features): Remove YYFAIL
documentation.
(LocalWords): Remove YYFAIL.
(cherry picked from commit 1625df5b18)

Conflicts:

	src/parse-gram.c
	src/parse-gram.h
2009-12-22 12:53:17 -05:00
Joel E. Denny
3473147172 Add gcc's -Wundef to test suite and fix another warning from it.
* NEWS (2.4.2): Update description of -Wundef fix.
* configure.ac (WARN_CXXFLAGS_TEST): New substitution.
(WARN_CFLAGS_TEST): New substitution.
* data/glr.c: Avoid warning about __STRICT_ANSI__.
* tests/atlocal.in (CFLAGS): Use WARN_CFLAGS_TEST instead of
WARN_CFLAGS.
(NO_WERROR_CFLAGS): Likewise.
(CXXFLAGS): Use WARN_CXXFLAGS_TEST instead of WARN_CXXFLAGS.
(cherry picked from commit a603c6e0bb)
2009-12-16 13:32:50 -05:00
Joel E. Denny
3bba2dadae * data/yacc.c: Reformat m4 a little.
(cherry picked from commit 19750d310c)
2009-12-16 01:51:49 -05:00
Jonathan Nieder
874ac415b9 Simplify y.tab.c when location tracking is disabled.
* data/yacc.c: Do not check YYLTYPE_IS_TRIVIAL if location
tracking is not enabled.  Instead, unconditionally define
YY_LOCATION_PRINT as a no-op for backward compatibility.
(cherry picked from commit fcd32abd3a)
2009-12-16 01:44:52 -05:00
Jonathan Nieder
06caf0e144 Avoid warnings from gcc -Wundef y.tab.c.
* data/glr.c: Check if YYENABLE_NLS and YYLTYPE_IS_TRIVIAL are
defined before using them.
* data/lalr1.cc: Likewise.
* data/yacc.c: Likewise.
(cherry picked from commit ae93128c96)
2009-12-16 01:44:42 -05:00
Joel E. Denny
51f255a530 * data/bison.m4: Update comments for rename to muscle-tab.h. 2009-10-08 17:08:01 -04:00
Joel E. Denny
69a2ab11cf yysyntax_error: avoid duplicate lookahead collection.
Except when memory reallocation is required, this change
eliminates the need to invoke yysyntax_error twice and thus to
repeat the collection of lookaheads.  It also prepares for
future extensions that will make those repetitions more
expensive and that will require additional memory management in
yysyntax_error.  Finally, it fixes an obscure bug already
exercised in the test suite.
* data/yacc.c (yysyntax_error): Add arguments for message
buffer variables stored in the parser.  Instead of size, return
status similar to yyparse status but indicating success of
message creation.  Other than the actual reallocation of the
message buffer, import and clean up memory management code
from...
(yyparse, yypush_parse): ... here.
* tests/regression.at (%error-verbose overflow): No longer an
expected failure.
(cherry picked from commit 45319f1365)

Conflicts:

	src/parse-gram.c
	src/parse-gram.h
2009-10-04 16:26:39 -04:00
Akim Demaille
9da640eaa8 Pass the token type to yysyntax_error.
* data/yacc.c (yysyntax_error): Take the transated token instead
of the raw number.
Adjust callers.
(cherry picked from commit 84eedf86fe)

Conflicts:

	TODO
2009-10-04 16:24:17 -04:00
Akim Demaille
d3d3628bde Simplify the i18n of the error messages.
* data/yacc.c (yysyntax_error): Rewrite, using a switch instead
of building dynamically the format string.
(cherry picked from commit eeb2942237)

Conflicts:

	data/lalr1.cc
2009-10-04 16:24:17 -04:00
Joel E. Denny
93d0103dd4 Clean up yacc.c a little.
* data/yacc.c: Clean up M4 for readability, and make output
whitespace more consistent.  For the main parse function
comment, instead of saying "yyparse or yypush_parse", say either
"yyparse" or "yypush_parse" depending on which it actually is.
(cherry picked from commit bb31eb56ab)

Conflicts:

	src/parse-gram.c
	src/parse-gram.h
2009-09-10 00:42:21 -04:00
Joel E. Denny
628be6c97d Complain about unused %define variables and %code qualifiers.
* NEWS (2.5): Document.
* data/bison.m4 (b4_check_user_names): Complain instead of warn.
* doc/bison.texinfo (Decl Summary): Document complaint, and
improve %define documentation a little otherwise.
* tests/input.at (Reject unused %code qualifiers): Update.
(%define errors): Update.
(%define, --define, --force-define): Update.
(%define backward compatibility): Update.
(Unused %define api.pure): Update.
* tests/push.at (Push Parsing: Unsupported Skeletons): Update.
(cherry picked from commit c6abeab182)

Conflicts:

	ChangeLog
2009-09-05 18:44:02 -04:00
Joel E. Denny
e4bcae3c5a Actually handle the yytable zero value correctly this time.
* data/glr.c, data/lalr1.cc, data/lalr1.java, data/yacc.c: 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.
(cherry picked from commit aa0cb40d61)

Conflicts:

	data/bison.m4
	data/lalr1.java
2009-08-26 03:14:58 -04:00
Joel E. Denny
d5eb0826af More fixes related to last two patches.
* data/c.m4 (b4_table_value_equals): Comment that YYID must be
defined.
* data/glr.c, data/lalr1.cc, data/lalr1.java, data/yacc.c: Fix
yytable comments: zero indicates syntax error not default
action.
* 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.
(cherry picked from commit f2b30bdf37)

Conflicts:

	data/bison.m4
	data/lalr1.cc
	data/lalr1.java
	data/yacc.c
	src/parse-gram.c
	src/parse-gram.h
2009-08-25 20:34:28 -04:00
Joel E. Denny
1fa303077d Fix %error-verbose for conflicts resolved by %nonassoc.
* 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.
(cherry picked from commit 53f036ce02)

Conflicts:

	data/lalr1.cc
	data/lalr1.java
	src/parse-gram.c
	src/parse-gram.h
2009-08-25 02:58:16 -04:00
Joel E. Denny
77373efad2 Some code and documentation improvements.
* 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.
(cherry picked from commit 8741288212)

Conflicts:

	data/lalr1.java
	data/yacc.c
2009-08-25 02:57:57 -04:00
Joel E. Denny
38609c3455 maint: run "make update-copyright" 2009-08-06 19:16:29 -04:00
Joel E. Denny
ac2def5602 maint: automate b4_copyright updates.
* Makefile.am (update-b4-copyright): New target rule.
* build-aux/Makefile.am (EXTRA_DIST): Add update-b4-copyright.
* build-aux/update-b4-copyright: New.
* data/yacc.c: Remove stray characters around b4_copyright
invocations.
(cherry picked from commit 269e222e24)

Conflicts:

	build-aux/local.mk
	data/yacc.c
2009-08-04 21:32:58 -04:00
Akim Demaille
83b66dddb6 style changes.
* data/xslt/xml2dot.xsl, data/xslt/xml2xhtml.xsl: Space changes.
	* src/print-xml.c: Style changes.
	* tests/conflicts.at: Comment changes.
2009-06-11 15:27:45 +02:00
Joel E. Denny
246c4efafe Update some comments to make sense for -D.
* data/bison.m4 (b4_check_user_names): In header comments, say
"user occurrence" instead of "grammar occurrence".
* src/muscle_tab.h (muscle_percent_define_insert): Likewise.
(muscle_percent_code_grow): Likewise just for consistency.
2009-05-22 01:52:03 -04:00
Joel E. Denny
531683e74b * data/c++.m4: Update copyright year. 2009-05-22 01:47:38 -04:00
Joel E. Denny
e7bfa8b721 * data/c++.m4 (b4_namespace_close): Simplify slightly. 2009-05-20 17:14:08 -04:00
Joel E. Denny
8c221795af Handle a trailing `:' in a user-supplied C++ namespace better.
* data/c++.m4 (b4_namespace_close): Don't let it be printed
among the closing braces here.  This fix might make the
generated code easier to debug, but otherwise it should be
insignificant because a trailing `:' is a C++ error already.
2009-05-19 18:14:25 -04:00
Joel E. Denny
812775a039 Convert underscores to dashes in some %define variable names.
For now, just api.push-pull and lr.keep-unreachable-states.
Maintain old names for backward compatibility.
* NEWS (2.5): Document.
* data/c.m4 (b4_identification): Update comment.
* data/yacc.c: Update access.
* doc/bison.texinfo: Update.
* etc/bench.pl.in (bench_grammar): Update use.
* src/files.c (tr): Move to...
* src/getargs.c, src/getargs.h (tr): ... here because I can't
think of a better place to expose it.  My logic is that, for all
uses of tr so far, command-line arguments can be involved, and
getargs.h is already included.
* src/main.c (main): Update access.
* src/muscle_tab.c (muscle_percent_define_insert): Convert old
variable names to new variable names before assigning value.
* src/reader.c (reader): Update setting default.
* tests/calc.at: Update uses.
* tests/conflicts.at (Unreachable States After Conflict
Resolution): Update use.
* tests/input.at (%define enum variables): Update use.
(%define backward compatibility): New test group.
* tests/push.at: Update uses.
* tests/reduce.at: Update uses.
* tests/torture.at: Update uses.
2009-04-30 03:43:42 -04:00
Joel E. Denny
25029e164a List accepted values for a %define enum variable with an invalid value.
Suggested by Akim Demaille at
<http://lists.gnu.org/archive/html/bison-patches/2009-04/msg00082.html>.
* data/bison.m4 (_b4_percent_define_check_values): Implement.
* src/muscle_tab.c (muscle_percent_define_check_values): Implement.
* tests/input.at (%define lr.default_reductions invalid values): Merge
into...
(%define enum variables): ... here, and update output.
2009-04-24 02:47:22 -04:00
Joel E. Denny
620b572773 Rename "default rule" to "default reduction".
This includes changing variable names in code, changing
comments, and renaming %define lr.default_rules to %define
lr.default_reductions.
* NEWS (2.5): Update IELR documentation.
* data/glr.c, data/lalr1.cc, data/lalr1.java, data/yacc.c:
Adjust YYDEFACT and yydefact_ documentation.
* doc/bison.texinfo (Decl Summary): Adjust lr.default_reductions
and lr.type documentation.  Make some other wording
improvements.
(Glossary): Adjust cross-references and Default Reduction
definition.
* src/lalr.c (state_lookahead_tokens_count): Adjust code.
Remove a confusing comment pointed out by Akim Demaille.
(initialize_LA): Adjust code.
* src/print-xml.c (print_reductions): Adjust code.
* src/print.c (print_reductions): Adjust code.
* src/reader.c (reader): Adjust code.
* src/tables.c (action_row): Adjust code.
(token_actions): Adjust code.
* src/tables.h: Adjust YYDEFACT documentation.
* tests/input.at (%define lr.default_rules invalid values):
Rename test group to...
(%define lr.default_reductions invalid values): ... this, and
update grammar file and expected output.
* tests/reduce.at (AT_TEST_LR_DEFAULT_RULES): Rename to...
(AT_TEST_LR_DEFAULT_REDUCTIONS): ... this, and update.
2009-04-23 04:29:25 -04:00
Akim Demaille
e80b068ce1 Copyright years.
* data/glr.c: Add 2007 and 2008 here, consistenly with the comments.
2009-04-06 04:57:17 -04:00
Akim Demaille
e3ee30b88f Install autoconf as a submodule to get m4sugar.
* .gitmodules: Add submodules/autoconf.
	* data/m4sugar/foreach.m4, data/m4sugar/m4sugar.m4: Now links into
	submodules/autoconf.
(cherry picked from commit 6c63b895fb)
2009-04-06 04:41:33 -04:00
Joel E. Denny
c19178bfaf Remove spurious initial empty lines.
* data/location.cc: End the @output lines with an @.
2009-04-06 00:39:49 -04:00
Akim Demaille
0d2b2ab033 Remove spurious initial empty lines.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/lalr1.java,
	* data/yacc.c: End the @output lines with an @.
2009-04-06 00:36:42 -04:00
Joel E. Denny
580c075d7f Fix strange %define locations for default values.
Reported by Akim Demaille at
<http://lists.gnu.org/archive/html/bug-bison/2007-12/msg00001.html>
and discussed again starting at
<http://lists.gnu.org/archive/html/bison-patches/2008-11/msg00102.html>.
* data/bison.m4 (b4_percent_define_default): Leave syncline blank
because location information is bogus.
Use angle brackets to delimit fake file name because square brackets
look like over-quoted m4.  Choose a better fake file name.
Use negative line numbers.
* src/muscle_tab.c (muscle_percent_define_default): Likewise.
* src/location.c (location_print): If line for a boundary is negative,
only print that boundary's file name.
* src/location.h: Document that.
* tests/skeletons.at (%define Boolean variables: invalid skeleton
defaults): Update output.
2009-04-03 03:56:58 -04:00
Akim Demaille
b328890a9e lalr1.cc: avoid GCC 4.3 warnings.
GCC 4.3 now warns about "a || b && c" and asks for explicit
parentheses.
Reported by Alexandre Duret-Lutz.
	* data/location.cc: Update copyright years.
	(Position::operator==): Use parens to make precedence explicit.
	Compare lines and columns first, as they are more likely to be
	different, and they are faster to compare.
2009-03-26 23:45:25 +01:00
Akim Demaille
876fd8357a Update data/README.
* data/README: Document glr.cc, lalr1.java, m4sugar and xslt.
2008-12-09 13:24:18 +01:00
Joel E. Denny
462503f825 Fix unexpanded macros in GLR defines file.
Reported by Csaba Raduly at
<http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00048.html>.
* THANKS (Csaba Raduly): Add.
* data/glr.c: Fix overquoting on b4_prefix for yylval and yylloc.
* tests/calc.at (_AT_DATA_CALC_Y): If %defines is specified, generate
lexer in a separate module that includes the defines file.
(AT_CHECK_CALC): Use AT_FULL_COMPILE and request compilation of lexer
source.
* tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Push AT_DEFINES_IF.
Adjust AT_LOC and AT_VAL to use AT_NAME_PREFIX.
(AT_BISON_OPTION_POPDEFS): Pop AT_DEFINES_IF.
(AT_DATA_SOURCE_PROLOGUE): New.
(AT_DATA_GRAMMAR_PROLOGUE): Use AT_DATA_SOURCE_PROLOGUE.
(AT_DATA_SOURCE): New.
(AT_FULL_COMPILE): New, copied from master branch and extended to
support an additional output file.
2008-11-19 00:38:14 -05:00
Di-an Jan
e254a580b5 Java parser improvements
2008-11-01  Di-an Jan  <dianj@freeshell.org>
	    Paolo Bonzini  <bonzini@gnu.org>

	Support all Java parser class modifiers.
	* data/java.m4 (b4_percent_define_get3): New.
	(b4_final_if, b4_strictfp_if): New.
	* data/lalr1.java (final, strictfp, extends, implements): Support.
	* doc/bison.texinfo (final, strictfp, extends, implements): Add
	documentation.
	* tests/java.at (AT_CHECK_JAVA_MINIMAL): New.
	(AT_CHECK_JAVA_MINIMAL_W_LEXER): New.
	(AT_CHECK_JAVA_GREP): New.
	(Java parser class modifiers): New test.
	(Java parser class extends and implements): New test.

	Model exception propagation better with throws and lex_throws.
	* data/java.m4 (b4_list2): New.
	(throws): Change default.
	* data/lalr1.java (yyaction): Add throws.
	(parse): Add lex_throws in addition to throws.
	* doc/bison.texinfo (throws, lex_throws): Add documentation.
	* tests/java.at (Java throws specifications): New test.

	Improve documentation for Java parsers.
	* doc/bison.texinfo (Java Parsers): Add subsections.
	Don't quote first argument of %define.
	(Java Bison Interface): Document output files.  Move documentation
	of parser class and merge into Java Parser Interface.  Document
	features that error out.  Document directives with no effect.
	Move note about Javadoc higher.
	(Java Semantic Values): Explicitly mention stype.
	Document that generic types cannot be used.
	(Java Location Values): Use @deftypeivar.  Document constructors.
	Correct return value for toString.
	(Java Parser Interface): List undocumented constants/fields.
	Move documentation of fields added by %parse-param closer to list
	of members.  Document that token names are added as fields.
	Document constructors accurately.  Remove error method.
	(Java Scanner Interface): Move note on %pure-parser to Java Bison
	Interface.  Describe %code lexer and yylex accutately.
	Remove documentation that does not match the code.
	(Java Action Features): New.
	(Java Differences): Add reference.  Add item on semantic values.
	Add note about @{ ... @}.  Clarify %% epilogue placement.
	(Java Declarations Summary): New.

	Fix Java skeleton.
	* data/java.m4 (b4_prefix): Correct quoting for m4_define_default.
	(b4_remove_comma): Quote test argument.
	* tests/java.at (Java parser class and package names): New test.
	(Java %parse-param and %lex-param): New test.
	(Java stype, position_class and location_class): New test.
2008-11-01 20:00:01 +01:00
Di-an Jan
74d6c0fe17 Correct visible errors in generated Javadoc.
2008-10-27  Di-an Jan  <dianj@freeshell.org>

    * data/lalr1.jave: Update copyright years.
    (YYParser): Correct name of "generated from" file in Javadoc:
    use b4_file_name instead of @ofile@.
    (Location constructor): Correct Javadoc parameter name.
    (yylloc): Add missing opening m4 quote after b4_location_if.
    This removes a stray [ in the Javadoc of Lexer.getStartPos.
    (Lexer.yyerror): Fix incorrect m4 and Javadoc.
    (YYParser constructor): Correct Javadoc parameter name.
2008-10-31 13:42:08 +01:00
Akim Demaille
482dc52fb7 Space changes.
* data/lalr1.cc: Formatting changes.
2008-10-28 17:11:17 +01:00
Akim Demaille
52cbbe845a Don't define debugging functions when !YYDEBUG.
* data/lalr1.cc (debug_stream, set_debug_stream)
	(debug_level_type, debug_level, set_debug_level): Don't
	declare them when YYDEBUG is not defined.
	The implementation are already YYDEBUG-aware.
2008-10-28 17:11:14 +01:00
Akim Demaille
cf98343c1d Space and comments changes.
* data/c++.m4, data/glr.c, data/lalr1.cc: Copyright year changes.
	* data/c.m4, data/lalr1.cc: Space changes.
2008-10-28 17:11:07 +01:00
Joel E. Denny
0f0e1ace60 Fix yyerror_range for user-defined location type in C++.
Reported by Georg Sauthoff at
<http://lists.gnu.org/archive/html/bug-bison/2008-08/msg00008.html>.
* data/lalr1.cc (parse): Change type of yyerror_range to location_type.
* THANKS (Georg Sauthoff): Add.
2008-10-18 12:46:12 -04:00
Paolo Bonzini
ddf17a6e0e small but important bugfixes for the Java skeleton
2008-10-08  Di-an Jan  <dianj@freeshell.org>  (tiny change)

	Small but important bugfixes for the Java skeleton.
	* data/lalr1.java (yyerror): Change Location to b4_location_type.
	(yy_symbol_print): Call toString on yyvaluep.
2008-10-09 21:26:29 +02:00
Eric Blake
9a90b6bbc6 Resync m4sugar from autoconf.
* data/m4sugar/m4sugar.m4 (m4_defn, m4_popdef, m4_undefine)
(m4_init): Adjust to latest m4.git changes.
(m4_mapall_sep, _m4_list_cmp, m4_version_compare): Reduce side
effects.
* data/m4sugar/foreach.m4 (_m4_shiftn): Fix off-by-one bug.
(_m4_list_cmp): Reduce side effects.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-08-27 20:44:41 -06:00
Akim Demaille
98e26a9201 Support yyerrok in lalr1.cc.
YYBACKUP is still to import back into lalr1.cc.

	* data/lalr1.cc (yyerrork, yyclearin, YYRECOVERING): Define.
2008-08-27 10:21:31 +02:00
Eric Blake
d67c52e852 Remaining m4sugar merge from autoconf.
* data/m4sugar/m4sugar.m4: Copy entire file from autoconf.
* data/m4sugar/foreach.m4: New file, copied from autoconf.
* data/Makefile.am (dist_m4sugar_DATA): Distribute it.
* src/output.c (output_skeleton): Tell m4 how to find it.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-08-15 11:46:20 -06:00
Eric Blake
6bbb2ed5ef Partial m4sugar merge from autoconf: m4_map.
* data/m4sugar/m4sugar.m4 (m4_fst): Delete.
(m4_map, m4_map_sep, _m4_map): Rewrite more efficiently.
(m4_apply, _m4_apply, m4_mapall, m4_mapall_sep): New macros.
* data/java.m4 (b4_token_enums): Use more efficient short-circuit
for empty list.
* data/c.m4 (b4_token_defines, b4_token_enums, b4_c_ansi_formals):
Likewise.
(b4_parse_param_for): Avoid m4_fst, now that autoconf no longer
declares it.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-08-15 11:17:01 -06:00
Eric Blake
a3764451d3 Partial m4sugar merge from autoconf: m4_shiftn.
* data/m4sugar/m4sugar.m4 (m4_shiftn): Faster implementation.
(m4_shift2, m4_shift3): New macros.
(m4_case, m4_bmatch, m4_bpatsubsts, m4_join): Adjust clients.
* data/c.m4 (b4_c_function_def, b4_c_ansi_function_def)
(b4_c_ansi_function_decl, b4_c_function_call): Likewise.
* data/java.m4 (b4_remove_comma): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-08-06 21:22:06 -06:00
Eric Blake
882a1fbf72 Partial m4sugar merge from autoconf: m4_wrap vs. m4 1.6.
* data/m4sugar/m4sugar.m4 (m4_unquote, m4_wrap_lifo): New macros.
(m4_wrap): Guarantee FIFO order, in spite of m4 1.6.
(m4_init): Consolidate wrapped text into single m4_wrap.
* data/bison.m4 (b4_check_user_names_wrap): Stick with LIFO order
in wrapped text.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-08-06 20:19:50 -06:00
Eric Blake
dfcc595944 Partial m4sugar merge from autoconf: builtins, version.m4.
* data/m4sugar/m4sugar.m4 (changeword): Nuke.
(m4_prepend): Remove, as it is unused and inherently quadratic,
whereas m4_append is linear in newer m4.
(m4_mkstemp): New builtin.
(m4_symbols): Make rename conditional.
(m4_version_prereq): Ensure fatal error if used in bison, which
intentionally lacks version.m4.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-08-05 06:39:55 -06:00
Eric Blake
a30e920d17 Fix comments in m4sugar.
* data/m4sugar/m4sugar.m4: Comment changes, borrowed from autoconf.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-08-05 06:34:24 -06:00