Commit Graph

702 Commits

Author SHA1 Message Date
Akim Demaille
ad597a7877 parse.error: fix.
* data/bison.m4: Move code related to specific variables after the
	definition of the variable-maintaining macros so that we don't
	"invoke" b4_percent_define_check_values before it is defined.
2009-06-29 15:08:47 +02:00
Akim Demaille
31b850d2d4 variables: parse.error
Implement, document, and test the replacement of %error-verbose
by %define parse.error "verbose".

	* data/bison.m4 (b4_error_verbose_if): Reimplement to track the
	values of the parse.error variable.
	Make "simple" its default value.
	Check the valid values.
	* src/parse-gram.y: Use %define parse.error.
	(PERCENT_ERROR_VERBOSE): New token.
	Support it.
	* src/scan-gram.l: Support %error-verbose.

	* doc/bison.texinfo (Decl Summary): Replace the documentation of
	%define error-verbose by that of %define parse.error.
	* NEWS: Document it.

	* tests/actions.at, tests/calc.at: Use parse.error instead of
	%error-verbose.
2009-06-29 13:37:44 +02:00
Akim Demaille
6750106107 variables: rename namespace as api.namespace.
Discussed in
http://lists.gnu.org/archive/html/bison-patches/2009-04/msg00033.html

	* data/bison.m4 (b4_percent_define_copy_, b4_percent_define_copy):
	New.
	(b4_percent_define_use): New.
	Use it where applicable.
	* data/c++.m4: Replace uses of the variable "namespace" by
	"api.namespace".
	Default the latter to the former.
	* doc/bison.texinfo (Decl Summary): Document "namespace" as
	obsolete.
	Document api.namespace.
	Use @samp to document %define uses, keep @code for identifiers.
	* NEWS: Likewise.
	* tests/c++.at, tests/input.at: Test api.namespace instead of
	namespace. (The tests passed with namespace.)
2009-06-24 17:38:48 +02:00
Akim Demaille
4197678606 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 14:53:05 +02:00
Joel E. Denny
f8e7258f7f 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.
(cherry picked from commit 246c4efafe)

Conflicts:

	src/muscle-tab.h
2009-05-23 00:00:02 -04:00
Joel E. Denny
b987342bab * data/c++.m4 (b4_namespace_close): Simplify slightly.
(cherry picked from commit e7bfa8b721)
2009-05-20 18:05:03 -04:00
Joel E. Denny
4977e0a7d9 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.
(cherry picked from commit 8c221795af)
2009-05-19 18:16:08 -04:00
Akim Demaille
4c6622c2dd Rename token.prefix as api.tokens.prefix.
Discussed here.
http://lists.gnu.org/archive/html/bison-patches/2009-05/msg00024.html.

	* NEWS, data/bison.m4, data/c.m4, data/java.m4, doc/bison.texinfo,
	* tests/c++.at, tests/calc.at, tests/java.at, tests/local.at
	(token.prefix): Rename as...
	(api.tokens.prefix): this.
2009-05-15 16:10:52 +02:00
Joel E. Denny
6721294104 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_push_parser): 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.
(cherry picked from commit 812775a039)

Conflicts:

	data/c.m4
	etc/bench.pl.in
	src/parse-gram.c
	src/parse-gram.h
	tests/conflicts.at
2009-04-30 03:43:58 -04:00
Joel E. Denny
f49097730e 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.
(cherry picked from commit 25029e164a)
2009-04-24 02:54:10 -04:00
Joel E. Denny
110ef36a1a 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/bison.m4 (b4_integral_parser_tables_map): Adjust YYDEFACT
documentation.
* data/glr.c, data/lalr1.java: Sync copyright dates.
* 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:18:13 -04:00
Akim Demaille
71b00ed874 variables: prefer error-verbose to error_verbose.
* data/bison.m4 (b4_error_verbose_if): Based on error-verbose
	instead of error_verbose.
	* src/scan-gram.l (%error-verbose): Map the error-verbose
	variable.
	* doc/bison.texinfo: Promote %define error-verbose instead of
	%error-verbose.
	* tests/actions.at: Prefer %define error-verbose to %error-verbose.
