Compare commits

...
46 Commits
Author SHA1 Message Date
Joel E. Denny bfb40910e3 * NEWS: Version 2.4. 2008-11-02 16:55:49 -05:00
Joel E. Denny 241fda7a8d Prepare for next release.
* NEWS: Briefly mention changes since 2.3b.
* README: Say GNU m4 1.4.6, which we've been requiring in release
announcements already, not 1.4.3, which breaks the build.
2008-11-02 16:55:14 -05:00
Joel E. Denny ed4d67dcbe Say %language is experimental.
We're thinking of extending it's effect on output file naming.  See the
thread at
<http://lists.gnu.org/archive/html/bison-patches/2008-10/msg00003.html>.
* NEWS: Say it's experimental.
* doc/bison.texinfo (Decl Summary): Say it's experimental, and so don't
recommend it over %skeleton for now.
(Bison Options): Likewise.
(C++ Bison Interface): Use %skeleton not %language.
(Calc++ Parser): Use %skeleton not %language.
* src/getargs.c (usage): Say it's experimental.
2008-11-02 16:54:45 -05:00
Di-an JanandPaolo Bonzini e254a580b5 Java parser improvements
2008-11-01  Di-an Jan  <[email protected]>
	    Paolo Bonzini  <[email protected]>

	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
Paolo Bonzini f259e4e63c commit missing ChangeLog entry 2008-10-31 14:33:08 +01:00
Di-an JanandPaolo Bonzini 74d6c0fe17 Correct visible errors in generated Javadoc.
2008-10-27  Di-an Jan  <[email protected]>

    * 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
Joel E. Denny cae5057f47 Always put auxiliary code files in the same dir as other output files.
* src/files.c (compute_file_name_parts): When the user specifies
--output but not --file-prefix, extract the directory prefix from the
file prefix not from the grammar file name.  This affects the location
of files like location.hh generated by the C++ skeleton.  The includes
in the other output files require this fix.
* tests/output.at (AT_CHECK_OUTPUT): Automatically create directories
for expected output files.
(Output files): Add a test for the above.
2008-10-30 15:43:11 -04:00
Joel E. Denny 4af432ba25 * gnulib: Update submodule to HEAD. 2008-10-29 10:40:32 -04:00
Joel E. Denny e26d4e4314 Update copyright year.
* src/files.c: Here.
2008-10-28 22:08:52 -04:00
Di-an JanandJoel E. Denny c0ee9e2115 Don't overwrite the input file.
* src/files.c (output_file_name_check): Fatal error if using input file
for output.
* tests/output.at: (AT_CHECK_CONFLICTING_OUTPUT): Add return status
argument.
(Conflicting output files): Add test.
2008-10-28 21:45:43 -04: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 0925d5bfd4 Prefer "continue" for empty loop bodies.
* etc/bench.pl.in: Use "continue" instead of {}.
2008-10-28 17:11:11 +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
Akim Demaille 9f467b7d84 Make gnulib a submodule.
* gnulib: New.
	* .gitmodules (gnulib): New.