2009-04-20 23:17:54 +02:00
Akim Demaille
4f646c3794 variables: accept dashes.
* data/bison.m4 (b4_percent_define_if_define_): Also map dashes to
	underscores.
	* src/scan-gram.l ({id}): Also accept dashes after the initial
	letter.
	({directive}): Use {id}.
	* src/parse-gram.y: Comment and formatting changes.
	* doc/bison.texinfo (Symbols): Adjust the lexical definitions of
	symbols.
	* src/complain.h, src/complain.c (yacc_at): New.
	* src/symtab.c (symbol_new): Use yacc_at to report inappropriate
	symbol names.
	* src/output.c (token_definitions_output): Do not #define token
	names with dashes.
2009-04-20 23:17:51 +02:00
Akim Demaille
0c90a1f5e9 variables: use parse.assert' instead of assert'.
* TODO (assert): Remove.
	* data/bison.m4 (b4_assert_if): Replace with...
	(b4_parse_assert_if): this.
	* data/lalr1.cc, data/variant.hh, tests/c++.at: Adjust.
	* doc/bison.texinfo (Decl Summary): Document parse.assert.
2009-04-14 08:11:19 +02:00
Akim Demaille
fa81950916 variables: use parse.assert' instead of debug'.
* src/getargs.c (getargs): Map -t to %define trace.parse.
	* src/scan-gram.l (%debug): Map to %define trace.parse.
	* data/bison.m4 (b4_percent_define_if_define): Map `.' in variable
	names to `_' in macro names.
	(b4_debug_if): Replace with...
	(b4_parse_trace_if): this.
	* data/glr.c, data/glr.cc, data/lalr1.cc, data/lalr1.java,
	* data/yacc.c: Adjust.
	* doc/bison.texinfo (Decl Summary): Document %debug as obsoleted.
	Use @code to label the variable list.
	Document the variable parse.trace.
	(Tracing): Promote the parse.trace variable.
	* TODO: %printer is not documented.
2009-04-14 08:11:16 +02:00
Akim Demaille
bc0f573730 parser: handle %locations as %define locations.
* src/getargs.h, src/getargs.c (locations_flag): Remove.
	* src/getargs.c, src/scan-code.l: Use muscle_percent_define_ensure
	to set "locations" to true.
	* src/output.c (prepare): Don't output "locations".
	* src/scan-gram.l (%locations): Handle it as a %<flag>.
	* src/parse-gram.y: It's no longer a token.
	Don't handle it.
	* data/bison.m4 (b4_locations_if): Define it with
	b4_percent_define_if_define.
	* data/c.m4, data/glr.cc: Adjust.
2009-04-06 13:24:47 +02:00
Akim Demaille
0ce615753e Treat %debug as %define debug.
* data/bison.m4 (b4_debug_if): New.
	* data/glr.c, data/glr.cc, data/lalr1.cc, data/yacc.c,
	* data/lalr1.java: Use it instead of b4_debug_flag.
	* src/getargs.h, src/getargs.c (debug_flag): Remove.
	* src/output.c (prepare): Don't output it.
	* src/parse-gram.y: Treat %debug as %define debug.
2009-04-03 10:26:10 +02:00
Akim Demaille
b3a2272a73 Treat %error-verbose as %define error_verbose.
This allows to pass -Derror_verbose on the command line.  Better yet, it
allows to pass -Derror_verbose=$(ERROR_VERBOSE), with ERROR_VERBOSE being
defined as false or true.

	* data/bison.m4 (b4_percent_define_if_define): Instead of relying
	on b4_percent_define_ifdef, for does not check the defined value,
	but only whether the symbol is defined, rely on
	b4_percent_define_flag_if, so that a value of "false" is processed
	as a false.
	If not defined, define the flag to "false".
	(b4_error_verbose_if): New.
	* data/glr.c, data/lalr1.cc, data/yacc.c: Use it instead of
	b4_error_verbose_flag.
	* src/getargs.h, src/getargs.c (error_verbose_flag): Remove.
	* src/output.c (prepare): Don't output it.
	* src/parse-gram.y (%error-verbose): Treat as %define error_verbose.
2009-04-03 10:26:09 +02:00
Joel E. Denny
92822affc5 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:55:08 -04:00
Akim Demaille
56f772e95e 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-27 07:26:24 +01:00
Akim Demaille
91be6b283e Comment changes. 2009-03-02 17:06:55 +01:00
Akim Demaille
cbf25ce74f Share b4_yytranslate_define.
* data/lalr1.cc (b4_yytranslate_define): Move to...
	* data/c++.m4: here.
2009-03-02 16:34:09 +01:00
Akim Demaille
0623bacc05 Dub make_TOKEN as a public type interface.
* data/c++.m4 (b4_symbol_constructor_declare)
	(b4_symbol_constructor_define): New empty stubs.
	(b4_public_types_declare, b4_public_types_define): Use them.
	* data/lalr1.cc (b4_symbol_constructor_declare)
	(b4_symbol_constructor_declare_)
	(b4_symbol_constructor_define_, b4_symbol_constructor_define):
	Move to...
	* data/variant.hh: here.
	Remove the "b4_variant_if" parts, as variant.hh is loaded only if
	needed.
	* data/lalr1.cc: No longer invoke b4_symbol_constructor_define and
	b4_symbol_constructor_declare, as it is now done by
	b4_public_types_define and b4_public_types_declare.
2009-03-02 16:27:48 +01:00
Akim Demaille
5f5a90dff6 Coding style changes.
* data/lalr1.cc (b4_symbol_constructor_declaration_)
	(b4_symbol_constructor_declarations)
	(b4_symbol_constructor_definition_)
	(b4_symbol_constructor_definitions)
	(b4_yytranslate_definition): Rename as...
	(b4_symbol_constructor_declare_)
	(b4_symbol_constructor_declare)
	(b4_symbol_constructor_define_)
	(b4_symbol_constructor_define)
	(b4_yytranslate_define): these.
	* data/variant.hh (b4_variant_definition): Rename as...
	(b4_variant_define): this.
2009-03-02 16:24:21 +01:00
Akim Demaille
b47b6ff7fd Factor b4_assert_if, b4_lex_symbol_if, and b4_variant_if.
* data/bison.m4 (b4_percent_define_if_define): New.
	* data/c++.m4 (b4_variant_if): Move to...
	* data/bison.m4: Here, using b4_percent_define_if_define.
	* data/lalr1.cc (b4_assert_if, b4_lex_symbol_if): Move to...
	* data/bison.m4: Here, using b4_percent_define_if_define.
2009-03-02 16:20:26 +01:00
Akim Demaille
1d6b689b26 Dub symbol_type_base as a public type.
* data/c++.m4 (b4_public_types_declare): Now define
	symbol_type_base and symbol_type.
	(b4_public_types_define): New.
	In both cases, the definitions are taken verbatim from lalr1.cc.
	* data/lalr1.cc: Adjust.
2009-03-02 16:15:28 +01:00
Akim Demaille
4f84717d23 b4_public_types_declare.
* data/c++.m4 (b4_public_types_declare): New.
	* data/glr.cc, data/lalr1.cc: Use it.
2009-03-02 16:12:11 +01:00
Akim Demaille
b9e4eb5b72 b4_semantic_type_declare.
* data/c++.m4 (b4_semantic_type_declare): New.
	Factors and generalizes what was in glr.cc and lalr1.cc.
	* data/variant.hh (b4_semantic_type_declare): Redefine it for
	variants.
	* data/lalr1.cc, data/glr.cc: Use it.
2009-03-02 16:08:07 +01:00
Akim Demaille
e9e61b0002 Remove useless arguments.
* data/glr.c (yy_reduce_print): $$ and @$ are not used and not
	relevant.
2009-02-25 23:45:46 +01:00
Akim Demaille
3eead995a4 Comment changes.
* data/lalr1.cc: here.
2009-02-25 23:41:40 +01:00
Akim Demaille
87f28efe7e Fix glr.cc's debug level handling.
* data/glr.cc (yydebug_): Remove, as it is actually yydebug from
	glr.c which is used.
	(debug_level, set_debug_level): Adjust.
2009-02-25 23:38:27 +01:00
Akim Demaille
9be2a009c4 Copyright years.
* data/glr.c: Add 2007 and 2008 here, consistenly with the comments.
2009-02-25 23:34:45 +01:00
Akim Demaille
33c78bd23e Comment change.
* data/lalr1.cc: here.
2009-02-25 23:28:15 +01:00
Akim Demaille
49572920dd Make yyparser::error public.
* data/lalr1.cc: here.
	There is no good reason to keep it private (and it is convenient
	to use it from the scanner for instance).  It is already public in
	glr.cc.