2008-10-28 17:05:48 +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
Joel E. Denny 548e2104e2 Update several administrative files mainly to facilitate releasing.
* HACKING (Administrivia): Make the git-merge-changelog notes more
helpful.
(Test suite): Don't say lalr1.cc is not exercised in the test suite.
(Release Procedure): Update for git and add numerous details that were
previously missing.
* Makefile.am (EXTRA_DIST): Remove Makefile.cfg and Makefile.maint.
* maint.mk (announcement): Don't list bison as a bootstrap tool so
that announcements don't claim we bootstrapped with whatever bison
happened to be in PATH.  Add flex as a bootstrap tool.
* Makefile.maint: Remove, previously replaced by maint.mk.
* Makefile.cfg: Remove, and migrate settings to...
* cfg.mk: ... here for the sake of `make announcement'.
* bootstrap.conf (gnulib_modules): Add announce-gen.
* README: Say GNU Bison instead of just Bison.  Suggested by Karl
Berry.
2008-10-18 12:18:12 -04:00
Paolo Bonzini ddf17a6e0e small but important bugfixes for the Java skeleton
2008-10-08  Di-an Jan  <[email protected]>  (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
Akim Demaille e1145ad8bd Clarify UPDATED use.
* doc/bison.texinfo: It refers to the last edition of this file,
	not to the release date of Bison.
	Reported by Joel E. Denny.
2008-08-29 10:12:23 +02:00
Akim Demaille 0df72d78ff Update README.
* README: Update FAQ pointer.
	Reported by Joel E. Denny.
2008-08-29 10:07:04 +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 <[email protected]>
2008-08-27 20:44:41 -06:00
Akim Demaille 6501566813 Check yyerrok in calc.at.
* tests/calc.at (calc.y): Use yyerrok on "( error )".
	(AT_CHECK_CALC): Add a check that ensures that yyerrok works as
	expected.
2008-08-27 10:30:06 +02: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
Joel E. Denny 86c0e78460 For maintainer-check*, don't recompile for a $(VERSION) update.
* cfg.mk: New file.
(_is-dist-target): Override the one in GNUmakefile.
* Makefile.am (EXTRA_DIST): Add cfg.mk.
2008-08-26 23:43:03 -04:00
Joel E. Denny 8851116612 Update for recent change to gnulib.
* src/parse-gram.y: Don't include strverscmp.h.  It comes from
string.h now.
2008-08-26 03:33:55 -04: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 <[email protected]>
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 <[email protected]>
2008-08-15 11:17:01 -06:00
Joel E. Denny 8dce3875bc Keep .version and PACKAGE_VERSION in sync.
* Makefile.am ($(top_srcdir)/.version): Declare configure as a
dependency, and add comments justifying this in more detail.  Discussed
starting at
<http://lists.gnu.org/archive/html/bison-patches/2008-07/msg00022.html>.
2008-08-07 18:37:07 -04: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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
2008-08-05 06:34:24 -06:00
Joel E. Denny 445b74704f Update for recent .gitignore fix in Gnulib.
* bootstrap: Back out 2008-07-18 hack now that gnulib-tool creates
anchored .gitignore entries.
2008-08-02 15:18:21 -04:00
Joel E. Denny a1e50014a0 Set gnu or gnits strictness.
* configure.ac (AM_INIT_AUTOMAKE): Set gnu strictness during
development and gnits strictness for releases.  Based on Eric Blake's
suggestion at
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00019.html>.
2008-08-02 02:32:29 -04:00
Paolo Bonzini d43f77e7ee clarify documentation of %language in the NEWS file
2008-07-31  Paolo Bonzini  <[email protected]>

	* NEWS: Clarify documentation of %language.
2008-07-31 11:01:47 +02:00
Paolo Bonzini fee2ed87aa document and support usage of git-merge-changelog
2008-07-31  Paolo Bonzini  <[email protected]>

	Support usage of git-merge-changelog.
	* .gitattributes: New.
	* HACKING: Document usage of git-merge-changelog.
	* bootstrap: Install git-merge-changelog entries in .git/config
	if appropriate.
2008-07-31 11:00:58 +02:00
Paolo Bonzini fdd2c97c0b add a .gitattributes file to use the git-merge-changelog driver 2008-07-31 10:52:07 +02:00
Joel E. Denny 78029cd561 Remove remaining dependence on CVS Id keyword.
* ChangeLog: For the sake of people still using CVS, don't use dollars
when mentioning Id.
* data/xslt/bison.xsl: Remove Id from header comments, where it was
unusual anyway.
* data/xslt/xml2dot.xsl: Likewise.
* data/xslt/xml2text.xsl: Likewise.
* data/xslt/xml2xhtml.xsl: Likewise.
* doc/Doxyfile.in (PROJECT_NUMBER): Don't use ID.
* doc/Makefile.am (neutralize): Remove, no longer needed.
(.x.1): Don't use neutralize.
(edit): Don't substitute for ID.
(Doxyfile): Don't define Id, and thus don't depend on ChangeLog.
2008-07-27 15:49:04 -04:00
Joel E. Denny c53d18b157 Fix dependence on computed configure variables.
* doc/Makefile.am (common_dep): Depend on $(top_srcdir)/configure not
$(top_srcdir)/configure.ac so that changes to computed variables, such
as PACKAGE_VERSION, are seen.
* tests/Makefile.am ($(srcdir)/package.m4): Likewise.
2008-07-27 01:15:12 -04:00
Joel E. Denny 5523ac79a0 Update copyright dates for recent changes.
* Makefile.am: Here.
* src/Makefile.am: Here.
* src/reduce.c: Here.
* tests/reduce.at: Here.
2008-07-20 18:33:17 -04:00
Joel E. Denny 8fa369111f Use git-version-gen for version names between releases.
* .cvsignore (.tarball-version, GNUmakefile, *~): Add.
* .gitignore (/.tarball-version, /GNUmakefile, /*~): Add.
* .prev-version: New.
* .version.in: Remove.
* ChangeLog: Remove the $Id$ previously used for capturing the CVS
revision.
* GNUmakefile: Remove, now copied from Gnulib.
* Makefile.am: Add code suggested by comments in
build-aux/git-version-gen.
(EXTRA_DIST): Remove GNUmakefile, handled by Gnulib.  Add maint.mk,
.prev-version, and .version.
* NEWS (2.3b+): Rename to...
(?.?): ... this because we're dropping the "+" version naming scheme,
but, in general, we still can't be sure of our next release name.
* bootstrap: Add a quick hack to remove from .gitignore the
GNUmakefile entry that gnulib adds.  We already have a /GNUmakefile
entry.  This should really be fixed in gnulib instead.
* bootstrap.conf (gnulib_modules): Add gnumakefile.
* configure.ac (AC_INIT): Set version name by invoking
build-aux/git-version-gen.
(AC_CONFIG_FILES): Remove .version, now generated by
build-aux/git-version-gen.
* maint.mk: New, copied from coreutils.
* doc/.cvsignore (bison.1): Add.
* doc/.gitignore (/bison.1): Add.
* doc/bison.1: Remove, generated.
* src/.cvsignore (revision.c): Remove.
* src/.gitignore (/revision.c): Remove.
* src/Makefile.am (bison_SOURCES): Remove revision.c and revision.h.
(BUILT_SOURCES): Remove revision.c.
(revision.c): Remove.
* src/getargs.c (version): Don't print revision after the VERSION.
* src/revision.h: Remove.
2008-07-18 12:55:39 -04:00
Joel E. Denny bcf07cb707 Fix untranslatable composition of sentences.
Reported by Goran Uddeborg at
<http://lists.gnu.org/archive/html/bug-bison/2008-06/msg00000.html>.
* THANKS (Goran Uddeborg): Add.
* src/reduce.c (reduce_print): Report the number of nonterminals and
rules useless in the grammar in separate sentences.
* tests/reduce.at (Useless Rules): Update output.
(Reduced Automaton): Likewise.
(Underivable Rules): Likewise.
(Empty Language): Likewise.
2008-07-16 02:56:36 -04:00
Joel E. Denny 9aacab9ae9 Fix some .gitignore and .cvsignore problems.
* bootstrap (insert_sorted_if_absent): Replace all uses with...
(insert_vc_ignore): ... this new function, which prepends `/' to all
.gitignore entries before passing them to insert_sorted_if_absent.
* bootstrap.conf (vc_ignore): Set to '.cvsignore .gitignore' so that
.cvsignore files are maintained even though Bison developers run
bootstrap while using Git.
* .cvsignore (*.patch *.log log patches applied): Remove, apparently
unneeded by Bison.
(gnulib): Add.
* .gitignore (/*.patch *.log log patches applied): Remove, broken and
unneeded.  Reported by Eric Blake.
* lib/.gitignore (/*~): Add.
* po/.cvsignore, runtime-po/.cvsignore: Sync with .gitignore.
* examples/calc++/.gitignore (/calc++.exe): Add.  Reported by Eric
Blake.
* src/.gitignore (/bison.exe): Add.  Reported by Eric Blake.
2008-07-16 02:05:14 -04:00
Joel E. Denny a9fc7990fa Improve forward-compatibility with GNU M4.
Reported by Eric Blake at
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>.
* bootstrap.conf (gnulib_modules): Add unsetenv.
* lib/.gitignore, lib/.cvsignore (/unsetenv.c): Add.
* m4/.gitignore, m4/.cvsignore (/environ.m4): Add.
(/setenv.m4): Add.
* src/output.c (output_skeleton): For the m4 invocation, pass -dV as
the first argument because it may become position-dependent, and unset
POSIXLY_CORRECT so Bison's skeletons have access to GNU M4 extensions.
Add comments explaining these issues in more detail.
2008-07-15 21:00:36 -04:00
Joel E. Denny 0f1d6f10d7 Add .gitignore everywhere based on .cvsignore.
* .gitignore: New.
* build-aux/.gitignore: New.
* data/.gitignore: New.
* doc/.gitignore: New.
* etc/.gitignore: New.
* examples/.gitignore: New.
* examples/calc++/.gitignore: New.
* lib/.gitignore: New.
* m4/.gitignore: New.
* po/.gitignore: New.
* runtime-po/.gitignore: New.
* src/.gitignore: New.
* tests/.gitignore: New.
2008-07-14 06:06:26 -04:00
Joel E. Denny 7bd1665a86 * NEWS (2.3b+): New section, empty for now.
* configure.ac (AC_INIT): 2.3b -> 2.3b+.
2008-05-28 03:25:22 +00:00
73 changed files with 4769 additions and 1777 deletions
+4 -1
View File
@@ -1,10 +1,12 @@
*.cache
*.flc
*.patch *.log log patches applied
*.prj
*~
.tarball-version
.version
ABOUT-NLS
COPYING
GNUmakefile
INSTALL
Makefile
Makefile.in
@@ -21,6 +23,7 @@ config.status
configure
configure.lineno
conftest*
gnulib
javacomp.sh
javaexec.sh
patches
+1
View File
@@ -0,0 +1 @@
ChangeLog merge=merge-changelog
+31
View File
@@ -0,0 +1,31 @@
/*.cache
/*.flc
/*.prj
/*~
/.tarball-version
/.version
/ABOUT-NLS
/COPYING
/GNUmakefile
/INSTALL
/Makefile
/Makefile.in
/_*
/a.exe
/a.out
/aclocal.m4
/b.out
/bison-*
/conf[0-9]*
/confdefs*
/config.log
/config.status
/configure
/configure.lineno
/conftest*
/gnulib
/javacomp.sh
/javaexec.sh
/patches
/releases
/stamp-h*
+3
View File
@@ -0,0 +1,3 @@
[submodule "gnulib"]
path = gnulib
url = git://git.savannah.gnu.org/gnulib.git
+1
View File
@@ -0,0 +1 @@
2.3b
-1
View File
@@ -1 +0,0 @@
@VERSION@
+452 -2
View File
@@ -1,3 +1,455 @@
2008-11-02 Joel E. Denny <[email protected]>
* NEWS: Version 2.4.
2008-11-02 Joel E. Denny <[email protected]>
Prepare for next release.
* NEWS: Briefly mention changes since 2.3b.
* README: Say GNU m4 1.4.6, which we've been requiring in release
announcements already, not 1.4.3, which breaks the build.
2008-11-02 Joel E. Denny <[email protected]>
Say %language is experimental.
We're thinking of extending it's effect on output file naming. See the
thread at
<http://lists.gnu.org/archive/html/bison-patches/2008-10/msg00003.html>.
* NEWS: Say it's experimental.
* doc/bison.texinfo (Decl Summary): Say it's experimental, and so don't
recommend it over %skeleton for now.
(Bison Options): Likewise.
(C++ Bison Interface): Use %skeleton not %language.
(Calc++ Parser): Use %skeleton not %language.
* src/getargs.c (usage): Say it's experimental.
2008-11-01 Di-an Jan <[email protected]>
Paolo Bonzini <[email protected]>
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.
(b4_identification): Remove "bison" field.
* 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-10-31 Di-an Jan <[email protected]>
* 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-30 Joel E. Denny <[email protected]>
Always put auxiliary code files in the same dir as other output files.
* src/files.c (compute_file_name_parts): When the user specifies
--output but not --file-prefix, extract the directory prefix from the
file prefix not from the grammar file name. This affects the location
of files like location.hh generated by the C++ skeleton. The includes
in the other output files require this fix.
* tests/output.at (AT_CHECK_OUTPUT): Automatically create directories
for expected output files.
(Output files): Add a test for the above.
2008-10-29 Joel E. Denny <[email protected]>
* gnulib: Update submodule to HEAD.
2008-10-28 Joel E. Denny <[email protected]>
Update copyright year.
* src/files.c: Here.
2008-10-28 Di-an Jan <[email protected]> (tiny change)
Don't overwrite the input file.
* src/files.c (output_file_name_check): Fatal error if using input file
for output.
* tests/output.at: (AT_CHECK_CONFLICTING_OUTPUT): Add return status
argument.
(Conflicting output files): Add test.
2008-10-28 Akim Demaille <[email protected]>
Space changes.
* data/lalr1.cc: Formatting changes.
2008-10-28 Akim Demaille <[email protected]>
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 Akim Demaille <[email protected]>
Prefer "continue" for empty loop bodies.
* etc/bench.pl.in: Use "continue" instead of {}.
2008-10-28 Akim Demaille <[email protected]>
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 Akim Demaille <[email protected]>
Make gnulib a submodule.
* gnulib: New.
* .gitmodules (gnulib): New.
2008-10-18 Joel E. Denny <[email protected]>
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 Joel E. Denny <[email protected]>
Update several administrative files mainly to facilitate releasing.
* HACKING (Administrivia): Make the git-merge-changelog notes more
helpful.
(Test suite): Don't say lalr1.cc is not exercised in the test suite.
(Release Procedure): Update for git and add numerous details that were
previously missing.
* Makefile.am (EXTRA_DIST): Remove Makefile.cfg and Makefile.maint.
* maint.mk (announcement): Don't list bison as a bootstrap tool so
that announcements don't claim we bootstrapped with whatever bison
happened to be in PATH. Add flex as a bootstrap tool.
* Makefile.maint: Remove, previously replaced by maint.mk.
* Makefile.cfg: Remove, and migrate settings to...
* cfg.mk: ... here for the sake of `make announcement'.
* bootstrap.conf (gnulib_modules): Add announce-gen.
* README: Say GNU Bison instead of just Bison. Suggested by Karl
Berry.
2008-10-08 Di-an Jan <[email protected]> (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-08-29 Akim Demaille <[email protected]>
Clarify UPDATED use.
* doc/bison.texinfo: It refers to the last edition of this file,
not to the release date of Bison.
Reported by Joel E. Denny.
2008-08-29 Akim Demaille <[email protected]>
* README: Update FAQ pointer.
Reported by Joel E. Denny.
2008-08-27 Eric Blake <[email protected]>
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.
2008-08-27 Akim Demaille <[email protected]>
Check yyerrok in calc.at.
* tests/calc.at (calc.y): Use yyerrok on "( error )".
(AT_CHECK_CALC): Add a check that ensures that yyerrok works as
expected.
2008-08-27 Akim Demaille <[email protected]>
Support yyerrok in lalr1.cc.
YYBACKUP is still to import back into lalr1.cc.
* data/lalr1.cc (yyerrork, yyclearin, YYRECOVERING): Define.
2008-08-26 Joel E. Denny <[email protected]>
For maintainer-check*, don't recompile for a $(VERSION) update.
* cfg.mk: New file.
(_is-dist-target): Override the one in GNUmakefile.
* Makefile.am (EXTRA_DIST): Add cfg.mk.
2008-08-26 Joel E. Denny <[email protected]>
Update for recent change to gnulib.
* src/parse-gram.y: Don't include strverscmp.h. It comes from
string.h now.
2008-08-15 Eric Blake <[email protected]>
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.
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.
2008-08-07 Joel E. Denny <[email protected]>
Keep .version and PACKAGE_VERSION in sync.
* Makefile.am ($(top_srcdir)/.version): Declare configure as a
dependency, and add comments justifying this in more detail. Discussed
starting at
<http://lists.gnu.org/archive/html/bison-patches/2008-07/msg00022.html>.
2008-08-06 Eric Blake <[email protected]>
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.
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.
2008-08-05 Eric Blake <[email protected]>
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.
Fix comments in m4sugar.
* data/m4sugar/m4sugar.m4: Comment changes, borrowed from autoconf.
2008-08-02 Joel E. Denny <[email protected]>
Update for recent .gitignore fix in Gnulib.
* bootstrap: Back out 2008-07-18 hack now that gnulib-tool creates
anchored .gitignore entries.
2008-08-02 Joel E. Denny <[email protected]>
Set gnu or gnits strictness.
* configure.ac (AM_INIT_AUTOMAKE): Set gnu strictness during
development and gnits strictness for releases. Based on Eric Blake's
suggestion at
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00019.html>.
2008-07-31 Paolo Bonzini <[email protected]>
* NEWS: Clarify documentation of %language.
2008-07-31 Paolo Bonzini <[email protected]>
Support usage of git-merge-changelog.
* .gitattributes: New.
* HACKING: Document usage of git-merge-changelog.
* bootstrap: Install git-merge-changelog entries in .git/config
if appropriate.
2008-07-27 Joel E. Denny <[email protected]>
Remove remaining dependence on CVS Id keyword.
* ChangeLog: For the sake of people still using CVS, don't use dollars
when mentioning Id.
* data/xslt/bison.xsl: Remove Id from header comments, where it was
unusual anyway.
* data/xslt/xml2dot.xsl: Likewise.
* data/xslt/xml2text.xsl: Likewise.
* data/xslt/xml2xhtml.xsl: Likewise.
* doc/Doxyfile.in (PROJECT_NUMBER): Don't use ID.
* doc/Makefile.am (neutralize): Remove, no longer needed.
(.x.1): Don't use neutralize.
(edit): Don't substitute for ID.
(Doxyfile): Don't define Id, and thus don't depend on ChangeLog.
2008-07-27 Joel E. Denny <[email protected]>
Fix dependence on computed configure variables.
* doc/Makefile.am (common_dep): Depend on $(top_srcdir)/configure not
$(top_srcdir)/configure.ac so that changes to computed variables, such
as PACKAGE_VERSION, are seen.
* tests/Makefile.am ($(srcdir)/package.m4): Likewise.
2008-07-20 Joel E. Denny <[email protected]>
Update copyright dates for recent changes.
* Makefile.am: Here.
* src/Makefile.am: Here.
* src/reduce.c: Here.
* tests/reduce.at: Here.
2008-07-18 Joel E. Denny <[email protected]>
Use git-version-gen for version names between releases.
* .cvsignore (.tarball-version, GNUmakefile, *~): Add.
* .gitignore (/.tarball-version, /GNUmakefile, /*~): Add.
* .prev-version: New.
* .version.in: Remove.
* ChangeLog: Remove the Id previously used for capturing the CVS
revision.
* GNUmakefile: Remove, now copied from Gnulib.
* Makefile.am: Add code suggested by comments in
build-aux/git-version-gen.
(EXTRA_DIST): Remove GNUmakefile, handled by Gnulib. Add maint.mk,
.prev-version, and .version.
* NEWS (2.3b+): Rename to...
(?.?): ... this because we're dropping the "+" version naming scheme,
but, in general, we still can't be sure of our next release name.
* bootstrap: Add a quick hack to remove from .gitignore the
GNUmakefile entry that gnulib adds. We already have a /GNUmakefile
entry. This should really be fixed in gnulib instead.
* bootstrap.conf (gnulib_modules): Add gnumakefile.
* configure.ac (AC_INIT): Set version name by invoking
build-aux/git-version-gen.
(AC_CONFIG_FILES): Remove .version, now generated by
build-aux/git-version-gen.
* maint.mk: New, copied from coreutils.
* doc/.cvsignore (bison.1): Add.
* doc/.gitignore (/bison.1): Add.
* doc/bison.1: Remove, generated.
* src/.cvsignore (revision.c): Remove.
* src/.gitignore (/revision.c): Remove.
* src/Makefile.am (bison_SOURCES): Remove revision.c and revision.h.
(BUILT_SOURCES): Remove revision.c.
(revision.c): Remove.
* src/getargs.c (version): Don't print revision after the VERSION.
* src/revision.h: Remove.
2008-07-16 Joel E. Denny <[email protected]>
Fix untranslatable composition of sentences. Reported by Goran
Uddeborg at
<http://lists.gnu.org/archive/html/bug-bison/2008-06/msg00000.html>.
* THANKS (Goran Uddeborg): Add.
* src/reduce.c (reduce_print): Report the number of nonterminals and
rules useless in the grammar in separate sentences.
* tests/reduce.at (Useless Rules): Update output.
(Reduced Automaton): Likewise.
(Underivable Rules): Likewise.
(Empty Language): Likewise.
2008-07-15 Joel E. Denny <[email protected]>
Fix some .gitignore and .cvsignore problems.
* bootstrap (insert_sorted_if_absent): Replace all uses with...
(insert_vc_ignore): ... this new function, which prepends `/' to all
.gitignore entries before passing them to insert_sorted_if_absent.
* bootstrap.conf (vc_ignore): Set to '.cvsignore .gitignore' so that
.cvsignore files are maintained even though Bison developers run
bootstrap while using Git.
* .cvsignore (*.patch *.log log patches applied): Remove, apparently
unneeded by Bison.
(gnulib): Add.
* .gitignore (/*.patch *.log log patches applied): Remove, broken and
unneeded. Reported by Eric Blake.
* lib/.gitignore (/*~): Add.
* po/.cvsignore, runtime-po/.cvsignore: Sync with .gitignore.
* examples/calc++/.gitignore (/calc++.exe): Add. Reported by Eric
Blake.
* src/.gitignore (/bison.exe): Add. Reported by Eric Blake.
2008-07-15 Joel E. Denny <[email protected]>
Improve forward-compatibility with GNU M4. Reported by Eric Blake at
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>.
* bootstrap.conf (gnulib_modules): Add unsetenv.
* lib/.gitignore, lib/.cvsignore (/unsetenv.c): Add.
* m4/.gitignore, m4/.cvsignore (/environ.m4): Add.
(/setenv.m4): Add.
* src/output.c (output_skeleton): For the m4 invocation, pass -dV as
the first argument because it may become position-dependent, and unset
POSIXLY_CORRECT so Bison's skeletons have access to GNU M4 extensions.
Add comments explaining these issues in more detail.
2008-07-14 Joel E. Denny <[email protected]>
Add .gitignore everywhere based on .cvsignore.
* .gitignore: New.
* build-aux/.gitignore: New.
* data/.gitignore: New.
* doc/.gitignore: New.
* etc/.gitignore: New.
* examples/.gitignore: New.
* examples/calc++/.gitignore: New.
* lib/.gitignore: New.
* m4/.gitignore: New.
* po/.gitignore: New.
* runtime-po/.gitignore: New.
* src/.gitignore: New.
* tests/.gitignore: New.
2008-05-27 Joel E. Denny <[email protected]>
* NEWS (2.3b+): New section, empty for now.
* configure.ac (AC_INIT): 2.3b -> 2.3b+.
2008-05-27 Joel E. Denny <[email protected]>
* NEWS (2.3b): Update release date since there has been a delay in
@@ -20532,5 +20984,3 @@
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice and this
notice are preserved.
$Id$
-71
View File
@@ -1,71 +0,0 @@
# Having a separate GNUmakefile lets me `include' the dynamically
# generated rules created via Makefile.maint as well as Makefile.maint itself.
# This makefile is used only if you run GNU Make.
# It is necessary if you want to build targets usually of interest
# only to the maintainer.
# Copyright (C) 2001, 2003, 2006-2007, 2008 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Systems where /bin/sh is not the default shell need this. The $(shell)
# command below won't work with e.g. stock DOS/Windows shells.
ifeq ($(wildcard /bin/s[h]),/bin/sh)
SHELL = /bin/sh
else
# will be used only with the next shell-test line, then overwritten
# by a configured-in value
SHELL = sh
endif
have-Makefile := $(shell test -f Makefile && echo yes)
# If the user runs GNU make but has not yet run ./configure,
# give them a diagnostic.
ifeq ($(have-Makefile),yes)
# Make tar archive easier to reproduce.
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
include Makefile
# Ensure that $(VERSION) is up to date for dist-related targets, but not
# for others: rerunning autoconf and recompiling everything isn't cheap.
ifeq (0,$(MAKELEVEL))
_is-dist-target = $(filter dist% alpha beta major,$(MAKECMDGOALS))
ifneq (,$(_is-dist-target))
_curr-ver := $(shell build-aux/git-version-gen .version)
ifneq ($(_curr-ver),$(VERSION))
$(info INFO: rerunning autoconf for new version string: $(_curr-ver))
dummy := $(shell rm -rf autom4te.cache; $(AUTOCONF))
endif
endif
endif
include $(srcdir)/Makefile.cfg
include $(srcdir)/Makefile.maint
else
all:
@echo There seems to be no Makefile in this directory. 1>&2
@echo "You must run ./configure before running \`make'." 1>&2
@exit 1
endif
# Tell version 3.79 and up of GNU make to not build goals in this
# directory in parallel. This is necessary in case someone tries to
# build multiple targets on one command line.
.NOTPARALLEL:
+73 -9
View File
@@ -25,6 +25,15 @@ The correct response to most actual bugs is to write a new test case
which demonstrates the bug. Then fix the bug, re-run the test suite,
and check everything in.
** You may find it useful to install the git-merge-changelog merge driver:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c
When following the generic installation instructions there, keep in mind that
your clone of Bison's git repository already contains appropriate
.gitattributes files, and running Bison's bootstrap script will make the
necessary changes to .git/config.
* Hacking
@@ -71,8 +80,7 @@ release:
- Change tests/atlocal/CFLAGS to add your preferred options. For
instance, `-traditional' to check that the parsers are K&R. Note
that it does not make sense for glr.c, which should be ANSI,
but currently is actually GNU C, nor for lalr1.cc, which anyway is
not exercised yet in the test suite.
but currently is actually GNU C, nor for lalr1.cc.
* Release Procedure
@@ -89,35 +97,83 @@ This covers PO files too. Sometimes a PO file contains problems that
causes it to be rejected by recent Gettext releases; please report
these to the Translation Project.
** Update README
Make sure the information in this file is current. Most notably, make sure it
recommends a version of GNU M4 that is compatible with the latest Bison
sources.
** Update NEWS
The version number, *and* the date of the release (including for
betas).
** Update ChangeLog
Should have an entry similar to `Version 1.49b.'.
Check all this in once `make distcheck' passes.
** Update configure.ac
Be sure PACKAGE_COPYRIGHT_YEAR is up-to-date.
** Tag the release
Before Bison will build with the right version number, you must tag the release
in git. Do this after all other changes. The command is similar to:
git tag -a v2.3b
The log message can be simply:
Bison 2.3b
** Push
Once `make distcheck' passes, push your changes and the tag.
`git push' without arguments will not push the tag.
** make alpha
FIXME: `make alpha' is not maintained and is broken. These
instructions need to be replaced or removed.
Running `make alpha' is absolutely perfect for beta releases: it makes
the tarballs, the xdeltas, and prepares (in /tmp/) a proto
announcement. It is so neat, that that's what I use anyway for
genuine releases, but adjusting things by hand (e.g., the urls in the
announcement file, the ChangeLog which is not needed etc.).
FIXME: `make alpha' is not maintained and is broken. These
instructions need to be replaced or removed.
If it fails, you're on your own...
It requires GNU Make.
** Upload
Put the tarballs/xdeltas where they should be. Or put it somewhere,
and send the URL to [email protected].
The generic GNU upload procedure is at:
** Bump the version number
In configure.ac. Run `make', check this in.
http://www.gnu.org/prep/maintain/maintain.html#Automated-FTP-Uploads
After following the instructions there to register your information so you're
permitted to upload, here's a brief reminder of how to roll the tarballs and
upload them:
*** make distcheck
*** gpg -b bison-2.3b.tar.gz
*** In a file named `bison-2.3b.tar.gz.directive', type:
version: 1.1
directory: bison
filename: bison-2.3b.tar.gz
*** gpg --clearsign bison-2.3b.tar.gz.directive
*** ftp ftp-upload.gnu.org # Log in as anonymous.
*** cd /incoming/alpha # cd /incoming/ftp for full release.
*** put bison-2.3b.tar.gz # This can take a while.
*** put bison-2.3b.tar.gz.sig
*** put bison-2.3b.tar.gz.directive.asc
*** Repeat all these steps for bison-2.3b.tar.bz2.
** Announce
To generate a template announcement file:
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
where alpha can be replaced by beta or major and F125BDF3 should be replaced
with your key ID. For an example of how to fill out the template, search the
mailing list archives for the most recent release announcement.
Complete/fix the announcement file, and send it at least to
[email protected] (if a real release, or a ``serious beta''),
[email protected], [email protected], [email protected],
@@ -128,6 +184,14 @@ email to [email protected]. Do not make any Cc as the moderator will
throw away anything cross-posted or Cc'ed. It really needs to be a
separate message.
** Bump the version number
In configure.ac. Run `make'. So that developers don't accidentally add new
items to the old NEWS entry, create a new empty NEWS entry something like:
Changes in version ?.? (????-??-??):
Push these changes.
-----
+17 -2
View File
@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
## Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
@@ -23,7 +23,7 @@ SUBDIRS = build-aux po runtime-po lib data src doc examples tests etc
aclocaldir = @aclocaldir@
aclocal_DATA = m4/bison-i18n.m4
EXTRA_DIST = GNUmakefile Makefile.cfg Makefile.maint \
EXTRA_DIST = .prev-version .version cfg.mk maint.mk \
OChangeLog PACKAGING \
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
@@ -42,3 +42,18 @@ maintainer-push-check:
.PHONY: maintainer-xml-check
maintainer-xml-check:
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
# See comments in build-aux/git-version-gen. However, we make .version depend
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
# working copy (for example, when you run autoreconf && make). Allowing these
# to fall out of sync appears to have little potential to improve Bison build
# efficiency (even if we were to replace VERSION/PACKAGE_VERSION with .version
# everywhere possible). On the other hand, it could be harmful. For example,
# a developer might naively reference .version in a test case while the bison
# executable still compiles with VERSION, and so the test case might fail or
# pass incorrectly.
BUILT_SOURCES = $(top_srcdir)/.version
$(top_srcdir)/.version: configure
echo $(VERSION) > $@-t && mv $@-t $@
dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version
-637
View File
@@ -1,637 +0,0 @@
# -*-Makefile-*-
# This Makefile fragment is shared between the coreutils,
# CPPI, Bison, and Autoconf.
## Copyright (C) 2001-2006 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This is reported not to work with make-3.79.1
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ME := Makefile.maint
# Do not save the original name or timestamp in the .tar.gz file.
# Use --rsyncable if available.
gzip_rsyncable = \
(gzip --help|grep rsyncable) >/dev/null 2>&1 && echo --rsyncable
GZIP_ENV = "--no-name --best `$(gzip_rsyncable)`"
CVS = cvs
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
CVS_LIST = sh -c ' \
if test -x $(srcdir)/build-aux/cvsu; then \
$(srcdir)/build-aux/cvsu --find --types=AFGM $$*; \
else \
awk -F/ '\''{ \
if (!$$1 && $$3 !~ /^-/) { \
f=FILENAME; \
sub(/CVS\/Entries/, "", f); \
print f $$2; \
}}'\'' \
$$(find $${*-*} -name Entries -print) /dev/null; \
fi \
' dummy
CVS_LIST_EXCEPT = \
$(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
ifeq ($(origin prev_version_file), undefined)
prev_version_file = .prev-version
endif
PREV_VERSION := $(shell cat $(prev_version_file))
VERSION_REGEXP = $(subst .,\.,$(VERSION))
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
tag-this-version = $(subst .,_,$(VERSION))
this-cvs-tag = $(tag-package)-$(tag-this-version)
my_distdir = $(PACKAGE)-$(VERSION)
# Old releases are stored here.
# Used for diffs and xdeltas.
release_archive_dir ?= ../release
# Prevent programs like 'sort' from considering distinct strings to be equal.
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
export LC_ALL = C
## --------------- ##
## Sanity checks. ##
## --------------- ##
# FIXME: add a check to prohibit definition in src/*.c of symbols defined
# in system.h. E.g. today I removed from tail.c a useless definition of
# ENOSYS. It was useless because system.h ensures it's defined.
# Checks that don't require cvs.
# Run `changelog-check' last, as previous test may reveal problems requiring
# new ChangeLog entries.
local-checks-available = \
po-check copyright-check writable-files m4-check author_mark_check \
changelog-check strftime-check $(syntax-check-rules) \
makefile_path_separator_check \
makefile-check
.PHONY: $(local-checks-available)
local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available))
.PHONY: $(syntax-check-rules)
syntax-check-rules = \
sc_cast_of_argument_to_free \
sc_cast_of_x_alloc_return_value \
sc_cast_of_alloca_return_value \
sc_changelog \
sc_dd_max_sym_length \
sc_error_exit_success \
sc_file_system \
sc_no_if_have_config_h \
sc_obsolete_symbols \
sc_prohibit_atoi_atof \
sc_prohibit_jm_in_m4 \
sc_prohibit_assert_without_use \
sc_require_config_h \
sc_root_tests \
sc_space_tab \
sc_sun_os_names \
sc_system_h_headers \
sc_tight_scope \
sc_trailing_blank \
sc_two_space_separator_in_usage \
sc_unmarked_diagnostics \
sc_useless_cpp_parens
syntax-check: $(syntax-check-rules)
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
# $$(find -type f -name '*.[chly]') && \
# { echo '$(ME): found conditional include' 1>&2; \
# exit 1; } || :
# grep -nE '^# *include <(string|stdlib)\.h>' \
# $(srcdir)/{lib,src}/*.[chy] && \
# { echo '$(ME): FIXME' 1>&2; \
# exit 1; } || :
# FIXME: don't allow `#include .strings\.h' anywhere
sc_cast_of_argument_to_free:
@grep -nE '\<free \(\(' $(srcdir)/{lib,src}/*.[chly] && \
{ echo '$(ME): don'\''t cast free argument' 1>&2; \
exit 1; } || :
sc_cast_of_x_alloc_return_value:
@grep -nE --exclude=$(srcdir)/lib/regex.c \
'\*\) *x(m|c|re)alloc\>' \
$(srcdir)/{lib,src}/*.[chy] && \
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
exit 1; } || :
sc_cast_of_alloca_return_value:
@grep -nE '\*\) *alloca\>' \
$(srcdir)/src/*.[chy] && \
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
exit 1; } || :
sc_space_tab:
@grep -n '[ ] ' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
1>&2; exit 1; } || :
# Don't use the old ato* functions in `real' code.
# They provide no error checking mechanism.
# Instead, use strto* functions.
sc_prohibit_atoi_atof:
@grep -nE '\<ato([filq]|ll)\>' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \
1>&2; exit 1; } || :
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success:
@grep -nF 'error (EXIT_SUCCESS,' \
$$(find -type f -name '*.[chly]') && \
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
exit 1; } || :
sc_file_system:
@grep -ni 'file''system' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found use of "file''system";' \
'rewrite to use "file system"' 1>&2; \
exit 1; } || :
sc_no_if_have_config_h:
@grep -n '^# *if HAVE_CONFIG_H' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef' \
1>&2; exit 1; } || :
# Nearly all .c files must include <config.h>.
sc_require_config_h:
@grep -L '^# *include <config\.h>' \
$$($(CVS_LIST_EXCEPT) | grep '\.c$$') \
| grep . && \
{ echo '$(ME): the above files do not include <config.h>' \
1>&2; exit 1; } || :
# Prohibit the inclusion of assert.h without an actual use of assert.
sc_prohibit_assert_without_use:
@files=$$(grep -l '# *include <assert\.h>' \
$$($(CVS_LIST_EXCEPT) | grep '\.c$$')) && \
grep -L '\<assert (' $$files \
| grep . && \
{ echo "$(ME): the above files include <assert.h> but don't use it" \
1>&2; exit 1; } || :
sc_obsolete_symbols:
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
$$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
1>&2; exit 1; } || :
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
# Each nonempty line must start with a year number, or a TAB.
sc_changelog:
@grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
exit 1; } || :
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
# with the strings from the two affected variables.
dd_c = $(srcdir)/src/dd.c
sc_dd_max_sym_length:
ifneq ($(wildcard $(dd_c)),)
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
| wc --max-line-length); \
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|tr -d '"' | wc --max-line-length); \
if test "$$len" = "$$max"; then :; else \
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
exit 1; \
fi
endif
# Many m4 macros names once began with `jm_'.
# On 2004-04-13, they were all changed to start with gl_ instead.
# Make sure that none are inadvertently reintroduced.
sc_prohibit_jm_in_m4:
@grep -nE 'jm_[A-Z]' \
$$($(CVS_LIST) $(srcdir)/m4 |grep '\.m4$$') && \
{ echo '$(ME): do not use jm_ in m4 macro names' \
1>&2; exit 1; } || :
sc_root_tests:
@t1=sc-root.expected; t2=sc-root.actual; \
grep -nl '^PRIV_CHECK_ARG=require-root' \
$$($(CVS_LIST) tests) |sed s,tests,., |sort > $$t1; \
sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
$(srcdir)/tests/Makefile.am |sort > $$t2; \
diff -u $$t1 $$t2 || diff=1; \
rm -f $$t1 $$t2; \
test "$$diff" \
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
exit 1; } || :
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
| grep -Ev 'sys/(param|file)\.h' \
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
> $@-t
@mv $@-t $@
# Files in src/ should not include directly any of
# the headers already included via system.h.
sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
grep -nE -f .re-list \
$$($(CVS_LIST) src | \
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
&& { echo '$(ME): the above are already included via system.h'\
1>&2; exit 1; } || :; \
fi
sc_sun_os_names:
@grep -nEi \
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
$$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
exit 1; } || :
sc_tight_scope:
$(MAKE) -C src $@
sc_trailing_blank:
@grep -n '[ ]$$' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found trailing blank(s)' \
1>&2; exit 1; } || :
sc_two_space_separator_in_usage:
@grep -n '^ *--[a-z][0-9A-Za-z-]* [^ ].*\\$$' \
$$($(CVS_LIST_EXCEPT)) && \
{ echo "$(ME): help2man requires at least two spaces between"; \
echo "$(ME): an option and its description"; \
1>&2; exit 1; } || :
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
sc_unmarked_diagnostics:
@grep -nE \
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \
| grep -v '_''(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
# Avoid useless parentheses like those in this example:
# #if defined (SYMBOL) || defined (SYM2)
sc_useless_cpp_parens:
@grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found useless parentheses in cpp directive' \
1>&2; exit 1; } || :
# Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N,
# which date accepts but GNU strftime does not.
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
strftime-check:
if test -f $(srcdir)/src/date.c; then \
grep '^ %. ' $(srcdir)/src/date.c | sort \
| $(extract_char) > $@-src; \
{ echo N; \
info libc date calendar format | grep '^ `%.'\' \
| $(extract_char); } | sort > $@-info; \
diff -u $@-src $@-info || exit 1; \
rm -f $@-src $@-info; \
fi
# Ensure that we use only the standard $(VAR) notation,
# not @...@ in Makefile.am, now that we can rely on automake
# to emit a definition for each substituted variable.
makefile-check:
grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
&& { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || :
news-date-check: NEWS
today=`date +%Y-%m-%d`; \
if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
>/dev/null; then \
:; \
else \
echo "version or today's date is not in NEWS" 1>&2; \
exit 1; \
fi
changelog-check:
if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
>/dev/null; then \
:; \
else \
echo "$(VERSION) not in ChangeLog" 1>&2; \
exit 1; \
fi
m4-check:
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
&& { echo 'Makefile.maint: quote the first arg to AC_DEFUN' 1>&2; \
exit 1; } || :
# Verify that all source files using _() are listed in po/POTFILES.in.
# FIXME: don't hard-code file names below; use a more general mechanism.
po-check:
if test -f po/POTFILES.in; then \
grep -E -v '^(#|$$)' po/POTFILES.in \
| grep -v '^src/false\.c$$' | sort > $@-1; \
files=; \
for file in $$($(CVS_LIST_EXCEPT)) lib/*.[ch]; do \
case $$file in \
djgpp/* | man/*) continue;; \
esac; \
case $$file in \
*.[ch]) \
base=`expr " $$file" : ' \(.*\)\..'`; \
{ test -f $$base.l || test -f $$base.y; } && continue;; \
esac; \
files="$$files $$file"; \
done; \
grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2; \
diff -u $@-1 $@-2 || exit 1; \
rm -f $@-1 $@-2; \
fi
# In a definition of #define AUTHORS "... and ..." where the RHS contains
# the English word `and', the string must be marked with `N_ (...)' so that
# gettext recognizes it as a string requiring translation.
author_mark_check:
@grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
{ echo 'Makefile.maint: enclose the above strings in N_ (...)' 1>&2; \
exit 1; } || :
# Sometimes it is useful to change the PATH environment variable
# in Makefiles. When doing so, it's better not to use the Unix-centric
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
# and there probably aren't many projects with so many Makefile.am files
# that we'd have to worry about limits on command line length.
msg = 'Makefile.maint: Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
makefile_path_separator_check:
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
&& { echo $(msg) 1>&2; exit 1; } || :
# Check that `make alpha' will not fail at the end of the process.
writable-files:
if test -d $(release_archive_dir); then :; else \
mkdir $(release_archive_dir); \
fi
for file in $(distdir).tar.gz $(xd-delta) \
$(release_archive_dir)/$(distdir).tar.gz \
$(release_archive_dir)/$(xd-delta); do \
test -e $$file || continue; \
test -w $$file \
|| { echo ERROR: $$file is not writable; fail=1; }; \
done; \
test "$$fail" && exit 1 || :
v_etc_file = lib/version-etc.c
# Make sure that the copyright date in $(v_etc_file) is up to date.
copyright-check:
@if test -f $(v_etc_file); then \
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
>/dev/null \
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
exit 1; }; \
fi
# Sanity checks with the CVS repository.
cvs-tag-check:
echo $(this-cvs-tag); \
if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
exit 1; \
else :; fi
cvs-diff-check:
if $(CVS) diff >cvs-diffs; then \
rm cvs-diffs; \
else \
echo "Some files are locally modified:" 1>&2; \
cat cvs-diffs; \
exit 1; \
fi
cvs-check: cvs-diff-check cvs-tag-check
maintainer-distcheck: changelog-check
$(MAKE) distcheck
$(MAKE) my-distcheck
# Tag before making distribution. Also, don't make a distribution if
# checks fail. Also, make sure the NEWS file is up-to-date.
# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
cvs-dist: $(local-check) cvs-check maintainer-distcheck
$(CVS) update po
$(CVS) tag -c $(this-cvs-tag)
$(MAKE) dist
# Use this to make sure we don't run these programs when building
# from a virgin tgz file, below.
null_AM_MAKEFLAGS = \
ACLOCAL=false \
AUTOCONF=false \
AUTOMAKE=false \
AUTOHEADER=false \
MAKEINFO=false
# Detect format-string/arg-list mismatches that would normally be obscured
# by the use of _(). The --disable-nls effectively defines away that macro,
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be
# treated as a failure. Also, check for shadowing problems with -Wshadow.
# These CFLAGS are pretty strict. If you build this target, you probably
# have to have a recent version of gcc and glibc headers.
TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test
my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
-rm -rf $(t)
mkdir -p $(t)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \
&& ./configure --disable-nls \
&& $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow' \
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \
&& $(MAKE) check \
&& $(MAKE) distclean
(cd $(t) && mv $(distdir) $(distdir).old \
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
-rm -rf $(t)
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
echo "========================"
WGET = wget
WGETFLAGS = -C off
rel-check:
tarz=/tmp/rel-check-tarz-$$$$; \
md5_tmp=/tmp/rel-check-md5-$$$$; \
set -e; \
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
$(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \
echo "$(md5) -" > $$md5_tmp; \
md5sum -c $$md5_tmp < $$tarz
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
rel-files = $(xd-delta) $(DIST_ARCHIVES)
announcement: NEWS ChangeLog $(rel-files)
@./announce-gen \
--release-type=$(RELEASE_TYPE) \
--package=$(PACKAGE) \
--prev=$(PREV_VERSION) \
--curr=$(VERSION) \
--release-archive-directory=$(release_archive_dir) \
--gpg-key-id=$(gpg_key_ID) \
--news=NEWS \
$(addprefix --url-dir=, $(url_dir_list)) \
## ---------------- ##
## Updating files. ##
## ---------------- ##
ftp-gnu = ftp://ftp.gnu.org/gnu
www-gnu = http://www.gnu.org
# Use mv, if you don't have/want move-if-change.
move_if_change ?= move-if-change
# --------------------- #
# Updating everything. #
# --------------------- #
.PHONY: update
local_updates ?= wget-update cvs-update po-update
update: $(local_updates)
# ------------------- #
# Updating PO files. #
# ------------------- #
po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
.PHONY: do-po-update po-update
do-po-update:
tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
rm -rf $$tmppo && \
mkdir $$tmppo && \
(cd $$tmppo && \
$(WGET) $(WGETFLAGS) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
cp $$tmppo/*.po po
cd po && $(MAKE) update-po
$(MAKE) po-check
po-update:
if test -d "po"; then \
$(MAKE) do-po-update; \
fi
# -------------------------- #
# Updating GNU build tools. #
# -------------------------- #
# The following pseudo table associates a local directory and a URL
# with each of the files that belongs to some other package and is
# regularly updated from the specified URL.
wget_files ?= \
$(srcdir)/build-aux/config.guess \
$(srcdir)/build-aux/config.sub \
$(srcdir)/build-aux/texinfo.tex \
$(srcdir)/src/ansi2knr.c
get-targets = $(patsubst %, get-%, $(wget_files))
config.guess-url_prefix = $(ftp-gnu)/build-aux/
config.sub-url_prefix = $(ftp-gnu)/build-aux/
ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
standards.texi-url_prefix = $(www-gnu)/prep/
make-stds.texi-url_prefix = $(standards.texi-url_prefix)
target = $(patsubst get-%, %, $@)
url = $($(notdir $(target))-url_prefix)$(notdir $(target))
.PHONY: $(get-targets)
$(get-targets):
$(WGET) $(WGETFLAGS) $(url) -O $(target).t \
&& $(move_if_change) $(target).t $(target)
cvs_files ?= \
$(srcdir)/build-aux/depcomp \
$(srcdir)/build-aux/install-sh \
$(srcdir)/build-aux/missing \
$(srcdir)/build-aux/mkinstalldirs \
$(srcdir)/src/ansi2knr.c
automake_repo=:pserver:anoncvs:[email protected]:/cvs/automake
.PHONY: wget-update
wget-update: $(get-targets)
.PHONY: cvs-update
cvs-update:
fail=; \
for f in $(cvs_files); do \
test -f $$f || { echo "*** skipping $$f" 1>&2; continue; }; \
cvs diff $$f > /dev/null \
|| { echo "*** $$f is locally modified; skipping it" 1>&2; \
fail=yes; continue; }; \
file=$$(basename $$f); \
echo checking out $$file...; \
$(CVS) -d $(automake_repo) co -p automake/lib/$$file> $$f.t \
&& $(move_if_change) $$f.t $$f; \
done; \
test "$$fail" && exit 1
emit_upload_commands:
@echo =====================================
@echo =====================================
@echo "$(srcdir)/gnupload $(GNUPLOADFLAGS) \\"
@echo " --to $(gnu_rel_host):coreutils \\"
@echo " $(rel-files)"
@echo '# send the /tmp/announcement e-mail'
@echo =====================================
@echo =====================================
$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
xdelta delta -9 $^ $@ || :
.PHONY: alpha beta major
alpha beta major: news-date-check $(local-check)
$(MAKE) cvs-dist
$(MAKE) $(xd-delta)
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
ln $(rel-files) $(release_archive_dir)
chmod a-w $(rel-files)
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
echo $(VERSION) > $(prev_version_file)
$(CVS) ci -m. $(prev_version_file)
+18 -3
View File
@@ -1,6 +1,21 @@
Bison News
----------
Changes in version 2.4 (2008-11-02):
* %language is an experimental feature.
We first introduced this feature in test release 2.3b as a cleaner
alternative to %skeleton. Since then, we have discussed the possibility of
modifying its effect on Bison's output file names. Thus, in this release,
we consider %language to be an experimental feature that will likely evolve
in future releases.
* Forward compatibility with GNU M4 has been improved.
* Several bugs in the C++ skeleton and the experimental Java skeleton have been
fixed.
Changes in version 2.3b (2008-05-27):
* The quotes around NAME that used to be required in the following directive
@@ -49,9 +64,9 @@ Changes in version 2.3b (2008-05-27):
* %language
This new directive specifies the programming language of the generated
parser, which can be C (the default), C++, or Java. This directive affects
the skeleton used and the names of the generated files if the grammar file's
name ends in ".y".
parser, which can be C (the default), C++, or Java. Besides the skeleton
that Bison uses, the directive affects the names of the generated files if
the grammar file's name ends in ".y".
* XML Automaton Report
+11 -7
View File
@@ -1,16 +1,20 @@
This directory contains the Bison parser generator.
This package contains the GNU Bison parser generator.
See the file INSTALL for generic compilation and installation instructions.
See the file doc/FAQ for frequently asked questions.
Bison requires GNU m4 1.4.3 or later. See:
See the section FAQ in the documentation (doc/bison.info) for
frequently asked questions. The documentation is also available in
PDF and HTML, provided you have a recent version of Texinfo installed:
run "make pdf" or "make html".
ftp://ftp.gnu.org/gnu/m4/m4-1.4.3.tar.gz
Bison requires GNU m4 1.4.6 or later. See:
Bison can work with pre-1.4.3 distributions of GNU m4 if they are
ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
Bison can work with pre-1.4.6 distributions of GNU m4 if they are
sufficiently patched, but if you encounter a bug with an older
distribution and report a bug we will probably suggest that you
upgrade to 1.4.3 as the first step in trying to fix it.
upgrade to 1.4.6 as the first step in trying to fix it.
Please send bug reports to <[email protected]>. Please include the
version number from `bison --version', and a complete, self-contained
@@ -21,7 +25,7 @@ not answer them, please send mail to <[email protected]>.
-----
Copyright (C) 1992, 1998, 1999, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 1992, 1998, 1999, 2003, 2004, 2005, 2008 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+3
View File
@@ -25,6 +25,7 @@ Cris van Pelt [email protected]
Daniel Hagerty [email protected]
David J. MacKenzie [email protected]
Derek M. Jones [email protected]
Di-an Jan [email protected]
Dick Streefland [email protected]
Enrico Scholz [email protected]
Eric Blake [email protected]
@@ -33,6 +34,8 @@ Fabrice Bauzac [email protected]
Florian Krohm [email protected]
Frank Heckenbach [email protected]
Frans Englich [email protected]
Georg Sauthoff [email protected]
Goran Uddeborg [email protected]
Guido Trentalancia [email protected]
H. Merijn Brand [email protected]
Hans Aberg [email protected]
+35 -6
View File
@@ -211,7 +211,7 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
exit 1
fi
# If $STR is not already on a line by itself in $FILE, insert it,
# If each line in $STR is not already on a line by itself in $FILE, insert it,
# sorting the new contents of the file and replacing $FILE with the result.
insert_sorted_if_absent() {
file=$1
@@ -222,6 +222,21 @@ insert_sorted_if_absent() {
|| exit 1
}
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
# insert_sorted_if_absent.
insert_vc_ignore() {
vc_ignore_file="$1"
case $vc_ignore_file in
*.gitignore)
# A .gitignore entry that does not start with `/' applies recursively to
# subdirectories, so prepend `/' to every .gitignore entry.
pattern=`echo "$2" | sed s,^,/,`;;
*)
pattern="$2";;
esac
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
}
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
found_aux_dir=no
grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
@@ -240,7 +255,7 @@ if test ! -d $build_aux; then
mkdir $build_aux
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
insert_sorted_if_absent $dot_ig $build_aux
insert_vc_ignore $dot_ig $build_aux
done
fi
@@ -252,6 +267,20 @@ cleanup_gnulib() {
exit $status
}
# See if we can use gnulib's git-merge-changelog merge driver.
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
if git config merge.merge-changelog.driver >/dev/null ; then
:
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
echo "initializing git-merge-changelog driver"
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
else
echo "consider installing git-merge-changelog from gnulib"
fi
fi
# Get gnulib files.
case ${GNULIB_SRCDIR--} in
@@ -350,7 +379,7 @@ check_dst_dir()
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
ig=$parent/$dot_ig
insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'`
done
fi
}
@@ -507,18 +536,18 @@ slurp() {
test $dot_ig = x && continue
ig=$dir/$dot_ig
if test -n "$copied"; then
insert_sorted_if_absent $ig "$copied"
insert_vc_ignore $ig "$copied"
# If an ignored file name ends with _.h, then also add
# the name with just ".h". Many gnulib headers are generated,
# e.g., stdint_.h -> stdint.h, dirent_.h ->..., etc.
# Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
f=`echo "$copied"|sed 's/_\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
insert_sorted_if_absent $ig "$f"
insert_vc_ignore $ig "$f"
# For files like sys_stat_.h and sys_time_.h, record as
# ignorable the directory we might eventually create: sys/.
f=`echo "$copied"|sed 's/sys_.*_\.h$/sys/'`
insert_sorted_if_absent $ig "$f"
insert_vc_ignore $ig "$f"
fi
done
done
+9 -5
View File
@@ -17,12 +17,12 @@
# gnulib modules used by this package.
gnulib_modules='
argmatch config-h c-strcase configmake
dirname error extensions fopen-safer git-version-gen
getopt gettext hash inttypes javacomp-script javaexec-script malloc
announce-gen argmatch config-h c-strcase configmake
dirname error extensions fopen-safer getopt gettext git-version-gen
gnumakefile hash inttypes javacomp-script javaexec-script malloc
mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
strverscmp unistd unistd-safer unlocked-io verify xalloc xalloc-die
xstrndup
strverscmp unistd unistd-safer unlocked-io unsetenv verify xalloc
xalloc-die xstrndup
'
# Any gnulib files needed that are not in modules.
@@ -65,3 +65,7 @@ excluded_files='
m4/visibility.m4
m4/xsize.m4
'
# In directories like lib/, m4/, and po/, generate both these files because we
# still try to support CVS emulation.
vc_ignore='.cvsignore .gitignore'
+1
View File
@@ -1,5 +1,6 @@
Makefile
Makefile.in
announce-gen
compile
config.guess
config.rpath
+17
View File
@@ -0,0 +1,17 @@
/Makefile
/Makefile.in
/announce-gen
/compile
/config.guess
/config.rpath
/config.sub
/depcomp
/git-version-gen
/install-sh
/javacomp.sh.in
/javaexec.sh.in
/link-warning.h
/mdate-sh
/missing
/texinfo.tex
/ylwrap
+12 -5
View File
@@ -1,19 +1,26 @@
# Customize Makefile.maint. -*- makefile -*-
# Copyright (C) 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
# Customize maint.mk -*- makefile -*-
# Copyright (C) 2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# It's useful to run maintainer-check* targets during development, but we don't
# want to wait on a recompile because of an update to $(VERSION). Thus,
# override the _is-dist-target from GNUmakefile so that maintainer-check*
# targets are filtered out.
_is-dist-target = $(filter-out %clean maintainer-check%, \
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
# Use alpha.gnu.org for alpha and beta releases.
# Use ftp.gnu.org for major releases.
gnu_ftp_host-alpha = alpha.gnu.org
@@ -32,4 +39,4 @@ local-checks-to-skip = changelog-check
# The local directory containing the checked-out copy of gnulib used in
# this release. Used solely to get a date for the "announcement" target.
gnulib_dir = /gnulib
gnulib_dir = $(srcdir)/../../gnulib
+9 -4
View File
@@ -19,7 +19,9 @@
# We have strange test case titles, so we need Autoconf 2.61 or better.
AC_PREREQ(2.61)
AC_INIT([GNU Bison], [2.3b], [[email protected]])
AC_INIT([GNU Bison],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[[email protected]])
AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2008],
[The copyright year for this package])
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2008])
@@ -28,7 +30,11 @@ AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
# We don't have a file m4/Makefile.am, so we need Automake 1.8 or later.
AM_INIT_AUTOMAKE([1.8 check-news readme-alpha dist-bzip2])
# We want gnits strictness only when rolling a formal release so that we can,
# for example, run make dist at other times without being required to add a
# bogus NEWS entry.
AM_INIT_AUTOMAKE([1.8 dist-bzip2]
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [-], [gnu], [gnits]))
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
# Checks for the compiler.
@@ -142,8 +148,7 @@ AC_SUBST([O0CXXFLAGS], [`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`])
gt_JAVACOMP([1.3])
gt_JAVAEXEC
AC_CONFIG_FILES([.version
Makefile
AC_CONFIG_FILES([Makefile
build-aux/Makefile
po/Makefile.in
data/Makefile
+2
View File
@@ -0,0 +1,2 @@
/Makefile.in
/Makefile
+1 -1
View File
@@ -19,7 +19,7 @@ dist_pkgdata_DATA = README bison.m4 \
java-skel.m4 java.m4 lalr1.java
m4sugardir = $(pkgdatadir)/m4sugar
dist_m4sugar_DATA = m4sugar/m4sugar.m4
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/foreach.m4
xsltdir = $(pkgdatadir)/xslt
dist_xslt_DATA = \
+1 -1
View File
@@ -550,7 +550,7 @@ m4_define([b4_check_user_names_wrap],
[b4_percent_]$1[_user_]$2[s],
[[b4_percent_]$1[_bison_]$2[s]])])])
m4_wrap([
m4_wrap_lifo([
b4_check_user_names_wrap([[define]], [[variable]])
b4_check_user_names_wrap([[code]], [[qualifier]])
])
+1 -1
View File
@@ -2,7 +2,7 @@
# C++ skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
# Inc.
# This program is free software: you can redistribute it and/or modify
+16 -12
View File
@@ -1,7 +1,8 @@
-*- Autoconf -*-
# C M4 Macros for Bison.
# Copyright (C) 2002, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
# Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -89,7 +90,7 @@ b4_parse_param)
# the formal name to FORMAL, and evaluating the BODY.
m4_define([b4_parse_param_for],
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
[m4_pushdef([$1], m4_fst($1_$2))dnl
[m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
m4_pushdef([$2], m4_shift($1_$2))dnl
$3[]dnl
m4_popdef([$2])dnl
@@ -132,6 +133,8 @@ m4_define([b4_int_type],
m4_define([b4_int_type_for],
[b4_int_type($1_min, $1_max)])
## ---------##
## Values. ##
## ---------##
@@ -143,6 +146,8 @@ m4_define([b4_int_type_for],
m4_define([b4_null], [0])
## ------------------------- ##
## Assigning token numbers. ##
## ------------------------- ##
@@ -159,7 +164,7 @@ m4_define([b4_token_define],
# -------------------------------------------------------
# Output the definition of the tokens (if there are) as #defines.
m4_define([b4_token_defines],
[m4_if([$@], [[]], [],
[m4_if([$#$1], [1], [],
[/* Tokens. */
m4_map([b4_token_define], [$@])])
])
@@ -176,7 +181,7 @@ m4_define([b4_token_enum],
# -----------------------------------------------------
# Output the definition of the tokens (if there are) as enums.
m4_define([b4_token_enums],
[m4_if([$@], [[]], [],
[m4_if([$#$1], [1], [],
[/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -228,8 +233,8 @@ m4_define([b4_c_function_def],
b4_c_ansi_function_def($@)
#else
$2
$1 (b4_c_knr_formal_names(m4_shiftn(2, $@)))
b4_c_knr_formal_decls(m4_shiftn(2, $@))
$1 (b4_c_knr_formal_names(m4_shift2($@)))
b4_c_knr_formal_decls(m4_shift2($@))
#endif[]dnl
])
@@ -239,7 +244,7 @@ b4_c_knr_formal_decls(m4_shiftn(2, $@))
# Declare the function NAME in ANSI.
m4_define([b4_c_ansi_function_def],
[$2
$1 (b4_c_ansi_formals(m4_shiftn(2, $@)))[]dnl
$1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
])
@@ -247,9 +252,8 @@ $1 (b4_c_ansi_formals(m4_shiftn(2, $@)))[]dnl
# --------------------------------------
# Output the arguments ANSI-C definition.
m4_define([b4_c_ansi_formals],
[m4_case([$@],
[], [void],
[[]], [void],
[m4_if([$#], [0], [void],
[$#$1], [1], [void],
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
m4_define([b4_c_ansi_formal],
@@ -301,7 +305,7 @@ $2 $1 ();
# ----------------------------------------------------------------
# Declare the function NAME.
m4_define([b4_c_ansi_function_decl],
[$2 $1 (b4_c_ansi_formals(m4_shiftn(2, $@)));[]dnl
[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
])
@@ -316,7 +320,7 @@ m4_define([b4_c_ansi_function_decl],
# -----------------------------------------------------------
# Call the function NAME with arguments NAME1, NAME2 etc.
m4_define([b4_c_function_call],
[$1 (b4_c_args(m4_shiftn(2, $@)))[]dnl
[$1 (b4_c_args(m4_shift2($@)))[]dnl
])
+1 -1
View File
@@ -1,7 +1,7 @@
-*- C -*-
# GLR skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
# Inc.
# This program is free software: you can redistribute it and/or modify
+40 -10
View File
@@ -2,7 +2,7 @@
# Java language support for Bison
# Copyright (C) 2007 Free Software Foundation, Inc.
# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,6 +25,23 @@ m4_define([b4_comment], [/* m4_bpatsubst([$1], [
]) */])
# b4_list2(LIST1, LIST2)
# --------------------------
# Join two lists with a comma if necessary.
m4_define([b4_list2],
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
# b4_percent_define_get3(DEF, PRE, POST, NOT)
# -------------------------------------------
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
# otherwise NOT.
m4_define([b4_percent_define_get3],
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
# b4_flag_value(BOOLEAN-FLAG)
# ---------------------------
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
@@ -44,6 +61,20 @@ m4_define([b4_abstract_if],
[b4_percent_define_flag_if([abstract], [$1], [$2])])
# b4_final_if(TRUE, FALSE)
# ---------------------------
b4_percent_define_default([[final]], [[false]])
m4_define([b4_final_if],
[b4_percent_define_flag_if([final], [$1], [$2])])
# b4_strictfp_if(TRUE, FALSE)
# ---------------------------
b4_percent_define_default([[strictfp]], [[false]])
m4_define([b4_strictfp_if],
[b4_percent_define_flag_if([strictfp], [$1], [$2])])
# b4_lexer_if(TRUE, FALSE)
# ------------------------
m4_define([b4_lexer_if],
@@ -53,10 +84,7 @@ m4_define([b4_lexer_if],
# b4_identification
# -----------------
m4_define([b4_identification],
[/** Always <tt>true</tt>, identifies Bison output. */
public static final boolean bison = true;
/** Version number for the Bison executable that generated this parser. */
[ /** Version number for the Bison executable that generated this parser. */
public static final String bisonVersion = "b4_version";
/** Name of the skeleton that generated this parser. */
@@ -75,7 +103,7 @@ m4_define([b4_identification],
m4_define([b4_int_type],
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
b4_ints_in($@, [-32768], [32767]), [1], [short],
[int])])
[int])])
# b4_int_type_for(NAME)
# ---------------------
@@ -106,7 +134,7 @@ m4_define([b4_token_enum],
# -----------------------------------------------------
# Output the definition of the tokens (if there are) as enums.
m4_define([b4_token_enums],
[m4_if([$@], [[]], [],
[m4_if([$#$1], [1], [],
[/* Tokens. */
m4_map([b4_token_enum], [$@])])
])
@@ -128,14 +156,16 @@ m4_define([b4_case], [ case $1:
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
b4_percent_define_default([[stype]], [[Object]])])
m4_define_default([[b4_prefix]], [[YY]])])
# %name-prefix
m4_define_default([b4_prefix], [[YY]])
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])])
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])])
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
b4_percent_define_default([[throws]], [b4_lex_throws])])
b4_percent_define_default([[throws]], [])])
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
b4_percent_define_default([[location_type]], [Location])])
@@ -205,7 +235,7 @@ m4_define([b4_param_decls],
[m4_map([b4_param_decl], [$@])])
m4_define([b4_param_decl], [, $1])
m4_define([b4_remove_comma], [m4_ifval($1, [$1, ], [])m4_shiftn(2, $@)])
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
+17 -9
View File
@@ -1,7 +1,7 @@
# C++ skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
# Inc.
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ m4_divert_push(0)dnl
b4_defines_if(
[@output(b4_spec_defines_file@)
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
[2002, 2003, 2004, 2005, 2006])
[2002, 2003, 2004, 2005, 2006, 2007, 2008])
dnl FIXME: This is wrong, we want computed header guards.
[
/* C++ LALR(1) parser skeleton written by Akim Demaille. */
@@ -130,6 +130,7 @@ b4_user_stype
/// \returns 0 iff parsing succeeded.
virtual int parse ();
#if YYDEBUG
/// The current debugging stream.
std::ostream& debug_stream () const;
/// Set the current debugging stream.
@@ -141,6 +142,7 @@ b4_user_stype
debug_level_type debug_level () const;
/// Set the current debugging level.
void set_debug_level (debug_level_type l);
#endif
private:
/// Report a syntax error.
@@ -298,7 +300,7 @@ b4_percent_code_get([[provides]])[]dnl
])dnl
@output(b4_parser_file_name@)
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++],
[2002, 2003, 2004, 2005, 2006])
[2002, 2003, 2004, 2005, 2006, 2007, 2008])
b4_percent_code_get([[top]])[]dnl
m4_if(b4_prefix, [yy], [],
[
@@ -367,9 +369,13 @@ do { \
#endif /* !YYDEBUG */
#define yyerrok (yyerrstatus_ = 0)
#define yyclearin (yychar = yyempty_)
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
#define YYRECOVERING() (!!yyerrstatus_)
]b4_namespace_open[
#if YYERROR_VERBOSE
@@ -533,7 +539,7 @@ do { \
/// Location of the lookahead.
location_type yylloc;
/// The locations where the error started and ended.
location yyerror_range[2];
location_type yyerror_range[2];
/// $$.
semantic_type yyval;
@@ -670,7 +676,8 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
switch (yyn)
{
]b4_user_actions[
default: break;
default:
break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
@@ -788,7 +795,7 @@ b4_error_verbose_if([, yytoken])[));
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
&yysemantic_stack_[0], &yylocation_stack_[0]);
&yysemantic_stack_[0], &yylocation_stack_[0]);
yystate = yyn;
goto yynewstate;
@@ -1050,7 +1057,7 @@ b4_error_verbose_if([, int tok])[)
dnl
@output(b4_dir_prefix[]stack.hh@)
b4_copyright([Stack handling for Bison parsers in C++],
[2002, 2003, 2004, 2005, 2006])[
[2002, 2003, 2004, 2005, 2006, 2007, 2008])[
#ifndef BISON_STACK_HH
# define BISON_STACK_HH
@@ -1145,5 +1152,6 @@ b4_copyright([Stack handling for Bison parsers in C++],
};
]b4_namespace_close[
#endif // not BISON_STACK_HH]
#endif // not BISON_STACK_HH[]dnl
]
m4_divert_pop(0)
+20 -15
View File
@@ -1,6 +1,6 @@
# Java skeleton for Bison -*- autoconf -*-
# Copyright (C) 2007 Free Software Foundation, Inc.
# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,18 +25,24 @@ m4_ifval(m4_defn([b4_symbol_destructors]),
m4_divert_push(0)dnl
@output(b4_parser_file_name@)
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
[2007])
[2007, 2008])
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
])[/* First part of user declarations. */
]b4_pre_prologue
b4_percent_code_get([[imports]])
[/**
* A Bison parser, automatically generated from <tt>@ofile@</tt>.
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
*
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
*/
]b4_public_if([public ])b4_abstract_if([abstract ])[class ]b4_parser_class_name[
]b4_public_if([public ])dnl
b4_abstract_if([abstract ])dnl
b4_final_if([final ])dnl
b4_strictfp_if([strictfp ])dnl
[class ]b4_parser_class_name[]dnl
b4_percent_define_get3([extends], [ extends ])dnl
b4_percent_define_get3([implements], [ implements ])[
{
]b4_identification[
@@ -57,7 +63,7 @@ b4_locations_if([[
public ]b4_position_type[ end;
/**
* Create a ]b4_location_type[ denoting an empty range located at
* Create a <code>]b4_location_type[</code> denoting an empty range located at
* a given point.
* @@param loc The position at which the range is anchored. */
public ]b4_location_type[ (]b4_position_type[ loc) {
@@ -67,7 +73,7 @@ b4_locations_if([[
/**
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
* @@param begin The first position included in the range.
* @@param begin The first position beyond the range. */
* @@param end The first position beyond the range. */
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
this.begin = begin;
this.end = end;
@@ -99,7 +105,7 @@ b4_token_enums(b4_tokens)
return new ]b4_location_type[ (rhs.locationAt (1).begin, rhs.locationAt (n).end);
else
return new ]b4_location_type[ (rhs.locationAt (0).end);
}]])
}]])[
/**
* Communication interface between the scanner and the Bison-generated
@@ -130,10 +136,9 @@ b4_token_enums(b4_tokens)
/**
* Entry point for error reporting. Emits an error
* ]b4_locations_if([ referring to the given location])[in a user-defined
* way.
* ]b4_locations_if([referring to the given location ])[in a user-defined way.
*
* ]b4_locations_if([loc], [[The location of the element to which the
* ]b4_locations_if([[@@param loc The location of the element to which the
* error message is related]])[
* @@param s The string for the error message. */
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s);]
@@ -160,7 +165,7 @@ b4_lexer_if([[
/**
* Instantiates the Bison-generated parser.
* @@param yylex The scanner that will supply tokens to the parser.
* @@param yylexer The scanner that will supply tokens to the parser.
*/
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) {
this.yylexer = yylexer;
@@ -205,7 +210,7 @@ b4_lexer_if([[
]b4_locations_if([
protected final void yyerror (String s) {
yylexer.yyerror ((Location)null, s);
yylexer.yyerror ((]b4_location_type[)null, s);
}
protected final void yyerror (]b4_position_type[ loc, String s) {
yylexer.yyerror (new ]b4_location_type[ (loc), s);
@@ -325,7 +330,7 @@ b4_lexer_if([[
return yyerrstatus_ == 0;
}
private int yyaction (int yyn, YYStack yystack, int yylen)
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
{
]b4_yystype[ yyval;
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
@@ -414,7 +419,7 @@ b4_lexer_if([[
yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
+ yytname_[yytype] + " ("]b4_locations_if([
+ yylocationp + ": "])[
+ (yyvaluep == null ? "(null)" : yyvaluep) + ")");
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
}
/**
@@ -424,7 +429,7 @@ b4_lexer_if([[
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
* imply that there were no syntax errors.
*/
public boolean parse () ]b4_maybe_throws([b4_throws])[
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
{
/// Lookahead and lookahead in internal form.
int yychar = yyempty_;
+400
View File
@@ -0,0 +1,400 @@
# -*- Autoconf -*-
# This file is part of Autoconf.
# foreach-based replacements for recursive functions.
# Speeds up GNU M4 1.4.x by avoiding quadratic $@ recursion, but penalizes
# GNU M4 1.6 by requiring more memory and macro expansions.
#
# Copyright (C) 2008 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception, the Free Software Foundation gives unlimited
# permission to copy, distribute and modify the configure scripts that
# are the output of Autoconf. You need not follow the terms of the GNU
# General Public License when using or distributing such scripts, even
# though portions of the text of Autoconf appear in them. The GNU
# General Public License (GPL) does govern all other use of the material
# that constitutes the Autoconf program.
#
# Certain portions of the Autoconf source text are designed to be copied
# (in certain cases, depending on the input) into the output of
# Autoconf. We call these the "data" portions. The rest of the Autoconf
# source text consists of comments plus executable code that decides which
# of the data portions to output in any given case. We call these
# comments and executable code the "non-data" portions. Autoconf never
# copies any of the non-data portions into its output.
#
# This special exception to the GPL applies to versions of Autoconf
# released by the Free Software Foundation. When you make and
# distribute a modified version of Autoconf, you may extend this special
# exception to the GPL to apply to your modified version as well, *unless*
# your modified version has the potential to copy into its output some
# of the text that was the non-data portion of the version that you started
# with. (In other words, unless your change moves or copies text from
# the non-data portions to the data portions.) If your modification has
# such potential, you must delete any notice of this special exception
# to the GPL from your modified version.
#
# Written by Eric Blake.
#
# In M4 1.4.x, every byte of $@ is rescanned. This means that an
# algorithm on n arguments that recurses with one less argument each
# iteration will scan n * (n + 1) / 2 arguments, for O(n^2) time. In
# M4 1.6, this was fixed so that $@ is only scanned once, then
# back-references are made to information stored about the scan.
# Thus, n iterations need only scan n arguments, for O(n) time.
# Additionally, in M4 1.4.x, recursive algorithms did not clean up
# memory very well, requiring O(n^2) memory rather than O(n) for n
# iterations.
#
# This file is designed to overcome the quadratic nature of $@
# recursion by writing a variant of m4_foreach that uses m4_for rather
# than $@ recursion to operate on the list. This involves more macro
# expansions, but avoids the need to rescan a quadratic number of
# arguments, making these replacements very attractive for M4 1.4.x.
# On the other hand, in any version of M4, expanding additional macros
# costs additional time; therefore, in M4 1.6, where $@ recursion uses
# fewer macros, these replacements actually pessimize performance.
# Additionally, the use of $10 to mean the tenth argument violates
# POSIX; although all versions of m4 1.4.x support this meaning, a
# future m4 version may switch to take it as the first argument
# concatenated with a literal 0, so the implementations in this file
# are not future-proof. Thus, this file is conditionally included as
# part of m4_init(), only when it is detected that M4 probably has
# quadratic behavior (ie. it lacks the macro __m4_version__).
#
# Please keep this file in sync with m4sugar.m4.
# m4_foreach(VARIABLE, LIST, EXPRESSION)
# --------------------------------------
# Expand EXPRESSION assigning each value of the LIST to VARIABLE.
# LIST should have the form `item_1, item_2, ..., item_n', i.e. the
# whole list must *quoted*. Quote members too if you don't want them
# to be expanded.
#
# This version minimizes the number of times that $@ is evaluated by
# using m4_for to generate a boilerplate into VARIABLE then passing $@
# to that temporary macro. Thus, the recursion is done in m4_for
# without reparsing any user input, and is not quadratic. For an idea
# of how this works, note that m4_foreach(i,[1,2],[i]) defines i to be
# m4_define([$1],[$3])$2[]m4_define([$1],[$4])$2[]m4_popdef([i])
# then calls i([i],[i],[1],[2]).
m4_define([m4_foreach],
[m4_if([$2], [], [], [_$0([$1], [$3], $2)])])
m4_define([_m4_foreach],
[m4_define([$1], m4_pushdef([$1])_m4_for([$1], [3], [$#], [1],
[$0_([1], [2], _m4_defn([$1]))])[m4_popdef([$1])])m4_indir([$1], $@)])
m4_define([_m4_foreach_],
[[m4_define([$$1], [$$3])$$2[]]])
# m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
# -----------------------------------------------------------
# Find the first VAL that SWITCH matches, and expand the corresponding
# IF-VAL. If there are no matches, expand DEFAULT.
#
# Use m4_for to create a temporary macro in terms of a boilerplate
# m4_if with final cleanup. If $# is even, we have DEFAULT; if it is
# odd, then rounding the last $# up in the temporary macro is
# harmless. For example, both m4_case(1,2,3,4,5) and
# m4_case(1,2,3,4,5,6) result in the intermediate _m4_case being
# m4_if([$1],[$2],[$3],[$1],[$4],[$5],_m4_popdef([_m4_case])[$6])
m4_define([m4_case],
[m4_if(m4_eval([$# <= 2]), [1], [$2],
[m4_pushdef([_$0], [m4_if(]m4_for([_m4_count], [2], m4_decr([$#]), [2],
[_$0_([1], _m4_count, m4_incr(_m4_count))])[_m4_popdef(
[_$0])]m4_dquote($m4_eval([($# + 1) & ~1]))[)])_$0($@)])])
m4_define([_m4_case_],
[[[$$1],[$$2],[$$3],]])
# m4_bmatch(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT)
# -----------------------------------------------------
# m4 equivalent of
#
# if (SWITCH =~ RE1)
# VAL1;
# elif (SWITCH =~ RE2)
# VAL2;
# elif ...
# ...
# else
# DEFAULT
#
# We build the temporary macro _m4_b:
# m4_define([_m4_b], _m4_defn([_m4_bmatch]))_m4_b([$1], [$2], [$3])...
# _m4_b([$1], [$m-1], [$m])_m4_b([], [], [$m+1]_m4_popdef([_m4_b]))
# then invoke m4_unquote(_m4_b($@)), for concatenation with later text.
m4_define([m4_bmatch],
[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
[$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
[$#], 2, [$2],
[m4_define([_m4_b], m4_pushdef([_m4_b])[m4_define([_m4_b],
_m4_defn([_$0]))]_m4_for([_m4_b], [3], m4_eval([($# + 1) / 2 * 2 - 1]),
[2], [_$0_([1], m4_decr(_m4_b), _m4_b)])[_m4_b([], [],]m4_dquote(
[$]m4_incr(_m4_b))[_m4_popdef([_m4_b]))])m4_unquote(_m4_b($@))])])
m4_define([_m4_bmatch],
[m4_if(m4_bregexp([$1], [$2]), [-1], [], [[$3]m4_define([$0])])])
m4_define([_m4_bmatch_],
[[_m4_b([$$1], [$$2], [$$3])]])
# m4_cond(TEST1, VAL1, IF-VAL1, TEST2, VAL2, IF-VAL2, ..., [DEFAULT])
# -------------------------------------------------------------------
# Similar to m4_if, except that each TEST is expanded when encountered.
# If the expansion of TESTn matches the string VALn, the result is IF-VALn.
# The result is DEFAULT if no tests passed. This macro allows
# short-circuiting of expensive tests, where it pays to arrange quick
# filter tests to run first.
#
# m4_cond already guarantees either 3*n or 3*n + 1 arguments, 1 <= n.
# We only have to speed up _m4_cond, by building the temporary _m4_c:
# m4_define([_m4_c], _m4_defn([m4_unquote]))_m4_c([m4_if(($1), [($2)],
# [[$3]m4_define([_m4_c])])])_m4_c([m4_if(($4), [($5)],
# [[$6]m4_define([_m4_c])])])..._m4_c([m4_if(($m-2), [($m-1)],
# [[$m]m4_define([_m4_c])])])_m4_c([[$m+1]]_m4_popdef([_m4_c]))
# We invoke m4_unquote(_m4_c($@)), for concatenation with later text.
m4_define([_m4_cond],
[m4_define([_m4_c], m4_pushdef([_m4_c])[m4_define([_m4_c],
_m4_defn([m4_unquote]))]_m4_for([_m4_c], [2], m4_eval([$# / 3 * 3 - 1]), [3],
[$0_(m4_decr(_m4_c), _m4_c, m4_incr(_m4_c))])[_m4_c(]m4_dquote(m4_dquote(
[$]m4_eval([$# / 3 * 3 + 1])))[_m4_popdef([_m4_c]))])m4_unquote(_m4_c($@))])
m4_define([_m4_cond_],
[[_m4_c([m4_if(($$1), [($$2)], [[$$3]m4_define([_m4_c])])])]])
# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...)
# ----------------------------------------------------
# m4 equivalent of
#
# $_ = STRING;
# s/RE1/SUBST1/g;
# s/RE2/SUBST2/g;
# ...
#
# m4_bpatsubsts already validated an odd number of arguments; we only
# need to speed up _m4_bpatsubsts. To avoid nesting, we build the
# temporary _m4_p:
# m4_define([_m4_p], [$1])m4_define([_m4_p],
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$2], [$3]))m4_define([_m4_p],
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$4], [$5]))m4_define([_m4_p],...
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$m-1], [$m]))m4_unquote(
# _m4_defn([_m4_p])_m4_popdef([_m4_p]))
m4_define([_m4_bpatsubsts],
[m4_define([_m4_p], m4_pushdef([_m4_p])[m4_define([_m4_p],
]m4_dquote([$]1)[)]_m4_for([_m4_p], [3], [$#], [2], [$0_(m4_decr(_m4_p),
_m4_p)])[m4_unquote(_m4_defn([_m4_p])_m4_popdef([_m4_p]))])_m4_p($@)])
m4_define([_m4_bpatsubsts_],
[[m4_define([_m4_p],
m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$$1], [$$2]))]])
# m4_shiftn(N, ...)
# -----------------
# Returns ... shifted N times. Useful for recursive "varargs" constructs.
#
# m4_shiftn already validated arguments; we only need to speed up
# _m4_shiftn. If N is 3, then we build the temporary _m4_s, defined as
# ,[$5],[$6],...,[$m]_m4_popdef([_m4_s])
# before calling m4_shift(_m4_s($@)).
m4_define([_m4_shiftn],
[m4_if(m4_incr([$1]), [$#], [], [m4_define([_m4_s],
m4_pushdef([_m4_s])_m4_for([_m4_s], m4_eval([$1 + 2]), [$#], [1],
[[,]m4_dquote([$]_m4_s)])[_m4_popdef([_m4_s])])m4_shift(_m4_s($@))])])
# m4_do(STRING, ...)
# ------------------
# This macro invokes all its arguments (in sequence, of course). It is
# useful for making your macros more structured and readable by dropping
# unnecessary dnl's and have the macros indented properly.
#
# Here, we use the temporary macro _m4_do, defined as
# $1[]$2[]...[]$n[]_m4_popdef([_m4_do])
m4_define([m4_do],
[m4_if([$#], [0], [],
[m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [1], [$#], [1],
[$_$0[[]]])[_m4_popdef([_$0])])_$0($@)])])
# m4_dquote_elt(ARGS)
# -------------------
# Return ARGS as an unquoted list of double-quoted arguments.
#
# m4_foreach to the rescue. It's easier to shift off the leading comma.
m4_define([m4_dquote_elt],
[m4_shift(m4_foreach([_m4_elt], [$@], [,m4_dquote(_m4_defn([_m4_elt]))]))])
# m4_reverse(ARGS)
# ----------------
# Output ARGS in reverse order.
#
# Invoke _m4_r($@) with the temporary _m4_r built as
# [$m], [$m-1], ..., [$2], [$1]_m4_popdef([_m4_r])
m4_define([m4_reverse],
[m4_if([$#], [0], [], [$#], [1], [[$1]],
[m4_define([_m4_r], m4_dquote([$$#])m4_pushdef([_m4_r])_m4_for([_m4_r],
m4_decr([$#]), [1], [-1],
[[, ]m4_dquote([$]_m4_r)])[_m4_popdef([_m4_r])])_m4_r($@)])])
# m4_map(MACRO, LIST)
# -------------------
# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements
# of LIST. $1, $2... must in turn be lists, appropriate for m4_apply.
#
# m4_map/m4_map_sep only execute once; the speedup comes in fixing
# _m4_map. The mismatch in () is intentional, since $1 supplies the
# opening `(' (but it sure looks odd!). Build the temporary _m4_m:
# $1, [$3])$1, [$4])...$1, [$m])_m4_popdef([_m4_m])
m4_define([_m4_map],
[m4_if([$#], [2], [],
[m4_define([_m4_m], m4_pushdef([_m4_m])_m4_for([_m4_m], [3], [$#], [1],
[$0_([1], _m4_m)])[_m4_popdef([_m4_m])])_m4_m($@)])])
m4_define([_m4_map_],
[[$$1, [$$2])]])
# m4_transform(EXPRESSION, ARG...)
# --------------------------------
# Expand EXPRESSION([ARG]) for each argument. More efficient than
# m4_foreach([var], [ARG...], [EXPRESSION(m4_defn([var]))])
#
# Invoke the temporary macro _m4_transform, defined as:
# $1([$2])[]$1([$3])[]...$1([$m])[]_m4_popdef([_m4_transform])
m4_define([m4_transform],
[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
[$#], [1], [],
[m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [2], [$#], [1],
[_$0_([1], _$0)])[_m4_popdef([_$0])])_$0($@)])])
m4_define([_m4_transform_],
[[$$1([$$2])[]]])
# m4_transform_pair(EXPRESSION, [END-EXPR = EXPRESSION], ARG...)
# --------------------------------------------------------------
# Perform a pairwise grouping of consecutive ARGs, by expanding
# EXPRESSION([ARG1], [ARG2]). If there are an odd number of ARGs, the
# final argument is expanded with END-EXPR([ARGn]).
#
# Build the temporary macro _m4_transform_pair, with the $2([$m+1])
# only output if $# is odd:
# $1([$3], [$4])[]$1([$5], [$6])[]...$1([$m-1],
# [$m])[]m4_default([$2], [$1])([$m+1])[]_m4_popdef([_m4_transform_pair])
m4_define([m4_transform_pair],
[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
[$#], [1], [m4_fatal([$0: too few arguments: $#: $1])],
[$#], [2], [],
[$#], [3], [m4_default([$2], [$1])([$3])[]],
[m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [3],
m4_eval([$# / 2 * 2 - 1]), [2], [_$0_([1], _$0, m4_incr(_$0))])_$0_end(
[1], [2], [$#])[_m4_popdef([_$0])])_$0($@)])])
m4_define([_m4_transform_pair_],
[[$$1([$$2], [$$3])[]]])
m4_define([_m4_transform_pair_end],
[m4_if(m4_eval([$3 & 1]), [1], [[m4_default([$$2], [$$1])([$$3])[]]])])
# m4_join(SEP, ARG1, ARG2...)
# ---------------------------
# Produce ARG1SEPARG2...SEPARGn. Avoid back-to-back SEP when a given ARG
# is the empty string. No expansion is performed on SEP or ARGs.
#
# Use a self-modifying separator, since we don't know how many
# arguments might be skipped before a separator is first printed, but
# be careful if the separator contains $. m4_foreach to the rescue.
m4_define([m4_join],
[m4_pushdef([_m4_sep], [m4_define([_m4_sep], _m4_defn([m4_echo]))])]dnl
[m4_foreach([_m4_arg], [m4_shift($@)],
[m4_ifset([_m4_arg], [_m4_sep([$1])_m4_defn([_m4_arg])])])]dnl
[_m4_popdef([_m4_sep])])
# m4_joinall(SEP, ARG1, ARG2...)
# ------------------------------
# Produce ARG1SEPARG2...SEPARGn. An empty ARG results in back-to-back SEP.
# No expansion is performed on SEP or ARGs.
#
# A bit easier than m4_join. m4_foreach to the rescue.
m4_define([m4_joinall],
[[$2]m4_if(m4_eval([$# <= 2]), [1], [],
[m4_foreach([_m4_arg], [m4_shift2($@)],
[[$1]_m4_defn([_m4_arg])])])])
# m4_list_cmp(A, B)
# -----------------
# Compare the two lists of integer expressions A and B.
#
# m4_list_cmp takes care of any side effects; we only override
# _m4_list_cmp_raw, where we can safely expand lists multiple times.
# First, insert padding so that both lists are the same length; the
# trailing +0 is necessary to handle a missing list. Next, create a
# temporary macro to perform pairwise comparisons until an inequality
# is found. For example, m4_list_cmp([1], [1,2]) creates _m4_cmp as
# m4_if(m4_eval([($1) != ($3)]), [1], [m4_cmp([$1], [$3])],
# m4_eval([($2) != ($4)]), [1], [m4_cmp([$2], [$4])],
# [0]_m4_popdef([_m4_cmp], [_m4_size]))
# then calls _m4_cmp([1+0], [0], [1], [2+0])
m4_define([_m4_list_cmp_raw],
[m4_if([$1], [$2], 0, [m4_pushdef(
[_m4_size])_m4_list_cmp($1+0_m4_list_pad(m4_count($1), m4_count($2)),
$2+0_m4_list_pad(m4_count($2), m4_count($1)))])])
m4_define([_m4_list_pad],
[m4_if(m4_eval($1 < $2), [1],
[_m4_for([_m4_size], m4_incr([$1]), [$2], [1], [,0])])])
m4_define([_m4_list_cmp],
[m4_define([_m4_size], m4_eval([$# >> 1]))]dnl
[m4_define([_m4_cmp], m4_pushdef([_m4_cmp])[m4_if(]_m4_for([_m4_cmp],
[1], _m4_size, [1], [$0_(_m4_cmp, m4_eval(_m4_cmp + _m4_size))])[
[0]_m4_popdef([_m4_cmp], [_m4_size]))])_m4_cmp($@)])
m4_define([_m4_list_cmp_],
[[m4_eval([($$1) != ($$2)]), [1], [m4_cmp([$$1], [$$2])],
]])
# m4_max(EXPR, ...)
# m4_min(EXPR, ...)
# -----------------
# Return the decimal value of the maximum (or minimum) in a series of
# integer expressions.
#
# m4_foreach to the rescue; we only need to replace _m4_minmax. Here,
# we need a temporary macro to track the best answer so far, so that
# the foreach expression is tractable.
m4_define([_m4_minmax],
[m4_pushdef([_m4_best], m4_eval([$2]))m4_foreach([_m4_arg], [m4_shift2($@)],
[m4_define([_m4_best], $1(_m4_best, _m4_defn([_m4_arg])))])]dnl
[_m4_best[]_m4_popdef([_m4_best])])
# m4_set_add_all(SET, VALUE...)
# -----------------------------
# Add each VALUE into SET. This is O(n) in the number of VALUEs, and
# can be faster than calling m4_set_add for each VALUE.
#
# m4_foreach to the rescue. If no deletions have occurred, then avoid
# the speed penalty of m4_set_add.
m4_define([m4_set_add_all],
[m4_if([$#], [0], [], [$#], [1], [],
[m4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1])
+ m4_len(m4_foreach([_m4_arg], [m4_shift($@)],
m4_ifdef([_m4_set_cleanup($1)],
[[m4_set_add([$1], _m4_defn([_m4_arg]))]],
[[m4_ifdef([_m4_set([$1],]_m4_defn([_m4_arg])[)], [],
[m4_define([_m4_set([$1],]_m4_defn([_m4_arg])[)],
[1])m4_pushdef([_m4_set([$1])],
_m4_defn([_m4_arg]))-])]])))))])])
+1388 -373
View File
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -2,9 +2,8 @@
<!--
bison.xsl - common templates for Bison XSLT.
$Id$
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+1 -2
View File
@@ -2,9 +2,8 @@
<!--
xml2dot.xsl - transform Bison XML Report into DOT.
$Id$
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+1 -2
View File
@@ -2,9 +2,8 @@
<!--
xml2text.xsl - transform Bison XML Report into plain text.
$Id$
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
-1
View File
@@ -2,7 +2,6 @@
<!--
xml2html.xsl - transform Bison XML Report into XHTML.
$Id$
Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+1
View File
@@ -1,4 +1,5 @@
Makefile
bison.1
bison.aux
bison.cp
bison.cps
+25
View File
@@ -0,0 +1,25 @@
/Makefile
/bison.1
/bison.aux
/bison.cp
/bison.cps
/bison.dvi
/bison.fn
/bison.html
/bison.ky
/bison.log
/bison.pdf
/bison.pg
/bison.ps
/bison.toc
/bison.tp
/bison.vr
/cross-options.texi
/Makefile.in
/refcard.dvi
/refcard.log
/refcard.ps
/*.info*
/stamp-vti
/version.texi
/yacc.1
+1 -1
View File
@@ -23,7 +23,7 @@ PROJECT_NAME = "@PACKAGE_NAME@"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = "@PACKAGE_VERSION@ @ID@"
PROJECT_NUMBER = "@PACKAGE_VERSION@"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
+6 -14
View File
@@ -1,5 +1,6 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
## Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
## Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2008 Free Software
## Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,15 +54,11 @@ dist_man_MANS = $(srcdir)/bison.1
EXTRA_DIST += $(dist_man_MANS:.1=.x) common.x
MAINTAINERCLEANFILES += $(dist_man_MANS)
# Depend on configure.ac to get version number changes.
common_dep = $(top_srcdir)/configure.ac $(srcdir)/common.x
# Depend on configure to get version number changes.
common_dep = $(top_srcdir)/configure $(srcdir)/common.x
srcsrcdir = $(top_srcdir)/bin
$(srcdir)/bison.1: $(common_dep) $(top_srcdir)/src/getargs.c
# Output from --help and --version that must not appear in the man page.
neutralize = \
perl -0777 -pi -e 's/\.PP\nId:.*\n//g'
# Differences to ignore when comparing the man page (the date).
remove_time_stamp = \
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
@@ -87,7 +84,6 @@ PREPATH = $(top_builddir)/src
--include=$*.x \
--include=$(srcdir)/common.x \
--output=$@.t `echo '$*' | sed 's,.*/,,'`
$(neutralize) $@.t
if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
$(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
touch $@; \
@@ -111,8 +107,7 @@ doc: html
html-local: Doxyfile
$(DOXYGEN)
edit = sed -e "s|@ID@|$$Id|" \
-e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
-e 's,@top_builddir\@,$(top_builddir),g' \
-e 's,@top_srcdir\@,$(top_srcdir),g'
@@ -121,10 +116,7 @@ EXTRA_DIST += Doxyfile.in
CLEANFILES += Doxyfile
# Sed is used to generate Doxyfile from Doxyfile.in instead of
# configure, because the former is way faster than the latter.
# Moreover, this file is updated whenever ChangeLog is touched: using
# sed instead of configure saves us a lot of time.
Doxyfile: $(top_srcdir)/ChangeLog $(srcdir)/Doxyfile.in
Id=`grep '^\$$Id' $(top_srcdir)/ChangeLog`; \
Doxyfile: $(srcdir)/Doxyfile.in
$(edit) $(srcdir)/Doxyfile.in >Doxyfile
CLEANDIRS += html latex
-197
View File
@@ -1,197 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
.TH BISON "1" "May 2008" "bison 2.3b" "User Commands"
.SH NAME
bison \- GNU Project parser generator (yacc replacement)
.SH SYNOPSIS
.B bison
[\fIOPTION\fR]... \fIFILE\fR
.SH DESCRIPTION
.I Bison
is a parser generator in the style of
.IR yacc (1).
It should be upwardly compatible with input files designed
for
.IR yacc .
.PP
Input files should follow the
.I yacc
convention of ending in
.BR .y .
Unlike
.IR yacc ,
the generated files do not have fixed names, but instead use the prefix
of the input file.
Moreover, if you need to put
.I C++
code in the input file, you can end his name by a C++-like extension
(.ypp or .y++), then bison will follow your extension to name the
output file (.cpp or .c++).
For instance, a grammar description file named
.B parse.yxx
would produce the generated parser in a file named
.BR parse.tab.cxx ,
instead of
.IR yacc 's
.B y.tab.c
or old
.I Bison
version's
.BR parse.tab.c .
.PP
This description of the options that can be given to
.I bison
is adapted from the node
.B Invocation
in the
.B bison.texinfo
manual, which should be taken as authoritative.
.PP
.I Bison
supports both traditional single-letter options and mnemonic long
option names. Long option names are indicated with
.B \-\-
instead of
.BR \- .
Abbreviations for option names are allowed as long as they
are unique. When a long option takes an argument, like
.BR \-\-file-prefix ,
connect the option name and the argument with
.BR = .
.PP
Generate LALR(1) and GLR parsers.
.PP
Mandatory arguments to long options are mandatory for short options too.
The same is true for optional arguments.
.SS "Operation modes:"
.TP
\fB\-h\fR, \fB\-\-help\fR
display this help and exit
.TP
\fB\-V\fR, \fB\-\-version\fR
output version information and exit
.TP
\fB\-\-print\-localedir\fR
output directory containing locale\-dependent data
.TP
\fB\-\-print\-datadir\fR
output directory containing skeletons and XSLT
.TP
\fB\-y\fR, \fB\-\-yacc\fR
emulate POSIX Yacc
.TP
\fB\-W\fR, \fB\-\-warnings\fR=\fI[CATEGORY]\fR
report the warnings falling in CATEGORY
.SS "Parser:"
.TP
\fB\-L\fR, \fB\-\-language\fR=\fILANGUAGE\fR
specify the output programming language
.TP
\fB\-S\fR, \fB\-\-skeleton\fR=\fIFILE\fR
specify the skeleton to use
.TP
\fB\-t\fR, \fB\-\-debug\fR
instrument the parser for debugging
.TP
\fB\-\-locations\fR
enable locations computation
.TP
\fB\-p\fR, \fB\-\-name\-prefix\fR=\fIPREFIX\fR
prepend PREFIX to the external symbols
.TP
\fB\-l\fR, \fB\-\-no\-lines\fR
don't generate `#line' directives
.TP
\fB\-k\fR, \fB\-\-token\-table\fR
include a table of token names
.SS "Output:"
.TP
\fB\-\-defines\fR[=\fIFILE\fR]
also produce a header file
.TP
\fB\-d\fR
likewise but cannot specify FILE (for POSIX Yacc)
.TP
\fB\-r\fR, \fB\-\-report\fR=\fITHINGS\fR
also produce details on the automaton
.TP
\fB\-\-report\-file\fR=\fIFILE\fR
write report to FILE
.TP
\fB\-v\fR, \fB\-\-verbose\fR
same as `\-\-report=state'
.TP
\fB\-b\fR, \fB\-\-file\-prefix\fR=\fIPREFIX\fR
specify a PREFIX for output files
.TP
\fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR
leave output to FILE
.TP
\fB\-g\fR, \fB\-\-graph\fR[=\fIFILE\fR]
also output a graph of the automaton
.TP
\fB\-x\fR, \fB\-\-xml\fR[=\fIFILE\fR]
also output an XML report of the automaton
(the XML schema is experimental)
.SS "Warning categories include:"
.TP
`midrule\-values'
unset or unused midrule values
.TP
`yacc'
incompatibilities with POSIX YACC
.TP
`all'
all the warnings
.TP
`no\-CATEGORY'
turn off warnings in CATEGORY
.TP
`none'
turn off all the warnings
.TP
`error'
treat warnings as errors
.SS "THINGS is a list of comma separated words that can include:"
.TP
`state'
describe the states
.TP
`itemset'
complete the core item sets with their closure
.TP
`lookahead'
explicitly associate lookahead tokens to items
.TP
`solved'
describe shift/reduce conflicts solving
.TP
`all'
include all the above information
.TP
`none'
disable the report
.SH AUTHOR
Written by Robert Corbett and Richard Stallman.
.SH "REPORTING BUGS"
Report bugs to <bug\-[email protected]>.
.SH COPYRIGHT
Copyright \(co 2008 Free Software Foundation, Inc.
.br
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
.BR lex (1),
.BR flex (1),
.BR yacc (1).
.PP
The full documentation for
.B bison
is maintained as a Texinfo manual. If the
.B info
and
.B bison
programs are properly installed at your site, the command
.IP
.B info bison
.PP
should give you access to the complete manual.
+390 -137
View File
@@ -30,8 +30,8 @@
@copying
This manual is for @acronym{GNU} Bison (version @value{VERSION},
@value{UPDATED}), the @acronym{GNU} parser generator.
This manual (@value{UPDATED}) is for @acronym{GNU} Bison (version
@value{VERSION}), the @acronym{GNU} parser generator.
Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
@@ -315,8 +315,10 @@ Java Parsers
* Java Semantic Values:: %type and %token vs. Java
* Java Location Values:: The position and location classes
* Java Parser Interface:: Instantiating and running the parser
* Java Scanner Interface:: Java scanners, and pure parsers
* Java Scanner Interface:: Specifying the scanner for the parser
* Java Action Features:: Special features for use in actions.
* Java Differences:: Differences between C/C++ and Java Grammars
* Java Declarations Summary:: List of Bison declarations used with Java
Frequently Asked Questions
@@ -4836,7 +4838,7 @@ already defined, so that the debugging facilities are compiled.
Define a variable to adjust Bison's behavior.
The possible choices for @var{variable}, as well as their meanings, depend on
the selected target language and/or the parser skeleton (@pxref{Decl
Summary,,%language}).
Summary,,%language}, @pxref{Decl Summary,,%skeleton}).
Bison will warn if a @var{variable} is defined multiple times.
@@ -5049,6 +5051,9 @@ chosen as if the input file were named @file{@var{prefix}.y}.
Specify the programming language for the generated parser. Currently
supported languages include C, C++, and Java.
@var{language} is case-insensitive.
This directive is experimental and its effect may be modified in future
releases.
@end deffn
@deffn {Directive} %locations
@@ -5109,10 +5114,10 @@ Require a Version of Bison}.
@deffn {Directive} %skeleton "@var{file}"
Specify the skeleton to use.
You probably don't need this option unless you are developing Bison.
You should use @code{%language} if you want to specify the skeleton for a
different language, because it is clearer and because it will always choose the
correct skeleton for non-deterministic or push parsers.
@c You probably don't need this option unless you are developing Bison.
@c You should use @code{%language} if you want to specify the skeleton for a
@c different language, because it is clearer and because it will always choose the
@c correct skeleton for non-deterministic or push parsers.
If @var{file} does not contain a @code{/}, @var{file} is the name of a skeleton
file in the Bison installation directory.
@@ -7835,6 +7840,9 @@ Specify the programming language for the generated parser, as if
Summary}). Currently supported languages include C, C++, and Java.
@var{language} is case-insensitive.
This option is experimental and its effect may be modified in future
releases.
@item --locations
Pretend that @code{%locations} was specified. @xref{Decl Summary}.
@@ -7856,10 +7864,10 @@ parser file, treating it as an independent source file in its own right.
Specify the skeleton to use, similar to @code{%skeleton}
(@pxref{Decl Summary, , Bison Declaration Summary}).
You probably don't need this option unless you are developing Bison.
You should use @option{--language} if you want to specify the skeleton for a
different language, because it is clearer and because it will always
choose the correct skeleton for non-deterministic or push parsers.
@c You probably don't need this option unless you are developing Bison.
@c You should use @option{--language} if you want to specify the skeleton for a
@c different language, because it is clearer and because it will always
@c choose the correct skeleton for non-deterministic or push parsers.
If @var{file} does not contain a @code{/}, @var{file} is the name of a skeleton
file in the Bison installation directory.
@@ -8007,13 +8015,13 @@ int yyparse (void);
@node C++ Bison Interface
@subsection C++ Bison Interface
@c - %language "C++"
@c - %skeleton "lalr1.cc"
@c - Always pure
@c - initial action
The C++ @acronym{LALR}(1) parser is selected using the language directive,
@samp{%language "C++"}, or the synonymous command-line option
@option{--language=c++}.
The C++ @acronym{LALR}(1) parser is selected using the skeleton directive,
@samp{%skeleton "lalr1.c"}, or the synonymous command-line option
@option{--skeleton=lalr1.c}.
@xref{Decl Summary}.
When run, @command{bison} will create several entities in the @samp{yy}
@@ -8407,7 +8415,7 @@ the grammar for.
@comment file: calc++-parser.yy
@example
%language "C++" /* -*- C++ -*- */
%skeleton "lalr1.cc" /* -*- C++ -*- */
%require "@value{VERSION}"
%defines
%define parser_class_name "calcxx_parser"
@@ -8724,50 +8732,59 @@ main (int argc, char *argv[])
* Java Semantic Values:: %type and %token vs. Java
* Java Location Values:: The position and location classes
* Java Parser Interface:: Instantiating and running the parser
* Java Scanner Interface:: Java scanners, and pure parsers
* Java Scanner Interface:: Specifying the scanner for the parser
* Java Action Features:: Special features for use in actions.
* Java Differences:: Differences between C/C++ and Java Grammars
* Java Declarations Summary:: List of Bison declarations used with Java
@end menu
@node Java Bison Interface
@subsection Java Bison Interface
@c - %language "Java"
@c - initial action
(The current Java interface is experimental and may evolve.
More user feedback will help to stabilize it.)
The Java parser skeletons are selected using a language directive,
@samp{%language "Java"}, or the synonymous command-line option
@option{--language=java}.
The Java parser skeletons are selected using the @code{%language "Java"}
directive or the @option{-L java}/@option{--language=java} option.
When run, @command{bison} will create several entities whose name
starts with @samp{YY}. Use the @samp{%name-prefix} directive to
change the prefix, see @ref{Decl Summary}; classes can be placed
in an arbitrary Java package using a @samp{%define package} section.
The parser class defines an inner class, @code{Location}, that is used
for location tracking. If the parser is pure, it also defines an
inner interface, @code{Lexer}; see @ref{Java Scanner Interface} for the
meaning of pure parsers when the Java language is chosen. Other than
these inner class/interface, and the members described in @ref{Java
Parser Interface}, all the other members and fields are preceded
with a @code{yy} prefix to avoid clashes with user code.
No header file can be generated for Java parsers; you must not pass
@option{-d}/@option{--defines} to @command{bison}, nor use the
@samp{%defines} directive.
By default, the @samp{YYParser} class has package visibility. A
declaration @samp{%define "public"} will change to public visibility.
Remember that, according to the Java language specification, the name
of the @file{.java} file should match the name of the class in this
case.
Similarly, a declaration @samp{%define "abstract"} will make your
class abstract.
@c FIXME: Documented bug.
When generating a Java parser, @code{bison @var{basename}.y} will create
a single Java source file named @file{@var{basename}.java}. Using an
input file without a @file{.y} suffix is currently broken. The basename
of the output file can be changed by the @code{%file-prefix} directive
or the @option{-p}/@option{--name-prefix} option. The entire output file
name can be changed by the @code{%output} directive or the
@option{-o}/@option{--output} option. The output file contains a single
class for the parser.
You can create documentation for generated parsers using Javadoc.
Contrary to C parsers, Java parsers do not use global variables; the
state of the parser is always local to an instance of the parser class.
Therefore, all Java parsers are ``pure'', and the @code{%pure-parser}
and @code{%define api.pure} directives does not do anything when used in
Java.
Push parsers are currently unsupported in Java and @code{%define
api.push_pull} have no effect.
@acronym{GLR} parsers are currently unsupported in Java. Do not use the
@code{glr-parser} directive.
No header file can be generated for Java parsers. Do not use the
@code{%defines} directive or the @option{-d}/@option{--defines} options.
@c FIXME: Possible code change.
Currently, support for debugging and verbose errors are always compiled
in. Thus the @code{%debug} and @code{%token-table} directives and the
@option{-t}/@option{--debug} and @option{-k}/@option{--token-table}
options have no effect. This may change in the future to eliminate
unused code in the generated parser, so use @code{%debug} and
@code{%verbose-error} explicitly if needed. Also, in the future the
@code{%token-table} directive might enable a public interface to
access the token names and codes.
@node Java Semantic Values
@subsection Java Semantic Values
@c - No %union, specify type in %type/%token.
@@ -8786,20 +8803,23 @@ semantic values' types (class names) should be specified in the
By default, the semantic stack is declared to have @code{Object} members,
which means that the class types you specify can be of any class.
To improve the type safety of the parser, you can declare the common
superclass of all the semantic values using the @samp{%define} directive.
For example, after the following declaration:
superclass of all the semantic values using the @code{%define stype}
directive. For example, after the following declaration:
@example
%define "stype" "ASTNode"
%define stype "ASTNode"
@end example
@noindent
any @code{%type} or @code{%token} specifying a semantic type which
is not a subclass of ASTNode, will cause a compile-time error.
@c FIXME: Documented bug.
Types used in the directives may be qualified with a package name.
Primitive data types are accepted for Java version 1.5 or later. Note
that in this case the autoboxing feature of Java 1.5 will be used.
Generic types may not be used; this is due to a limitation in the
implementation of Bison, and may change in future releases.
Java parsers do not support @code{%destructor}, since the language
adopts garbage collection. The parser will try to hold references
@@ -8822,20 +8842,29 @@ An auxiliary user-defined class defines a @dfn{position}, a single point
in a file; Bison itself defines a class representing a @dfn{location},
a range composed of a pair of positions (possibly spanning several
files). The location class is an inner class of the parser; the name
is @code{Location} by default, may also be renamed using @code{%define
"location_type" "@var{class-name}}.
is @code{Location} by default, and may also be renamed using
@code{%define location_type "@var{class-name}}.
The location class treats the position as a completely opaque value.
By default, the class name is @code{Position}, but this can be changed
with @code{%define "position_type" "@var{class-name}"}.
with @code{%define position_type "@var{class-name}"}. This class must
be supplied by the user.
@deftypemethod {Location} {Position} begin
@deftypemethodx {Location} {Position} end
@deftypeivar {Location} {Position} begin
@deftypeivarx {Location} {Position} end
The first, inclusive, position of the range, and the first beyond.
@end deftypemethod
@end deftypeivar
@deftypemethod {Location} {void} toString ()
@deftypeop {Constructor} {Location} {} Location (Position @var{loc})
Create a @code{Location} denoting an empty range located at a given point.
@end deftypeop
@deftypeop {Constructor} {Location} {} Location (Position @var{begin}, Position @var{end})
Create a @code{Location} from the endpoints of the range.
@end deftypeop
@deftypemethod {Location} {String} toString ()
Prints the range represented by the location. For this to work
properly, the position class should override the @code{equals} and
@code{toString} methods appropriately.
@@ -8850,19 +8879,56 @@ properly, the position class should override the @code{equals} and
@c debug_stream.
@c - Reporting errors
The output file defines the parser class in the package optionally
indicated in the @code{%define package} section. The class name defaults
to @code{YYParser}. The @code{YY} prefix may be changed using
@samp{%name-prefix}; alternatively, you can use @samp{%define
"parser_class_name" "@var{name}"} to give a custom name to the class.
The interface of this class is detailed below. It can be extended using
the @code{%parse-param} directive; each occurrence of the directive will
add a field to the parser class, and an argument to its constructor.
The name of the generated parser class defaults to @code{YYParser}. The
@code{YY} prefix may be changed using the @code{%name-prefix} directive
or the @option{-p}/@option{--name-prefix} option. Alternatively, use
@code{%define parser_class_name "@var{name}"} to give a custom name to
the class. The interface of this class is detailed below.
@deftypemethod {YYParser} {} YYParser (@var{type1} @var{arg1}, ...)
Build a new parser object. There are no arguments by default, unless
@samp{%parse-param @{@var{type1} @var{arg1}@}} was used.
@end deftypemethod
By default, the parser class has package visibility. A declaration
@code{%define public} will change to public visibility. Remember that,
according to the Java language specification, the name of the @file{.java}
file should match the name of the class in this case. Similarly, you can
use @code{abstract}, @code{final} and @code{strictfp} with the
@code{%define} declaration to add other modifiers to the parser class.
The Java package name of the parser class can be specified using the
@code{%define package} directive. The superclass and the implemented
interfaces of the parser class can be specified with the @code{%define
extends} and @code{%define implements} directives.
The parser class defines an inner class, @code{Location}, that is used
for location tracking (see @ref{Java Location Values}), and a inner
interface, @code{Lexer} (see @ref{Java Scanner Interface}). Other than
these inner class/interface, and the members described in the interface
below, all the other members and fields are preceded with a @code{yy} or
@code{YY} prefix to avoid clashes with user code.
@c FIXME: The following constants and variables are still undocumented:
@c @code{bisonVersion}, @code{bisonSkeleton} and @code{errorVerbose}.
The parser class can be extended using the @code{%parse-param}
directive. Each occurrence of the directive will add a @code{protected
final} field to the parser class, and an argument to its constructor,
which initialize them automatically.
Token names defined by @code{%token} and the predefined @code{EOF} token
name are added as constant fields to the parser class.
@deftypeop {Constructor} {YYParser} {} YYParser (@var{lex_param}, @dots{}, @var{parse_param}, @dots{})
Build a new parser object with embedded @code{%code lexer}. There are
no parameters, unless @code{%parse-param}s and/or @code{%lex-param}s are
used.
@end deftypeop
@deftypeop {Constructor} {YYParser} {} YYParser (Lexer @var{lexer}, @var{parse_param}, @dots{})
Build a new parser object using the specified scanner. There are no
additional parameters unless @code{%parse-param}s are used.
If the scanner is defined by @code{%code lexer}, this constructor is
declared @code{protected} and is called automatically with a scanner
created with the correct @code{%lex-param}s.
@end deftypeop
@deftypemethod {YYParser} {boolean} parse ()
Run the syntactic analysis, and return @code{true} on success,
@@ -8871,7 +8937,8 @@ Run the syntactic analysis, and return @code{true} on success,
@deftypemethod {YYParser} {boolean} recovering ()
During the syntactic analysis, return @code{true} if recovering
from a syntax error. @xref{Error Recovery}.
from a syntax error.
@xref{Error Recovery}.
@end deftypemethod
@deftypemethod {YYParser} {java.io.PrintStream} getDebugStream ()
@@ -8886,13 +8953,6 @@ Get or set the tracing level. Currently its value is either 0, no trace,
or nonzero, full tracing.
@end deftypemethod
@deftypemethod {YYParser} {void} error (Location @var{l}, String @var{m})
The definition for this member function must be supplied by the user
in the same way as the scanner interface (@pxref{Java Scanner
Interface}); the parser uses it to report a parser error occurring at
@var{l}, described by @var{m}.
@end deftypemethod
@node Java Scanner Interface
@subsection Java Scanner Interface
@@ -8900,27 +8960,16 @@ Interface}); the parser uses it to report a parser error occurring at
@c - %lex-param
@c - Lexer interface
Contrary to C parsers, Java parsers do not use global variables; the
state of the parser is always local to an instance of the parser class.
Therefore, all Java parsers are ``pure'', and the @code{%pure-parser}
directive does not do anything when used in Java.
@c FIXME: But a bit farther it is stated that
@c If @code{%pure-parser} is not specified, the lexer interface
@c resides in the same class (@code{YYParser}) as the Bison-generated
@c parser. The fields and methods that are provided to
@c this end are as follows.
There are two possible ways to interface a Bison-generated Java parser
with a scanner: the scanner may be defined by @code{%code lexer}, or
defined elsewhere. In either case, the scanner has to implement the
@code{Lexer} inner interface of the parser class.
The scanner always resides in a separate class than the parser.
Still, there are two possible ways to interface a Bison-generated Java
parser with a scanner, that is, the scanner may reside in a separate file
than the Bison grammar, or in the same file. The interface
to the scanner is similar in the two cases.
In the first case, where the scanner in the same file as the grammar, the
scanner code has to be placed in @code{%code lexer} blocks. If you want
to pass parameters from the parser constructor to the scanner constructor,
specify them with @code{%lex-param}; they are passed before
@code{%parse-param}s to the constructor.
In the first case, the body of the scanner class is placed in
@code{%code lexer} blocks. If you want to pass parameters from the
parser constructor to the scanner constructor, specify them with
@code{%lex-param}; they are passed before @code{%parse-param}s to the
constructor.
In the second case, the scanner has to implement the @code{Lexer} interface,
which is defined within the parser class (e.g., @code{YYParser.Lexer}).
@@ -8930,18 +8979,19 @@ case.
In both cases, the scanner has to implement the following methods.
@deftypemethod {Lexer} {void} yyerror (Location @var{l}, String @var{m})
As explained in @pxref{Java Parser Interface}, this method is defined
by the user to emit an error message. The first parameter is omitted
if location tracking is not active. Its type can be changed using
@samp{%define "location_type" "@var{class-name}".}
@deftypemethod {Lexer} {void} yyerror (Location @var{loc}, String @var{msg})
This method is defined by the user to emit an error message. The first
parameter is omitted if location tracking is not active. Its type can be
changed using @code{%define location_type "@var{class-name}".}
@end deftypemethod
@deftypemethod {Lexer} {int} yylex (@var{type1} @var{arg1}, ...)
@deftypemethod {Lexer} {int} yylex ()
Return the next token. Its type is the return value, its semantic
value and location are saved and returned by the ther methods in the
interface. Invocations of @samp{%lex-param @{@var{type1}
@var{arg1}@}} yield additional arguments.
interface.
Use @code{%define lex_throws} to specify any uncaught exceptions.
Default is @code{java.io.IOException}.
@end deftypemethod
@deftypemethod {Lexer} {Position} getStartPos ()
@@ -8950,53 +9000,100 @@ Return respectively the first position of the last token that
@code{yylex} returned, and the first position beyond it. These
methods are not needed unless location tracking is active.
The return type can be changed using @samp{%define "position_type"
The return type can be changed using @code{%define position_type
"@var{class-name}".}
@end deftypemethod
@deftypemethod {Lexer} {Object} getLVal ()
Return the semantical value of the last token that yylex returned.
The return type can be changed using @samp{%define "stype"
The return type can be changed using @code{%define stype
"@var{class-name}".}
@end deftypemethod
The lexer interface resides in the same class (@code{YYParser}) as the
Bison-generated parser.
The fields and methods that are provided to this end are as follows.
@node Java Action Features
@subsection Special Features for Use in Java Actions
@deftypemethod {YYParser} {void} error (Location @var{l}, String @var{m})
As already explained (@pxref{Java Parser Interface}), this method is defined
by the user to emit an error message. The first parameter is not used
unless location tracking is active. Its type can be changed using
@samp{%define "location_type" "@var{class-name}".}
@end deftypemethod
The following special constructs can be uses in Java actions.
Other analogous C action features are currently unavailable for Java.
@deftypemethod {YYParser} {int} yylex (@var{type1} @var{arg1}, ...)
Return the next token. Its type is the return value, its semantic
value and location are saved into @code{yylval}, @code{yystartpos},
@code{yyendpos}. Invocations of @samp{%lex-param @{@var{type1}
@var{arg1}@}} yield additional arguments.
@end deftypemethod
Use @code{%define throws} to specify any uncaught exceptions from parser
actions, and initial actions specified by @code{%initial-action}.
@deftypecv {Field} {YYParser} Position yystartpos
@deftypecvx {Field} {YYParser} Position yyendpos
Contain respectively the first position of the last token that yylex
returned, and the first position beyond it. These methods are not
needed unless location tracking is active.
@defvar $@var{n}
The semantic value for the @var{n}th component of the current rule.
This may not be assigned to.
@xref{Java Semantic Values}.
@end defvar
The field's type can be changed using @samp{%define "position_type"
"@var{class-name}".}
@end deftypecv
@defvar $<@var{typealt}>@var{n}
Like @code{$@var{n}} but specifies a alternative type @var{typealt}.
@xref{Java Semantic Values}.
@end defvar
@deftypecv {Field} {YYParser} Object yylval
Return respectively the first position of the last token that yylex
returned, and the first position beyond it.
@defvar $$
The semantic value for the grouping made by the current rule. As a
value, this is in the base type (@code{Object} or as specified by
@code{%define stype}) as in not cast to the declared subtype because
casts are not allowed on the left-hand side of Java assignments.
Use an explicit Java cast if the correct subtype is needed.
@xref{Java Semantic Values}.
@end defvar
@defvar $<@var{typealt}>$
Same as @code{$$} since Java always allow assigning to the base type.
Perhaps we should use this and @code{$<>$} for the value and @code{$$}
for setting the value but there is currently no easy way to distinguish
these constructs.
@xref{Java Semantic Values}.
@end defvar
@defvar @@@var{n}
The location information of the @var{n}th component of the current rule.
This may not be assigned to.
@xref{Java Location Values}.
@end defvar
@defvar @@$
The location information of the grouping made by the current rule.
@xref{Java Location Values}.
@end defvar
@deffn {Statement} {return YYABORT;}
Return immediately from the parser, indicating failure.
@xref{Java Parser Interface}.
@end deffn
@deffn {Statement} {return YYACCEPT;}
Return immediately from the parser, indicating success.
@xref{Java Parser Interface}.
@end deffn
@deffn {Statement} {return YYERROR;}
Start error recovery without printing an error message.
@xref{Error Recovery}.
@end deffn
@deffn {Statement} {return YYFAIL;}
Print an error message and start error recovery.
@xref{Error Recovery}.
@end deffn
@deftypefn {Function} {boolean} recovering ()
Return whether error recovery is being done. In this state, the parser
reads token until it reaches a known state, and then restarts normal
operation.
@xref{Error Recovery}.
@end deftypefn
@deftypefn {Function} {protected void} yyerror (String msg)
@deftypefnx {Function} {protected void} yyerror (Position pos, String msg)
@deftypefnx {Function} {protected void} yyerror (Location loc, String msg)
Print an error message using the @code{yyerror} method of the scanner
instance in use.
@end deftypefn
The field's type can be changed using @samp{%define "stype"
"@var{class-name}".}
@end deftypecv
@node Java Differences
@subsection Differences between C/C++ and Java Grammars
@@ -9013,6 +9110,7 @@ macros. Instead, they should be preceded by @code{return} when they
appear in an action. The actual definition of these symbols is
opaque to the Bison grammar, and it might change in the future. The
only meaningful operation that you can do, is to return them.
See @pxref{Java Action Features}.
Note that of these three symbols, only @code{YYACCEPT} and
@code{YYABORT} will cause a return from the @code{yyparse}
@@ -9020,6 +9118,17 @@ method@footnote{Java parsers include the actions in a separate
method than @code{yyparse} in order to have an intuitive syntax that
corresponds to these C macros.}.
@item
Java lacks unions, so @code{%union} has no effect. Instead, semantic
values have a common base type: @code{Object} or as specified by
@code{%define stype}. Angle backets on @code{%token}, @code{type},
@code{$@var{n}} and @code{$$} specify subtypes rather than fields of
an union. The type of @code{$$}, even with angle brackets, is the base
type since Java casts are not allow on the left-hand side of assignments.
Also, @code{$@var{n}} and @code{@@@var{n}} are not allowed on the
left-hand side of assignments. See @pxref{Java Semantic Values} and
@pxref{Java Action Features}.
@item
The prolog declarations have a different meaning than in C/C++ code.
@table @asis
@@ -9039,10 +9148,154 @@ Interface}).
@end table
Other @code{%code} blocks are not supported in Java parsers.
In particular, @code{%@{ @dots{} %@}} blocks should not be used
and may give an error in future versions of Bison.
The epilogue has the same meaning as in C/C++ code and it can
be used to define other classes used by the parser.
be used to define other classes used by the parser @emph{outside}
the parser class.
@end itemize
@node Java Declarations Summary
@subsection Java Declarations Summary
This summary only include declarations specific to Java or have special
meaning when used in a Java parser.
@deffn {Directive} {%language "Java"}
Generate a Java class for the parser.
@end deffn
@deffn {Directive} %lex-param @{@var{type} @var{name}@}
A parameter for the lexer class defined by @code{%code lexer}
@emph{only}, added as parameters to the lexer constructor and the parser
constructor that @emph{creates} a lexer. Default is none.
@xref{Java Scanner Interface}.
@end deffn
@deffn {Directive} %name-prefix "@var{prefix}"
The prefix of the parser class name @code{@var{prefix}Parser} if
@code{%define parser_class_name} is not used. Default is @code{YY}.
@xref{Java Bison Interface}.
@end deffn
@deffn {Directive} %parse-param @{@var{type} @var{name}@}
A parameter for the parser class added as parameters to constructor(s)
and as fields initialized by the constructor(s). Default is none.
@xref{Java Parser Interface}.
@end deffn
@deffn {Directive} %token <@var{type}> @var{token} @dots{}
Declare tokens. Note that the angle brackets enclose a Java @emph{type}.
@xref{Java Semantic Values}.
@end deffn
@deffn {Directive} %type <@var{type}> @var{nonterminal} @dots{}
Declare the type of nonterminals. Note that the angle brackets enclose
a Java @emph{type}.
@xref{Java Semantic Values}.
@end deffn
@deffn {Directive} %code @{ @var{code} @dots{} @}
Code appended to the inside of the parser class.
@xref{Java Differences}.
@end deffn
@deffn {Directive} {%code imports} @{ @var{code} @dots{} @}
Code inserted just after the @code{package} declaration.
@xref{Java Differences}.
@end deffn
@deffn {Directive} {%code lexer} @{ @var{code} @dots{} @}
Code added to the body of a inner lexer class within the parser class.
@xref{Java Scanner Interface}.
@end deffn
@deffn {Directive} %% @var{code} @dots{}
Code (after the second @code{%%}) appended to the end of the file,
@emph{outside} the parser class.
@xref{Java Differences}.
@end deffn
@deffn {Directive} %@{ @var{code} @dots{} %@}
Not supported. Use @code{%code import} instead.
@xref{Java Differences}.
@end deffn
@deffn {Directive} {%define abstract}
Whether the parser class is declared @code{abstract}. Default is false.
@xref{Java Bison Interface}.
@end deffn
@deffn {Directive} {%define extends} "@var{superclass}"
The superclass of the parser class. Default is none.
@xref{Java Bison Interface}.
@end deffn
@deffn {Directive} {%define final}
Whether the parser class is declared @code{final}. Default is false.
@xref{Java Bison Interface}.
@end deffn
@deffn {Directive} {%define implements} "@var{interfaces}"
The implemented interfaces of the parser class, a comma-separated list.
Default is none.
@xref{Java Bison Interface}.
@end deffn
@deffn {Directive} {%define lex_throws} "@var{exceptions}"
The exceptions thrown by the @code{yylex} method of the lexer, a
comma-separated list. Default is @code{java.io.IOException}.
@xref{Java Scanner Interface}.
@end deffn
@deffn {Directive} {%define location_type} "@var{class}"
The name of the class used for locations (a range between two
positions). This class is generated as an inner class of the parser
class by @command{bison}. Default is @code{Location}.
@xref{Java Location Values}.
@end deffn
@deffn {Directive} {%define package} "@var{package}"
The package to put the parser class in. Default is none.
@xref{Java Bison Interface}.
@end deffn
@deffn {Directive} {%define parser_class_name} "@var{name}"
The name of the parser class. Default is @code{YYParser} or
@code{@var{name-prefix}Parser}.
@xref{Java Bison Interface}.
@end deffn
@deffn {Directive} {%define position_type} "@var{class}"
The name of the class used for positions. This class must be supplied by
the user. Default is @code{Position}.
@xref{Java Location Values}.
@end deffn
@deffn {Directive} {%define public}
Whether the parser class is declared @code{public}. Default is false.
@xref{Java Bison Interface}.
@end deffn
@deffn {Directive} {%define stype} "@var{class}"
The base type of semantic values. Default is @code{Object}.
@xref{Java Semantic Values}.
@end deffn
@deffn {Directive} {%define strictfp}
Whether the parser class is declared @code{strictfp}. Default is false.
@xref{Java Bison Interface}.
@end deffn
@deffn {Directive} {%define throws} "@var{exceptions}"
The exceptions thrown by user-supplied parser actions and
@code{%initial-action}, a comma-separated list. Default is none.
@xref{Java Parser Interface}.
@end deffn
@c ================================================= FAQ
@node FAQ
+3
View File
@@ -0,0 +1,3 @@
/Makefile
/Makefile.in
/bench.pl
+1 -3
View File
@@ -270,9 +270,7 @@ yylex (void)
/* Skip white space. */
while ((c = get_char ()) == ' ' || c == '\t')
{
}
continue;
/* process numbers */
if (c == '.' || isdigit (c))
+2
View File
@@ -0,0 +1,2 @@
/Makefile
/Makefile.in
+13
View File
@@ -0,0 +1,13 @@
/*.cc
/*.hh
/*.ll
/*.o
/*.output
/*.stamp
/*.tmp
/*.yy
/.deps
/Makefile
/Makefile.in
/calc++
/calc++.exe
+1
View File
@@ -0,0 +1 @@
external: gnulib
Submodule
+1
Submodule gnulib added at cdccece581
+2
View File
@@ -17,6 +17,7 @@ configmake.h
dirname.c
dirname.h
dup-safer.c
errno.in.h
error.c
error.h
exitfail.c
@@ -87,6 +88,7 @@ unitypes.h
uniwidth
uniwidth.h
unlocked-io.h
unsetenv.c
verify.h
wchar.h
wchar.in.h
+108
View File
@@ -0,0 +1,108 @@
/*.a
/*.o
/*~
/.deps
/Makefile
/Makefile.in
/argmatch.c
/argmatch.h
/basename.c
/c-ctype.c
/c-ctype.h
/c-strcase.h
/c-strcasecmp.c
/c-strncasecmp.c
/charset.alias
/config.charset
/config.h
/config.hin
/configmake.h
/dirname.c
/dirname.h
/dup-safer.c
/errno.in.h
/error.c
/error.h
/exitfail.c
/exitfail.h
/fd-safer.c
/fopen-safer.c
/getopt.c
/getopt.h
/getopt.in.h
/getopt1.c
/getopt_.h
/getopt_int.h
/gettext.h
/gnulib.mk
/hash.c
/hash.h
/intprops.h
/inttypes.h
/inttypes.in.h
/inttypes_.h
/localcharset.c
/localcharset.h
/malloc.c
/mbswidth.c
/mbswidth.h
/obstack.c
/obstack.h
/pipe-safer.c
/quote.c
/quote.h
/quotearg.c
/quotearg.h
/ref-add.sed
/ref-add.sin
/ref-del.sed
/ref-del.sin
/stamp-h1
/stdbool.h
/stdbool.in.h
/stdbool_.h
/stdint.h
/stdint.in.h
/stdint_.h
/stdio--.h
/stdio-safer.h
/stdlib.h
/stdlib.in.h
/stdlib_.h
/stpcpy.c
/streq.h
/strerror.c
/string.h
/string.in.h
/string_.h
/stripslash.c
/strndup.c
/strnlen.c
/strtol.c
/strtoul.c
/strverscmp.c
/strverscmp.h
/unistd--.h
/unistd-safer.h
/unistd.h
/unistd.in.h
/unistd_.h
/unitypes.h
/uniwidth
/uniwidth.h
/unlocked-io.h
/unsetenv.c
/verify.h
/wchar.h
/wchar.in.h
/wchar_.h
/wctype.h
/wctype.in.h
/wctype_.h
/wcwidth.c
/wcwidth.h
/xalloc-die.c
/xalloc.h
/xmalloc.c
/xstrndup.c
/xstrndup.h
+4
View File
@@ -4,6 +4,8 @@ config-h.m4
dirname.m4
dos.m4
double-slash-root.m4
environ.m4
errno_h.m4
error.m4
exitfail.m4
extensions.m4
@@ -37,6 +39,7 @@ po.m4
progtest.m4
quote.m4
quotearg.m4
setenv.m4
stdbool.m4
stdint.m4
stdint_h.m4
@@ -50,6 +53,7 @@ strnlen.m4
strtol.m4
strtoul.m4
strverscmp.m4
threadlib.m4
unistd-safer.m4
unistd_h.m4
unlocked-io.m4
+67
View File
@@ -0,0 +1,67 @@
/absolute-header.m4
/argmatch.m4
/config-h.m4
/dirname.m4
/dos.m4
/double-slash-root.m4
/environ.m4
/errno_h.m4
/error.m4
/exitfail.m4
/extensions.m4
/getopt.m4
/gettext.m4
/gnulib-cache.m4
/gnulib-common.m4
/gnulib-comp.m4
/gnulib-tool.m4
/hash.m4
/iconv.m4
/include_next.m4
/inline.m4
/intlmacosx.m4
/inttypes-h.m4
/inttypes-pri.m4
/inttypes.m4
/javacomp.m4
/javaexec.m4
/lib-ld.m4
/lib-link.m4
/lib-prefix.m4
/localcharset.m4
/longlong.m4
/malloc.m4
/mbrtowc.m4
/mbstate_t.m4
/mbswidth.m4
/nls.m4
/po.m4
/progtest.m4
/quote.m4
/quotearg.m4
/setenv.m4
/stdbool.m4
/stdint.m4
/stdint_h.m4
/stdio-safer.m4
/stdlib_h.m4
/stpcpy.m4
/strerror.m4
/string_h.m4
/strndup.m4
/strnlen.m4
/strtol.m4
/strtoul.m4
/strverscmp.m4
/threadlib.m4
/unistd-safer.m4
/unistd_h.m4
/unlocked-io.m4
/warning.m4
/wchar.m4
/wchar_t.m4
/wctype.m4
/wcwidth.m4
/wint_t.m4
/xalloc.m4
/xstrndup.m4
+858
View File
@@ -0,0 +1,858 @@
# -*-Makefile-*-
# This Makefile fragment tries to be general-purpose enough to be
# used by at least coreutils, idutils, CPPI, Bison, and Autoconf.
## Copyright (C) 2001-2008 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
# This is reported not to work with make-3.79.1
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ME := maint.mk
# Do not save the original name or timestamp in the .tar.gz file.
# Use --rsyncable if available.
gzip_rsyncable := \
$(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable)
GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
GIT = git
VC = $(GIT)
VC-tag = git tag -s -m '$(VERSION)'
VC_LIST = build-aux/vc-list-files
VC_LIST_EXCEPT = \
$(VC_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
ifeq ($(origin prev_version_file), undefined)
prev_version_file = $(srcdir)/.prev-version
endif
PREV_VERSION := $(shell cat $(prev_version_file))
VERSION_REGEXP = $(subst .,\.,$(VERSION))
PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
ifeq ($(VC),$(GIT))
this-vc-tag = v$(VERSION)
this-vc-tag-regexp = v$(VERSION_REGEXP)
else
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
tag-this-version = $(subst .,_,$(VERSION))
this-vc-tag = $(tag-package)-$(tag-this-version)
this-vc-tag-regexp = $(this-vc-tag)
endif
my_distdir = $(PACKAGE)-$(VERSION)
# Old releases are stored here.
release_archive_dir ?= ../release
# Prevent programs like 'sort' from considering distinct strings to be equal.
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
export LC_ALL = C
## --------------- ##
## Sanity checks. ##
## --------------- ##
# Collect the names of rules starting with `sc_'.
syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
$(srcdir)/$(ME))
.PHONY: $(syntax-check-rules)
local-checks-available = \
po-check copyright-check m4-check author_mark_check \
patch-check strftime-check $(syntax-check-rules) \
makefile_path_separator_check \
makefile-check check-AUTHORS
.PHONY: $(local-checks-available)
local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
syntax-check: $(local-check)
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
# $$(find -type f -name '*.[chly]') && \
# { echo '$(ME): found conditional include' 1>&2; \
# exit 1; } || :
# grep -nE '^# *include <(string|stdlib)\.h>' \
# $(srcdir)/{lib,src}/*.[chy] && \
# { echo '$(ME): FIXME' 1>&2; \
# exit 1; } || :
# FIXME: don't allow `#include .strings\.h' anywhere
sc_avoid_if_before_free:
@$(srcdir)/build-aux/useless-if-before-free \
$(useless_free_options) \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found useless "if" before "free" above' 1>&2; \
exit 1; } || :
sc_cast_of_argument_to_free:
@grep -nE '\<free *\( *\(' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): don'\''t cast free argument' 1>&2; \
exit 1; } || :
sc_cast_of_x_alloc_return_value:
@grep -nE '\*\) *x(m|c|re)alloc\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
exit 1; } || :
sc_cast_of_alloca_return_value:
@grep -nE '\*\) *alloca\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
exit 1; } || :
sc_space_tab:
@grep -n '[ ] ' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
1>&2; exit 1; } || :
# Don't use *scanf or the old ato* functions in `real' code.
# They provide no error checking mechanism.
# Instead, use strto* functions.
sc_prohibit_atoi_atof:
@grep -nE '\<([fs]?scanf|ato([filq]|ll))\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): do not use *scan''f, ato''f, ato''i, ato''l, ato''ll, ato''q, or ss''canf' \
1>&2; exit 1; } || :
# Use STREQ rather than comparing strcmp == 0, or != 0.
sc_prohibit_strcmp:
@grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *==' \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): use STREQ in place of the above uses of str''cmp' \
1>&2; exit 1; } || :
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success:
@grep -nF 'error (EXIT_SUCCESS,' \
$$(find -type f -name '*.[chly]') && \
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
exit 1; } || :
# `FATAL:' should be fully upper-cased in error messages
# `WARNING:' should be fully upper-cased, or fully lower-cased
sc_error_message_warn_fatal:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '"Warning|"Fatal|"fatal' && \
{ echo '$(ME): use FATAL, WARNING or warning' 1>&2; \
exit 1; } || :
# Error messages should not start with a capital letter
sc_error_message_uppercase:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '"[A-Z]' \
| grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' && \
{ echo '$(ME): found capitalized error message' 1>&2; \
exit 1; } || :
# Error messages should not end with a period
sc_error_message_period:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '[^."]\."' && \
{ echo '$(ME): found error message ending in period' 1>&2; \
exit 1; } || :
sc_file_system:
@grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of "file''system";' \
'rewrite to use "file system"' 1>&2; \
exit 1; } || :
# Don't use cpp tests of this symbol. All code assumes config.h is included.
sc_no_have_config_h:
@grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
1>&2; exit 1; } || :
# Nearly all .c files must include <config.h>.
sc_require_config_h:
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
grep -L '^# *include <config\.h>' \
$$($(VC_LIST_EXCEPT) | grep '\.c$$') \
| grep . && \
{ echo '$(ME): the above files do not include <config.h>' \
1>&2; exit 1; } || :; \
else :; \
fi
# To use this "command" macro, you must first define two shell variables:
# h: the header, enclosed in <> or ""
# re: a regular expression that matches IFF something provided by $h is used.
define _header_without_use
h_esc=`echo "$$h"|sed 's/\./\\./'`; \
if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
files=$$(grep -l '^# *include '"$$h_esc" \
$$($(VC_LIST_EXCEPT) | grep '\.c$$')) && \
grep -LE "$$re" $$files | grep . && \
{ echo "$(ME): the above files include $$h but don't use it" \
1>&2; exit 1; } || :; \
else :; \
fi
endef
# Prohibit the inclusion of assert.h without an actual use of assert.
sc_prohibit_assert_without_use:
@h='<assert.h>' re='\<assert *\(' $(_header_without_use)
# Prohibit the inclusion of getopt.h without an actual use.
sc_prohibit_getopt_without_use:
@h='<getopt.h>' re='\<getopt(_long)? *\(' $(_header_without_use)
# Don't include quotearg.h unless you use one of its functions.
sc_prohibit_quotearg_without_use:
@h='"quotearg.h"' re='\<quotearg(_[^ ]+)? *\(' $(_header_without_use)
# Don't include quote.h unless you use one of its functions.
sc_prohibit_quote_without_use:
@h='"quote.h"' re='\<quote(_n)? *\(' $(_header_without_use)
# Don't include this header unless you use one of its functions.
sc_prohibit_long_options_without_use:
@h='"long-options.h"' re='\<parse_long_options *\(' \
$(_header_without_use)
# Don't include this header unless you use one of its functions.
sc_prohibit_inttostr_without_use:
@h='"inttostr.h"' re='\<(off|[iu]max|uint)tostr *\(' \
$(_header_without_use)
# Don't include this header unless you use one of its functions.
sc_prohibit_error_without_use:
@h='"error.h"' \
re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
$(_header_without_use)
sc_prohibit_safe_read_without_use:
@h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
$(_header_without_use)
sc_prohibit_argmatch_without_use:
@h='"argmatch.h"' \
re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<argmatch(_exit_fn|_(in)?valid) *\()' \
$(_header_without_use)
sc_prohibit_root_dev_ino_without_use:
@h='"root-dev-ino.h"' \
re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
$(_header_without_use)
sc_obsolete_symbols:
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
1>&2; exit 1; } || :
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
# Each nonempty line must start with a year number, or a TAB.
sc_changelog:
@grep -n '^[^12 ]' $$(find . -maxdepth 2 -name ChangeLog) && \
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
exit 1; } || :
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
# with the strings from the two affected variables.
dd_c = $(srcdir)/src/dd.c
sc_dd_max_sym_length:
ifneq ($(wildcard $(dd_c)),)
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
| wc --max-line-length); \
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|tr -d '"' | wc --max-line-length); \
if test "$$len" = "$$max"; then :; else \
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
exit 1; \
fi
endif
# Many m4 macros names once began with `jm_'.
# On 2004-04-13, they were all changed to start with gl_ instead.
# Make sure that none are inadvertently reintroduced.
sc_prohibit_jm_in_m4:
@grep -nE 'jm_[A-Z]' \
$$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
{ echo '$(ME): do not use jm_ in m4 macro names' \
1>&2; exit 1; } || :
# Ensure that each root-requiring test is run via the "check-root" rule.
sc_root_tests:
@if test -d tests \
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
t1=sc-root.expected; t2=sc-root.actual; \
grep -nl '^require_root_$$' \
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
$(srcdir)/tests/Makefile.am \
| sed 's/^ *//;/^root_tests =/d' \
| tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \
diff -u $$t1 $$t2 || diff=1; \
rm -f $$t1 $$t2; \
test "$$diff" \
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
exit 1; } || :; \
fi
headers_with_interesting_macro_defs = \
exit.h \
fcntl_.h \
fnmatch_.h \
intprops.h \
inttypes_.h \
lchown.h \
openat.h \
stat-macros.h \
stdint_.h
# Create a list of regular expressions matching the names
# of macros that are guaranteed by parts of gnulib to be defined.
.re-defmac:
@(cd $(srcdir)/lib; \
for f in $(headers_with_interesting_macro_defs); do \
test -f $$f && \
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
done; \
) | sort -u \
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
| sed 's/^/^# *define /' \
> $@-t
@mv $@-t $@
# Don't define macros that we already get from gnulib header files.
sc_always_defined_macros: .re-defmac
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
grep -f .re-defmac $$($(VC_LIST)) \
&& { echo '$(ME): define the above via some gnulib .h file' \
1>&2; exit 1; } || :; \
fi
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
| grep -Ev 'sys/(param|file)\.h' \
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
> $@-t
@mv $@-t $@
# Files in src/ should not include directly any of
# the headers already included via system.h.
sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
grep -nE -f .re-list \
$$($(VC_LIST) src | \
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
&& { echo '$(ME): the above are already included via system.h'\
1>&2; exit 1; } || :; \
fi
# Ensure that each .c file containing a "main" function also
# calls set_program_name.
sc_program_name:
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
grep -LE 'set_program_name *\(m?argv\[0\]\);' $$files \
| grep . && \
{ echo '$(ME): the above files do not call set_program_name' \
1>&2; exit 1; } || :; \
else :; \
fi
# Require that the final line of each test-lib.sh-using test be this one:
# (exit $fail); exit $fail
# Note: this test requires GNU grep's --label= option.
sc_require_test_exit_idiom:
@if test -f $(srcdir)/tests/test-lib.sh; then \
die=0; \
for i in $$(grep -l -F /../test-lib.sh $$($(VC_LIST) tests)); do \
tail -n1 $$i | grep '^(exit \$$fail); exit \$$fail$$' > /dev/null \
&& : || { die=1; echo $$i; } \
done; \
test $$die = 1 && \
{ echo 1>&2 '$(ME): the final line in each of the above is not:'; \
echo 1>&2 '(exit $$fail); exit $$fail'; \
exit 1; } || :; \
fi
sc_sun_os_names:
@grep -nEi \
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
exit 1; } || :
sc_the_the:
@grep -ni '\<the ''the\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of "the ''the";' 1>&2; \
exit 1; } || :
sc_tight_scope:
$(MAKE) -C src $@
sc_trailing_blank:
@grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found trailing blank(s)' \
1>&2; exit 1; } || :
# Match lines like the following, but where there is only one space
# between the options and the description:
# -D, --all-repeated[=delimit-method] print all duplicate lines\n
longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
sc_two_space_separator_in_usage:
@grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
$$($(VC_LIST_EXCEPT)) && \
{ echo "$(ME): help2man requires at least two spaces between"; \
echo "$(ME): an option and its description"; \
1>&2; exit 1; } || :
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
sc_unmarked_diagnostics:
@grep -nE \
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
| grep -v '_''(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
# Avoid useless parentheses like those in this example:
# #if defined (SYMBOL) || defined (SYM2)
sc_useless_cpp_parens:
@grep -n '^# *if .*defined *(' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found useless parentheses in cpp directive' \
1>&2; exit 1; } || :
# Require the latest GPL.
sc_GPL_version:
@grep -n 'either ''version [^3]' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): GPL vN, N!=3' 1>&2; exit 1; } || :
# Perl-based tests used to exec perl from a #!/bin/sh script.
# Now they all start with #!/usr/bin/perl and the portability
# infrastructure is in tests/Makefile.am. Make sure no old-style
# script sneaks back in.
sc_no_exec_perl_coreutils:
@if test -f $(srcdir)/tests/Coreutils.pm; then \
grep '^exec *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) && \
{ echo 1>&2 '$(ME): found anachronistic Perl-based tests'; \
exit 1; } || :; \
fi
NEWS_hash = \
$$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
$(srcdir)/NEWS | md5sum -)
# Ensure that we don't accidentally insert an entry into an old NEWS block.
sc_immutable_NEWS:
@if test -f $(srcdir)/NEWS; then \
test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \
{ echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
fi
# Each program that uses proper_name_utf8 must link with
# one of the ICONV libraries.
sc_proper_name_utf8_requires_ICONV:
@progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\
if test "x$$progs" != x; then \
fail=0; \
for p in $$progs; do \
dir=$$(dirname "$$p"); \
base=$$(basename "$$p" .c); \
grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \
|| { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \
done; \
test $$fail = 1 && \
{ echo 1>&2 '$(ME): the above do not link with any ICONV library'; \
exit 1; } || :; \
fi
# Warn about "c0nst struct Foo const foo[]",
# but not about "char const *const foo" or "#define const const".
sc_redundant_const:
@grep -E '\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
$$($(VC_LIST_EXCEPT)) && \
{ echo 1>&2 '$(ME): redundant "const" in declarations'; \
exit 1; } || :
sc_const_long_option:
@grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT)) \
| grep -Ev 'const struct option|struct option const' && { \
echo 1>&2 '$(ME): add "const" to the above declarations'; \
exit 1; } || :
# Update the hash stored above. Do this after each release and
# for any corrections to old entries.
update-NEWS-hash: NEWS
perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \
$(srcdir)/cfg.mk
epoch_date = 1970-01-01 00:00:00.000000000 +0000
# Ensure that the c99-to-c89 patch applies cleanly.
patch-check:
rm -rf src-c89 $@.1 $@.2
cp -a src src-c89
(cd src-c89; patch -p1 -V never --fuzz=0) < src/c99-to-c89.diff \
> $@.1 2>&1
if test "$(REGEN_PATCH)" = yes; then \
diff -upr src src-c89 | sed 's,src-c89/,src/,' \
| grep -vE '^(Only in|File )' \
| perl -pe 's/^((?:\+\+\+|---) \S+\t).*/$${1}$(epoch_date)/;' \
-e 's/^ $$//' \
> new-diff || : ; fi
grep -v '^patching file ' $@.1 > $@.2 || :
msg=ok; test -s $@.2 && msg='fuzzy patch' || : ; \
rm -f src-c89/*.o || msg='rm failed'; \
$(MAKE) -C src-c89 CFLAGS='-Wdeclaration-after-statement -Werror' \
|| msg='compile failure with extra options'; \
test "$$msg" = ok && rm -rf src-c89 $@.1 $@.2 || echo "$$msg" 1>&2; \
test "$$msg" = ok
# Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N,
# which date accepts but GNU strftime does not.
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
strftime-check:
if test -f $(srcdir)/src/date.c; then \
grep '^ %. ' $(srcdir)/src/date.c | sort \
| $(extract_char) > $@-src; \
{ echo N; \
info libc date calendar format | grep '^ `%.'\' \
| $(extract_char); } | sort > $@-info; \
diff -u $@-src $@-info || exit 1; \
rm -f $@-src $@-info; \
fi
check-AUTHORS:
$(MAKE) -C src $@
# Ensure that we use only the standard $(VAR) notation,
# not @...@ in Makefile.am, now that we can rely on automake
# to emit a definition for each substituted variable.
makefile-check:
@grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
&& { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
news-date-check: NEWS
today=`date +%Y-%m-%d`; \
if head NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
>/dev/null; then \
:; \
else \
echo "version or today's date is not in NEWS" 1>&2; \
exit 1; \
fi
changelog-check:
if head ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
>/dev/null; then \
:; \
else \
echo "$(VERSION) not in ChangeLog" 1>&2; \
exit 1; \
fi
m4-check:
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
&& { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \
exit 1; } || :
# Verify that all source files using _() are listed in po/POTFILES.in.
po-check:
@if test -f po/POTFILES.in; then \
grep -E -v '^(#|$$)' po/POTFILES.in \
| grep -v '^src/false\.c$$' | sort > $@-1; \
files=; \
for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \
case $$file in \
*.?|*.??) ;; \
*) continue;; \
esac; \
case $$file in \
*.[ch]) \
base=`expr " $$file" : ' \(.*\)\..'`; \
{ test -f $$base.l || test -f $$base.y; } && continue;; \
esac; \
files="$$files $$file"; \
done; \
grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
| sort -u > $@-2; \
diff -u $@-1 $@-2 || exit 1; \
rm -f $@-1 $@-2; \
fi
# In a definition of #define AUTHORS "... and ..." where the RHS contains
# the English word `and', the string must be marked with `N_ (...)' so that
# gettext recognizes it as a string requiring translation.
author_mark_check:
@grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
{ echo '$(ME): enclose the above strings in N_ (...)' 1>&2; \
exit 1; } || :
# Sometimes it is useful to change the PATH environment variable
# in Makefiles. When doing so, it's better not to use the Unix-centric
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
# and there probably aren't many projects with so many Makefile.am files
# that we'd have to worry about limits on command line length.
msg = '$(ME): Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
makefile_path_separator_check:
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
&& { echo $(msg) 1>&2; exit 1; } || :
# Check that `make alpha' will not fail at the end of the process.
writable-files:
if test -d $(release_archive_dir); then :; else \
for file in $(distdir).tar.gz \
$(release_archive_dir)/$(distdir).tar.gz; do \
test -e $$file || continue; \
test -w $$file \
|| { echo ERROR: $$file is not writable; fail=1; }; \
done; \
test "$$fail" && exit 1 || : ; \
fi
v_etc_file = lib/version-etc.c
sample-test = tests/sample-test
texi = doc/$(PACKAGE).texi
# Make sure that the copyright date in $(v_etc_file) is up to date.
# Do the same for the $(sample-test) and the main doc/.texi file.
copyright-check:
@if test -f $(v_etc_file); then \
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
>/dev/null \
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
exit 1; }; \
fi
@if test -f $(sample-test); then \
grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
>/dev/null \
|| { echo 'out of date copyright in $(sample-test); update it' 1>&2; \
exit 1; }; \
fi
@if test -f $(texi); then \
grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
>/dev/null \
|| { echo 'out of date copyright in $(texi); update it' 1>&2; \
exit 1; }; \
fi
vc-diff-check:
$(VC) diff > vc-diffs || :
if test -s vc-diffs; then \
cat vc-diffs; \
echo "Some files are locally modified:" 1>&2; \
exit 1; \
else \
rm vc-diffs; \
fi
cvs-check: vc-diff-check
maintainer-distcheck:
$(MAKE) distcheck
$(MAKE) my-distcheck
# Don't make a distribution if checks fail.
# Also, make sure the NEWS file is up-to-date.
vc-dist: $(local-check) cvs-check maintainer-distcheck
$(MAKE) dist
# Use this to make sure we don't run these programs when building
# from a virgin tgz file, below.
null_AM_MAKEFLAGS = \
ACLOCAL=false \
AUTOCONF=false \
AUTOMAKE=false \
AUTOHEADER=false \
MAKEINFO=false
built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list)
warn_cflags = -Dlint -O -Werror -Wall -Wformat -Wshadow -Wpointer-arith
bin=bin-$$$$
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test
pfx=$(t)/i
# Verify that a twisted use of --program-transform-name=PROGRAM works.
define install-transform-check
rm -rf $(pfx); \
$(MAKE) program_transform_name='s/.*/zyx/' \
prefix=$(pfx) install \
&& test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \
&& test "$$(echo $(pfx)/share/man/man1/*)" = \
"$(pfx)/share/man/man1/zyx.1"
endef
# Install, then verify that all binaries and man pages are in place.
# Note that neither the binary, ginstall, nor the ].1 man page is installed.
define my-instcheck
$(MAKE) prefix=$(pfx) install \
&& test ! -f $(pfx)/bin/ginstall \
&& { fail=0; \
for i in $(built_programs); do \
test "$$i" = ginstall && i=install; \
for j in "$(pfx)/bin/$$i" \
"$(pfx)/share/man/man1/$$i.1"; do \
case $$j in *'[.1') continue;; esac; \
test -f "$$j" && : \
|| { echo "$$j not installed"; fail=1; }; \
done; \
done; \
test $$fail = 1 && exit 1 || :; \
}
endef
# Use -Wformat -Werror to detect format-string/arg-list mismatches.
# Also, check for shadowing problems with -Wshadow, and for pointer
# arithmetic problems with -Wpointer-arith.
# These CFLAGS are pretty strict. If you build this target, you probably
# have to have a recent version of gcc and glibc headers.
# The hard-linking for-loop below ensures that there is a bin/ directory
# full of all of the programs under test (except the ones that are required
# for basic Makefile rules), all symlinked to the just-built "false" program.
# This is to ensure that if ever a test neglects to make PATH include
# the build srcdir, these always-failing programs will run.
# Otherwise, it is too easy to test the wrong programs.
# Note that "false" itself is a symlink to true, so it too will malfunction.
my-distcheck: $(DIST_ARCHIVES) $(local-check)
$(MAKE) syntax-check
$(MAKE) check
-rm -rf $(t)
mkdir -p $(t)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \
&& ./configure --disable-nls \
&& $(MAKE) CFLAGS='$(warn_cflags)' \
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \
&& $(install-transform-check) \
&& $(my-instcheck) \
&& mkdir $(bin) \
&& ($(write_loser)) > $(bin)/loser \
&& chmod a+x $(bin)/loser \
&& for i in $(built_programs); do \
case $$i in \
rm|expr|basename|echo|sort|ls|tr);; \
cat|dirname|mv|wc);; \
*) ln $(bin)/loser $(bin)/$$i;; \
esac; \
done \
&& ln -sf ../src/true $(bin)/false \
&& PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \
&& { test -d gnulib-tests \
&& $(MAKE) -C gnulib-tests check \
|| :; } \
&& rm -rf $(bin) \
&& $(MAKE) distclean
(cd $(t) && mv $(distdir) $(distdir).old \
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
if test -f $(srcdir)/src/c99-to-c89.diff; then \
cd $(t)/$(distdir) \
&& (cd src && patch -V never --fuzz=0 <c99-to-c89.diff) \
&& ./configure --disable-largefile \
CFLAGS='-Werror -ansi -Wno-long-long' \
&& $(MAKE); \
fi
-rm -rf $(t)
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
echo "========================"
WGET = wget
WGETFLAGS = -C off
rel-check:
tarz=/tmp/rel-check-tarz-$$$$; \
md5_tmp=/tmp/rel-check-md5-$$$$; \
set -e; \
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
$(WGET) $(WGETFLAGS) -q --output-document=$$tarz $(url); \
echo "$(md5) -" > $$md5_tmp; \
md5sum -c $$md5_tmp < $$tarz
rel-files = $(DIST_ARCHIVES)
gnulib-version = $$(cd $(gnulib_dir) && git describe)
announcement: NEWS ChangeLog $(rel-files)
@./build-aux/announce-gen \
--release-type=$(RELEASE_TYPE) \
--package=$(PACKAGE) \
--prev=$(PREV_VERSION) \
--curr=$(VERSION) \
--gpg-key-id=$(gpg_key_ID) \
--news=NEWS \
--bootstrap-tools=autoconf,automake,flex,gnulib \
--gnulib-version=$(gnulib-version) \
$(addprefix --url-dir=, $(url_dir_list))
## ---------------- ##
## Updating files. ##
## ---------------- ##
ftp-gnu = ftp://ftp.gnu.org/gnu
www-gnu = http://www.gnu.org
# Use mv, if you don't have/want move-if-change.
move_if_change ?= move-if-change
emit_upload_commands:
@echo =====================================
@echo =====================================
@echo "$(srcdir)/build-aux/gnupload $(GNUPLOADFLAGS) \\"
@echo " --to $(gnu_rel_host):$(PACKAGE) \\"
@echo " $(rel-files)"
@echo '# send the /tmp/announcement e-mail'
@echo =====================================
@echo =====================================
noteworthy = * Noteworthy changes in release ?.? (????-??-??) [?]
define emit-commit-log
printf '%s\n' 'post-release administrivia' '' \
'* NEWS: Add header line for next release.' \
'* .prev-version: Record previous version.' \
'* cfg.mk (old_NEWS_hash): Auto-update.'
endef
.PHONY: alpha beta major
alpha beta major: $(local-check) writable-files
test $@ = major \
&& { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
|| { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
|| :
$(MAKE) vc-dist
$(MAKE) news-date-check
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
if test -d $(release_archive_dir); then \
ln $(rel-files) $(release_archive_dir); \
chmod a-w $(rel-files); \
fi
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
echo $(VERSION) > $(prev_version_file)
$(MAKE) update-NEWS-hash
perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS
$(emit-commit-log) > .ci-msg
$(VC) commit -F .ci-msg
+2
View File
@@ -1,5 +1,7 @@
*.gmo
*.po
*.po~
.reference
LINGUAS
Makefile
Makefile.in
+22
View File
@@ -0,0 +1,22 @@
/*.gmo
/*.po
/*.po~
/.reference
/LINGUAS
/Makefile
/Makefile.in
/Makefile.in.in
/Makevars
/Makevars.template
/POTFILES
/Rules-quot
/bison.pot
/boldquot.sed
/[email protected]
/[email protected]
/insert-header.sed
/insert-header.sin
/quot.sed
/remove-potcdate.sed
/remove-potcdate.sin
/stamp-po
+2
View File
@@ -1,5 +1,7 @@
*.gmo
*.po
*.po~
.reference
LINGUAS
Makefile
Makefile.in
+20
View File
@@ -0,0 +1,20 @@
/*.gmo
/*.po
/*.po~
/.reference
/LINGUAS
/Makefile
/Makefile.in
/Makefile.in.in
/Makevars
/POTFILES
/Rules-quot
/bison-runtime.pot
/boldquot.sed
/[email protected]
/[email protected]
/insert-header.sin
/quot.sed
/remove-potcdate.sed
/remove-potcdate.sin
/stamp-po
-1
View File
@@ -5,7 +5,6 @@
Makefile
Makefile.in
bison
revision.c
scan-code.c
scan-gram.c
scan-skel.c
+13
View File
@@ -0,0 +1,13 @@
/*.flc
/*.log
/*.o
/*.output
/.deps
/Makefile
/Makefile.in
/bison
/bison.exe
/scan-code.c
/scan-gram.c
/scan-skel.c
/yacc
+1 -13
View File
@@ -1,6 +1,6 @@
# Make bison/src.
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
@@ -53,7 +53,6 @@ bison_SOURCES = \
print-xml.c print-xml.h \
reader.c reader.h \
reduce.c reduce.h \
revision.c revision.h \
relation.c relation.h \
scan-code.h scan-code-c.c \
scan-gram.h scan-gram-c.c \
@@ -70,7 +69,6 @@ EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
BUILT_SOURCES = \
parse-gram.c parse-gram.h \
revision.c \
scan-code.c \
scan-skel.c \
scan-gram.c
@@ -85,16 +83,6 @@ yacc:
echo:
echo $(bison_SOURCES) $(noinst_HEADERS)
revision.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog
case "$(VERSION)" in \
*+*) sed -n \
's/^\$$\(Id.*\)\$$$$/const char *revision = "\1\\n";/p' \
$(top_srcdir)/ChangeLog \
;; \
*) echo 'const char *revision = "";' \
;; \
esac >$@
# The following rule is not designed to be portable,
# and relies on tools that not everyone has.
+6 -2
View File
@@ -1,7 +1,7 @@
/* Open and close files for Bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc.
2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -267,7 +267,9 @@ compute_file_name_parts (void)
if (spec_file_prefix)
{
/* If --file-prefix=foo was specified, ALL_BUT_TAB_EXT = `foo'. */
dir_prefix = xstrndup (grammar_file, base - grammar_file);
dir_prefix =
xstrndup (spec_file_prefix,
last_component (spec_file_prefix) - spec_file_prefix);
all_but_tab_ext = xstrdup (spec_file_prefix);
}
else if (yacc_flag)
@@ -351,6 +353,8 @@ compute_output_file_names (void)
void
output_file_name_check (char const *file_name)
{
if (0 == strcmp (file_name, grammar_file))
fatal (_("refusing to overwrite the input file %s"), quote (file_name));
{
int i;
for (i = 0; i < file_names_count; i++)
+1 -2
View File
@@ -20,7 +20,6 @@
#include <config.h>
#include "system.h"
#include "revision.h"
#include "output.h"
#include <argmatch.h>
@@ -273,6 +272,7 @@ Operation modes:\n\
fputs (_("\
Parser:\n\
-L, --language=LANGUAGE specify the output programming language\n\
(this is an experimental feature)\n\
-S, --skeleton=FILE specify the skeleton to use\n\
-t, --debug instrument the parser for debugging\n\
--locations enable locations computation\n\
@@ -338,7 +338,6 @@ version (void)
continue. */
printf (_("bison (GNU Bison) %s"), VERSION);
putc ('\n', stdout);
printf ("%s", revision);
fputs (_("Written by Robert Corbett and Richard Stallman.\n"), stdout);
putc ('\n', stdout);
+46 -14
View File
@@ -473,13 +473,10 @@ output_skeleton (void)
FILE *in;
FILE *out;
int filter_fd[2];
char const *argv[7];
char const *argv[9];
pid_t pid;
/* Compute the names of the package data dir and skeleton file.
Test whether m4sugar.m4 is readable, to check for proper
installation. A faulty installation can cause deadlock, so a
cheap sanity check is worthwhile. */
/* Compute the names of the package data dir and skeleton files. */
char const m4sugar[] = "m4sugar/m4sugar.m4";
char const m4bison[] = "bison.m4";
char *full_m4sugar;
@@ -505,26 +502,61 @@ output_skeleton (void)
strcpy (full_skeleton, skeleton);
else
strcpy (full_skeleton + pkgdatadirlen + 1, skeleton);
/* Test whether m4sugar.m4 is readable, to check for proper
installation. A faulty installation can cause deadlock, so a
cheap sanity check is worthwhile. */
xfclose (xfopen (full_m4sugar, "r"));
/* Create an m4 subprocess connected to us via two pipes. */
if (trace_flag & trace_tools)
fprintf (stderr, "running: %s %s - %s %s\n",
m4, full_m4sugar, full_m4bison, full_skeleton);
m4, full_m4sugar, full_m4bison, full_skeleton);
argv[0] = m4;
argv[1] = full_m4sugar;
argv[2] = "-";
argv[3] = full_m4bison;
argv[4] = full_skeleton;
argv[5] = trace_flag & trace_m4 ? "-dV" : NULL;
argv[6] = NULL;
/* Some future version of GNU M4 (most likely 1.6) may treat the -dV in a
position-dependent manner. Keep it as the first argument so that all
files are traced.
See the thread starting at
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
for details. */
{
int i = 0;
argv[i++] = m4;
argv[i++] = "-I";
argv[i++] = pkgdatadir;
if (trace_flag & trace_m4)
argv[i++] = "-dV";
argv[i++] = full_m4sugar;
argv[i++] = "-";
argv[i++] = full_m4bison;
argv[i++] = full_skeleton;
argv[i++] = NULL;
}
/* When POSIXLY_CORRECT is set, some future versions of GNU M4 (most likely
2.0) may drop some of the GNU extensions that Bison's skeletons depend
upon. So that the next release of Bison is forward compatible with those
future versions of GNU M4, we unset POSIXLY_CORRECT here.
FIXME: A user might set POSIXLY_CORRECT to affect processes run from
macros like m4_syscmd in a custom skeleton. For now, Bison makes no
promises about the behavior of custom skeletons, so this scenario is not a
concern. However, we eventually want to eliminate this shortcoming. The
next release of GNU M4 (1.4.12 or 1.6) will accept the -g command-line
option as a no-op, and later releases will accept it to indicate that
POSIXLY_CORRECT should be ignored. Once the GNU M4 versions that accept
-g are pervasive, Bison should use -g instead of unsetting
POSIXLY_CORRECT.
See the thread starting at
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
for details. */
unsetenv ("POSIXLY_CORRECT");
init_subpipe ();
pid = create_subpipe (argv, filter_fd);
free (full_m4bison);
free (full_m4sugar);
free (full_m4bison);
free (full_skeleton);
out = fdopen (filter_fd[0], "w");
+141 -143
View File
@@ -1,5 +1,5 @@
/* A Bison parser, made by GNU Bison 2.3b. */
/* A Bison parser, made by GNU Bison 2.3b.21-d67c5-dirty. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
@@ -46,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.3b"
#define YYBISON_VERSION "2.3b.21-d67c5-dirty"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -100,8 +100,6 @@
#include <config.h>
#include "system.h"
#include <strverscmp.h>
#include "complain.h"
#include "conflicts.h"
#include "files.h"
@@ -153,7 +151,7 @@ static int current_prec = 0;
/* Line 189 of yacc.c */
#line 157 "parse-gram.c"
#line 155 "parse-gram.c"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -301,8 +299,8 @@ static int current_prec = 0;
typedef union YYSTYPE
{
/* Line 214 of yacc.c */
#line 94 "parse-gram.y"
/* Line 222 of yacc.c */
#line 92 "parse-gram.y"
symbol *symbol;
symbol_list *list;
@@ -315,8 +313,8 @@ typedef union YYSTYPE
/* Line 214 of yacc.c */
#line 320 "parse-gram.c"
/* Line 222 of yacc.c */
#line 318 "parse-gram.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -341,7 +339,7 @@ typedef struct YYLTYPE
/* Line 264 of yacc.c */
#line 345 "parse-gram.c"
#line 343 "parse-gram.c"
#ifdef short
# undef short
@@ -666,17 +664,17 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 204, 204, 212, 214, 218, 219, 229, 230, 234,
235, 240, 241, 242, 243, 244, 245, 250, 259, 260,
261, 262, 263, 264, 265, 266, 267, 268, 269, 282,
283, 307, 308, 309, 310, 314, 315, 316, 320, 327,
334, 338, 342, 349, 364, 365, 369, 381, 381, 386,
386, 391, 402, 417, 418, 419, 423, 424, 429, 431,
436, 437, 442, 444, 449, 450, 454, 455, 456, 457,
462, 467, 472, 478, 484, 495, 496, 505, 506, 512,
513, 514, 521, 521, 525, 526, 527, 532, 533, 535,
537, 539, 541, 551, 552, 558, 561, 570, 590, 592,
601, 606, 607, 612, 619, 621
0, 202, 202, 210, 212, 216, 217, 227, 228, 232,
233, 238, 239, 240, 241, 242, 243, 248, 257, 258,
259, 260, 261, 262, 263, 264, 265, 266, 267, 280,
281, 305, 306, 307, 308, 312, 313, 314, 318, 325,
332, 336, 340, 347, 362, 363, 367, 379, 379, 384,
384, 389, 400, 415, 416, 417, 421, 422, 427, 429,
434, 435, 440, 442, 447, 448, 452, 453, 454, 455,
460, 465, 470, 476, 482, 493, 494, 503, 504, 510,
511, 512, 519, 519, 523, 524, 525, 530, 531, 533,
535, 537, 539, 549, 550, 556, 559, 568, 588, 590,
599, 604, 605, 610, 617, 619
};
#endif
@@ -1032,146 +1030,146 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
case 3: /* "\"string\"" */
/* Line 715 of yacc.c */
#line 182 "parse-gram.y"
#line 180 "parse-gram.y"
{ fputs (quotearg_style (c_quoting_style, (yyvaluep->chars)), stderr); };
/* Line 715 of yacc.c */
#line 1040 "parse-gram.c"
#line 1038 "parse-gram.c"
break;
case 4: /* "\"integer\"" */
/* Line 715 of yacc.c */
#line 193 "parse-gram.y"
#line 191 "parse-gram.y"
{ fprintf (stderr, "%d", (yyvaluep->integer)); };
/* Line 715 of yacc.c */
#line 1049 "parse-gram.c"
#line 1047 "parse-gram.c"
break;
case 43: /* "\"{...}\"" */
/* Line 715 of yacc.c */
#line 184 "parse-gram.y"
#line 182 "parse-gram.y"
{ fprintf (stderr, "{\n%s\n}", (yyvaluep->code)); };
/* Line 715 of yacc.c */
#line 1058 "parse-gram.c"
#line 1056 "parse-gram.c"
break;
case 44: /* "\"char\"" */
/* Line 715 of yacc.c */
#line 176 "parse-gram.y"
#line 174 "parse-gram.y"
{ fputs (char_name ((yyvaluep->character)), stderr); };
/* Line 715 of yacc.c */
#line 1067 "parse-gram.c"
#line 1065 "parse-gram.c"
break;
case 45: /* "\"epilogue\"" */
/* Line 715 of yacc.c */
#line 184 "parse-gram.y"
#line 182 "parse-gram.y"
{ fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
/* Line 715 of yacc.c */
#line 1076 "parse-gram.c"
#line 1074 "parse-gram.c"
break;
case 47: /* "\"identifier\"" */
/* Line 715 of yacc.c */
#line 189 "parse-gram.y"
#line 187 "parse-gram.y"
{ fputs ((yyvaluep->uniqstr), stderr); };
/* Line 715 of yacc.c */
#line 1085 "parse-gram.c"
#line 1083 "parse-gram.c"
break;
case 48: /* "\"identifier:\"" */
/* Line 715 of yacc.c */
#line 190 "parse-gram.y"
#line 188 "parse-gram.y"
{ fprintf (stderr, "%s:", (yyvaluep->uniqstr)); };
/* Line 715 of yacc.c */
#line 1094 "parse-gram.c"
#line 1092 "parse-gram.c"
break;
case 51: /* "\"%{...%}\"" */
/* Line 715 of yacc.c */
#line 184 "parse-gram.y"
#line 182 "parse-gram.y"
{ fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
/* Line 715 of yacc.c */
#line 1103 "parse-gram.c"
#line 1101 "parse-gram.c"
break;
case 53: /* "\"type\"" */
/* Line 715 of yacc.c */
#line 188 "parse-gram.y"
#line 186 "parse-gram.y"
{ fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); };
/* Line 715 of yacc.c */
#line 1112 "parse-gram.c"
#line 1110 "parse-gram.c"
break;
case 82: /* "variable" */
/* Line 715 of yacc.c */
#line 189 "parse-gram.y"
#line 187 "parse-gram.y"
{ fputs ((yyvaluep->uniqstr), stderr); };
/* Line 715 of yacc.c */
#line 1121 "parse-gram.c"
#line 1119 "parse-gram.c"
break;
case 83: /* "content.opt" */
/* Line 715 of yacc.c */
#line 184 "parse-gram.y"
#line 182 "parse-gram.y"
{ fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
/* Line 715 of yacc.c */
#line 1130 "parse-gram.c"
#line 1128 "parse-gram.c"
break;
case 84: /* "braceless" */
/* Line 715 of yacc.c */
#line 184 "parse-gram.y"
#line 182 "parse-gram.y"
{ fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
/* Line 715 of yacc.c */
#line 1139 "parse-gram.c"
#line 1137 "parse-gram.c"
break;
case 85: /* "id" */
/* Line 715 of yacc.c */
#line 196 "parse-gram.y"
#line 194 "parse-gram.y"
{ fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
/* Line 715 of yacc.c */
#line 1148 "parse-gram.c"
#line 1146 "parse-gram.c"
break;
case 86: /* "id_colon" */
/* Line 715 of yacc.c */
#line 197 "parse-gram.y"
#line 195 "parse-gram.y"
{ fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); };
/* Line 715 of yacc.c */
#line 1157 "parse-gram.c"
#line 1155 "parse-gram.c"
break;
case 87: /* "symbol" */
/* Line 715 of yacc.c */
#line 196 "parse-gram.y"
#line 194 "parse-gram.y"
{ fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
/* Line 715 of yacc.c */
#line 1166 "parse-gram.c"
#line 1164 "parse-gram.c"
break;
case 88: /* "string_as_id" */
/* Line 715 of yacc.c */
#line 196 "parse-gram.y"
#line 194 "parse-gram.y"
{ fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
/* Line 715 of yacc.c */
#line 1175 "parse-gram.c"
#line 1173 "parse-gram.c"
break;
default:
break;
@@ -1690,8 +1688,8 @@ YYLTYPE yylloc;
/* User initialization code. */
/* Line 1242 of yacc.c */
#line 86 "parse-gram.y"
/* Line 1248 of yacc.c */
#line 84 "parse-gram.y"
{
/* Bison's grammar can initial empty locations, hence a default
location is needed. */
@@ -1699,8 +1697,8 @@ YYLTYPE yylloc;
boundary_set (&yylloc.end, current_file, 1, 1);
}
/* Line 1242 of yacc.c */
#line 1704 "parse-gram.c"
/* Line 1248 of yacc.c */
#line 1702 "parse-gram.c"
yylsp[0] = yylloc;
goto yysetstate;
@@ -1888,7 +1886,7 @@ yyreduce:
case 6:
/* Line 1455 of yacc.c */
#line 220 "parse-gram.y"
#line 218 "parse-gram.y"
{
code_props plain_code;
code_props_plain_init (&plain_code, (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)]));
@@ -1903,14 +1901,14 @@ yyreduce:
case 7:
/* Line 1455 of yacc.c */
#line 229 "parse-gram.y"
#line 227 "parse-gram.y"
{ debug_flag = true; }
break;
case 8:
/* Line 1455 of yacc.c */
#line 231 "parse-gram.y"
#line 229 "parse-gram.y"
{
muscle_percent_define_insert ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars));
}
@@ -1919,14 +1917,14 @@ yyreduce:
case 9:
/* Line 1455 of yacc.c */
#line 234 "parse-gram.y"
#line 232 "parse-gram.y"
{ defines_flag = true; }
break;
case 10:
/* Line 1455 of yacc.c */
#line 236 "parse-gram.y"
#line 234 "parse-gram.y"
{
defines_flag = true;
spec_defines_file = xstrdup ((yyvsp[(2) - (2)].chars));
@@ -1936,42 +1934,42 @@ yyreduce:
case 11:
/* Line 1455 of yacc.c */
#line 240 "parse-gram.y"
#line 238 "parse-gram.y"
{ error_verbose = true; }
break;
case 12:
/* Line 1455 of yacc.c */
#line 241 "parse-gram.y"
#line 239 "parse-gram.y"
{ expected_sr_conflicts = (yyvsp[(2) - (2)].integer); }
break;
case 13:
/* Line 1455 of yacc.c */
#line 242 "parse-gram.y"
#line 240 "parse-gram.y"
{ expected_rr_conflicts = (yyvsp[(2) - (2)].integer); }
break;
case 14:
/* Line 1455 of yacc.c */
#line 243 "parse-gram.y"
#line 241 "parse-gram.y"
{ spec_file_prefix = (yyvsp[(2) - (2)].chars); }
break;
case 15:
/* Line 1455 of yacc.c */
#line 244 "parse-gram.y"
#line 242 "parse-gram.y"
{ spec_file_prefix = (yyvsp[(3) - (3)].chars); }
break;
case 16:
/* Line 1455 of yacc.c */
#line 246 "parse-gram.y"
#line 244 "parse-gram.y"
{
nondeterministic_parser = true;
glr_parser = true;
@@ -1981,7 +1979,7 @@ yyreduce:
case 17:
/* Line 1455 of yacc.c */
#line 251 "parse-gram.y"
#line 249 "parse-gram.y"
{
code_props action;
code_props_symbol_action_init (&action, (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)]));
@@ -1995,77 +1993,77 @@ yyreduce:
case 18:
/* Line 1455 of yacc.c */
#line 259 "parse-gram.y"
#line 257 "parse-gram.y"
{ language_argmatch ((yyvsp[(2) - (2)].chars), 1, &(yylsp[(1) - (2)])); }
break;
case 19:
/* Line 1455 of yacc.c */
#line 260 "parse-gram.y"
#line 258 "parse-gram.y"
{ add_param ("lex_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
break;
case 20:
/* Line 1455 of yacc.c */
#line 261 "parse-gram.y"
#line 259 "parse-gram.y"
{ locations_flag = true; }
break;
case 21:
/* Line 1455 of yacc.c */
#line 262 "parse-gram.y"
#line 260 "parse-gram.y"
{ spec_name_prefix = (yyvsp[(2) - (2)].chars); }
break;
case 22:
/* Line 1455 of yacc.c */
#line 263 "parse-gram.y"
#line 261 "parse-gram.y"
{ spec_name_prefix = (yyvsp[(3) - (3)].chars); }
break;
case 23:
/* Line 1455 of yacc.c */
#line 264 "parse-gram.y"
#line 262 "parse-gram.y"
{ no_lines_flag = true; }
break;
case 24:
/* Line 1455 of yacc.c */
#line 265 "parse-gram.y"
#line 263 "parse-gram.y"
{ nondeterministic_parser = true; }
break;
case 25:
/* Line 1455 of yacc.c */
#line 266 "parse-gram.y"
#line 264 "parse-gram.y"
{ spec_outfile = (yyvsp[(2) - (2)].chars); }
break;
case 26:
/* Line 1455 of yacc.c */
#line 267 "parse-gram.y"
#line 265 "parse-gram.y"
{ spec_outfile = (yyvsp[(3) - (3)].chars); }
break;
case 27:
/* Line 1455 of yacc.c */
#line 268 "parse-gram.y"
#line 266 "parse-gram.y"
{ add_param ("parse_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
break;
case 28:
/* Line 1455 of yacc.c */
#line 270 "parse-gram.y"
#line 268 "parse-gram.y"
{
/* %pure-parser is deprecated in favor of `%define api.pure', so use
`%define api.pure' in a backward-compatible manner here. First, don't
@@ -2083,14 +2081,14 @@ yyreduce:
case 29:
/* Line 1455 of yacc.c */
#line 282 "parse-gram.y"
#line 280 "parse-gram.y"
{ version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); }
break;
case 30:
/* Line 1455 of yacc.c */
#line 284 "parse-gram.y"
#line 282 "parse-gram.y"
{
char const *skeleton_user = (yyvsp[(2) - (2)].chars);
if (strchr (skeleton_user, '/'))
@@ -2119,28 +2117,28 @@ yyreduce:
case 31:
/* Line 1455 of yacc.c */
#line 307 "parse-gram.y"
#line 305 "parse-gram.y"
{ token_table_flag = true; }
break;
case 32:
/* Line 1455 of yacc.c */
#line 308 "parse-gram.y"
#line 306 "parse-gram.y"
{ report_flag |= report_states; }
break;
case 33:
/* Line 1455 of yacc.c */
#line 309 "parse-gram.y"
#line 307 "parse-gram.y"
{ yacc_flag = true; }
break;
case 37:
/* Line 1455 of yacc.c */
#line 317 "parse-gram.y"
#line 315 "parse-gram.y"
{
grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]));
}
@@ -2149,7 +2147,7 @@ yyreduce:
case 38:
/* Line 1455 of yacc.c */
#line 321 "parse-gram.y"
#line 319 "parse-gram.y"
{
symbol_list *list;
for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
@@ -2161,7 +2159,7 @@ yyreduce:
case 39:
/* Line 1455 of yacc.c */
#line 328 "parse-gram.y"
#line 326 "parse-gram.y"
{
symbol_list *list;
for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
@@ -2173,7 +2171,7 @@ yyreduce:
case 40:
/* Line 1455 of yacc.c */
#line 335 "parse-gram.y"
#line 333 "parse-gram.y"
{
default_prec = true;
}
@@ -2182,7 +2180,7 @@ yyreduce:
case 41:
/* Line 1455 of yacc.c */
#line 339 "parse-gram.y"
#line 337 "parse-gram.y"
{
default_prec = false;
}
@@ -2191,7 +2189,7 @@ yyreduce:
case 42:
/* Line 1455 of yacc.c */
#line 343 "parse-gram.y"
#line 341 "parse-gram.y"
{
/* Do not invoke muscle_percent_code_grow here since it invokes
muscle_user_name_list_grow. */
@@ -2203,7 +2201,7 @@ yyreduce:
case 43:
/* Line 1455 of yacc.c */
#line 350 "parse-gram.y"
#line 348 "parse-gram.y"
{
muscle_percent_code_grow ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)]));
code_scanner_last_string_free ();
@@ -2213,21 +2211,21 @@ yyreduce:
case 44:
/* Line 1455 of yacc.c */
#line 364 "parse-gram.y"
#line 362 "parse-gram.y"
{}
break;
case 45:
/* Line 1455 of yacc.c */
#line 365 "parse-gram.y"
#line 363 "parse-gram.y"
{ muscle_code_grow ("union_name", (yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break;
case 46:
/* Line 1455 of yacc.c */
#line 370 "parse-gram.y"
#line 368 "parse-gram.y"
{
union_seen = true;
muscle_code_grow ("stype", (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)]));
@@ -2238,14 +2236,14 @@ yyreduce:
case 47:
/* Line 1455 of yacc.c */
#line 381 "parse-gram.y"
#line 379 "parse-gram.y"
{ current_class = nterm_sym; }
break;
case 48:
/* Line 1455 of yacc.c */
#line 382 "parse-gram.y"
#line 380 "parse-gram.y"
{
current_class = unknown_sym;
current_type = NULL;
@@ -2255,14 +2253,14 @@ yyreduce:
case 49:
/* Line 1455 of yacc.c */
#line 386 "parse-gram.y"
#line 384 "parse-gram.y"
{ current_class = token_sym; }
break;
case 50:
/* Line 1455 of yacc.c */
#line 387 "parse-gram.y"
#line 385 "parse-gram.y"
{
current_class = unknown_sym;
current_type = NULL;
@@ -2272,7 +2270,7 @@ yyreduce:
case 51:
/* Line 1455 of yacc.c */
#line 392 "parse-gram.y"
#line 390 "parse-gram.y"
{
symbol_list *list;
tag_seen = true;
@@ -2285,7 +2283,7 @@ yyreduce:
case 52:
/* Line 1455 of yacc.c */
#line 403 "parse-gram.y"
#line 401 "parse-gram.y"
{
symbol_list *list;
++current_prec;
@@ -2302,126 +2300,126 @@ yyreduce:
case 53:
/* Line 1455 of yacc.c */
#line 417 "parse-gram.y"
#line 415 "parse-gram.y"
{ (yyval.assoc) = left_assoc; }
break;
case 54:
/* Line 1455 of yacc.c */
#line 418 "parse-gram.y"
#line 416 "parse-gram.y"
{ (yyval.assoc) = right_assoc; }
break;
case 55:
/* Line 1455 of yacc.c */
#line 419 "parse-gram.y"
#line 417 "parse-gram.y"
{ (yyval.assoc) = non_assoc; }
break;
case 56:
/* Line 1455 of yacc.c */
#line 423 "parse-gram.y"
#line 421 "parse-gram.y"
{ current_type = NULL; }
break;
case 57:
/* Line 1455 of yacc.c */
#line 424 "parse-gram.y"
#line 422 "parse-gram.y"
{ current_type = (yyvsp[(1) - (1)].uniqstr); tag_seen = true; }
break;
case 58:
/* Line 1455 of yacc.c */
#line 430 "parse-gram.y"
#line 428 "parse-gram.y"
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
break;
case 59:
/* Line 1455 of yacc.c */
#line 432 "parse-gram.y"
#line 430 "parse-gram.y"
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); }
break;
case 60:
/* Line 1455 of yacc.c */
#line 436 "parse-gram.y"
#line 434 "parse-gram.y"
{ (yyval.symbol) = (yyvsp[(1) - (1)].symbol); }
break;
case 61:
/* Line 1455 of yacc.c */
#line 437 "parse-gram.y"
#line 435 "parse-gram.y"
{ (yyval.symbol) = (yyvsp[(1) - (2)].symbol); symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); }
break;
case 62:
/* Line 1455 of yacc.c */
#line 443 "parse-gram.y"
#line 441 "parse-gram.y"
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
break;
case 63:
/* Line 1455 of yacc.c */
#line 445 "parse-gram.y"
#line 443 "parse-gram.y"
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); }
break;
case 64:
/* Line 1455 of yacc.c */
#line 449 "parse-gram.y"
#line 447 "parse-gram.y"
{ (yyval.list) = (yyvsp[(1) - (1)].list); }
break;
case 65:
/* Line 1455 of yacc.c */
#line 450 "parse-gram.y"
#line 448 "parse-gram.y"
{ (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].list)); }
break;
case 66:
/* Line 1455 of yacc.c */
#line 454 "parse-gram.y"
#line 452 "parse-gram.y"
{ (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
break;
case 67:
/* Line 1455 of yacc.c */
#line 455 "parse-gram.y"
#line 453 "parse-gram.y"
{ (yyval.list) = symbol_list_type_new ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break;
case 68:
/* Line 1455 of yacc.c */
#line 456 "parse-gram.y"
#line 454 "parse-gram.y"
{ (yyval.list) = symbol_list_default_tagged_new ((yylsp[(1) - (1)])); }
break;
case 69:
/* Line 1455 of yacc.c */
#line 457 "parse-gram.y"
#line 455 "parse-gram.y"
{ (yyval.list) = symbol_list_default_tagless_new ((yylsp[(1) - (1)])); }
break;
case 70:
/* Line 1455 of yacc.c */
#line 463 "parse-gram.y"
#line 461 "parse-gram.y"
{
current_type = (yyvsp[(1) - (1)].uniqstr);
tag_seen = true;
@@ -2431,7 +2429,7 @@ yyreduce:
case 71:
/* Line 1455 of yacc.c */
#line 468 "parse-gram.y"
#line 466 "parse-gram.y"
{
symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true);
symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)]));
@@ -2441,7 +2439,7 @@ yyreduce:
case 72:
/* Line 1455 of yacc.c */
#line 473 "parse-gram.y"
#line 471 "parse-gram.y"
{
symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
@@ -2452,7 +2450,7 @@ yyreduce:
case 73:
/* Line 1455 of yacc.c */
#line 479 "parse-gram.y"
#line 477 "parse-gram.y"
{
symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
@@ -2463,7 +2461,7 @@ yyreduce:
case 74:
/* Line 1455 of yacc.c */
#line 485 "parse-gram.y"
#line 483 "parse-gram.y"
{
symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true);
symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)]));
@@ -2475,7 +2473,7 @@ yyreduce:
case 81:
/* Line 1455 of yacc.c */
#line 515 "parse-gram.y"
#line 513 "parse-gram.y"
{
yyerrok;
}
@@ -2484,77 +2482,77 @@ yyreduce:
case 82:
/* Line 1455 of yacc.c */
#line 521 "parse-gram.y"
#line 519 "parse-gram.y"
{ current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); }
break;
case 84:
/* Line 1455 of yacc.c */
#line 525 "parse-gram.y"
#line 523 "parse-gram.y"
{ grammar_current_rule_end ((yylsp[(1) - (1)])); }
break;
case 85:
/* Line 1455 of yacc.c */
#line 526 "parse-gram.y"
#line 524 "parse-gram.y"
{ grammar_current_rule_end ((yylsp[(3) - (3)])); }
break;
case 87:
/* Line 1455 of yacc.c */
#line 532 "parse-gram.y"
#line 530 "parse-gram.y"
{ grammar_current_rule_begin (current_lhs, current_lhs_location); }
break;
case 88:
/* Line 1455 of yacc.c */
#line 534 "parse-gram.y"
#line 532 "parse-gram.y"
{ grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); }
break;
case 89:
/* Line 1455 of yacc.c */
#line 536 "parse-gram.y"
#line 534 "parse-gram.y"
{ grammar_current_rule_action_append ((yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); }
break;
case 90:
/* Line 1455 of yacc.c */
#line 538 "parse-gram.y"
#line 536 "parse-gram.y"
{ grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); }
break;
case 91:
/* Line 1455 of yacc.c */
#line 540 "parse-gram.y"
#line 538 "parse-gram.y"
{ grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); }
break;
case 92:
/* Line 1455 of yacc.c */
#line 542 "parse-gram.y"
#line 540 "parse-gram.y"
{ grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); }
break;
case 94:
/* Line 1455 of yacc.c */
#line 552 "parse-gram.y"
#line 550 "parse-gram.y"
{ (yyval.uniqstr) = uniqstr_new ((yyvsp[(1) - (1)].chars)); }
break;
case 95:
/* Line 1455 of yacc.c */
#line 558 "parse-gram.y"
#line 556 "parse-gram.y"
{
(yyval.chars) = "";
}
@@ -2563,7 +2561,7 @@ yyreduce:
case 97:
/* Line 1455 of yacc.c */
#line 571 "parse-gram.y"
#line 569 "parse-gram.y"
{
code_props plain_code;
(yyvsp[(1) - (1)].code)[strlen ((yyvsp[(1) - (1)].code)) - 1] = '\n';
@@ -2577,14 +2575,14 @@ yyreduce:
case 98:
/* Line 1455 of yacc.c */
#line 591 "parse-gram.y"
#line 589 "parse-gram.y"
{ (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break;
case 99:
/* Line 1455 of yacc.c */
#line 593 "parse-gram.y"
#line 591 "parse-gram.y"
{
(yyval.symbol) = symbol_get (char_name ((yyvsp[(1) - (1)].character)), (yylsp[(1) - (1)]));
symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
@@ -2595,14 +2593,14 @@ yyreduce:
case 100:
/* Line 1455 of yacc.c */
#line 601 "parse-gram.y"
#line 599 "parse-gram.y"
{ (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
break;
case 103:
/* Line 1455 of yacc.c */
#line 613 "parse-gram.y"
#line 611 "parse-gram.y"
{
(yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)]));
symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
@@ -2612,7 +2610,7 @@ yyreduce:
case 105:
/* Line 1455 of yacc.c */
#line 622 "parse-gram.y"
#line 620 "parse-gram.y"
{
code_props plain_code;
code_props_plain_init (&plain_code, (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)]));
@@ -2626,7 +2624,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 2630 "parse-gram.c"
#line 2628 "parse-gram.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2845,7 +2843,7 @@ yyreturn:
/* Line 1675 of yacc.c */
#line 632 "parse-gram.y"
#line 630 "parse-gram.y"
+4 -4
View File
@@ -1,5 +1,5 @@
/* A Bison parser, made by GNU Bison 2.3b. */
/* A Bison parser, made by GNU Bison 2.3b.21-d67c5-dirty. */
/* Skeleton interface for Bison's Yacc-like parsers in C
@@ -160,8 +160,8 @@
typedef union YYSTYPE
{
/* Line 1676 of yacc.c */
#line 94 "parse-gram.y"
/* Line 1740 of yacc.c */
#line 92 "parse-gram.y"
symbol *symbol;
symbol_list *list;
@@ -174,7 +174,7 @@ typedef union YYSTYPE
/* Line 1676 of yacc.c */
/* Line 1740 of yacc.c */
#line 179 "parse-gram.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
-2
View File
@@ -21,8 +21,6 @@
#include <config.h>
#include "system.h"
#include <strverscmp.h>
#include "complain.h"
#include "conflicts.h"
#include "files.h"
+17 -19
View File
@@ -1,7 +1,7 @@
/* Grammar reduction for Bison.
Copyright (C) 1988, 1989, 2000, 2001, 2002, 2003, 2005, 2006,
2007 Free Software Foundation, Inc.
2007, 2008 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -382,26 +382,24 @@ reduce_output (FILE *out)
static void
reduce_print (void)
{
fprintf (stderr, "%s: %s: ", grammar_file, _("warning"));
if (nuseless_nonterminals > 0)
fprintf (stderr, ngettext ("%d nonterminal",
"%d nonterminals",
nuseless_nonterminals),
nuseless_nonterminals);
if (nuseless_nonterminals > 0 && nuseless_productions > 0)
fprintf (stderr, _(" and "));
{
fprintf (stderr, "%s: %s: ", grammar_file, _("warning"));
fprintf (stderr, ngettext ("%d nonterminal useless in grammar",
"%d nonterminals useless in grammar",
nuseless_nonterminals),
nuseless_nonterminals);
fprintf (stderr, "\n");
}
if (nuseless_productions > 0)
fprintf (stderr, ngettext ("%d rule",
"%d rules",
nuseless_productions),
nuseless_productions);
if (nuseless_nonterminals > 0 || nuseless_productions > 0)
fprintf (stderr, _(" useless in grammar"));
fprintf (stderr, "\n");
{
fprintf (stderr, "%s: %s: ", grammar_file, _("warning"));
fprintf (stderr, ngettext ("%d rule useless in grammar",
"%d rules useless in grammar",
nuseless_productions),
nuseless_productions);
fprintf (stderr, "\n");
}
}
void
-25
View File
@@ -1,25 +0,0 @@
/* Between Bison releases, define a precise revision string.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef REVISION_H_
# define REVISION_H_
extern const char *revision;
#endif /* !REVISION_H_ */
+16
View File
@@ -0,0 +1,16 @@
/*.dot
/*.output
/atconfig
/atlocal
/autom4te.cache
/bison
/calc
/calc.[chy]
/calc.tab.*
/Makefile
/Makefile.in
/Makefile.in
/package.m4
/testsuite
/testsuite.dir
/testsuite.log
+3 -3
View File
@@ -2,8 +2,8 @@
## Makefile for Bison testsuite.
## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
## Foundation, Inc.
## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
## Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
## package.m4. ##
## ------------ ##
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
$(srcdir)/package.m4: $(top_srcdir)/configure
{ \
echo '# Signature of the current package.'; \
echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \
+10 -2
View File
@@ -1,6 +1,6 @@
# Simple calculator. -*- Autotest -*-
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
@@ -139,7 +139,7 @@ exp:
| '-' exp %prec NEG { $$ = -$2; }
| exp '^' exp { $$ = power ($1, $3); }
| '(' exp ')' { $$ = $2; }
| '(' error ')' { $$ = 1111; }
| '(' error ')' { $$ = 1111; yyerrok; }
| '!' { $$ = 0; YYERROR; }
| '-' error { $$ = 0; YYERROR; }
;
@@ -529,6 +529,14 @@ _AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [113],
[1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
1.12: syntax error, unexpected number
calc: error: 2222 != 1])
# Check that yyerrok works properly: second error is not reported,
# third and fourth are. Parse status is succesfull.
_AT_CHECK_CALC_ERROR([$1], [0], [(* *) + (*) + (*)], [113],
[1.2: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
1.10: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
1.16: syntax error, unexpected '*', expecting number or '-' or '(' or '!'])
AT_BISON_OPTION_POPDEFS
AT_CLEANUP
+368 -1
View File
@@ -1,6 +1,6 @@
# Java tests for simple calculator. -*- Autotest -*-
# Copyright (C) 2007 Free Software Foundation, Inc.
# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -397,3 +397,370 @@ AT_CHECK_JAVA_CALC([%lex-param { InputStream is } ], [[
new Calc (System.in).parse ();
}
]])
# -----------------#
# Java Directives. #
# -----------------#
AT_BANNER([Java Parameters.])
# AT_CHECK_JAVA_MINIMAL([DIRECTIVES], [PARSER_ACTION], [POSITION_CLASS])
# ----------------------------------------------------------------------
# Check that a mininal parser with DIRECTIVES compiles in Java.
# Put the Java code in YYParser.java.
m4_define([AT_CHECK_JAVA_MINIMAL],
[
AT_DATA([[YYParser.y]], [
%language "Java"
%locations
%debug
%error-verbose
%token-table
$1
%%
start: "end" {$2};
%%
class m4_default([$3], [Position]) {}
])
AT_BISON_CHECK([[YYParser.y]])
AT_CHECK([[grep -q '[mb]4_' YYParser.y]], [1])
AT_JAVA_COMPILE([[YYParser.java]])
])
# AT_CHECK_JAVA_MINIMAL_W_LEXER([1:DIRECTIVES], [2:LEX_THROWS],
# [3:YYLEX_ACTION], [4:LEXER_BODY], [5:PARSER_ACTION], [6:STYPE],
# [7:POSITION_TYPE], [8:LOCATION_TYPE])
# ---------------------------------------------------------------------
# Check that a mininal parser with DIRECTIVES and a "%code lexer".
# YYLEX is the body of yylex () which throws LEX_THROW.
# compiles in Java.
m4_define([AT_CHECK_JAVA_MINIMAL_W_LEXER],
[AT_CHECK_JAVA_MINIMAL([$1
%code lexer
{
m4_default([$6], [Object]) yylval;
public m4_default([$6], [Object]) getLVal() { return yylval; }
public m4_default([$7], [Position]) getStartPos() { return null; }
public m4_default([$7], [Position]) getEndPos() { return null; }
public void yyerror (m4_default([$8], [Location]) loc, String s)
{
System.err.println (loc + ": " + s);
}
public int yylex ()$2
{
$3
}
$4
}], [$5], [$7])])
# AT_CHECK_JAVA_GREP([LINE], [COUNT=1])
# -------------------------------------
# Check that YYParser.java contains exactly COUNT lines matching ^LINE$
# with grep.
m4_define([AT_CHECK_JAVA_GREP],
[AT_CHECK([grep -c '^$1$' YYParser.java], [], [m4_default([$2], [1])
])
])
# ----------------------------------- #
# Java parser class and package names #
# ----------------------------------- #
AT_SETUP([Java parser class and package names])
AT_CHECK_JAVA_MINIMAL([])
AT_CHECK_JAVA_GREP([[class YYParser]])
AT_CHECK_JAVA_MINIMAL([[%name-prefix "Prefix"]])
AT_CHECK_JAVA_GREP([[class PrefixParser]])
AT_CHECK_JAVA_MINIMAL([[%define parser_class_name "ParserClassName"]])
AT_CHECK_JAVA_GREP([[class ParserClassName]])
AT_CHECK_JAVA_MINIMAL([[%define package "user_java_package"]])
AT_CHECK_JAVA_GREP([[package user_java_package;]])
AT_CLEANUP
# --------------------------- #
# Java parser class modifiers #
# --------------------------- #
AT_SETUP([Java parser class modifiers])
AT_CHECK_JAVA_MINIMAL([[%define abstract]])
AT_CHECK_JAVA_GREP([[abstract class YYParser]])
AT_CHECK_JAVA_MINIMAL([[%define final]])
AT_CHECK_JAVA_GREP([[final class YYParser]])
AT_CHECK_JAVA_MINIMAL([[%define strictfp]])
AT_CHECK_JAVA_GREP([[strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define abstract
%define strictfp]])
AT_CHECK_JAVA_GREP([[abstract strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define final
%define strictfp]])
AT_CHECK_JAVA_GREP([[final strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[%define public]])
AT_CHECK_JAVA_GREP([[public class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define public
%define abstract]])
AT_CHECK_JAVA_GREP([[public abstract class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define public
%define final]])
AT_CHECK_JAVA_GREP([[public final class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define public
%define strictfp]])
AT_CHECK_JAVA_GREP([[public strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define public
%define abstract
%define strictfp]])
AT_CHECK_JAVA_GREP([[public abstract strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define public
%define final
%define strictfp]])
AT_CHECK_JAVA_GREP([[public final strictfp class YYParser]])
AT_CLEANUP
# ---------------------------------------- #
# Java parser class extends and implements #
# ---------------------------------------- #
AT_SETUP([Java parser class extends and implements])
AT_CHECK_JAVA_MINIMAL([[%define extends "Thread"]])
AT_CHECK_JAVA_GREP([[class YYParser extends Thread]])
AT_CHECK_JAVA_MINIMAL([[%define implements "Cloneable"]])
AT_CHECK_JAVA_GREP([[class YYParser implements Cloneable]])
AT_CHECK_JAVA_MINIMAL([[
%define extends "Thread"
%define implements "Cloneable"]])
AT_CHECK_JAVA_GREP([[class YYParser extends Thread implements Cloneable]])
AT_CLEANUP
# -------------------------------- #
# Java %parse-param and %lex-param #
# -------------------------------- #
AT_SETUP([Java %parse-param and %lex-param])
AT_CHECK_JAVA_MINIMAL([])
AT_CHECK_JAVA_GREP([[ *public YYParser (Lexer yylexer) {]])
AT_CHECK_JAVA_MINIMAL([[%parse-param {int parse_param1}]])
AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]])
AT_CHECK_JAVA_GREP([[ *public YYParser (Lexer yylexer, *int parse_param1) {]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]])
AT_CHECK_JAVA_MINIMAL([[
%parse-param {int parse_param1}
%parse-param {long parse_param2}]])
AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]])
AT_CHECK_JAVA_GREP([[ *protected final long parse_param2;]])
AT_CHECK_JAVA_GREP([[ *public YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param2 = parse_param2;]])
AT_CHECK_JAVA_MINIMAL_W_LEXER([], [], [[return EOF;]])
AT_CHECK_JAVA_GREP([[ *public YYParser () {]])
AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer) {]])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[%parse-param {int parse_param1}]],
[], [[return EOF;]])
AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]])
AT_CHECK_JAVA_GREP([[ *public YYParser (int parse_param1) {]])
AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer, *int parse_param1) {]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]], [2])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
%parse-param {int parse_param1}
%parse-param {long parse_param2}]],
[], [[return EOF;]])
AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]])
AT_CHECK_JAVA_GREP([[ *protected final long parse_param2;]])
AT_CHECK_JAVA_GREP([[ *public YYParser (int parse_param1, *long parse_param2) {]])
AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]], [2])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param2 = parse_param2;]], [2])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[%lex-param {char lex_param1}]],
[], [[return EOF;]], [[YYLexer (char lex_param1) {}]])
AT_CHECK_JAVA_GREP([[ *public YYParser (char lex_param1) {]])
AT_CHECK_JAVA_GREP([[.* = new YYLexer *(lex_param1);]])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
%lex-param {char lex_param1}
%lex-param {short lex_param2}]],
[], [[return EOF;]], [[YYLexer (char lex_param1, short lex_param2) {}]])
AT_CHECK_JAVA_GREP([[ *public YYParser (char lex_param1, *short lex_param2) {]])
AT_CHECK_JAVA_GREP([[.* = new YYLexer *(lex_param1, *lex_param2);]])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
%parse-param {int parse_param1}
%parse-param {long parse_param2}
%lex-param {char lex_param1}
%lex-param {short lex_param2}]],
[], [[return EOF;]], [[YYLexer (char lex_param1, short lex_param2) {}]])
AT_CHECK_JAVA_GREP([[ *protected final int parse_param1;]])
AT_CHECK_JAVA_GREP([[ *protected final long parse_param2;]])
AT_CHECK_JAVA_GREP([[ *public YYParser (char lex_param1, *short lex_param2, *int parse_param1, *long parse_param2) {]])
AT_CHECK_JAVA_GREP([[.* = new YYLexer *(lex_param1, *lex_param2);]])
AT_CHECK_JAVA_GREP([[ *protected YYParser (Lexer yylexer, *int parse_param1, *long parse_param2) {]])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param1 = parse_param1;]], [2])
AT_CHECK_JAVA_GREP([[[ ]*this.parse_param2 = parse_param2;]], [2])
AT_CLEANUP
# ------------------------- #
# Java throw specifications #
# ------------------------- #
AT_SETUP([Java throws specifications])
# %define throws - 0 1 2
# %define lex-throws - 0 1 2
# %code lexer 0 1
m4_define([AT_JT_lex_throws_define], [m4_case(AT_JT_lex_throws,
-1, [],
0, [[%define lex_throws ""]],
1, [[%define lex_throws "InterruptedException"]],
2, [[%define lex_throws "InterruptedException, IllegalAccessException"]])])
m4_define([AT_JT_yylex_throws], [m4_case(AT_JT_lex_throws,
-1, [[ throws java.io.IOException]],
0, [],
1, [[ throws InterruptedException]],
2, [[ throws InterruptedException, IllegalAccessException]])])
m4_define([AT_JT_yylex_action], [m4_case(AT_JT_lex_throws,
-1, [[throw new java.io.IOException();]],
0, [[return EOF;]],
1, [[throw new InterruptedException();]],
2, [[throw new IllegalAccessException();]])])
m4_define([AT_JT_throws_define], [m4_case(AT_JT_throws,
-1, [],
0, [[%define throws ""]],
1, [[%define throws "ClassNotFoundException"]],
2, [[%define throws "ClassNotFoundException, InstantiationException"]])])
m4_define([AT_JT_yyaction_throws], [m4_case(AT_JT_throws,
-1, [],
0, [],
1, [[ throws ClassNotFoundException]],
2, [[ throws ClassNotFoundException, InstantiationException]])])
m4_define([AT_JT_parse_throws_2], [m4_case(AT_JT_throws,
-1, [],
0, [],
1, [[, ClassNotFoundException]],
2, [[, ClassNotFoundException, InstantiationException]])])
m4_define([AT_JT_parse_throws],
[m4_if(m4_quote(AT_JT_yylex_throws), [],
[AT_JT_yyaction_throws],
[AT_JT_yylex_throws[]AT_JT_parse_throws_2])])
m4_define([AT_JT_initial_action], [m4_case(AT_JT_throws,
-1, [],
0, [],
1, [[%initial-action {if (true) throw new ClassNotFoundException();}]],
2, [[%initial-action {if (true) throw new InstantiationException();}]])])
m4_define([AT_JT_parse_action], [m4_case(AT_JT_throws,
-1, [],
0, [],
1, [[throw new ClassNotFoundException();]],
2, [[throw new ClassNotFoundException();]])])
m4_for([AT_JT_lexer], 0, 1, 1,
[m4_for([AT_JT_lex_throws], -1, 2, 1,
[m4_for([AT_JT_throws], -1, 2, 1,
[m4_if(AT_JT_lexer, 0,
[AT_CHECK_JAVA_MINIMAL([
AT_JT_throws_define
AT_JT_lex_throws_define
AT_JT_initial_action],
[AT_JT_parse_action])],
[AT_CHECK_JAVA_MINIMAL_W_LEXER([
AT_JT_throws_define
AT_JT_lex_throws_define
AT_JT_initial_action],
[AT_JT_yylex_throws],
[AT_JT_yylex_action],
[],
[AT_JT_parse_action])])
AT_CHECK_JAVA_GREP([[ *int yylex ()]AT_JT_yylex_throws *[;]])
AT_CHECK_JAVA_GREP([[ *private int yyaction ([^)]*)]AT_JT_yyaction_throws[ *]])
AT_CHECK_JAVA_GREP([[ *public boolean parse ()]AT_JT_parse_throws[ *]])
])])])
AT_CLEANUP
# --------------------------------------------- #
# Java stype, position_class and location_class #
# --------------------------------------------- #
AT_SETUP([Java stype, position_class and location_class])
AT_CHECK_JAVA_MINIMAL([[
%define stype "java.awt.Color"
%type<java.awt.Color> start;
%define location_type "MyLoc"
%define position_type "MyPos"
%code { class MyPos {} }]], [[$$ = $<java.awt.Color>1;]], [[MyPos]])
AT_CHECK([[grep -q 'java.awt.Color' YYParser.java]])
AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Position']], [1])
AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Location']], [1])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
%define stype "java.awt.Color"
%type<java.awt.Color> start;
%define location_type "MyLoc"
%define position_type "MyPos"
%code { class MyPos {} }]], [], [[return EOF;]], [],
[[$$ = $<java.awt.Color>1;]],
[[java.awt.Color]], [[MyPos]], [[MyLoc]])
AT_CHECK([[grep -q 'java.awt.Color' YYParser.java]])
AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Position']], [1])
AT_CHECK([[egrep -v ' */?\*' YYParser.java | grep -q 'Location']], [1])
AT_CLEANUP
+18 -6
View File
@@ -23,9 +23,11 @@ AT_BANNER([[Output file names.]])
# -----------------------------------------------------------------------------
m4_define([AT_CHECK_OUTPUT],
[AT_SETUP([[Output files: $2 $3 $5]])
case "$1" in
*/*) mkdir `echo "$1" | sed 's,/.*,,'`;;
esac
for file in $1 $4; do
case "$file" in
*/*) mkdir -p `echo "$file" | sed 's,/.*,,'`;;
esac
done
AT_DATA([$1],
[[$2
%%
@@ -116,9 +118,15 @@ AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose],
[subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/stack.hh subdir/position.hh],
[], [AT_CHECK_NO_SUBDIR_PART([subdir/foo])])
AT_CHECK_OUTPUT([gram_dir/foo.yy],
[%skeleton "lalr1.cc" %defines %verbose %file-prefix "output_dir/foo"],
[],
[output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/foo.output output_dir/location.hh output_dir/stack.hh output_dir/position.hh])
# AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR)
# -----------------------------------------------------------------------------
# AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR,
# [EXIT-STATUS])
# ------------------------------------------------------------------
m4_define([AT_CHECK_CONFLICTING_OUTPUT],
[AT_SETUP([Conflicting output files: $2 $3])
case "$1" in
@@ -130,7 +138,7 @@ AT_DATA([$1],
foo: {};
]])
AT_BISON_CHECK([$3 $1], 0, [], [$4])
AT_BISON_CHECK([$3 $1], $5, [], [$4])
AT_CLEANUP
])
@@ -149,6 +157,10 @@ AT_CHECK_CONFLICTING_OUTPUT([foo.y],
[foo.y: warning: conflicting outputs to file `location.hh'
])
AT_CHECK_CONFLICTING_OUTPUT([foo.y], [], [-o foo.y],
[foo.y: fatal error: refusing to overwrite the input file `foo.y'
], 1)
# AT_CHECK_OUTPUT_FILE_NAME(FILE-NAME-PREFIX, [ADDITIONAL-TESTS])
# -----------------------------------------------------------------------------
+9 -5
View File
@@ -1,5 +1,5 @@
# Exercising Bison Grammar Reduction. -*- Autotest -*-
# Copyright (C) 2001, 2002, 2007 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -142,7 +142,8 @@ useless9: '9';
]])
AT_BISON_CHECK([[input.y]], 0, [],
[[input.y: warning: 9 nonterminals and 9 rules useless in grammar
[[input.y: warning: 9 nonterminals useless in grammar
input.y: warning: 9 rules useless in grammar
input.y:6.1-8: warning: nonterminal useless in grammar: useless1
input.y:7.1-8: warning: nonterminal useless in grammar: useless2
input.y:8.1-8: warning: nonterminal useless in grammar: useless3
@@ -237,7 +238,8 @@ non_productive: non_productive useless_token
]])
AT_BISON_CHECK([[not-reduced.y]], 0, [],
[[not-reduced.y: warning: 2 nonterminals and 3 rules useless in grammar
[[not-reduced.y: warning: 2 nonterminals useless in grammar
not-reduced.y: warning: 3 rules useless in grammar
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable
not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive
not-reduced.y:11.6-57: warning: rule useless in grammar: exp: non_productive
@@ -311,7 +313,8 @@ indirection: underivable;
]])
AT_BISON_CHECK([[input.y]], 0, [],
[[input.y: warning: 2 nonterminals and 3 rules useless in grammar
[[input.y: warning: 2 nonterminals useless in grammar
input.y: warning: 3 rules useless in grammar
input.y:5.15-25: warning: nonterminal useless in grammar: underivable
input.y:6.14-24: warning: nonterminal useless in grammar: indirection
input.y:5.15-25: warning: rule useless in grammar: exp: underivable
@@ -346,7 +349,8 @@ exp: exp;
]])
AT_BISON_CHECK([[input.y]], 1, [],
[[input.y: warning: 2 nonterminals and 2 rules useless in grammar
[[input.y: warning: 2 nonterminals useless in grammar
input.y: warning: 2 rules useless in grammar
input.y:3.1-3: fatal error: start symbol exp does not derive any sentence
]])