2009-02-19 22:16:19 +01:00
Akim Demaille
88654b47c9 Comment changes.
* data/glr.cc: here.
2009-02-19 22:12:44 +01:00
Akim Demaille
4524c55bcf Remove trailing blanks.
The epilogue has its own ending \n, no need to add another.

	* data/glr.c, data/lalr1.java, data/yacc.c: dnl when outputing the
	epilogue.
	* data/glr.cc: dnl when extending the epilogue.
	Remove stray "private:".
2009-02-19 22:08:08 +01:00
Akim Demaille
6ceccee88d Use b4_c_modern.
* data/c.m4 (b4_c_function_decl): Here.
2009-02-19 22:02:56 +01:00
Akim Demaille
9c6a89660e Comment changes.
* data/lalr1.cc: here.
2009-02-19 21:58:13 +01:00
Akim Demaille
507aa0e2a8 Extract variant.hh
* data/variant.hh: New, extracted from...
	* data/lalr1.cc: here.
	Adjust.
	* data/local.mk: Adjust.
2009-02-19 21:53:58 +01:00
Akim Demaille
51bacae6b5 Extract stack.hh from lalr1.cc.
* data/stack.hh: New.
	* data/lalr1.cc: Extract from here.
	* data/local.mk: Adjust.
2009-02-19 21:49:46 +01:00
Samuel Tardieu
253192e69a Force a large alignment of a variant structure.
This is a temporary band-aid until Bison gets proper alignment handling.
We need it on ARM.

	* data/lalr1.cc (variant): Declare the buffer as a union to force
	the same alignment as "long double".
2009-01-28 15:46:05 +01:00
Akim Demaille
84eedf86fe Pass the token type to yysyntax_error.
* data/yacc.c (yysyntax_error): Take the transated token instead
	of the raw number.
	Adjust callers.
	* TODO: Update.
2008-12-11 10:47:14 +01:00
Akim Demaille
5860cc8c1c Formatting changes.
* data/glr.c: Formatting changes.
2008-12-11 10:47:10 +01:00
Akim Demaille
2b008529ed Propagate i18n changes into glr.c.
* TODO: Update.
	* data/glr.c (yyreportSyntaxError): Use "switch" instead of
	building the error message format dynamically.
	* data/lalr1.java: Formatting changes.
2008-12-11 10:47:06 +01:00
Akim Demaille
eeb2942237 Simplify the i18n of the error messages.
* data/lalr1.cc: Comment changes.
	* data/yacc.c (yysyntax_error): Rewrite, using a switch as in
	lalr1.cc instead of building dynamically the format string.
2008-12-11 10:45:52 +01:00
Akim Demaille
2ca1136c7c Update data/README.
* data/README: Document glr.cc, lalr1.java, m4sugar and xslt.
2008-12-08 09:47:35 +01:00
Akim Demaille
6c63b895fb 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.
2008-12-08 09:47:31 +01:00
Akim Demaille
417e31d2c3 Test token.prefix in all the skeletons.
* data/java.m4 (b4_token_enum): Use the token.prefix.
	* tests/local.at (AT_BISON_OPTION_PUSHDEFS): Define AT_TOKEN_PREFIX.
	* tests/calc.at (_AT_DATA_CALC_Y): Use it.
	Add checks for yacc.c, glr.c, lalr1.cc and glr.cc.
	* tests/java.at: Comment changes.
	(AT_CHECK_JAVA_MINIMAL): Define the END token.
	(Java parser class and package names): Add token.prefix check.
2008-12-08 09:47:26 +01:00
Akim Demaille
3bb211139b Use b4_symbol for printers and destructors everywhere.
* data/bison.m4 (b4_symbol_action_location): New.
	* data/c.m4 (b4_symbol_actions): Remove.
	Adjust all callers to use by b4_symbol_foreach and the corresponding
	b4_symbol_printer/destructor macro.
	* data/glr.cc: Adjust.
	* data/lalr1.java: Adjust the %destructor sanity check.
	* src/output.c (symbol_code_props_output): Remove, we no longer
	need the b4_symbol_printers/destructors tables.
2008-12-01 22:32:33 +01:00
Akim Demaille
fb7c5b1f23 Use b4_symbol_case_.
* data/lalr1.cc, data/bison.m4 (b4_symbol_action): Use
	b4_symbol_case_.
2008-12-01 22:29:20 +01:00