Compare commits

...
113 Commits
Author SHA1 Message Date
Akim Demaille da6f07468a version 3.0.3
* NEWS: Record release date.
2015-01-15 10:04:53 +01:00
Akim Demaille 93ee7a47e7 gnulib: update 2015-01-15 09:36:14 +01:00
Akim Demaille ca5a716303 tests: split a large test case into several smaller ones
* tests/conflicts.at (AT_CONSISTENT_ERRORS_CHECK): Move AT_SETUP/AT_CLEANUP
into it, so that we don't skip non Java tests following a test case in Java.
2015-01-13 14:19:02 +01:00
Akim Demaille d72642d691 package: a bit of trouble shooting indications
* README-hacking: here.
2015-01-12 12:11:53 +01:00
Akim Demaille 9a91e7f246 doc: liby's main arms the internationalization
Reported by Nicolas Bedon.
<https://lists.gnu.org/archive/html/bug-bison/2014-11/msg00005.html>

* doc/bison.texi (Yacc Library): Document the call the setlocale.
2015-01-12 11:37:24 +01:00
Akim Demaille 671850a1c3 bison: avoid warnings from static code analysis
A static analysis tool reports that some callers of symbol_list_n_get
might get NULL and not handle it properly.  This is not the case, yet
we can suppress this pattern.

Reported by Mike Sullivan.
<https://lists.gnu.org/archive/html/bug-bison/2013-12/msg00027.html>

* src/symlist.c (symbol_list_n_get): Actually it is never called
to return 0.  Enforce this postcondition via aver.
(symbol_list_n_type_name_get): Simplify accordingly.  In particular,
discards a (translated) useless error message.
* src/symlist.h: Adjust documentation.
* src/scan-code.l: Style change.
2015-01-09 15:27:59 +01:00
Akim Demaille ee028dceff c++: fix the use of destructors when variants are enabled
When using variants, destructors generate invalid code.
<http://lists.gnu.org/archive/html/bug-bison/2014-09/msg00005.html>
Reported by Michael Catanzaro.

* data/c++.m4 (~basic_symbol): b4_symbol_foreach works on yysym:
define it.
* tests/c++.at (Variants): Check it.
2015-01-09 13:54:58 +01:00
Akim Demaille e1d06b5235 style: tests: simplify the handling of some C++ tests
* tests/c++.at: here.
(Doxygen): Pass %define, so that files such as position.hh etc.
are generated, instead of putting everything into input.hh.
2015-01-08 16:08:00 +01:00
Akim Demaille 821394a3c8 c++: symbols can be empty, so use it
The previous patches ensure that symbols (symbol_type and
stack_symbol_type) can be empty, cleared, and their emptiness can be
checked.  Therefore, yyempty, which codes whether yyla is empty or
not, is now useless.

In C skeletons (e.g., yacc.c), the fact that the lookahead is empty is
coded by "yychar = YYEMPTY", which is exactly what this patch
restores, since yychar/yytoken corresponds to yyla.type.

* data/lalr1.cc (yyempty): Remove.
Rather, depend on yyla.empty ().
2015-01-08 16:07:59 +01:00
Akim Demaille 00cebd11d4 c++: variants: don't leak the lookahead in error recovery
During error recovery, when discarding the lookeahead, we don't
destroy it, which is caught by parse.assert assertions.

Reported by Antonio Silva Correia.
With an analysis and suggested patch from Michel d'Hooge.
<http://savannah.gnu.org/support/?108481>

* tests/c++.at (Variants): Strengthen the test to try syntax errors
with discarded lookahead.
2015-01-08 16:07:59 +01:00
Akim Demaille ee2f433512 c++: provide a means to clear symbols
The symbol destructor is currently the only means to clear a symbol.
Unfortunately during error recovery we might have to clear the
lookahead, which is a local variable (yyla) that has not yet reached
its end of scope.

Rather that duplicating the code to destroy a symbol, or rather than
destroying and recreating yyla, let's provide a means to clear a
symbol.

Reported by Antonio Silva Correia, with an analysis from Michel d'Hooge.
<http://savannah.gnu.org/support/?108481>

* data/c++.m4, data/lalr1.cc (basis_symbol::clear, by_state::clear)
(by_type::clear): New.
(basic_symbol::~basic_symbol): Use clear.
2015-01-08 16:07:59 +01:00
Akim Demaille 5422471cbb c++: clean up the handling of empty symbols
* data/c++.m4, data/lalr1.cc (yyempty_): Remove, replaced by...
(empty_symbol, by_state::empty_state): these.
(basic_symbol::empty): New.
2015-01-08 14:45:42 +01:00
Akim Demaille 8a4ec3595b c++: comment and style changes
* data/c++.m4, data/lalr1.cc: More documentation.
Tidy.
* tests/c++.at (string_cast): Rename as...
(to_string): this C++11 name.
2015-01-08 11:25:07 +01:00
Akim Demaille 7cf84b13a0 c++: variants: comparing addresses of typeid.name() is undefined
Instead of storing and comparing pointers to names of types, store
pointers to the typeids, and compares the typeids.
Reported by Thomas Jahns.
<http://lists.gnu.org/archive/html/bug-bison/2014-03/msg00001.html>

* data/variant.hh (yytname_): Replace with...
(yytypeid_): this.
2015-01-07 10:34:07 +01:00
Akim Demaille 56351d4c7b c++: locations: complete the API and fix comments
There are no support for += between locations, and some comments are wrong.
Reported by Alexandre Duret-Lutz.

* data/location.cc: Fix.
* doc/bison.texi: Document.
* tests/c++.at: Check.
2015-01-05 18:32:23 +01:00
Akim Demaille 478c4a8f49 build: do not clean figure sources in make clean
"make clean && make" fails in in-tree builds.

* doc/local.mk (CLEANDIRS): Replace with...
(CLEANFILES): this safer list of files to clean.
2015-01-05 14:41:46 +01:00
Akim Demaille a16074bb09 build: don't try to generate docs when cross-compiling
When cross-compiling don't run the generated bison to update the docs.
Reported by Aaro Koskinen.
<http://lists.gnu.org/archive/html/bison-patches/2014-03/msg00000.html>

* configure.ac (CROSS_COMPILING): New.
* doc/local.mk: Use it.
2015-01-05 12:27:27 +01:00
Akim Demaille 8386f6ef28 package: fix a reporter's name
* THANKS, build-aux/git-log-fix: s/Bernd Edligner/Bernd Edlinger/.
2015-01-04 18:00:51 +01:00
Akim Demaille 827bc59ca1 %union: fix the support for named %union
Bison supports a union tag, for obscure reasons.  But it does a poor
job at it, especially since Bison 3.0.
Reported by Stephen Cameron and Tobias Frost.

It did not ensure that the name was not given several times.  An easy
way to do this is to make the %union tag be handled as a %define
variable, as they cannot be defined several times.

Since Bison 3.0, the synclines were wrongly placed, resulting in
invalid code.  Addressing this issue, because of the way the union tag
was stored (as a code muscle), would have been tedious.  Unless we
rather define the %union tag as a %percent variable, whose synclines
are easier to manipulate.

So replace the b4_union_name muscle by the api.value.union.name
%define variable, document, and check.

* data/bison.m4: Make sure that api.value.union.name has a keyword value.
* data/c++.m4: Make sure that api.value.union.name is not defined.
* data/c.m4 (b4_union_name): No longer use it, use api.value.union.name.
* doc/bison.texi (%define Summary): Document it.
* src/parse-gram.y (union_name): No longer define b4_uion_name, but
api.value.union.name.
* tests/input.at (Redefined %union name): New.
* tests/synclines.at (%union name syncline): New.
* tests/types.at: Check named %unions.
2015-01-04 18:00:51 +01:00
Akim Demaille 3209eb1c4c package: bump to 2015
Which also requires:

* gnulib: Update.
2015-01-04 17:49:13 +01:00
Akim Demaille 975bb56431 flex: don't trust YY_USER_INIT
Reported by Bernd Edligner and others.

* src/scan-gram.l: here.
2014-12-31 14:54:43 +01:00
Akim Demaille 8d4dc896cb yacc.c: fix broken union when api.value.type=union and %defines are used
Reported by Rich Wilson.

* data/c.m4 (b4_symbol_type_register): Append to b4_union_members,
not b4_user_union_members.
The latter invokes the former, but it is the former which is reinitialized
to empty by b4_value_type_setup_union.
* tests/types.at: Check it.

This reveals another bug, this time in the case of glr.c parsers.

* data/glr.c: Generate the header file before the implementation file,
to be sure that the setup is run before what depends on it.
2014-12-31 14:39:05 +01:00
Akim Demaille a3c3c6f242 doc: fix missing xref
Reported by xolodho.

* doc/bison.texi (Printer Decl): here.
2014-12-31 12:49:39 +01:00
Akim Demaille 179b2419ba gnulib: update 2014-12-29 16:13:57 +01:00
Akim Demaille b702ec61ab location: remove some ugly debugging code traces
* data/location.cc: here.
2014-02-03 15:27:03 +01:00
Akim Demaille ab96bb2457 build: use abort to pacify compiler errors
clang, with -DNDEBUG and -Werror fails on some functions that might
lack a return.  This is because aver is just another assert, discarded
with -DNDEBUG.  So use abort.

* src/muscle-tab.c, src/scan-skel.l: here.
2014-02-03 15:27:02 +01:00
Akim Demaille fc51acddb4 package: bump to 2014
* AUTHORS, ChangeLog-2012, Makefile.am, NEWS, PACKAGING, README,
* README-alpha, README-hacking, THANKS, TODO, bootstrap.conf,
* build-aux/darwin11.4.0.valgrind, build-aux/local.mk,
* build-aux/update-b4-copyright,
* build-aux/update-package-copyright-year, cfg.mk, configure.ac,
* data/README, data/bison.m4, data/c++-skel.m4, data/c++.m4,
* data/c-like.m4, data/c-skel.m4, data/c.m4, data/glr.c, data/glr.cc,
* data/java-skel.m4, data/java.m4, data/lalr1.cc, data/lalr1.java,
* data/local.mk, data/location.cc, data/stack.hh, data/variant.hh,
* data/xslt/bison.xsl, data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl,
* data/xslt/xml2xhtml.xsl, data/yacc.c, djgpp/Makefile.maint,
* djgpp/README.in, djgpp/config.bat, djgpp/config.sed,
* djgpp/config.site, djgpp/config_h.sed, djgpp/djunpack.bat,
* djgpp/local.mk, djgpp/subpipe.c, djgpp/subpipe.h,
* djgpp/testsuite.sed, doc/bison.texi, doc/local.mk, doc/refcard.tex,
* etc/README, etc/bench.pl.in, etc/local.mk,
* examples/calc++/calc++.test, examples/calc++/local.mk,
* examples/extexi, examples/local.mk, examples/mfcalc/local.mk,
* examples/mfcalc/mfcalc.test, examples/rpcalc/local.mk,
* examples/rpcalc/rpcalc.test, examples/test, examples/variant.yy,
* lib/abitset.c, lib/abitset.h, lib/bbitset.h, lib/bitset.c,
* lib/bitset.h, lib/bitset_stats.c, lib/bitset_stats.h,
* lib/bitsetv-print.c, lib/bitsetv-print.h, lib/bitsetv.c,
* lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/get-errno.c,
* lib/get-errno.h, lib/lbitset.c, lib/lbitset.h, lib/libiberty.h,
* lib/local.mk, lib/main.c, lib/timevar.c, lib/timevar.def,
* lib/timevar.h, lib/vbitset.c, lib/vbitset.h, lib/yyerror.c,
* m4/bison-i18n.m4, m4/c-working.m4, m4/cxx.m4, m4/flex.m4,
* m4/timevar.m4, src/AnnotationList.c, src/AnnotationList.h,
* src/InadequacyList.c, src/InadequacyList.h, src/LR0.c, src/LR0.h,
* src/Sbitset.c, src/Sbitset.h, src/assoc.c, src/assoc.h,
* src/closure.c, src/closure.h, src/complain.c, src/complain.h,
* src/conflicts.c, src/conflicts.h, src/derives.c, src/derives.h,
* src/files.c, src/files.h, src/flex-scanner.h, src/getargs.c,
* src/getargs.h, src/gram.c, src/gram.h, src/graphviz.c,
* src/graphviz.h, src/ielr.c, src/ielr.h, src/lalr.c, src/lalr.h,
* src/local.mk, src/location.c, src/location.h, src/main.c,
* src/muscle-tab.c, src/muscle-tab.h, src/named-ref.c,
* src/named-ref.h, src/nullable.c, src/nullable.h, src/output.c,
* src/output.h, src/parse-gram.c, src/parse-gram.y, src/print-xml.c,
* src/print-xml.h, src/print.c, src/print.h, src/print_graph.c,
* src/print_graph.h, src/reader.c, src/reader.h, src/reduce.c,
* src/reduce.h, src/relation.c, src/relation.h, src/scan-code.h,
* src/scan-code.l, src/scan-gram.h, src/scan-gram.l, src/scan-skel.h,
* src/scan-skel.l, src/state.c, src/state.h, src/symlist.c,
* src/symlist.h, src/symtab.c, src/symtab.h, src/system.h,
* src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h,
* tests/actions.at, tests/atlocal.in, tests/bison.in, tests/c++.at,
* tests/calc.at, tests/conflicts.at, tests/cxx-type.at,
* tests/existing.at, tests/glr-regression.at, tests/headers.at,
* tests/input.at, tests/java.at, tests/javapush.at, tests/local.at,
* tests/local.mk, tests/named-refs.at, tests/output.at, tests/push.at,
* tests/reduce.at, tests/regression.at, tests/sets.at,
* tests/skeletons.at, tests/synclines.at, tests/testsuite.at,
* tests/torture.at, tests/types.at:
here.
2014-02-03 15:27:02 +01:00
Paul Eggert 957255b82c doc: specify documentation encoding
* doc/bison.texi: Add '@documentencoding UTF-8'; needed since the
manual contains UTF-8 characters.  This will cause the .info files
to contain UTF-8 quotes and the like, which should be OK nowadays.
Add @documentlanguage while we're at it.
2014-01-03 11:08:50 -08:00
Akim Demaille b167e7ba0d package: install the examples
Currently, we do not install the various examples extracted from the
documentation.  Let's do it, as they are useful starting points.

* configure.ac: When --enable-gcc-warnings is set, enable ENABLE_GCC_WARNINGS.
* examples/extexi: No longer issue synclines by default.
* examples/local.mk: Except if ENABLE_GCC_WARNINGS.
* examples/calc++/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk: Install the example files.
2013-12-09 16:53:14 +01:00
Akim Demaille 85d57e27d2 package: install README and the like in docdir
* Makefile.am: here.
2013-12-09 16:53:14 +01:00
Akim Demaille 461f1516f8 diagnostics: fix the order of multiple declarations reports
On

  %token FOO "foo"
  %printer {} "foo"
  %printer {} FOO

we report

  /tmp/foo.yy:2.10-11: error: %printer redeclaration for FOO
   %printer {} "foo"
            ^^
  /tmp/foo.yy:3.10-11:     previous declaration
   %printer {} FOO
            ^^

* src/symtab.c (locations_sort): New.
Use it.
* tests/input.at (Invalid Aliases): Stress the order of diagnostics.
2013-12-09 16:53:03 +01:00
Akim Demaille 26eb4f0bdc symbol: provide an easy means to compare them in source order
* src/symtab.c (symbols_sort): New.
(user_token_number_redeclaration): Taken from here.
2013-12-09 16:03:03 +01:00
Akim Demaille 0bd5ee5f89 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-12-05 15:16:28 +01:00
Akim Demaille a3efd13e44 version 3.0.2
* NEWS: Record release date.
2013-12-05 14:58:22 +01:00
Akim Demaille a4122000c6 gnulib: update
* gnulib: here.
2013-12-05 14:42:08 +01:00
Akim Demaille 461983270c output: do not generate source files when late errors are caught
Reported by Alexandre Duret-Lutz as "second problem" in:
http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html

* bootstrap.conf: We need the "unlink" module.
* src/files.h, src/files.c (unlink_generated_sources): New.
* src/output.c: Use it.
* tests/output.at: Check the case of late errors.
2013-12-04 15:53:01 +01:00
Akim Demaille ea99d6e6a0 output: record what generated files are source or report files
* src/files.h, src/files.c (output_file_name_check): Take an additional
argument to record whether a file is a source or report file.
* src/files.c (generated_file): New.
(file_names, file_names_count): Replace with...
(generated_files, generated_files_size): these.
* src/scan-skel.l: Adjust.
2013-12-04 15:53:01 +01:00
Akim Demaille 184b42c85b output: do not generate source files when early errors are caught
Reported by Alexandre Duret-Lutz as "second problem" in:
http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html

One problem is that some errors are caught early, before the
generation of output files, while others can only be detected
afterwards (since, for instance, skeletons can raise errors
themselves).

This will be addressed in two steps: early errors do not generate
source files at all, while later errors will remove the files that
have already been generated.

* src/scan-skel.l (yyout): Open to /dev/null when there are errors.
* tests/output.at (AT_CHECK_FILES): Factored out of...
(AT_CHECK_OUTPUT): this.
Fuse the "SHELLIO" argument in the "FLAGS" one.
Use $5 to denote the expected exit status.
Add a test case for early errors.
2013-12-04 15:53:01 +01:00
Akim Demaille be29c71dd8 xml: also use "%empty" with html output
* data/xslt/xml2xhtml.xsl: No longer issue an Epsilon, display as in
dot and text formats.
2013-11-26 16:28:22 +01:00
Akim Demaille d439985436 style: formatting changes
* src/print-xml.c: here.
2013-11-26 16:20:55 +01:00
Akim Demaille f3d2a1b2ac xml: also display %empty for empty right-hand sides
* data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl: Display %empty where needed.
2013-11-26 16:20:52 +01:00
Akim Demaille 21cf80399f reports: display %empty in the generated pointed-rules
* src/print.c (print_core): Use %empty for empty rules.
* src/print_graph.c (print_core): Ditto.
* tests/conflicts.at, tests/output.at, tests/reduce.at: Adjust
expectations.
2013-11-26 15:31:52 +01:00
Akim Demaille 7b0ca050f7 news: YYERROR vs variants 2013-11-26 15:31:51 +01:00
Akim Demaille a339aef48a style: scope reduction in lalr.cc
* src/lalr.c: Shorten variable scopes.
(lookahead_tokens_print): Use the same variable name in two loops
iterating over the same structure.
2013-11-18 10:29:23 +01:00
Akim Demaille 44186fc4ec lalr1.cc: formatting changes
* data/lalr1.cc: Fix indentation.
2013-11-15 10:14:06 +01:00
Akim Demaille 5c77412162 lalr1.cc: fix the support of YYERROR with variants
When variant are enabled, the yylhs variable (the left-hand side of
the rule being reduced, i.e. $$ and @$) is explicitly destroyed when
YYERROR is called.  This is because before running the user code, $$
is initialized, so that the user can properly use it.

However, when quitting yyparse, yylhs is also reclaimed by the C++
compiler: the variable goes out of scope.

Instead of trying to be too smart, let the compiler do its job: reduce
the scope of yylhs to exactly the reduction.  This way, whatever the
type of scope exit (regular, exception, return, goto...) this variable
will be properly reclaimed.

Reported by Paolo Simone Gasparello.
<http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00003.html>

* data/lalr1.cc (yyparse): Reduce the scope of yylhs.
* tests/c++.at: We now pass this test.
2013-11-15 10:14:05 +01:00
Akim Demaille 5cf6e669af tests: check $$'s destruction with variant, YYERROR, and no error recovery
When variant are enabled, the yylhs variable (the left-hand side of
the rule being reduced, i.e. $$ and @$) is explicitly destroyed when
YYERROR is called.  This is because before running the user code, $$
is initialized, so that the user can properly use it.

However, when quitting yyparse, yylhs is also reclaimed by the C++
compiler: the variable goes out of scope.

This was not detected by the test suite because (i) the Object tracker
was too weak, and (ii) the problem does not show when there is error
recovery.

Reported by Paolo Simone Gasparello.
<http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00003.html>

* tests/c++.at (Exception safety): Improve the objects logger to make
sure that we never destroy twice an object.
Also track copy-constructors.
Use a set instead of a list.
Display the logs before running the function body, this is more
useful in case of failure.
Generalize to track with and without error recovery.
2013-11-15 10:13:47 +01:00
Akim Demaille 16bb9f1647 tests: simplify useless obfuscation
* tests/c++.at: $$ is not special for M4, there is no need to "escape"
it.
2013-11-15 09:38:15 +01:00
Akim Demaille edb2e90531 skeletons: use better names when computing a "goto"
* data/glr.c (yyLRgotoState): Name the symbol argument yysym, instead
of yylhs.
* data/lalr1.cc (yy_lr_goto_state_): Likewise.
* data/lalr1.java (yy_lr_goto_state_): New, modeled after the previous
two routines.
Use it.
2013-11-14 16:26:16 +01:00
Akim Demaille 6d94eebba7 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-11-12 18:37:14 +01:00
Akim Demaille c2ecada32b version 3.0.1
* NEWS: Record release date.
2013-11-12 15:55:33 +01:00
Akim Demaille 458171e6df aver: it is no longer "protected against NDEBUG"
Apply the same rules for aver as for assert: no side effects,
especially not important ones.

* src/AnnotationList.c, src/muscle-tab.c: Adjust aver uses to resist
to -DNDEBUG.
2013-11-12 15:49:10 +01:00
Akim Demaille 8d0b7cef7d parsers: rename YY_NULL as YY_NULLPTR to avoid conflicts with Flex
Flex also defines YY_NULL (to 0).  Avoid gratuitous conflicts.

* data/c.m4 (b4_null_define): Rename YY_NULL as YY_NULLPTR.

* data/glr.c, data/lalr1.cc, data/location.cc, data/variant.hh,
* data/yacc.c, src/parse-gram.c, tests/actions.at, tests/c++.at,
* tests/cxx-type.at, tests/glr-regression.at, tests/headers.at,
* tests/push.at, tests/regression.at:
Adjust.
2013-11-08 10:52:15 +01:00
Akim Demaille afc4457605 build: use Automake 1.14's non-recursive Makefile features
* configure.ac: Require Automake 1.14.
* examples/calc++/local.mk, examples/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk, tests/local.mk: Use %D% and %C%.
2013-11-05 14:32:20 +01:00
Akim Demaille 60dcc936ce build: restore maintainer-push-check
* tests/local.mk: here.
2013-11-05 14:15:15 +01:00
Akim Demaille ad9d4f9f2e c++: use __attribute__((__pure__)) to avoid warnings
Building C++ parsers with -Wsuggest-attribute=const and
-Wsuggest-attribute=noreturn triggers warning in generated code.

* data/lalr1.cc: Call b4_attribute_define.
(debug_stream, debug_level): Flag as pure.
* tests/headers.at (Several parsers): There are now more YY macros
that "leak".
2013-11-05 10:44:03 +01:00
Akim Demaille 3cc83855d9 skeletons: update the handling of compiler attributes
* data/c.m4 (b4_attribute_define): Instead of defining __attribute__,
define YY_ATTRIBUTE conditionally.
(YY_ATTRIBUTE_PURE, YY_ATTRIBUTE_UNUSED, _Noreturn): New.
Use them.
* data/glr.c: Use them.
2013-11-05 10:44:03 +01:00
Akim Demaille 5407fc7d76 gnulib: update 2013-11-05 10:44:03 +01:00
Akim Demaille 516652b474 style: use /* ... */ comments
* src/complain.c: Here.
2013-10-24 17:22:21 +02:00
Akim Demaille 026816664f tests: skip C++ tests that are too demanding for some compilers
Some tests now fail when compiled with G++ 4.3 or 4.4 on MacPorts.

* tests/local.at (AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR): New.
* tests/c++.at (Exception safety): Use it.
2013-10-24 17:22:21 +02:00
Akim Demaille 265640d56e install: do not install yacc.1 when --disable-yacc
* configure.ac (ENABLE_YACC): New conditional.
(YACC_SCRIPT, YACC_LIBRARY): Remove.
* lib/local.mk, src/local.mk: Use the former instead of the latter.
* doc/local.mk: Use ENABLE_YACC to avoid installing yacc.1.
2013-10-22 17:34:22 +02:00
Akim Demaille ee9cdb8595 style: avoid tabs
* src/scan-code.l: here.
2013-10-22 16:43:17 +02:00
Akim Demaille a810712331 c++: fix generated doxygen comments
* configure.ac: Enable -Wdocumentation if supported.
* data/lalr1.cc: Fix comments.
2013-10-22 16:31:57 +02:00
Akim Demaille 1a9646fc91 fix: uniqstr are already pointers
* src/uniqstr.c (uniqstr_assert): Remove incorrect double indirection,
and now useless cast.
2013-10-22 16:29:22 +02:00
Paul Eggert 67411a88a0 bison: pacify Sun C 5.12
* src/scan-code.l (show_sub_message):
Redo initializations to work around a bogus Sun C 5.12 warning.
(parse_ref): Remove unreachable code that Sun C 5.12 complains about.
* src/uniqstr.h (uniqstr_vsprintf): Use
_GL_ATTRIBUTE_FORMAT_PRINTF (...)  instead of __attribute__
((__format__ (__printf__, ...))).  Otherwise, Sun C 5.12
complains about an unknown attribute.
2013-10-21 15:23:43 -07:00
Paul Eggert 0bfe22b6d5 maint: git now ignores rpcalc
* examples/rpcalc/.gitignore: Ignore rpcalc.
2013-10-21 15:23:43 -07:00
Paul Eggert 3a684d611e build: examples/calc++/calc++ requires flex
* configure.ac (FLEX_CXX_WORKS): New AM_CONDITIONAL.
* examples/calc++/local.mk (examples/calc++/calc++):
Build if FLEX_CXX_WORKS, not BISON_CXX_WORKS.
2013-10-21 15:23:42 -07:00
Paul Eggert a9733794bb maint: mention help2man, texinfo, apt-get
* README-hacking: Add help2man, texinfo.
Describe how to add packages if you're using Debian.
2013-10-21 15:23:42 -07:00
Paul Eggert 19fe1aa332 maint: git now ignores .log and .trs files
* .gitignore: Add *.log, *.trs.
2013-10-21 15:23:42 -07:00
Akim Demaille 39bace5da8 tests: fix incorrect object construction
Reported by Ken Moffat.
http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00009.html

* tests/c++.at (Exception safety): Here.
2013-10-21 10:36:53 +02:00
Akim Demaille 071863b3d8 glr: allow spaces between "%?" and "{" in predicates
Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00004.html
http://stackoverflow.com/questions/19330171/

* src/scan-gram.l: Do not try to be too smart when diagnosing invalid
directives.
* tests/glr-regression.at (Predicates): New test.
2013-10-16 15:51:25 +02:00
Akim Demaille e4678430c2 diagnostics: "-Werror -Wno-error=foo" must not emit errors
Currently "-Werror -Wno-error=foo" still turns "foo" warnings into errors.
Reported by Alexandre Duret-Lutz.
See http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html.

* src/complain.c (errority, errority_flag): New.
(complain_init): Initialize the latter.
(warning_argmatch): Extract the loop iterating on the flag's bits.
Set and unset errority_flag here.
(warnings_argmatch): -Wno-error is not the same as -Wno-error=everything:
we must remember if category foo was explicitly turned in an error/warning
via -W(no-)error=foo.
(warning_severity): Use errority_flag.

* tests/input.at (Symbols): Just check --yacc, not -Wyacc, that's the
job of tests on -W.
(-Werror is not affected by -Wnone and -Wall): Rename as...
(-Werror combinations): this.
Tests more combinations of -W, -W(no-)error, and -W(no-)error=foo.
* tests/local.at (AT_BISON_CHECK_WARNINGS): Don't expect -Werror
to turn runs that issue warnings into runs with errors, as the
warnings might be enforced as warnings by -Wno-error=foo, in which
case -Werror does not change anything.

* doc/bison.texi (Bison Options): Try to be clearer about how
-W(no-)error and -W(no-)error=foo interact.
2013-10-16 14:56:09 +02:00
Akim Demaille 2b7fe38c36 comment changes
* src/complain.h, src/complain.c: More documentation, more comments.
2013-10-16 14:45:27 +02:00
Andreas SchwabandAkim Demaille 4c4191cec2 location: fix EOF check
* location.c (location_caret): Use int, not char, for values from
getc.
2013-10-04 14:00:52 +02:00
Akim Demaille ae7cd18c98 style: variant: remove empty line
* data/variant.hh (b4_symbol_constructor_define_): Remove
stray eol.
2013-09-19 16:45:09 +02:00
Akim Demaille 77482f2783 glr: more assertions
* data/glr.c (yyaddDeferredAction, yyglrShiftDefer, yypdumpstack):
More assertions.
2013-09-19 15:58:00 +02:00
Akim Demaille 5a6e85fb8d glr: shorten scopes
* data/glr.c (yyglrReduce): Define yyflag with its value.
2013-09-19 15:57:59 +02:00
Akim Demaille 9e87ff5472 glr: formatting changes
* data/glr.c: here.
2013-09-19 15:57:59 +02:00
Akim Demaille 3afe18fd1f glr: better use of tracing macros
* data/glr.c (yydestroyGLRState): Use YY_SYMBOL_PRINT instead of
yy_symbol_print.
2013-09-19 15:57:59 +02:00
Akim Demaille b51cf830a6 examples: improve the output of the "variant" example
* examples/variant.yy: Improve the printing of lists.
2013-09-19 15:57:59 +02:00
Akim Demaille 66b03e134f variant: remove useless assertion
* data/variant.hh (move): Remove precondition assertion which is
ensured by the first call of the body (this precondition is also one
of "build").
2013-09-19 15:57:59 +02:00
Akim Demaille 3dc50b3bc2 tests: remove stray debugging traces
* tests/atlocal.in: Remove traces.
Be ready to remove conftest.dSYM generated on OS X.
2013-09-19 15:57:59 +02:00
Akim Demaille 0a244a2269 tests: do not use grep -q
Reported by Daniel Galloway.
http://lists.gnu.org/archive/html/bug-bison/2013-08/msg00020.html

* tests/java.at: Ignore grep's output instead.
2013-09-04 17:26:17 +02:00
Paul Eggert b5e27aa262 build: don't require flex for ordinary builds
* configure.ac (LEX): Don't fail if this is lex, as flex is not
required for ordinary builds.  Instead, issue a warning and
substitute a no-op LEX.  Reported by Michael Felt in
<http://lists.gnu.org/archive/html/bug-bison/2013-08/msg00009.html>.
2013-08-24 18:22:44 -07:00
Paul Eggert 0149d39e6e maint: update .gitignore
* .gitignore: Add *.eps, *.o, *.pdf, *.png, *.stamp, *~,
.deps, .dirstamp.  Needed to suppress unwanted chatter from
'git status' after a bootstrap build.
2013-08-24 18:00:52 -07:00
Paul Eggert 1d91bfdf1c build: port to pre-5.8.7 perl
* examples/local.mk (extract): Omit -f from perl options.
This doesn't work with perl versions before 5.8.7
that are configured without USE_SITECUSTOMIZE.
Reported by Michael Felt in
<http://lists.gnu.org/archive/html/bug-bison/2013-08/msg00006.html>.
2013-08-24 07:55:47 -07:00
Akim Demaille db40c3f869 tests: minor change to make it easier to test other skeletons
* tests/c++.at (Variants): Pass the skeleton as argument.
2013-08-01 16:11:27 +02:00
Valentin TolmerandAkim Demaille b663fd5322 uniqstr: fix assertion
* src/uniqstr.c (uniqstr_assert): Really make sure str is a uniqstr,
not just whether some uniqstr with the same content was registered.
2013-08-01 15:29:21 +02:00
Akim Demaille c4aa4ff541 build: ship the ASCII art figures
We don't ship the *.txt files that are used to build the info
file.
Reported by Colin Daley.

* doc/figs/example.txt: New.
* doc/local.mk (bison.info): Depend on the txt files.
And ship them.
2013-08-01 11:41:49 +02:00
Akim Demaille b97bbbaed7 doc: prefer the ".gv" extension to ".dot"
See http://marc.info/?l=graphviz-devel&m=129418103126092 for the
motivation (basically, some word processor now uses *.dot).

* doc/figs/example-reduce.dot: Rename as...
* doc/figs/example-reduce.gv: this.
* doc/figs/example-shift.dot: Rename as...
* doc/figs/example-shift.gv: this.
* doc/figs/example.dot: Rename as...
* doc/figs/example.gv: this.
* doc/local.mk: Adjust.
2013-08-01 11:20:13 +02:00
Akim Demaille e386b50f26 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-07-25 18:13:53 +02:00
Akim Demaille 534497f54b version 3.0
* NEWS: Record release date.
2013-07-25 17:55:58 +02:00
Akim Demaille a62a7b014c regen 2013-07-25 17:55:32 +02:00
Akim Demaille de1a2f20dd news: prepare 3.0
* NEWS (3.0): Reorder.
2013-07-25 17:53:59 +02:00
Akim Demaille afcc58c63e tests: fix invalid assignment when using variants in C++11
* tests/c++.at (Exception safety): In variant mode $$ is an instance
of Object.  Assigning YY_NULL in C++98 is incorrect, but behaves ok,
as it assigns YY_NULL=0 using Object::operator= (char v).  It is wrong
in C++11 as there is operator for "$$ = nullptr".
2013-07-25 17:53:59 +02:00
Akim Demaille d3ae5af6ec yacc: beware of "uninitialized uses" warnings
Again some issues with the fact that yylval is reported by GCC as
possibly not initialized in some cases.  Here, the case at hand is the
%destructor.

I am still not convinced that it is worth going all the trouble of
using pragmas to disable temporarily some warnings, instead of just
initializing the looking symbol once for all, but that's what Paul
voted for, see
<http://lists.gnu.org/archive/html/bison-patches/2012-10/msg00050.html>.

* data/c.m4 (b4_attribute_define): Define
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN, YY_IGNORE_MAYBE_UNINITIALIZED_END,
YY_INITIAL_VALUE here, as we will need them in the generation of the
destructor function, which is defined in yacc.c before yyparse, which
was in charge of defining these macros.
* data/yacc.c (b4_declare_scanner_communication_variables): Simplify:
trying to factor the definitions of the case pure and impure is
too complex.
Actually, it is not even clear that this macro should really exist,
as even the calls are complex.
Be careful not to issue a lone ";", as this is a statement, and C90
forbids declarations after statements ; so write
"YY_INITIAL_VALUE(Decl;)", not "YY_INITIAL_VALUE(Decl);".
2013-07-25 17:53:59 +02:00
Akim Demaille 41dfa1cbf0 gnulib: update 2013-07-25 13:47:01 +02:00
Akim Demaille b7171c45f4 tests: skip C++ tests if we can't compile a simple program
There are possible conflicts between gnulib replacement functions (in
<stdio.h>) and their C++ wrappers (in <stream>).  Trying to address
these in configure seems too hard, and I don't know how to fix the issue
in gnulib.  Cowardly avoid the problem by skipping C++ tests when this
happens.
Reported by Stefano Lattarini.
http://lists.gnu.org/archive/html/bug-bison/2013-06/msg00001.html

* tests/atlocal.in (BISON_CXX_WORKS): Also set it to "skip" if we can't
compile a simple program using <stream>.
* tests/local.at: Comment changes.
2013-07-03 17:18:54 +02:00
Akim Demaille ac953ff80a tests: fix 'find' portability issues
Reported by Stefano Lattarini.
http://lists.gnu.org/archive/html/bug-bison/2013-06/msg00000.html

* tests/output.at (AT_CHECK_OUTPUT): Use Perl instead.
2013-07-03 08:39:41 +02:00
Akim Demaille facb910cbd maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-06-24 10:29:36 +02:00
Akim Demaille 8faace8d1d version 2.7.91
* NEWS: Record release date.
2013-06-24 10:21:33 +02:00
Akim Demaille 9cdcbdf2cf NEWS: prepare for 2.7.91
* NEWS (2.7.91): Java push parsers.
2013-06-24 10:20:46 +02:00
Akim Demaille 45c64fa627 java: rename YYMORE as YYPUSH_MORE for consistency with C
http://lists.gnu.org/archive/html/bison-patches/2013-06/msg00008.html

* data/lalr1.java, doc/bison.texi, tests/javapush.at:
s/YYMORE/YYPUSH_MORE.
2013-06-24 09:37:18 +02:00
Akim Demaille 58b465ae5f tests: fix Java push failure when running with BISON_USE_PUSH_FOR_PULL
* tests/javapush.at (Trivial Push Parser with api.push-pull verification):
When push for pull is enabled, there is one such function generated.
2013-06-21 11:39:02 +02:00
Akim Demaille d116722c54 style: minor changes in the Java tests
* tests/java.at (AT_CHECK_JAVA_GREP): Ignore the exit status.
* tests/javapush.at (AT_CHECK_JAVA_GREP): Be more alike the previous
one.
Formating changes.
Remove stray debugging "jj" file.
2013-06-21 11:38:47 +02:00
Akim Demaille 1d678854a4 java: push: do not reset the error counter
* data/lalr1.java (parse): here, when in push-pull is in "both" mode.
This breaks the test suite, for instance
make check TESTSUITEFLAGS='-d 388 BISON_USE_PUSH_FOR_PULL=1'.
More generally make maintainer-push-check.
2013-06-21 11:17:05 +02:00
Akim Demaille 28c4075b58 build: add Valgrind suppression file for GNU/Linux
* build-aux/linux-gnu.valgrind: New.
* build-aux/local.mk: Ship it.
* configure.ac: Use it.
2013-06-14 09:58:12 +02:00
Dennis HeimbignerandAkim Demaille aa94def12d java: add push-parser support
* data/lalr1.java: Capture the declarations as m4 macros to avoid
duplication.  When push parsing, the declarations occur at the class
instance level rather than within the parse() function.

Change the way that the parser state is initialized.  For
push-parsing, the parse state declarations are moved to
"push_parse_initialize()", which is called on the first invocation of
"push_parse()". The %initial-action code is also inserted after the
invocation of "push_parse_initialize()".

The body of the parse loop is modified to return values at appropriate
points when doing push parsing.  In order to make push parsing work,
it is necessary to divide YYNEWSTATE into two states: YYNEWSTATE and
YYGETTOKEN. On the first call to push_parse(), the state is
YYNEWSTATE. On all later entries, the state is set to YYGETTOKEN. The
YYNEWSTATE switch arm falls through into YYGETTOKEN. YYGETTOKEN
indicates that a new token is potentially needed.  Normally, with a
pull parser, this new token would be obtained by calling "yylex()". In
the push parser, the value YYMORE is returned to the caller. On the
next call to push_parse(), the parser will return to the YYGETTOKEN
state and continue operation.

* tests/javapush.at: New test file for java push parsing.
* tests/testsuite.at: Use it.
* tests/local.mk: Adjust.
* doc/bison.texi (Java Push Parser Interface): New.

Signed-off-by: Akim Demaille <[email protected]>
2013-06-13 10:38:14 +02:00
Akim Demaille 0fcc2e9a74 build: ship all the files, even if the C++ compiler is broken
* examples/calc++/local.mk: Be sure to ship calc++.test even if
the current C++ compiler is not sufficient to run the tests.
2013-06-11 16:36:38 +02:00
Dennis HeimbignerandAkim Demaille 94a6225578 style: comment changes in Java skeleton
* data/lalr1.java: Here.
2013-06-05 10:04:21 +02:00
Akim Demaille 02798ba13d tests: fix a G++ warning
* tests/c++.at: Use YY_NULL instead of 0 for the null pointer.
And formatting changes.
2013-06-03 16:41:17 +02:00
Akim Demaille 8e13c5c03b build: fix a warning from clang
* src/muscle-tab.c: Declare local functions static.
2013-06-03 16:40:30 +02:00
Akim Demaille 266cdc3025 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-05-30 15:28:44 +02:00
213 changed files with 3585 additions and 1506 deletions
+10 -1
View File
@@ -1,7 +1,16 @@
*.eps
*.log
*.o
*.pdf
*.png
*.stamp
*.trs
*~
.deps
.dirstamp
/*.cache /*.cache
/*.flc /*.flc
/*.prj /*.prj
/*~
/.tarball-version /.tarball-version
/.version /.version
/ABOUT-NLS /ABOUT-NLS
+1 -1
View File
@@ -1 +1 @@
2.7.1 3.0.2
+1 -1
View File
@@ -24,7 +24,7 @@ and nasty bugs.
----- -----
Copyright (C) 1998-2013 Free Software Foundation, Inc. Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -26733,7 +26733,7 @@
----- -----
Copyright (C) 1987-1988, 1991-2013 Free Software Foundation, Copyright (C) 1987-1988, 1991-2015 Free Software Foundation,
Inc. Inc.
Copying and distribution of this file, with or without Copying and distribution of this file, with or without
+5 -3
View File
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
# Copyright (C) 2001-2013 Free Software Foundation, Inc. # Copyright (C) 2001-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -24,8 +24,10 @@ SUBDIRS = po runtime-po .
aclocaldir = @aclocaldir@ aclocaldir = @aclocaldir@
aclocal_DATA = m4/bison-i18n.m4 aclocal_DATA = m4/bison-i18n.m4
EXTRA_DIST = .prev-version .version \ EXTRA_DIST = .prev-version .version cfg.mk PACKAGING \
cfg.mk ChangeLog-1998 ChangeLog-2012 PACKAGING ChangeLog-1998 ChangeLog-2012 ChangeLog
dist_doc_DATA = AUTHORS COPYING NEWS README THANKS TODO
## Running the bison from this tarball. To generate our own parser, ## Running the bison from this tarball. To generate our own parser,
## but also to run the tests. Of course, you ought to keep a sane ## but also to run the tests. Of course, you ought to keep a sane
+117 -4
View File
@@ -1,6 +1,117 @@
GNU Bison NEWS GNU Bison NEWS
* Noteworthy changes in release 2.7.90 (2013-05-30) [beta] * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
** Bug fixes
*** C++ with Variants (lalr1.cc)
Problems with %destructor and '%define parse.assert' have been fixed.
*** Named %union support (yacc.c, glr.c)
Bison 3.0 introduced a regression on named %union such as
%union foo { int ival; };
The possibility to use a name was introduced "for Yacc compatibility".
It is however not required by POSIX Yacc, and its usefulness is not clear.
*** %define api.value.type union with %defines (yacc.c, glr.c)
The C parsers were broken when %defines was used together with "%define
api.value.type union".
*** Redeclarations are reported in proper order
On
%token FOO "foo"
%printer {} "foo"
%printer {} FOO
bison used to report:
/tmp/foo.yy:2.10-11: error: %printer redeclaration for FOO
%printer {} "foo"
^^
/tmp/foo.yy:3.10-11: previous declaration
%printer {} FOO
^^
Now, the "previous" declaration is always the first one.
** Documentation
Bison now installs various files in its docdir (which defaults to
'/usr/local/share/doc/bison'), including the three fully blown examples
extracted from the documentation:
- rpcalc
Reverse polish calculator, a simple introductory example.
- mfcalc
Multi-function Calc, a calculator with memory and functions and located
error messages.
- calc++
a calculator in C++ using variant support and token constructors.
* Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
** Bug fixes
*** Generated source files when errors are reported
When warnings are issued and -Werror is set, bison would still generate
the source files (*.c, *.h...). As a consequence, some runs of "make"
could fail the first time, but not the second (as the files were generated
anyway).
This is fixed: bison no longer generates this source files, but, of
course, still produces the various reports (*.output, *.xml, etc.).
*** %empty is used in reports
Empty right-hand sides are denoted by '%empty' in all the reports (text,
dot, XML and formats derived from it).
*** YYERROR and variants
When C++ variant support is enabled, an error triggered via YYERROR, but
not caught via error recovery, resulted in a double deletion.
* Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
** Bug fixes
*** Errors in caret diagnostics
On some platforms, some errors could result in endless diagnostics.
*** Fixes of the -Werror option
Options such as "-Werror -Wno-error=foo" were still turning "foo"
diagnostics into errors instead of warnings. This is fixed.
Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
leaves "foo" diagnostics as warnings. Similarly, with "-Werror=foo
-Wno-error", "foo" diagnostics are now errors.
*** GLR Predicates
As demonstrated in the documentation, one can now leave spaces between
"%?" and its "{".
*** Installation
The yacc.1 man page is no longer installed if --disable-yacc was
specified.
*** Fixes in the test suite
Bugs and portability issues.
* Noteworthy changes in release 3.0 (2013-07-25) [stable]
** WARNING: Future backward-incompatibilities! ** WARNING: Future backward-incompatibilities!
@@ -516,11 +627,13 @@ GNU Bison NEWS
** Java skeleton improvements ** Java skeleton improvements
Contributed by Paolo Bonzini.
The constants for token names were moved to the Lexer interface. Also, it The constants for token names were moved to the Lexer interface. Also, it
is possible to add code to the parser's constructors using "%code init" is possible to add code to the parser's constructors using "%code init"
and "%define init_throws". and "%define init_throws".
Contributed by Paolo Bonzini.
The Java skeleton now supports push parsing.
Contributed by Dennis Heimbigner.
** C++ skeletons improvements ** C++ skeletons improvements
@@ -2623,7 +2736,7 @@ Output file does not redefine const for C++.
----- -----
Copyright (C) 1995-2013 Free Software Foundation, Inc. Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Parser Generator. This file is part of Bison, the GNU Parser Generator.
+1 -1
View File
@@ -36,7 +36,7 @@ to the bison package.
----- -----
Copyright (C) 2002, 2005, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2005, 2009-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -44,7 +44,7 @@ End:
----- -----
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2013 Free Software Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015 Free Software
Foundation, Inc. Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -12,7 +12,7 @@ the problems you encounter.
----- -----
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
This file is part of GNU Bison. This file is part of GNU Bison.
+15 -4
View File
@@ -62,13 +62,22 @@ tools we depend upon, including:
- Gettext <http://www.gnu.org/software/gettext/> - Gettext <http://www.gnu.org/software/gettext/>
- Graphviz <http://www.graphviz.org> - Graphviz <http://www.graphviz.org>
- Gzip <http://www.gnu.org/software/gzip/> - Gzip <http://www.gnu.org/software/gzip/>
- Help2man <http://www.gnu.org/software/help2man/>
- Perl <http://www.cpan.org/> - Perl <http://www.cpan.org/>
- Rsync <http://samba.anu.edu.au/rsync/> - Rsync <http://samba.anu.edu.au/rsync/>
- Tar <http://www.gnu.org/software/tar/> - Tar <http://www.gnu.org/software/tar/>
- Texinfo <http://www.gnu.org/software/texinfo/>
Valgrind <http://valgrind.org/> is also highly recommended, if it supports Valgrind <http://valgrind.org/> is also highly recommended, if it supports
your architecture. your architecture.
If you're using a GNU/Linux distribution, the easiest way to install the
above packages depends on your system. The following shell command should
work for Debian-based systems such as Ubuntu:
sudo apt-get install \
autoconf automake autopoint flex graphviz help2man texinfo valgrind
Bison is written using Bison grammars, so there are bootstrapping issues. Bison is written using Bison grammars, so there are bootstrapping issues.
The bootstrap script attempts to discover when the C code generated from the The bootstrap script attempts to discover when the C code generated from the
grammars is out of date, and to bootstrap with an out-of-date version of the grammars is out of date, and to bootstrap with an out-of-date version of the
@@ -94,15 +103,17 @@ to perform the first checkout of the submodules, run
$ git submodule update --init $ git submodule update --init
Git submodule support is weak before versions 1.6 and later, you Git submodule support is weak before versions 1.6 and later, upgrade Git if
should probably upgrade Git if your version is older. your version is older.
The next step is to get other files needed to build, which are The next step is to get other files needed to build, which are
extracted from other source packages: extracted from other source packages:
$ ./bootstrap $ ./bootstrap
And there you are! Just If it fails with missing symbols (e.g., "error: possibly undefined macro:
AC_PROG_GNU_M4"), you are likely to have forgotten the submodule
initialization part. Otherwise, there you are! Just
$ ./configure $ ./configure
$ make $ make
@@ -440,7 +451,7 @@ Push these changes.
----- -----
Copyright (C) 2002-2005, 2007-2013 Free Software Foundation, Inc. Copyright (C) 2002-2005, 2007-2015 Free Software Foundation, Inc.
This file is part of GNU Bison. This file is part of GNU Bison.
+21 -3
View File
@@ -1,7 +1,8 @@
Bison was originally written by Robert Corbett. It would not be what Bison was originally written by Robert Corbett. It would not be what
it is today without the invaluable help of these people: it is today without the invaluable help of these people:
Аскар Сафин [email protected] Aaro Koskinen [email protected]
Аскар Сафин [email protected]
Airy Andre [email protected] Airy Andre [email protected]
Akim Demaille [email protected] Akim Demaille [email protected]
Albert Chin-A-Young [email protected] Albert Chin-A-Young [email protected]
@@ -11,11 +12,13 @@ Andreas Schwab [email protected]
Andrew Suffield [email protected] Andrew Suffield [email protected]
Angelo Borsotti [email protected] Angelo Borsotti [email protected]
Anthony Heading [email protected] Anthony Heading [email protected]
Antonio Silva Correia [email protected]
Arnold Robbins [email protected] Arnold Robbins [email protected]
Art Haas [email protected] Art Haas [email protected]
Baron Schwartz [email protected] Baron Schwartz [email protected]
Ben Pfaff [email protected] Ben Pfaff [email protected]
Benoit Perrot [email protected] Benoit Perrot [email protected]
Bernd Edlinger [email protected]
Bernd Kiefer [email protected] Bernd Kiefer [email protected]
Bert Deknuydt [email protected] Bert Deknuydt [email protected]
Bill Allombert [email protected] Bill Allombert [email protected]
@@ -25,11 +28,13 @@ Bruce Lilly [email protected]
Bruno Haible [email protected] Bruno Haible [email protected]
Charles-Henri de Boysson [email protected] Charles-Henri de Boysson [email protected]
Christian Burger [email protected] Christian Burger [email protected]
Colin Daley [email protected]
Cris Bailiff [email protected] Cris Bailiff [email protected]
Cris van Pelt [email protected] Cris van Pelt [email protected]
Csaba Raduly [email protected] Csaba Raduly [email protected]
Dagobert Michelsen [email protected] Dagobert Michelsen [email protected]
Daniel Frużyński [email protected] Daniel Frużyński [email protected]
Daniel Galloway [email protected]
Daniel Hagerty [email protected] Daniel Hagerty [email protected]
David J. MacKenzie [email protected] David J. MacKenzie [email protected]
David Kastrup [email protected] David Kastrup [email protected]
@@ -66,6 +71,7 @@ Jonathan Nieder [email protected]
Juan Manuel Guerrero [email protected] Juan Manuel Guerrero [email protected]
Kees Zeelenberg [email protected] Kees Zeelenberg [email protected]
Keith Browne [email protected] Keith Browne [email protected]
Ken Moffat [email protected]
Laurent Mascherpa [email protected] Laurent Mascherpa [email protected]
Lie Yan [email protected] Lie Yan [email protected]
Magnus Fromreide [email protected] Magnus Fromreide [email protected]
@@ -77,14 +83,19 @@ Martin Mokrejs [email protected]
Martin Nylin [email protected] Martin Nylin [email protected]
Matt Kraai [email protected] Matt Kraai [email protected]
Matt Rosing [email protected] Matt Rosing [email protected]
Michael Catanzaro [email protected]
Michael Felt [email protected]
Michael Hayes [email protected] Michael Hayes [email protected]
Michael Raskin [email protected] Michael Raskin [email protected]
Michel d'Hooge [email protected]
Michiel De Wilde [email protected] Michiel De Wilde [email protected]
Mickael Labau [email protected] Mickael Labau [email protected]
Mike Castle [email protected] Mike Castle [email protected]
Mike Sullivan [email protected]
Neil Booth [email protected] Neil Booth [email protected]
Nelson H. F. Beebe [email protected] Nelson H. F. Beebe [email protected]
Nick Bowler [email protected] Nick Bowler [email protected]
Nicolas Bedon [email protected]
Nicolas Burrus [email protected] Nicolas Burrus [email protected]
Nicolas Tisserand [email protected] Nicolas Tisserand [email protected]
Noah Friedman [email protected] Noah Friedman [email protected]
@@ -92,6 +103,7 @@ Odd Arild Olsen [email protected]
Oleg Smolsky [email protected] Oleg Smolsky [email protected]
Oleksii Taran [email protected] Oleksii Taran [email protected]
Paolo Bonzini [email protected] Paolo Bonzini [email protected]
Paolo Simone Gasparello [email protected]
Pascal Bart [email protected] Pascal Bart [email protected]
Paul Eggert [email protected] Paul Eggert [email protected]
Paul Hilfinger [email protected] Paul Hilfinger [email protected]
@@ -107,10 +119,12 @@ Quoc Peyrot [email protected]
R Blake [email protected] R Blake [email protected]
Raja R Harinath [email protected] Raja R Harinath [email protected]
Ralf Wildenhues [email protected] Ralf Wildenhues [email protected]
Rich Wilson [email protected]
Richard Stallman [email protected] Richard Stallman [email protected]
Rici Lake [email protected]
Rob Conde [email protected]
Rob Vermaas [email protected] Rob Vermaas [email protected]
Robert Anisko [email protected] Robert Anisko [email protected]
Rob Conde [email protected]
Roland Levillain [email protected] Roland Levillain [email protected]
Satya Kiran Popuri [email protected] Satya Kiran Popuri [email protected]
Sebastian Setzer [email protected] Sebastian Setzer [email protected]
@@ -118,13 +132,16 @@ Sebastien Fricker [email protected]
Sergei Steshenko [email protected] Sergei Steshenko [email protected]
Shura [email protected] Shura [email protected]
Stefano Lattarini [email protected] Stefano Lattarini [email protected]
Stephen Cameron [email protected]
Steve Murphy [email protected] Steve Murphy [email protected]
Sum Wu [email protected] Sum Wu [email protected]
Théophile Ranquet [email protected] Théophile Ranquet [email protected]
Thiru Ramakrishnan [email protected] Thiru Ramakrishnan [email protected]
Thomas Jahns [email protected]
Tim Josling [email protected] Tim Josling [email protected]
Tim Landscheidt [email protected] Tim Landscheidt [email protected]
Tim Van Holder [email protected] Tim Van Holder [email protected]
Tobias Frost [email protected]
Tom Lane [email protected] Tom Lane [email protected]
Tom Tromey [email protected] Tom Tromey [email protected]
Tommy Nordgren [email protected] Tommy Nordgren [email protected]
@@ -140,6 +157,7 @@ Wojciech Polak [email protected]
Wolfgang S. Kechel [email protected] Wolfgang S. Kechel [email protected]
Wolfram Wagner [email protected] Wolfram Wagner [email protected]
Wwp [email protected] Wwp [email protected]
xolodho [email protected]
Zack Weinberg [email protected] Zack Weinberg [email protected]
Many people are not named here because we lost track of them. We Many people are not named here because we lost track of them. We
@@ -152,7 +170,7 @@ End:
----- -----
Copyright (C) 2000-2013 Free Software Foundation, Inc. Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Parser Generator. This file is part of Bison, the GNU Parser Generator.
+1 -1
View File
@@ -369,7 +369,7 @@ End:
----- -----
Copyright (C) 2001-2004, 2006, 2008-2013 Free Software Foundation, Inc. Copyright (C) 2001-2004, 2006, 2008-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+86 -43
View File
@@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Print a version string. # Print a version string.
scriptversion=2013-05-08.20; # UTC scriptversion=2014-12-08.12; # UTC
# Bootstrap this package from checked-out sources. # Bootstrap this package from checked-out sources.
# Copyright (C) 2003-2013 Free Software Foundation, Inc. # Copyright (C) 2003-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -42,6 +42,9 @@ export LC_ALL
local_gl_dir=gl local_gl_dir=gl
# Honour $PERL, but work even if there is none
PERL="${PERL-perl}"
me=$0 me=$0
usage() { usage() {
@@ -209,12 +212,26 @@ bootstrap_sync=false
# Use git to update gnulib sources # Use git to update gnulib sources
use_git=true use_git=true
check_exists() {
if test "$1" = "--verbose"; then
($2 --version </dev/null) >/dev/null 2>&1
if test $? -ge 126; then
# If not found, run with diagnostics as one may be
# presented with env variables to set to find the right version
($2 --version </dev/null)
fi
else
($1 --version </dev/null) >/dev/null 2>&1
fi
test $? -lt 126
}
# find_tool ENVVAR NAMES... # find_tool ENVVAR NAMES...
# ------------------------- # -------------------------
# Search for a required program. Use the value of ENVVAR, if set, # Search for a required program. Use the value of ENVVAR, if set,
# otherwise find the first of the NAMES that can be run (i.e., # otherwise find the first of the NAMES that can be run.
# supports --version). If found, set ENVVAR to the program name, # If found, set ENVVAR to the program name, die otherwise.
# die otherwise.
# #
# FIXME: code duplication, see also gnu-web-doc-update. # FIXME: code duplication, see also gnu-web-doc-update.
find_tool () find_tool ()
@@ -224,27 +241,21 @@ find_tool ()
find_tool_names=$@ find_tool_names=$@
eval "find_tool_res=\$$find_tool_envvar" eval "find_tool_res=\$$find_tool_envvar"
if test x"$find_tool_res" = x; then if test x"$find_tool_res" = x; then
for i for i; do
do if check_exists $i; then
if ($i --version </dev/null) >/dev/null 2>&1; then find_tool_res=$i
find_tool_res=$i break
break
fi fi
done done
else
find_tool_error_prefix="\$$find_tool_envvar: "
fi fi
test x"$find_tool_res" != x \ if test x"$find_tool_res" = x; then
|| die "one of these is required: $find_tool_names" warn_ "one of these is required: $find_tool_names;"
($find_tool_res --version </dev/null) >/dev/null 2>&1 \ die "alternatively set $find_tool_envvar to a compatible tool"
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version" fi
eval "$find_tool_envvar=\$find_tool_res" eval "$find_tool_envvar=\$find_tool_res"
eval "export $find_tool_envvar" eval "export $find_tool_envvar"
} }
# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
find_tool SHA1SUM sha1sum gsha1sum shasum
# Override the default configuration, if necessary. # Override the default configuration, if necessary.
# Make sure that bootstrap.conf is sourced from the current directory # Make sure that bootstrap.conf is sourced from the current directory
# if we were invoked as "sh bootstrap". # if we were invoked as "sh bootstrap".
@@ -256,12 +267,12 @@ esac
# Extra files from gnulib, which override files from other sources. # Extra files from gnulib, which override files from other sources.
test -z "${gnulib_extra_files}" && \ test -z "${gnulib_extra_files}" && \
gnulib_extra_files=" gnulib_extra_files="
$build_aux/install-sh build-aux/install-sh
$build_aux/mdate-sh build-aux/mdate-sh
$build_aux/texinfo.tex build-aux/texinfo.tex
$build_aux/depcomp build-aux/depcomp
$build_aux/config.guess build-aux/config.guess
$build_aux/config.sub build-aux/config.sub
doc/INSTALL doc/INSTALL
" "
@@ -326,7 +337,7 @@ insert_if_absent() {
die "Error: Duplicate entries in $file: " $duplicate_entries die "Error: Duplicate entries in $file: " $duplicate_entries
fi fi
linesold=$(gitignore_entries $file | wc -l) linesold=$(gitignore_entries $file | wc -l)
linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | wc -l) linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
if [ $linesold != $linesnew ] ; then if [ $linesold != $linesnew ] ; then
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|| die "insert_if_absent $file $str: failed" || die "insert_if_absent $file $str: failed"
@@ -410,7 +421,7 @@ sort_ver() { # sort -V is not generally available
get_version() { get_version() {
app=$1 app=$1
$app --version >/dev/null 2>&1 || return 1 $app --version >/dev/null 2>&1 || { $app --version; return 1; }
$app --version 2>&1 | $app --version 2>&1 |
sed -n '# Move version to start of line. sed -n '# Move version to start of line.
@@ -448,6 +459,7 @@ check_versions() {
test "$appvar" = TAR && appvar=AMTAR test "$appvar" = TAR && appvar=AMTAR
case $appvar in case $appvar in
GZIP) ;; # Do not use $GZIP: it contains gzip options. GZIP) ;; # Do not use $GZIP: it contains gzip options.
PERL::*) ;; # Keep perl modules as-is
*) eval "app=\${$appvar-$app}" ;; *) eval "app=\${$appvar-$app}" ;;
esac esac
@@ -465,12 +477,22 @@ check_versions() {
ret=1 ret=1
continue continue
} ;; } ;;
# Another check is for perl modules. These can be written as
# e.g. perl::XML::XPath in case of XML::XPath module, etc.
perl::*)
# Extract module name
app="${app#perl::}"
if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then
warn_ "Error: perl module '$app' not found"
ret=1
fi
continue
;;
esac esac
if [ "$req_ver" = "-" ]; then if [ "$req_ver" = "-" ]; then
# Merely require app to exist; not all prereq apps are well-behaved # Merely require app to exist; not all prereq apps are well-behaved
# so we have to rely on $? rather than get_version. # so we have to rely on $? rather than get_version.
$app --version >/dev/null 2>&1 if ! check_exists --verbose $app; then
if [ 126 -le $? ]; then
warn_ "Error: '$app' not found" warn_ "Error: '$app' not found"
ret=1 ret=1
fi fi
@@ -503,6 +525,12 @@ print_versions() {
# can't depend on column -t # can't depend on column -t
} }
# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
# Also find the compatible sha1 utility on the BSDs
if test x"$SKIP_PO" = x; then
find_tool SHA1SUM sha1sum gsha1sum shasum sha1
fi
use_libtool=0 use_libtool=0
# We'd like to use grep -E, to see if any of LT_INIT, # We'd like to use grep -E, to see if any of LT_INIT,
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
@@ -548,13 +576,21 @@ if ! printf "$buildreq" | check_versions; then
fi fi
fi fi
# Warn the user if autom4te appears to be broken; this causes known
# issues with at least gettext 0.18.3.
probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -)
if test "x$probe" != xhi; then
warn_ "WARNING: your autom4te wrapper eats stdin;"
warn_ "if bootstrap fails, consider upgrading your autotools"
fi
echo "$0: Bootstrapping from checked-out $package sources..." echo "$0: Bootstrapping from checked-out $package sources..."
# See if we can use gnulib's git-merge-changelog merge driver. # 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 $use_git && test -d .git && check_exists git; then
if git config merge.merge-changelog.driver >/dev/null ; then if git config merge.merge-changelog.driver >/dev/null ; then
: :
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then elif check_exists git-merge-changelog; then
echo "$0: initializing git-merge-changelog driver" echo "$0: initializing git-merge-changelog driver"
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B' git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
@@ -574,17 +610,21 @@ git_modules_config () {
test -f .gitmodules && git config --file .gitmodules "$@" test -f .gitmodules && git config --file .gitmodules "$@"
} }
gnulib_path=$(git_modules_config submodule.gnulib.path) if $use_git; then
test -z "$gnulib_path" && gnulib_path=gnulib gnulib_path=$(git_modules_config submodule.gnulib.path)
test -z "$gnulib_path" && gnulib_path=gnulib
fi
# Get gnulib files. # Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
# submodule, for use in the rest of the script.
case ${GNULIB_SRCDIR--} in case ${GNULIB_SRCDIR--} in
-) -)
# Note that $use_git is necessarily true in this case.
if git_modules_config submodule.gnulib.url >/dev/null; then if git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..." echo "$0: getting gnulib files..."
git submodule init || exit $? git submodule init -- "$gnulib_path" || exit $?
git submodule update || exit $? git submodule update -- "$gnulib_path" || exit $?
elif [ ! -d "$gnulib_path" ]; then elif [ ! -d "$gnulib_path" ]; then
echo "$0: getting gnulib files..." echo "$0: getting gnulib files..."
@@ -601,8 +641,8 @@ case ${GNULIB_SRCDIR--} in
GNULIB_SRCDIR=$gnulib_path GNULIB_SRCDIR=$gnulib_path
;; ;;
*) *)
# Use GNULIB_SRCDIR as a reference. # Use GNULIB_SRCDIR directly or as a reference.
if test -d "$GNULIB_SRCDIR"/.git && \ if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
git_modules_config submodule.gnulib.url >/dev/null; then git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..." echo "$0: getting gnulib files..."
if git submodule -h|grep -- --reference > /dev/null; then if git submodule -h|grep -- --reference > /dev/null; then
@@ -613,13 +653,14 @@ case ${GNULIB_SRCDIR--} in
# This fallback allows at least git 1.5.5. # This fallback allows at least git 1.5.5.
if test -f "$gnulib_path"/gnulib-tool; then if test -f "$gnulib_path"/gnulib-tool; then
# Since file already exists, assume submodule init already complete. # Since file already exists, assume submodule init already complete.
git submodule update || exit $? git submodule update -- "$gnulib_path" || exit $?
else else
# Older git can't clone into an empty directory. # Older git can't clone into an empty directory.
rmdir "$gnulib_path" 2>/dev/null rmdir "$gnulib_path" 2>/dev/null
git clone --reference "$GNULIB_SRCDIR" \ git clone --reference "$GNULIB_SRCDIR" \
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
&& git submodule init && git submodule update \ && git submodule init -- "$gnulib_path" \
&& git submodule update -- "$gnulib_path" \
|| exit $? || exit $?
fi fi
fi fi
@@ -628,6 +669,9 @@ case ${GNULIB_SRCDIR--} in
;; ;;
esac esac
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
# we no longer need to use git or $gnulib_path below here.
if $bootstrap_sync; then if $bootstrap_sync; then
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
echo "$0: updating bootstrap and restarting..." echo "$0: updating bootstrap and restarting..."
@@ -685,11 +729,10 @@ update_po_files() {
cksum_file="$ref_po_dir/$po.s1" cksum_file="$ref_po_dir/$po.s1"
if ! test -f "$cksum_file" || if ! test -f "$cksum_file" ||
! test -f "$po_dir/$po.po" || ! test -f "$po_dir/$po.po" ||
! $SHA1SUM -c --status "$cksum_file" \ ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
< "$new_po" > /dev/null; then
echo "$me: updated $po_dir/$po.po..." echo "$me: updated $po_dir/$po.po..."
cp "$new_po" "$po_dir/$po.po" \ cp "$new_po" "$po_dir/$po.po" \
&& $SHA1SUM < "$new_po" > "$cksum_file" && $SHA1SUM < "$new_po" > "$cksum_file" || return
fi fi
done done
} }
+3 -2
View File
@@ -1,6 +1,6 @@
# Bootstrap configuration. # Bootstrap configuration.
# Copyright (C) 2006-2013 Free Software Foundation, Inc. # Copyright (C) 2006-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -34,7 +34,8 @@ gnulib_modules='
readme-release readme-release
realloc-posix realloc-posix
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
unistd unistd-safer unlocked-io update-copyright unsetenv verify unistd unistd-safer unlink unlocked-io
update-copyright unsetenv verify
warnings warnings
xalloc xalloc
xalloc-die xalloc-die
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Free Software Foundation, Inc. # Copyright (C) 2012-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+3
View File
@@ -2,6 +2,9 @@
# option. It specifies what changes to make to each given SHA1's commit # option. It specifies what changes to make to each given SHA1's commit
# log and metadata, using Perl-eval'able expressions. # log and metadata, using Perl-eval'able expressions.
975bb564319aa4f4204c48aba265757ba207a80f
s/Edligner/Edlinger/;
0db2648930e3b6c376a539aabe368aade83ee29a 0db2648930e3b6c376a539aabe368aade83ee29a
s/--flags/--feature/; s/--flags/--feature/;
s/flag_flag/feature_flag/; s/flag_flag/feature_flag/;
+16
View File
@@ -0,0 +1,16 @@
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
# x86_64 GNU/Linux
{
index
Memcheck:Cond
fun:index
fun:expand_dynamic_string_token
fun:_dl_map_object
fun:map_doit
fun:_dl_catch_error
fun:do_preload
fun:dl_main
fun:_dl_sysdep_start
fun:_dl_start
obj:/lib/ld-2.11.3.so
}
+2 -1
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2000-2013 Free Software Foundation, Inc. # Copyright (C) 2000-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -16,6 +16,7 @@
EXTRA_DIST += \ EXTRA_DIST += \
build-aux/cross-options.pl \ build-aux/cross-options.pl \
build-aux/darwin11.4.0.valgrind \ build-aux/darwin11.4.0.valgrind \
build-aux/linux-gnu.valgrind \
build-aux/move-if-change \ build-aux/move-if-change \
build-aux/prev-version.txt \ build-aux/prev-version.txt \
build-aux/update-b4-copyright build-aux/update-b4-copyright
+1 -1
View File
@@ -3,7 +3,7 @@
# Update b4_copyright invocations or b4_copyright_years definitions to # Update b4_copyright invocations or b4_copyright_years definitions to
# include the current year. # include the current year.
# Copyright (C) 2009-2013 Free Software Foundation, Inc. # Copyright (C) 2009-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year. # In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
# Copyright (C) 2010-2013 Free Software Foundation, Inc. # Copyright (C) 2010-2015 Free Software Foundation, Inc.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Customize maint.mk -*- makefile -*- # Customize maint.mk -*- makefile -*-
# Copyright (C) 2008-2013 Free Software Foundation, Inc. # Copyright (C) 2008-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+27 -23
View File
@@ -1,6 +1,6 @@
# Configure template for GNU Bison. -*-Autoconf-*- # Configure template for GNU Bison. -*-Autoconf-*-
# #
# Copyright (C) 2001-2013 Free Software Foundation, Inc. # Copyright (C) 2001-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -26,18 +26,14 @@ m4_pattern_forbid([^gl_[A-Z]])
AC_INIT([GNU Bison], AC_INIT([GNU Bison],
m4_esyscmd([build-aux/git-version-gen .tarball-version]), m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[[email protected]]) [[email protected]])
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2013]) AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2015])
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR], AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
[The copyright year for this package]) [The copyright year for this package])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
# Automake 1.10.3 and 1.11.1 fix a security flaw discussed here: # We use Automake 1.14's %D% and %C%.
#
# http://thread.gmane.org/gmane.comp.sysutils.autotools.announce/131
#
# To avoid 1.11, we make 1.11.1 the minimum version.
# #
# We want gnits strictness only when rolling a stable release. For # We want gnits strictness only when rolling a stable release. For
# release candidates, we use version strings like 2.4.3_rc1, but gnits # release candidates, we use version strings like 2.4.3_rc1, but gnits
@@ -45,7 +41,7 @@ AC_CONFIG_MACRO_DIR([m4])
# releases, we want to be able run make dist without being required to # releases, we want to be able run make dist without being required to
# add a bogus NEWS entry. In that case, the version string # add a bogus NEWS entry. In that case, the version string
# automatically contains a dash, which we also let disable gnits. # automatically contains a dash, which we also let disable gnits.
AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc AM_INIT_AUTOMAKE([1.14 dist-xz nostdinc
color-tests parallel-tests color-tests parallel-tests
silent-rules] silent-rules]
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]], m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
@@ -75,14 +71,17 @@ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
CFLAGS=$save_CFLAGS]) CFLAGS=$save_CFLAGS])
AC_ARG_ENABLE([gcc-warnings], AC_ARG_ENABLE([gcc-warnings],
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)], [ --enable-gcc-warnings turn on lots of GCC warnings (not recommended).
Also, issue synclines from the examples/ to
the corresponding source in the Texinfo doc.],
[case $enable_gcc_warnings in [case $enable_gcc_warnings in
yes|no) ;; yes|no) ;;
*) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);; *) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);;
esac], esac],
[enable_gcc_warnings=no]) [enable_gcc_warnings=no])
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
if test "$enable_gcc_warnings" = yes; then if test "$enable_gcc_warnings" = yes; then
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align warn_common='-Wall-Wextra -Wno-sign-compare -Wcast-align -Wdocumentation
-Wformat -Wpointer-arith -Wwrite-strings' -Wformat -Wpointer-arith -Wwrite-strings'
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes' warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
warn_cxx='-Wnoexcept' warn_cxx='-Wnoexcept'
@@ -161,21 +160,17 @@ AC_ARG_ENABLE([yacc],
[AC_HELP_STRING([--disable-yacc], [AC_HELP_STRING([--disable-yacc],
[do not build a yacc command or an -ly library])], [do not build a yacc command or an -ly library])],
, [enable_yacc=yes]) , [enable_yacc=yes])
case $enable_yacc in AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
yes)
YACC_SCRIPT=src/yacc
YACC_LIBRARY=lib/liby.a;;
*)
YACC_SCRIPT=
YACC_LIBRARY=;;
esac
AC_SUBST([YACC_SCRIPT])
AC_SUBST([YACC_LIBRARY])
# Checks for programs. # Checks for programs.
AM_MISSING_PROG([DOT], [dot]) AM_MISSING_PROG([DOT], [dot])
AC_PROG_LEX AC_PROG_LEX
$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required]) $LEX_IS_FLEX || test "X$LEX" = X: || {
AC_MSG_WARN([bypassing lex because flex is required])
LEX=:
}
AM_CONDITIONAL([FLEX_CXX_WORKS],
[$LEX_IS_FLEX && test $bison_cv_cxx_works = yes])
AC_PROG_YACC AC_PROG_YACC
AC_PROG_RANLIB AC_PROG_RANLIB
AC_PROG_GNU_M4 AC_PROG_GNU_M4
@@ -230,12 +225,21 @@ case $VALGRIND:$host_os in
'':*) ;; '':*) ;;
*:darwin*) *:darwin*)
# See README-hacking. # See README-hacking.
# VALGRIND+=' --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind' # VALGRIND+='-q --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
VALGRIND=;; VALGRIND=;;
*:*) *:*)
AC_SUBST([VALGRIND_PREBISON], ["$VALGRIND -q"]);; suppfile=build-aux/$host_os.valgrind
if test -f "$srcdir/$suppfile"; then
VALGRIND="$VALGRIND --gen-suppressions=all"
VALGRIND="$VALGRIND --suppressions=\$(abs_top_srcdir)/$suppfile"
fi
AC_SUBST([VALGRIND_PREBISON], ["$VALGRIND -q"])
;;
esac esac
# Whether we cannot run the compiled bison.
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
AM_MISSING_PROG([AUTOM4TE], [autom4te]) AM_MISSING_PROG([AUTOM4TE], [autom4te])
# Needed by tests/atlocal.in. # Needed by tests/atlocal.in.
AC_SUBST([GCC]) AC_SUBST([GCC])
+1 -1
View File
@@ -52,7 +52,7 @@ into various formats.
----- -----
Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2008-2015 Free Software Foundation, Inc.
This file is part of GNU Bison. This file is part of GNU Bison.
+4 -1
View File
@@ -2,7 +2,7 @@
# Language-independent M4 Macros for Bison. # Language-independent M4 Macros for Bison.
# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc. # Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -1061,3 +1061,6 @@ b4_percent_define_ifdef([api.value.type],
[['%s' and '%s' cannot be used together]], [['%s' and '%s' cannot be used together]],
[%yacc], [%yacc],
[%define api.value.type "union"])])])]) [%define api.value.type "union"])])])])
# api.value.union.name.
b4_percent_define_check_kind([api.value.union.name], [keyword])
+1 -1
View File
@@ -2,7 +2,7 @@
# C++ skeleton dispatching for Bison. # C++ skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. # Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+51 -9
View File
@@ -2,7 +2,7 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2013 Free Software Foundation, Inc. # Copyright (C) 2002-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -17,6 +17,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Sanity checks, before defaults installed by c.m4.
b4_percent_define_ifdef([[api.value.union.name]],
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
[named %union is invalid in C++])])
m4_include(b4_pkgdatadir/[c.m4]) m4_include(b4_pkgdatadir/[c.m4])
# b4_comment(TEXT, [PREFIX]) # b4_comment(TEXT, [PREFIX])
@@ -169,9 +174,12 @@ m4_define([b4_public_types_declare],
/// (External) token type, as returned by yylex. /// (External) token type, as returned by yylex.
typedef token::yytokentype token_type; typedef token::yytokentype token_type;
/// Internal symbol number. /// Symbol type: an internal symbol number.
typedef int symbol_number_type; typedef int symbol_number_type;
/// The symbol type number to denote an empty symbol.
enum { empty_symbol = -2 };
/// Internal symbol number for tokens (subsumed by symbol_number_type). /// Internal symbol number for tokens (subsumed by symbol_number_type).
typedef ]b4_int_type_for([b4_translate])[ token_number_type; typedef ]b4_int_type_for([b4_translate])[ token_number_type;
@@ -204,8 +212,15 @@ m4_define([b4_public_types_declare],
const semantic_type& v]b4_locations_if([, const semantic_type& v]b4_locations_if([,
const location_type& l])[); const location_type& l])[);
/// Destroy the symbol.
~basic_symbol (); ~basic_symbol ();
/// Destroy contents, and record that is empty.
void clear ();
/// Whether empty.
bool empty () const;
/// Destructive move, \a s is emptied into this. /// Destructive move, \a s is emptied into this.
void move (basic_symbol& s); void move (basic_symbol& s);
@@ -235,21 +250,23 @@ m4_define([b4_public_types_declare],
/// Constructor from (external) token numbers. /// Constructor from (external) token numbers.
by_type (kind_type t); by_type (kind_type t);
/// Record that this symbol is empty.
void clear ();
/// Steal the symbol type from \a that. /// Steal the symbol type from \a that.
void move (by_type& that); void move (by_type& that);
/// The (internal) type number (corresponding to \a type). /// The (internal) type number (corresponding to \a type).
/// -1 when this symbol is empty. /// \a empty when empty.
symbol_number_type type_get () const; symbol_number_type type_get () const;
/// The token. /// The token.
token_type token () const; token_type token () const;
enum { empty = 0 };
/// The symbol type. /// The symbol type.
/// -1 when this symbol is empty. /// \a empty_symbol when empty.
token_number_type type; /// An int, not token_number_type, to be able to store empty_symbol.
int type;
}; };
/// "External" symbols: returned by the scanner. /// "External" symbols: returned by the scanner.
@@ -318,9 +335,18 @@ m4_define([b4_public_types_define],
template <typename Base> template <typename Base>
inline inline
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol () ]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
{
clear ();
}
template <typename Base>
inline
void
]b4_parser_class_name[::basic_symbol<Base>::clear ()
{]b4_variant_if([[ {]b4_variant_if([[
// User destructor. // User destructor.
symbol_number_type yytype = this->type_get (); symbol_number_type yytype = this->type_get ();
basic_symbol<Base>& yysym = *this;
switch (yytype) switch (yytype)
{ {
]b4_symbol_foreach([b4_symbol_destructor])dnl ]b4_symbol_foreach([b4_symbol_destructor])dnl
@@ -330,6 +356,15 @@ m4_define([b4_public_types_define],
// Type destructor. // Type destructor.
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[ ]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
Base::clear ();
}
template <typename Base>
inline
bool
]b4_parser_class_name[::basic_symbol<Base>::empty () const
{
return Base::type_get () == empty_symbol;
} }
template <typename Base> template <typename Base>
@@ -347,7 +382,7 @@ m4_define([b4_public_types_define],
// by_type. // by_type.
inline inline
]b4_parser_class_name[::by_type::by_type () ]b4_parser_class_name[::by_type::by_type ()
: type (empty) : type (empty_symbol)
{} {}
inline inline
@@ -360,12 +395,19 @@ m4_define([b4_public_types_define],
: type (yytranslate_ (t)) : type (yytranslate_ (t))
{} {}
inline
void
]b4_parser_class_name[::by_type::clear ()
{
type = empty_symbol;
}
inline inline
void void
]b4_parser_class_name[::by_type::move (by_type& that) ]b4_parser_class_name[::by_type::move (by_type& that)
{ {
type = that.type; type = that.type;
that.type = empty; that.clear ();
} }
inline inline
+1 -1
View File
@@ -2,7 +2,7 @@
# Common code for C-like languages (C, C++, Java, etc.) # Common code for C-like languages (C, C++, Java, etc.)
# Copyright (C) 2012-2013 Free Software Foundation, Inc. # Copyright (C) 2012-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# C skeleton dispatching for Bison. # C skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. # Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+69 -27
View File
@@ -2,7 +2,7 @@
# C M4 Macros for Bison. # C M4 Macros for Bison.
# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc. # Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -97,7 +97,8 @@ m4_define([b4_api_PREFIX],
m4_define_default([b4_prefix], [b4_api_prefix]) m4_define_default([b4_prefix], [b4_api_prefix])
# If the %union is not named, its name is YYSTYPE. # If the %union is not named, its name is YYSTYPE.
m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE]) b4_percent_define_default([[api.value.union.name]],
[b4_api_PREFIX[][STYPE]])
## ------------------------ ## ## ------------------------ ##
@@ -205,13 +206,32 @@ m4_define([b4_table_value_equals],
# b4_attribute_define # b4_attribute_define
# ------------------- # -------------------
# Provide portability for __attribute__. # Provide portable compiler "attributes".
m4_define([b4_attribute_define], m4_define([b4_attribute_define],
[#ifndef __attribute__ [#ifndef YY_ATTRIBUTE
/* This feature is available in gcc versions 2.5 and later. */ # if (defined __GNUC__ \
# if (! defined __GNUC__ || __GNUC__ < 2 \ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define __attribute__(Spec) /* empty */ # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
# define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif # endif
#endif #endif
@@ -221,6 +241,25 @@ m4_define([b4_attribute_define],
#else #else
# define YYUSE(E) /* empty */ # define YYUSE(E) /* empty */
#endif #endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
]) ])
@@ -231,14 +270,14 @@ m4_define([b4_attribute_define],
# b4_null_define # b4_null_define
# -------------- # --------------
# Portability issues: define a YY_NULL appropriate for the current # Portability issues: define a YY_NULLPTR appropriate for the current
# language (C, C++98, or C++11). # language (C, C++98, or C++11).
m4_define([b4_null_define], m4_define([b4_null_define],
[# ifndef YY_NULL [# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus # if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULL nullptr # define YY_NULLPTR nullptr
# else # else
# define YY_NULL 0 # define YY_NULLPTR 0
# endif # endif
# endif[]dnl # endif[]dnl
]) ])
@@ -247,7 +286,7 @@ m4_define([b4_null_define],
# b4_null # b4_null
# ------- # -------
# Return a null pointer constant. # Return a null pointer constant.
m4_define([b4_null], [YY_NULL]) m4_define([b4_null], [YY_NULLPTR])
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT) # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
# ------------------------------------------------------------- # -------------------------------------------------------------
@@ -446,7 +485,9 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
yymsg = "Deleting"; yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
]b4_symbol_actions([destructor])[ ]b4_symbol_actions([destructor])[
YY_IGNORE_MAYBE_UNINITIALIZED_END
}]dnl }]dnl
]) ])
@@ -456,9 +497,9 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
# Define the "yy_symbol_print" function. # Define the "yy_symbol_print" function.
m4_define_default([b4_yy_symbol_print_define], m4_define_default([b4_yy_symbol_print_define],
[[ [[
/*--------------------------------. /*----------------------------------------.
| Print this symbol on YYOUTPUT. | | Print this symbol's value on YYOUTPUT. |
`--------------------------------*/ `----------------------------------------*/
]b4_function_define([yy_symbol_value_print], ]b4_function_define([yy_symbol_value_print],
[static void], [static void],
@@ -520,15 +561,15 @@ b4_locations_if([, yylocationp])[]b4_user_args[);
# b4_symbol_type_register(SYMBOL-NUM) # b4_symbol_type_register(SYMBOL-NUM)
# ----------------------------------- # -----------------------------------
# Symbol SYMBOL-NUM has a type (for variant) instead of a type-tag. # Symbol SYMBOL-NUM has a type (for variant) instead of a type-tag.
# Extend the definition of %union's body with a field of that type, # Extend the definition of %union's body (b4_union_members) with a
# and extend the symbol's "type" field to point to the field name, # field of that type, and extend the symbol's "type" field to point to
# instead of the type name. # the field name, instead of the type name.
m4_define([b4_symbol_type_register], m4_define([b4_symbol_type_register],
[m4_define([b4_symbol($1, type_tag)], [m4_define([b4_symbol($1, type_tag)],
[b4_symbol_if([$1], [has_id], [b4_symbol_if([$1], [has_id],
[b4_symbol([$1], [id])], [b4_symbol([$1], [id])],
[yytype_[]b4_symbol([$1], [number])])])dnl [yytype_[]b4_symbol([$1], [number])])])dnl
m4_append([b4_user_union_members], m4_append([b4_union_members],
m4_expand([ m4_expand([
b4_symbol_tag_comment([$1])dnl b4_symbol_tag_comment([$1])dnl
b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);])) b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]))
@@ -568,10 +609,9 @@ m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
]) ])
# ---------------- # # -------------------------- #
# api.value.type. # # api.value.type = variant. #
# ---------------- # # -------------------------- #
# b4_value_type_setup_variant # b4_value_type_setup_variant
# --------------------------- # ---------------------------
@@ -646,11 +686,13 @@ typedef ]b4_percent_define_get([[api.value.type]])[ ]b4_api_PREFIX[STYPE;
[m4_bmatch(b4_percent_define_get([[api.value.type]]), [m4_bmatch(b4_percent_define_get([[api.value.type]]),
[union\|union-directive], [union\|union-directive],
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED [[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
typedef union ]b4_union_name[ ]b4_api_PREFIX[STYPE; ]b4_percent_define_get_syncline([[api.value.union.name]])[
union ]b4_union_name[ union ]b4_percent_define_get([[api.value.union.name]])[
{ {
]b4_user_union_members[ ]b4_user_union_members[
}; };
]b4_percent_define_get_syncline([[api.value.union.name]])[
typedef union ]b4_percent_define_get([[api.value.union.name]])[ ]b4_api_PREFIX[STYPE;
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1 # define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1 # define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
#endif #endif
@@ -762,7 +804,7 @@ m4_define([b4_yy_location_print_define],
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
__attribute__((__unused__)) YY_ATTRIBUTE_UNUSED
]b4_function_define([yy_location_print_], ]b4_function_define([yy_location_print_],
[static unsigned], [static unsigned],
[[FILE *yyo], [yyo]], [[FILE *yyo], [yyo]],
+116 -94
View File
@@ -2,7 +2,7 @@
# GLR skeleton for Bison # GLR skeleton for Bison
# Copyright (C) 2002-2013 Free Software Foundation, Inc. # Copyright (C) 2002-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -178,9 +178,42 @@ m4_if(b4_skeleton, ["glr.c"],
## Output files. ## ## Output files. ##
## -------------- ## ## -------------- ##
# Unfortunately the order of generation between the header and the
# implementation file matters (for glr.c) because of the current
# implementation of api.value.type=union. In that case we still use a
# union for YYSTYPE, but we generate the contents of this union when
# setting up YYSTYPE. This is needed for other aspects, such as
# defining yy_symbol_value_print, since we need to now the name of the
# members of this union.
#
# To avoid this issue, just generate the header before the
# implementation file. But we should also make them more independant.
# ----------------- #
# The header file. #
# ----------------- #
# glr.cc produces its own header.
m4_if(b4_skeleton, ["glr.c"],
[b4_defines_if(
[b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C],
[2002-2015])[
]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_shared_declarations[
]b4_cpp_guard_close([b4_spec_defines_file])[
]b4_output_end()
])])
# ------------------------- #
# The implementation file. #
# ------------------------- #
b4_output_begin([b4_parser_file_name]) b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison GLR parsers in C], b4_copyright([Skeleton implementation for Bison GLR parsers in C],
[2002-2013])[ [2002-2015])[
/* C GLR parser skeleton written by Paul Hilfinger. */ /* C GLR parser skeleton written by Paul Hilfinger. */
@@ -445,9 +478,9 @@ int yydebug;
struct yyGLRStack; struct yyGLRStack;
static void yypstack (struct yyGLRStack* yystackp, size_t yyk) static void yypstack (struct yyGLRStack* yystackp, size_t yyk)
__attribute__ ((__unused__)); YY_ATTRIBUTE_UNUSED;
static void yypdumpstack (struct yyGLRStack* yystackp) static void yypdumpstack (struct yyGLRStack* yystackp)
__attribute__ ((__unused__)); YY_ATTRIBUTE_UNUSED;
#else /* !]b4_api_PREFIX[DEBUG */ #else /* !]b4_api_PREFIX[DEBUG */
@@ -669,19 +702,15 @@ struct yyGLRStack {
static void yyexpandGLRStack (yyGLRStack* yystackp); static void yyexpandGLRStack (yyGLRStack* yystackp);
#endif #endif
static void yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg) static _Noreturn void
__attribute__ ((__noreturn__));
static void
yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg) yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
{ {
if (yymsg != YY_NULL) if (yymsg != YY_NULLPTR)
yyerror (]b4_yyerror_args[yymsg); yyerror (]b4_yyerror_args[yymsg);
YYLONGJMP (yystackp->yyexception_buffer, 1); YYLONGJMP (yystackp->yyexception_buffer, 1);
} }
static void yyMemoryExhausted (yyGLRStack* yystackp) static _Noreturn void
__attribute__ ((__noreturn__));
static void
yyMemoryExhausted (yyGLRStack* yystackp) yyMemoryExhausted (yyGLRStack* yystackp)
{ {
YYLONGJMP (yystackp->yyexception_buffer, 2); YYLONGJMP (yystackp->yyexception_buffer, 2);
@@ -702,7 +731,7 @@ yytokenName (yySymbol yytoken)
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
* containing the pointer to the next state in the chain. */ * containing the pointer to the next state in the chain. */
static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__)); static void yyfillin (yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED;
static void static void
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
{ {
@@ -719,7 +748,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
else else
/* The effect of using yysval or yyloc (in an immediate rule) is /* The effect of using yysval or yyloc (in an immediate rule) is
* undefined. */ * undefined. */
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL;]b4_locations_if([[ yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;]b4_locations_if([[
yyvsp[i].yystate.yyloc = s->yyloc;]])[ yyvsp[i].yystate.yyloc = s->yyloc;]])[
s = yyvsp[i].yystate.yypred = s->yypred; s = yyvsp[i].yystate.yypred = s->yypred;
} }
@@ -729,7 +758,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
* YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1. * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
* For convenience, always return YYLOW1. */ * For convenience, always return YYLOW1. */
static inline int yyfill (yyGLRStackItem *, int *, int, yybool) static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
__attribute__ ((__unused__)); YY_ATTRIBUTE_UNUSED;
static inline int static inline int
yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal) yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
{ {
@@ -751,8 +780,7 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
yyGLRStack* yystackp, yyGLRStack* yystackp,
YYSTYPE* yyvalp]b4_locuser_formals[) YYSTYPE* yyvalp]b4_locuser_formals[)
{ {
yybool yynormal __attribute__ ((__unused__)) = yybool yynormal YY_ATTRIBUTE_UNUSED = (yystackp->yysplitPoint == YY_NULLPTR);
(yystackp->yysplitPoint == YY_NULL);
int yylow; int yylow;
]b4_parse_param_use([yyvalp], [yylocp])dnl ]b4_parse_param_use([yyvalp], [yylocp])dnl
[ YYUSE (yyrhslen); [ YYUSE (yyrhslen);
@@ -836,12 +864,10 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
if (yydebug) if (yydebug)
{ {
if (yys->yysemantics.yyfirstVal) if (yys->yysemantics.yyfirstVal)
YYFPRINTF (stderr, "%s unresolved ", yymsg); YYFPRINTF (stderr, "%s unresolved", yymsg);
else else
YYFPRINTF (stderr, "%s incomplete ", yymsg); YYFPRINTF (stderr, "%s incomplete", yymsg);
yy_symbol_print (stderr, yystos[yys->yylrState], YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc);
YY_NULL]b4_locuser_args([&yys->yyloc])[);
YYFPRINTF (stderr, "\n");
} }
#endif #endif
@@ -917,14 +943,18 @@ yygetLRActions (yyStateNum yystate, int yytoken,
} }
} }
/** Compute post-reduction state.
* \param yystate the current state
* \param yysym the nonterminal to push on the stack
*/
static inline yyStateNum static inline yyStateNum
yyLRgotoState (yyStateNum yystate, yySymbol yylhs) yyLRgotoState (yyStateNum yystate, yySymbol yysym)
{ {
int yyr = yypgoto[yylhs - YYNTOKENS] + yystate; int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate) if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
return yytable[yyr]; return yytable[yyr];
else else
return yydefgoto[yylhs - YYNTOKENS]; return yydefgoto[yysym - YYNTOKENS];
} }
static inline yybool static inline yybool
@@ -966,6 +996,7 @@ yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
{ {
yySemanticOption* yynewOption = yySemanticOption* yynewOption =
&yynewGLRStackItem (yystackp, yyfalse)->yyoption; &yynewGLRStackItem (yystackp, yyfalse)->yyoption;
YYASSERT (!yynewOption->yyisState);
yynewOption->yystate = yyrhs; yynewOption->yystate = yyrhs;
yynewOption->yyrule = yyrule; yynewOption->yyrule = yyrule;
if (yystackp->yytops.yylookaheadNeeds[yyk]) if (yystackp->yytops.yylookaheadNeeds[yyk])
@@ -993,7 +1024,7 @@ yyinitStateSet (yyGLRStateSet* yyset)
yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]); yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
if (! yyset->yystates) if (! yyset->yystates)
return yyfalse; return yyfalse;
yyset->yystates[0] = YY_NULL; yyset->yystates[0] = YY_NULLPTR;
yyset->yylookaheadNeeds = yyset->yylookaheadNeeds =
(yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]); (yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]);
if (! yyset->yylookaheadNeeds) if (! yyset->yylookaheadNeeds)
@@ -1023,8 +1054,8 @@ yyinitGLRStack (yyGLRStack* yystackp, size_t yysize)
if (!yystackp->yyitems) if (!yystackp->yyitems)
return yyfalse; return yyfalse;
yystackp->yynextFree = yystackp->yyitems; yystackp->yynextFree = yystackp->yyitems;
yystackp->yysplitPoint = YY_NULL; yystackp->yysplitPoint = YY_NULLPTR;
yystackp->yylastDeleted = YY_NULL; yystackp->yylastDeleted = YY_NULLPTR;
return yyinitStateSet (&yystackp->yytops); return yyinitStateSet (&yystackp->yytops);
} }
@@ -1063,10 +1094,10 @@ yyexpandGLRStack (yyGLRStack* yystackp)
{ {
yyGLRState* yys0 = &yyp0->yystate; yyGLRState* yys0 = &yyp0->yystate;
yyGLRState* yys1 = &yyp1->yystate; yyGLRState* yys1 = &yyp1->yystate;
if (yys0->yypred != YY_NULL) if (yys0->yypred != YY_NULLPTR)
yys1->yypred = yys1->yypred =
YYRELOC (yyp0, yyp1, yys0->yypred, yystate); YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULL) if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULLPTR)
yys1->yysemantics.yyfirstVal = yys1->yysemantics.yyfirstVal =
YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption); YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
} }
@@ -1074,18 +1105,18 @@ yyexpandGLRStack (yyGLRStack* yystackp)
{ {
yySemanticOption* yyv0 = &yyp0->yyoption; yySemanticOption* yyv0 = &yyp0->yyoption;
yySemanticOption* yyv1 = &yyp1->yyoption; yySemanticOption* yyv1 = &yyp1->yyoption;
if (yyv0->yystate != YY_NULL) if (yyv0->yystate != YY_NULLPTR)
yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate); yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
if (yyv0->yynext != YY_NULL) if (yyv0->yynext != YY_NULLPTR)
yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption); yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
} }
} }
if (yystackp->yysplitPoint != YY_NULL) if (yystackp->yysplitPoint != YY_NULLPTR)
yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems, yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
yystackp->yysplitPoint, yystate); yystackp->yysplitPoint, yystate);
for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1) for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
if (yystackp->yytops.yystates[yyn] != YY_NULL) if (yystackp->yytops.yystates[yyn] != YY_NULLPTR)
yystackp->yytops.yystates[yyn] = yystackp->yytops.yystates[yyn] =
YYRELOC (yystackp->yyitems, yynewItems, YYRELOC (yystackp->yyitems, yynewItems,
yystackp->yytops.yystates[yyn], yystate); yystackp->yytops.yystates[yyn], yystate);
@@ -1109,7 +1140,7 @@ yyfreeGLRStack (yyGLRStack* yystackp)
static inline void static inline void
yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys) yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
{ {
if (yystackp->yysplitPoint != YY_NULL && yystackp->yysplitPoint > yys) if (yystackp->yysplitPoint != YY_NULLPTR && yystackp->yysplitPoint > yys)
yystackp->yysplitPoint = yys; yystackp->yysplitPoint = yys;
} }
@@ -1117,9 +1148,9 @@ yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
static inline void static inline void
yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk) yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
{ {
if (yystackp->yytops.yystates[yyk] != YY_NULL) if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
yystackp->yylastDeleted = yystackp->yytops.yystates[yyk]; yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
yystackp->yytops.yystates[yyk] = YY_NULL; yystackp->yytops.yystates[yyk] = YY_NULLPTR;
} }
/** Undelete the last stack in *YYSTACKP that was marked as deleted. Can /** Undelete the last stack in *YYSTACKP that was marked as deleted. Can
@@ -1128,12 +1159,12 @@ yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
static void static void
yyundeleteLastStack (yyGLRStack* yystackp) yyundeleteLastStack (yyGLRStack* yystackp)
{ {
if (yystackp->yylastDeleted == YY_NULL || yystackp->yytops.yysize != 0) if (yystackp->yylastDeleted == YY_NULLPTR || yystackp->yytops.yysize != 0)
return; return;
yystackp->yytops.yystates[0] = yystackp->yylastDeleted; yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
yystackp->yytops.yysize = 1; yystackp->yytops.yysize = 1;
YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n")); YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
yystackp->yylastDeleted = YY_NULL; yystackp->yylastDeleted = YY_NULLPTR;
} }
static inline void static inline void
@@ -1143,7 +1174,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
yyi = yyj = 0; yyi = yyj = 0;
while (yyj < yystackp->yytops.yysize) while (yyj < yystackp->yytops.yysize)
{ {
if (yystackp->yytops.yystates[yyi] == YY_NULL) if (yystackp->yytops.yystates[yyi] == YY_NULLPTR)
{ {
if (yyi == yyj) if (yyi == yyj)
{ {
@@ -1201,12 +1232,13 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule) size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
{ {
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate; yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
YYASSERT (yynewState->yyisState);
yynewState->yylrState = yylrState; yynewState->yylrState = yylrState;
yynewState->yyposn = yyposn; yynewState->yyposn = yyposn;
yynewState->yyresolved = yyfalse; yynewState->yyresolved = yyfalse;
yynewState->yypred = yystackp->yytops.yystates[yyk]; yynewState->yypred = yystackp->yytops.yystates[yyk];
yynewState->yysemantics.yyfirstVal = YY_NULL; yynewState->yysemantics.yyfirstVal = YY_NULLPTR;
yystackp->yytops.yystates[yyk] = yynewState; yystackp->yytops.yystates[yyk] = yynewState;
/* Invokes YY_RESERVE_GLRSTACK. */ /* Invokes YY_RESERVE_GLRSTACK. */
@@ -1266,7 +1298,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
{ {
int yynrhs = yyrhsLength (yyrule); int yynrhs = yyrhsLength (yyrule);
if (yystackp->yysplitPoint == YY_NULL) if (yystackp->yysplitPoint == YY_NULLPTR)
{ {
/* Standard special case: single stack. */ /* Standard special case: single stack. */
yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk]; yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
@@ -1318,14 +1350,13 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
{ {
size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn; size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn;
if (yyforceEval || yystackp->yysplitPoint == YY_NULL) if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
{ {
YYRESULTTAG yyflag; YYSTYPE yysval;]b4_locations_if([[
YYSTYPE yysval;]b4_locations_if([ YYLTYPE yyloc;]])[
YYLTYPE yyloc;])[
yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[); YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULL) if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
{ {
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n", YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
(unsigned long int) yyk, yyrule - 1)); (unsigned long int) yyk, yyrule - 1));
@@ -1358,7 +1389,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
"Now in state %d.\n", "Now in state %d.\n",
(unsigned long int) yyk, yyrule - 1, yynewLRState)); (unsigned long int) yyk, yyrule - 1, yynewLRState));
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULL) if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
{ {
yyGLRState *yysplit = yystackp->yysplitPoint; yyGLRState *yysplit = yystackp->yysplitPoint;
yyGLRState *yyp = yystackp->yytops.yystates[yyi]; yyGLRState *yyp = yystackp->yytops.yystates[yyi];
@@ -1385,7 +1416,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
static size_t static size_t
yysplitStack (yyGLRStack* yystackp, size_t yyk) yysplitStack (yyGLRStack* yystackp, size_t yyk)
{ {
if (yystackp->yysplitPoint == YY_NULL) if (yystackp->yysplitPoint == YY_NULLPTR)
{ {
YYASSERT (yyk == 0); YYASSERT (yyk == 0);
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk]; yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
@@ -1395,7 +1426,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
yyGLRState** yynewStates; yyGLRState** yynewStates;
yybool* yynewLookaheadNeeds; yybool* yynewLookaheadNeeds;
yynewStates = YY_NULL; yynewStates = YY_NULLPTR;
if (yystackp->yytops.yycapacity if (yystackp->yytops.yycapacity
> (YYSIZEMAX / (2 * sizeof yynewStates[0]))) > (YYSIZEMAX / (2 * sizeof yynewStates[0])))
@@ -1406,7 +1437,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
(yyGLRState**) YYREALLOC (yystackp->yytops.yystates, (yyGLRState**) YYREALLOC (yystackp->yytops.yystates,
(yystackp->yytops.yycapacity (yystackp->yytops.yycapacity
* sizeof yynewStates[0])); * sizeof yynewStates[0]));
if (yynewStates == YY_NULL) if (yynewStates == YY_NULLPTR)
yyMemoryExhausted (yystackp); yyMemoryExhausted (yystackp);
yystackp->yytops.yystates = yynewStates; yystackp->yytops.yystates = yynewStates;
@@ -1414,7 +1445,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
(yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds, (yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds,
(yystackp->yytops.yycapacity (yystackp->yytops.yycapacity
* sizeof yynewLookaheadNeeds[0])); * sizeof yynewLookaheadNeeds[0]));
if (yynewLookaheadNeeds == YY_NULL) if (yynewLookaheadNeeds == YY_NULLPTR)
yyMemoryExhausted (yystackp); yyMemoryExhausted (yystackp);
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds; yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
} }
@@ -1478,9 +1509,9 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal; yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
while (yytrue) while (yytrue)
{ {
if (yyz1 == *yyz0p || yyz1 == YY_NULL) if (yyz1 == *yyz0p || yyz1 == YY_NULLPTR)
break; break;
else if (*yyz0p == YY_NULL) else if (*yyz0p == YY_NULLPTR)
{ {
*yyz0p = yyz1; *yyz0p = yyz1;
break; break;
@@ -1601,7 +1632,7 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred) for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
yystates[yyi] = yys; yystates[yyi] = yys;
if (yys == YY_NULL) if (yys == YY_NULLPTR)
{ {
yyleftmost_state.yyposn = 0; yyleftmost_state.yyposn = 0;
yystates[0] = &yyleftmost_state; yystates[0] = &yyleftmost_state;
@@ -1672,7 +1703,7 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
yyGLRStackItem yyrhsloc[1 + YYMAXRHS]; yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
int yynrhs; int yynrhs;
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal; yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
YYASSERT (yyoption != YY_NULL); YYASSERT (yyoption != YY_NULLPTR);
yynrhs = yyrhsLength (yyoption->yyrule); yynrhs = yyrhsLength (yyoption->yyrule);
if (yynrhs > 0) if (yynrhs > 0)
{ {
@@ -1731,7 +1762,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
YYRESULTTAG yyflag;]b4_locations_if([ YYRESULTTAG yyflag;]b4_locations_if([
YYLTYPE *yylocp = &yys->yyloc;])[ YYLTYPE *yylocp = &yys->yyloc;])[
for (yypp = &yyoptionList->yynext; *yypp != YY_NULL; ) for (yypp = &yyoptionList->yynext; *yypp != YY_NULLPTR; )
{ {
yySemanticOption* yyp = *yypp; yySemanticOption* yyp = *yypp;
@@ -1773,7 +1804,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
int yyprec = yydprec[yybest->yyrule]; int yyprec = yydprec[yybest->yyrule];
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[); yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[);
if (yyflag == yyok) if (yyflag == yyok)
for (yyp = yybest->yynext; yyp != YY_NULL; yyp = yyp->yynext) for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext)
{ {
if (yyprec == yydprec[yyp->yyrule]) if (yyprec == yydprec[yyp->yyrule])
{ {
@@ -1800,14 +1831,14 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
yys->yysemantics.yysval = yysval; yys->yysemantics.yysval = yysval;
} }
else else
yys->yysemantics.yyfirstVal = YY_NULL; yys->yysemantics.yyfirstVal = YY_NULLPTR;
return yyflag; return yyflag;
} }
static YYRESULTTAG static YYRESULTTAG
yyresolveStack (yyGLRStack* yystackp]b4_user_formals[) yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
{ {
if (yystackp->yysplitPoint != YY_NULL) if (yystackp->yysplitPoint != YY_NULLPTR)
{ {
yyGLRState* yys; yyGLRState* yys;
int yyn; int yyn;
@@ -1827,10 +1858,10 @@ yycompressStack (yyGLRStack* yystackp)
{ {
yyGLRState* yyp, *yyq, *yyr; yyGLRState* yyp, *yyq, *yyr;
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULL) if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
return; return;
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULL; for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
yyp != yystackp->yysplitPoint; yyp != yystackp->yysplitPoint;
yyr = yyp, yyp = yyq, yyq = yyp->yypred) yyr = yyp, yyp = yyq, yyq = yyp->yypred)
yyp->yypred = yyr; yyp->yypred = yyr;
@@ -1838,10 +1869,10 @@ yycompressStack (yyGLRStack* yystackp)
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems; yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1; yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1;
yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems; yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
yystackp->yysplitPoint = YY_NULL; yystackp->yysplitPoint = YY_NULLPTR;
yystackp->yylastDeleted = YY_NULL; yystackp->yylastDeleted = YY_NULLPTR;
while (yyr != YY_NULL) while (yyr != YY_NULLPTR)
{ {
yystackp->yynextFree->yystate = *yyr; yystackp->yynextFree->yystate = *yyr;
yyr = yyr->yypred; yyr = yyr->yypred;
@@ -1856,7 +1887,7 @@ static YYRESULTTAG
yyprocessOneStack (yyGLRStack* yystackp, size_t yyk, yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
size_t yyposn]b4_pure_formals[) size_t yyposn]b4_pure_formals[)
{ {
while (yystackp->yytops.yystates[yyk] != YY_NULL) while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
{ {
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState; yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
YYDPRINTF ((stderr, "Stack %lu Entering state %d\n", YYDPRINTF ((stderr, "Stack %lu Entering state %d\n",
@@ -1978,13 +2009,13 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
#else #else
{ {
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
size_t yysize0 = yytnamerr (YY_NULL, yytokenName (yytoken)); size_t yysize0 = yytnamerr (YY_NULLPTR, yytokenName (yytoken));
size_t yysize = yysize0; size_t yysize = yysize0;
yybool yysize_overflow = yyfalse; yybool yysize_overflow = yyfalse;
char* yymsg = YY_NULL; char* yymsg = YY_NULLPTR;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */ /* Internationalized format string. */
const char *yyformat = YY_NULL; const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */ /* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per /* Number of reported tokens (one for the "unexpected", one per
@@ -2040,7 +2071,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
} }
yyarg[yycount++] = yytokenName (yyx); yyarg[yycount++] = yytokenName (yyx);
{ {
size_t yysz = yysize + yytnamerr (YY_NULL, yytokenName (yyx)); size_t yysz = yysize + yytnamerr (YY_NULLPTR, yytokenName (yyx));
yysize_overflow |= yysz < yysize; yysize_overflow |= yysz < yysize;
yysize = yysz; yysize = yysz;
} }
@@ -2118,7 +2149,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
{ {
yySymbol yytoken; yySymbol yytoken;
if (yychar == YYEOF) if (yychar == YYEOF)
yyFail (yystackp][]b4_lpure_args[, YY_NULL); yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
if (yychar != YYEMPTY) if (yychar != YYEMPTY)
{]b4_locations_if([[ {]b4_locations_if([[
/* We throw away the lookahead, but the error range /* We throw away the lookahead, but the error range
@@ -2159,10 +2190,10 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
/* Reduce to one stack. */ /* Reduce to one stack. */
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1) for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
if (yystackp->yytops.yystates[yyk] != YY_NULL) if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
break; break;
if (yyk >= yystackp->yytops.yysize) if (yyk >= yystackp->yytops.yysize)
yyFail (yystackp][]b4_lpure_args[, YY_NULL); yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1) for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
yymarkStackDeleted (yystackp, yyk); yymarkStackDeleted (yystackp, yyk);
yyremoveDeletes (yystackp); yyremoveDeletes (yystackp);
@@ -2170,7 +2201,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
/* Now pop stack until we find a state that shifts the error token. */ /* Now pop stack until we find a state that shifts the error token. */
yystackp->yyerrState = 3; yystackp->yyerrState = 3;
while (yystackp->yytops.yystates[0] != YY_NULL) while (yystackp->yytops.yystates[0] != YY_NULLPTR)
{ {
yyGLRState *yys = yystackp->yytops.yystates[0]; yyGLRState *yys = yystackp->yytops.yystates[0];
yyj = yypact[yys->yylrState]; yyj = yypact[yys->yylrState];
@@ -2194,14 +2225,14 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
} }
}]b4_locations_if([[ }]b4_locations_if([[
yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[ yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
if (yys->yypred != YY_NULL) if (yys->yypred != YY_NULLPTR)
yydestroyGLRState ("Error: popping", yys]b4_user_args[); yydestroyGLRState ("Error: popping", yys]b4_user_args[);
yystackp->yytops.yystates[0] = yys->yypred; yystackp->yytops.yystates[0] = yys->yypred;
yystackp->yynextFree -= 1; yystackp->yynextFree -= 1;
yystackp->yyspaceLeft += 1; yystackp->yyspaceLeft += 1;
} }
if (yystackp->yytops.yystates[0] == YY_NULL) if (yystackp->yytops.yystates[0] == YY_NULLPTR)
yyFail (yystackp][]b4_lpure_args[, YY_NULL); yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
} }
#define YYCHK1(YYE) \ #define YYCHK1(YYE) \
@@ -2444,7 +2475,7 @@ b4_dollar_popdef])[]dnl
{ {
yyGLRState *yys = yystates[yyk]; yyGLRState *yys = yystates[yyk];
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]] ]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
)[ if (yys->yypred != YY_NULL) )[ if (yys->yypred != YY_NULLPTR)
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[); yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
yystates[yyk] = yys->yypred; yystates[yyk] = yys->yypred;
yystack.yynextFree -= 1; yystack.yynextFree -= 1;
@@ -2476,7 +2507,7 @@ yy_yypstack (yyGLRState* yys)
static void static void
yypstates (yyGLRState* yyst) yypstates (yyGLRState* yyst)
{ {
if (yyst == YY_NULL) if (yyst == YY_NULLPTR)
YYFPRINTF (stderr, "<null>"); YYFPRINTF (stderr, "<null>");
else else
yy_yypstack (yyst); yy_yypstack (yyst);
@@ -2490,7 +2521,7 @@ yypstack (yyGLRStack* yystackp, size_t yyk)
} }
#define YYINDEX(YYX) \ #define YYINDEX(YYX) \
((YYX) == YY_NULL ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems) ((YYX) == YY_NULLPTR ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems)
static void static void
@@ -2504,6 +2535,8 @@ yypdumpstack (yyGLRStack* yystackp)
(unsigned long int) (yyp - yystackp->yyitems)); (unsigned long int) (yyp - yystackp->yyitems));
if (*(yybool *) yyp) if (*(yybool *) yyp)
{ {
YYASSERT (yyp->yystate.yyisState);
YYASSERT (yyp->yyoption.yyisState);
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld", YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
yyp->yystate.yyresolved, yyp->yystate.yylrState, yyp->yystate.yyresolved, yyp->yystate.yylrState,
(unsigned long int) yyp->yystate.yyposn, (unsigned long int) yyp->yystate.yyposn,
@@ -2515,6 +2548,8 @@ yypdumpstack (yyGLRStack* yystackp)
} }
else else
{ {
YYASSERT (!yyp->yystate.yyisState);
YYASSERT (!yyp->yyoption.yyisState);
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld", YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
yyp->yyoption.yyrule - 1, yyp->yyoption.yyrule - 1,
(long int) YYINDEX (yyp->yyoption.yystate), (long int) YYINDEX (yyp->yyoption.yystate),
@@ -2548,16 +2583,3 @@ m4_if(b4_prefix, [yy], [],
]b4_epilogue[]dnl ]b4_epilogue[]dnl
b4_output_end() b4_output_end()
# glr.cc produces its own header.
m4_if(b4_skeleton, ["glr.c"],
[b4_defines_if(
[b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C],
[2002-2013])[
]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_shared_declarations[
]b4_cpp_guard_close([b4_spec_defines_file])[
]b4_output_end()
])])
+2 -2
View File
@@ -1,6 +1,6 @@
# C++ GLR skeleton for Bison # C++ GLR skeleton for Bison
# Copyright (C) 2002-2013 Free Software Foundation, Inc. # Copyright (C) 2002-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -329,7 +329,7 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
b4_defines_if( b4_defines_if(
[b4_output_begin([b4_spec_defines_file]) [b4_output_begin([b4_spec_defines_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C++], b4_copyright([Skeleton interface for Bison GLR parsers in C++],
[2002-2013])[ [2002-2015])[
// C++ GLR parser skeleton written by Akim Demaille. // C++ GLR parser skeleton written by Akim Demaille.
+1 -1
View File
@@ -2,7 +2,7 @@
# Java skeleton dispatching for Bison. # Java skeleton dispatching for Bison.
# Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. # Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Java language support for Bison # Java language support for Bison
# Copyright (C) 2007-2013 Free Software Foundation, Inc. # Copyright (C) 2007-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+98 -95
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2013 Free Software Foundation, Inc. # Copyright (C) 2002-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -131,7 +131,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[2002-2013]) [2002-2015])
m4_define([b4_parser_class_name], m4_define([b4_parser_class_name],
[b4_percent_define_get([[parser_class_name]])]) [b4_percent_define_get([[parser_class_name]])])
@@ -157,6 +157,7 @@ m4_define([b4_shared_declarations],
]b4_bison_locations_if([[# include "location.hh"]])])[ ]b4_bison_locations_if([[# include "location.hh"]])])[
]b4_variant_if([b4_variant_includes])[ ]b4_variant_if([b4_variant_includes])[
]b4_attribute_define[
]b4_YYDEBUG_define[ ]b4_YYDEBUG_define[
]b4_namespace_open[ ]b4_namespace_open[
@@ -183,14 +184,14 @@ b4_location_define])])[
#if ]b4_api_PREFIX[DEBUG #if ]b4_api_PREFIX[DEBUG
/// The current debugging stream. /// The current debugging stream.
std::ostream& debug_stream () const; std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
/// Set the current debugging stream. /// Set the current debugging stream.
void set_debug_stream (std::ostream &); void set_debug_stream (std::ostream &);
/// Type for debugging levels. /// Type for debugging levels.
typedef int debug_level_type; typedef int debug_level_type;
/// The current debugging level. /// The current debugging level.
debug_level_type debug_level () const; debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
/// Set the current debugging level. /// Set the current debugging level.
void set_debug_level (debug_level_type l); void set_debug_level (debug_level_type l);
#endif #endif
@@ -213,14 +214,14 @@ b4_location_define])])[
/// Generate an error message. /// Generate an error message.
/// \param yystate the state where the error occurred. /// \param yystate the state where the error occurred.
/// \param yytoken the lookahead token type, or yyempty_. /// \param yyla the lookahead token.
virtual std::string yysyntax_error_ (state_type yystate, virtual std::string yysyntax_error_ (state_type yystate,
symbol_number_type yytoken) const; const symbol_type& yyla) const;
/// Compute post-reduction state. /// Compute post-reduction state.
/// \param yystate the current state /// \param yystate the current state
/// \param yylhs the nonterminal to push on the stack /// \param yysym the nonterminal to push on the stack
state_type yy_lr_goto_state_ (state_type yystate, int yylhs); state_type yy_lr_goto_state_ (state_type yystate, int yysym);
/// Whether the given \c yypact_ value indicates a defaulted state. /// Whether the given \c yypact_ value indicates a defaulted state.
/// \param yyvalue the value to check /// \param yyvalue the value to check
@@ -267,7 +268,7 @@ b4_location_define])])[
/// \brief Reclaim the memory associated to a symbol. /// \brief Reclaim the memory associated to a symbol.
/// \param yymsg Why this token is reclaimed. /// \param yymsg Why this token is reclaimed.
/// If null, print nothing. /// If null, print nothing.
/// \param s The symbol. /// \param yysym The symbol.
template <typename Base> template <typename Base>
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const; void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
@@ -287,16 +288,21 @@ b4_location_define])])[
/// Copy constructor. /// Copy constructor.
by_state (const by_state& other); by_state (const by_state& other);
/// Record that this symbol is empty.
void clear ();
/// Steal the symbol type from \a that. /// Steal the symbol type from \a that.
void move (by_state& that); void move (by_state& that);
/// The (internal) type number (corresponding to \a state). /// The (internal) type number (corresponding to \a state).
/// "empty" when empty. /// \a empty_symbol when empty.
symbol_number_type type_get () const; symbol_number_type type_get () const;
enum { empty = 0 }; /// The state number used to denote an empty symbol.
enum { empty_state = -1 };
/// The state. /// The state.
/// \a empty when empty.
state_type state; state_type state;
}; };
@@ -337,17 +343,16 @@ b4_location_define])])[
/// Pop \a n symbols the three stacks. /// Pop \a n symbols the three stacks.
void yypop_ (unsigned int n = 1); void yypop_ (unsigned int n = 1);
// Constants. /// Constants.
enum enum
{ {
yyeof_ = 0, yyeof_ = 0,
yylast_ = ]b4_last[, //< Last index in yytable_. yylast_ = ]b4_last[, ///< Last index in yytable_.
yynnts_ = ]b4_nterms_number[, //< Number of nonterminal symbols. yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols.
yyempty_ = -2, yyfinal_ = ]b4_final_state_number[, ///< Termination state number.
yyfinal_ = ]b4_final_state_number[, //< Termination state number.
yyterror_ = 1, yyterror_ = 1,
yyerrcode_ = 256, yyerrcode_ = 256,
yyntokens_ = ]b4_tokens_number[ //< Number of tokens. yyntokens_ = ]b4_tokens_number[ ///< Number of tokens.
}; };
]b4_parse_param_vars[ ]b4_parse_param_vars[
@@ -463,7 +468,7 @@ m4_if(b4_prefix, [yy], [],
#endif // !]b4_api_PREFIX[DEBUG #endif // !]b4_api_PREFIX[DEBUG
#define yyerrok (yyerrstatus_ = 0) #define yyerrok (yyerrstatus_ = 0)
#define yyclearin (yyempty = true) #define yyclearin (yyla.clear ())
#define YYACCEPT goto yyacceptlab #define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab #define YYABORT goto yyabortlab
@@ -532,7 +537,7 @@ m4_if(b4_prefix, [yy], [],
// by_state. // by_state.
inline inline
]b4_parser_class_name[::by_state::by_state () ]b4_parser_class_name[::by_state::by_state ()
: state (empty) : state (empty_state)
{} {}
inline inline
@@ -540,12 +545,19 @@ m4_if(b4_prefix, [yy], [],
: state (other.state) : state (other.state)
{} {}
inline
void
]b4_parser_class_name[::by_state::clear ()
{
state = empty_state;
}
inline inline
void void
]b4_parser_class_name[::by_state::move (by_state& that) ]b4_parser_class_name[::by_state::move (by_state& that)
{ {
state = that.state; state = that.state;
that.state = empty; that.clear ();
} }
inline inline
@@ -557,7 +569,7 @@ m4_if(b4_prefix, [yy], [],
]b4_parser_class_name[::symbol_number_type ]b4_parser_class_name[::symbol_number_type
]b4_parser_class_name[::by_state::type_get () const ]b4_parser_class_name[::by_state::type_get () const
{ {
return state == empty ? 0 : yystos_[state]; return state == empty_state ? empty_symbol : yystos_[state];
} }
inline inline
@@ -573,7 +585,7 @@ m4_if(b4_prefix, [yy], [],
[value], [move], [that.value])], [value], [move], [that.value])],
[[value = that.value;]])[ [[value = that.value;]])[
// that is emptied. // that is emptied.
that.type = empty; that.type = empty_symbol;
} }
inline inline
@@ -670,13 +682,13 @@ m4_if(b4_prefix, [yy], [],
#endif // ]b4_api_PREFIX[DEBUG #endif // ]b4_api_PREFIX[DEBUG
inline ]b4_parser_class_name[::state_type inline ]b4_parser_class_name[::state_type
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yylhs) ]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym)
{ {
int yyr = yypgoto_[yylhs - yyntokens_] + yystate; int yyr = yypgoto_[yysym - yyntokens_] + yystate;
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
return yytable_[yyr]; return yytable_[yyr];
else else
return yydefgoto_[yylhs - yyntokens_]; return yydefgoto_[yysym - yyntokens_];
} }
inline bool inline bool
@@ -694,11 +706,9 @@ m4_if(b4_prefix, [yy], [],
int int
]b4_parser_class_name[::parse () ]b4_parser_class_name[::parse ()
{ {
/// Whether yyla contains a lookahead.
bool yyempty = true;
// State. // State.
int yyn; int yyn;
/// Length of the RHS of the rule being reduced.
int yylen = 0; int yylen = 0;
// Error handling. // Error handling.
@@ -711,9 +721,6 @@ m4_if(b4_prefix, [yy], [],
/// The locations where the error started and ended. /// The locations where the error started and ended.
stack_symbol_type yyerror_range[3];]])[ stack_symbol_type yyerror_range[3];]])[
/// $$ and @@$.
stack_symbol_type yylhs;
/// The return value of parse (). /// The return value of parse ().
int yyresult; int yyresult;
@@ -734,7 +741,7 @@ b4_dollar_popdef])[]dnl
location values to have been already stored, initialize these location values to have been already stored, initialize these
stacks with a primary value. */ stacks with a primary value. */
yystack_.clear (); yystack_.clear ();
yypush_ (YY_NULL, 0, yyla); yypush_ (YY_NULLPTR, 0, yyla);
// A new symbol was pushed on the stack. // A new symbol was pushed on the stack.
yynewstate: yynewstate:
@@ -755,7 +762,7 @@ b4_dollar_popdef])[]dnl
goto yydefault; goto yydefault;
// Read a lookahead token. // Read a lookahead token.
if (yyempty) if (yyla.empty ())
{ {
YYCDEBUG << "Reading a token: "; YYCDEBUG << "Reading a token: ";
try try
@@ -769,7 +776,6 @@ b4_dollar_popdef])[]dnl
error (yyexc); error (yyexc);
goto yyerrlab1; goto yyerrlab1;
} }
yyempty = false;
} }
YY_SYMBOL_PRINT ("Next token is", yyla); YY_SYMBOL_PRINT ("Next token is", yyla);
@@ -789,9 +795,6 @@ b4_dollar_popdef])[]dnl
goto yyreduce; goto yyreduce;
} }
// Discard the token being shifted.
yyempty = true;
// Count tokens shifted since error; after three, turn off error status. // Count tokens shifted since error; after three, turn off error status.
if (yyerrstatus_) if (yyerrstatus_)
--yyerrstatus_; --yyerrstatus_;
@@ -814,52 +817,55 @@ b4_dollar_popdef])[]dnl
`-----------------------------*/ `-----------------------------*/
yyreduce: yyreduce:
yylen = yyr2_[yyn]; yylen = yyr2_[yyn];
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([ {
/* Variants are always initialized to an empty instance of the stack_symbol_type yylhs;
correct type. The default $$=$1 action is NOT applied when using yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
variants. */ /* Variants are always initialized to an empty instance of the
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])],[ correct type. The default '$$ = $1' action is NOT applied
/* If YYLEN is nonzero, implement the default value of the action: when using variants. */
'$$ = $1'. Otherwise, use the top of the stack. b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])], [
/* If YYLEN is nonzero, implement the default value of the
action: '$$ = $1'. Otherwise, use the top of the stack.
Otherwise, the following line sets YYLHS.VALUE to garbage. Otherwise, the following line sets YYLHS.VALUE to garbage.
This behavior is undocumented and Bison This behavior is undocumented and Bison users should not rely
users should not rely upon it. */ upon it. */
if (yylen) if (yylen)
yylhs.value = yystack_@{yylen - 1@}.value; yylhs.value = yystack_@{yylen - 1@}.value;
else else
yylhs.value = yystack_@{0@}.value;])[ yylhs.value = yystack_@{0@}.value;])[
]b4_locations_if([dnl ]b4_locations_if([dnl
[ [
// Compute the default @@$. // Compute the default @@$.
{
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
}]])[
// Perform the reduction.
YY_REDUCE_PRINT (yyn);
try
{ {
switch (yyn) slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
{ YYLLOC_DEFAULT (yylhs.location, slice, yylen);
}]])[
// Perform the reduction.
YY_REDUCE_PRINT (yyn);
try
{
switch (yyn)
{
]b4_user_actions[ ]b4_user_actions[
default: default:
break; break;
} }
} }
catch (const syntax_error& yyexc) catch (const syntax_error& yyexc)
{ {
error (yyexc); error (yyexc);
YYERROR; YYERROR;
} }
YY_SYMBOL_PRINT ("-> $$ =", yylhs); YY_SYMBOL_PRINT ("-> $$ =", yylhs);
yypop_ (yylen); yypop_ (yylen);
yylen = 0; yylen = 0;
YY_STACK_PRINT (); YY_STACK_PRINT ();
// Shift the result of the reduction. // Shift the result of the reduction.
yypush_ (YY_NULL, yylhs); yypush_ (YY_NULLPTR, yylhs);
}
goto yynewstate; goto yynewstate;
/*--------------------------------------. /*--------------------------------------.
@@ -871,8 +877,7 @@ b4_dollar_popdef])[]dnl
{ {
++yynerrs_; ++yynerrs_;
error (]b4_join(b4_locations_if([yyla.location]), error (]b4_join(b4_locations_if([yyla.location]),
[[yysyntax_error_ (yystack_[0].state, [[yysyntax_error_ (yystack_[0].state, yyla)]])[);
yyempty ? yyempty_ : yyla.type_get ())]])[);
} }
]b4_locations_if([[ ]b4_locations_if([[
@@ -885,10 +890,10 @@ b4_dollar_popdef])[]dnl
// Return failure if at end of input. // Return failure if at end of input.
if (yyla.type_get () == yyeof_) if (yyla.type_get () == yyeof_)
YYABORT; YYABORT;
else if (!yyempty) else if (!yyla.empty ())
{ {
yy_destroy_ ("Error: discarding", yyla); yy_destroy_ ("Error: discarding", yyla);
yyempty = true; yyla.clear ();
} }
} }
@@ -906,10 +911,7 @@ b4_dollar_popdef])[]dnl
code. */ code. */
if (false) if (false)
goto yyerrorlab;]b4_locations_if([[ goto yyerrorlab;]b4_locations_if([[
yyerror_range[1].location = yystack_[yylen - 1].location;]])b4_variant_if([[ yyerror_range[1].location = yystack_[yylen - 1].location;]])[
/* $$ was initialized before running the user action. */
YY_SYMBOL_PRINT ("Error: discarding", yylhs);
yylhs.~stack_symbol_type();]])[
/* Do not reclaim the symbols of the rule whose action triggered /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */ this YYERROR. */
yypop_ (yylen); yypop_ (yylen);
@@ -967,7 +969,7 @@ b4_dollar_popdef])[]dnl
goto yyreturn; goto yyreturn;
yyreturn: yyreturn:
if (!yyempty) if (!yyla.empty ())
yy_destroy_ ("Cleanup: discarding lookahead", yyla); yy_destroy_ ("Cleanup: discarding lookahead", yyla);
/* Do not reclaim the symbols of the rule whose action triggered /* Do not reclaim the symbols of the rule whose action triggered
@@ -987,12 +989,12 @@ b4_dollar_popdef])[]dnl
<< std::endl; << std::endl;
// Do not try to display the values of the reclaimed symbols, // Do not try to display the values of the reclaimed symbols,
// as their printer might throw an exception. // as their printer might throw an exception.
if (!yyempty) if (!yyla.empty ())
yy_destroy_ (YY_NULL, yyla); yy_destroy_ (YY_NULLPTR, yyla);
while (1 < yystack_.size ()) while (1 < yystack_.size ())
{ {
yy_destroy_ (YY_NULL, yystack_[0]); yy_destroy_ (YY_NULLPTR, yystack_[0]);
yypop_ (); yypop_ ();
} }
throw; throw;
@@ -1009,10 +1011,9 @@ b4_dollar_popdef])[]dnl
// Generate an error message. // Generate an error message.
std::string std::string
]b4_parser_class_name[::yysyntax_error_ (]dnl ]b4_parser_class_name[::yysyntax_error_ (]dnl
b4_error_verbose_if([state_type yystate, symbol_number_type yytoken], b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
[state_type, symbol_number_type])[) const [state_type, const symbol_type&])[) const
{]b4_error_verbose_if([[ {]b4_error_verbose_if([[
std::string yyres;
// Number of reported tokens (one for the "unexpected", one per // Number of reported tokens (one for the "unexpected", one per
// "expected"). // "expected").
size_t yycount = 0; size_t yycount = 0;
@@ -1026,7 +1027,7 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
the only way this function was invoked is if the default action the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected is an error action. In that case, don't check for expected
tokens because there are none. tokens because there are none.
- The only way there can be no lookahead present (in yytoken) is - The only way there can be no lookahead present (in yyla) is
if this state is a consistent state with a default action. if this state is a consistent state with a default action.
Thus, detecting the absence of a lookahead is sufficient to Thus, detecting the absence of a lookahead is sufficient to
determine that there is no unexpected or expected token to determine that there is no unexpected or expected token to
@@ -1046,8 +1047,9 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
token that will not be accepted due to an error action in a token that will not be accepted due to an error action in a
later state. later state.
*/ */
if (yytoken != yyempty_) if (!yyla.empty ())
{ {
int yytoken = yyla.type_get ();
yyarg[yycount++] = yytname_[yytoken]; yyarg[yycount++] = yytname_[yytoken];
int yyn = yypact_[yystate]; int yyn = yypact_[yystate];
if (!yy_pact_value_is_default_ (yyn)) if (!yy_pact_value_is_default_ (yyn))
@@ -1074,7 +1076,7 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
} }
} }
char const* yyformat = YY_NULL; char const* yyformat = YY_NULLPTR;
switch (yycount) switch (yycount)
{ {
#define YYCASE_(N, S) \ #define YYCASE_(N, S) \
@@ -1090,6 +1092,7 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
#undef YYCASE_ #undef YYCASE_
} }
std::string yyres;
// Argument number. // Argument number.
size_t yyi = 0; size_t yyi = 0;
for (char const* yyp = yyformat; *yyp; ++yyp) for (char const* yyp = yyformat; *yyp; ++yyp)
+275 -80
View File
@@ -1,6 +1,6 @@
# Java skeleton for Bison -*- autoconf -*- # Java skeleton for Bison -*- autoconf -*-
# Copyright (C) 2007-2013 Free Software Foundation, Inc. # Copyright (C) 2007-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -20,7 +20,8 @@ m4_include(b4_pkgdatadir/[java.m4])
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java], b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java],
[b4_skeleton])]) [b4_skeleton])])
# We don't depend on %debug in Java, but pacify warnings about non-used flags. # We do not depend on %debug in Java, but pacify warnings about
# non-used flags.
b4_parse_trace_if([0], [0]) b4_parse_trace_if([0], [0])
m4_define([b4_symbol_no_destructor_assert], m4_define([b4_symbol_no_destructor_assert],
@@ -30,9 +31,60 @@ m4_define([b4_symbol_no_destructor_assert],
[b4_symbol_action_location([$1], [destructor])])])]) [b4_symbol_action_location([$1], [destructor])])])])
b4_symbol_foreach([b4_symbol_no_destructor_assert]) b4_symbol_foreach([b4_symbol_no_destructor_assert])
# Setup some macros for api.push-pull.
b4_percent_define_default([[api.push-pull]], [[pull]])
b4_percent_define_check_values([[[[api.push-pull]],
[[pull]], [[push]], [[both]]]])
# Define m4 conditional macros that encode the value
# of the api.push-pull flag.
b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
m4_case(b4_percent_define_get([[api.push-pull]]),
[pull], [m4_define([b4_push_flag], [[0]])],
[push], [m4_define([b4_pull_flag], [[0]])])
# Define a macro to be true when api.push-pull has the value "both".
m4_define([b4_both_if],[b4_push_if([b4_pull_if([$1],[$2])],[$2])])
# Handle BISON_USE_PUSH_FOR_PULL for the test suite. So that push parsing
# tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the
# behavior of Bison at all when push parsing is already requested.
b4_define_flag_if([use_push_for_pull])
b4_use_push_for_pull_if([
b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
[m4_define([b4_push_flag], [[1]])])])
# Define a macro to encapsulate the parse state variables.
# This allows them to be defined either in parse() when doing
# pull parsing, or as class instance variable when doing push parsing.
m4_define([b4_define_state],[[
/* Lookahead and lookahead in internal form. */
int yychar = yyempty_;
int yytoken = 0;
/* State. */
int yyn = 0;
int yylen = 0;
int yystate = 0;
YYStack yystack = new YYStack ();
int label = YYNEWSTATE;
/* Error handling. */
int yynerrs_ = 0;
]b4_locations_if([/* The location where the error started. */
b4_location_type yyerrloc = null;
/* Location. */
b4_location_type yylloc = new b4_location_type (null, null);])[
/* Semantic value of the lookahead. */
]b4_yystype[ yylval = null;
]])
b4_output_begin([b4_parser_file_name]) b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java], b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
[2007-2013]) [2007-2015])
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]); b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
])[/* First part of user declarations. */ ])[/* First part of user declarations. */
@@ -55,7 +107,9 @@ b4_percent_define_get3([implements], [ implements ])[
{ {
]b4_identification[ ]b4_identification[
]b4_error_verbose_if([[ ]b4_error_verbose_if([[
/** True if verbose error messages are enabled. */ /**
* True if verbose error messages are enabled.
*/
private boolean yyErrorVerbose = true; private boolean yyErrorVerbose = true;
/** /**
@@ -76,18 +130,24 @@ b4_locations_if([[
* A class defining a pair of positions. Positions, defined by the * A class defining a pair of positions. Positions, defined by the
* <code>]b4_position_type[</code> class, denote a point in the input. * <code>]b4_position_type[</code> class, denote a point in the input.
* Locations represent a part of the input through the beginning * Locations represent a part of the input through the beginning
* and ending positions. */ * and ending positions.
*/
public class ]b4_location_type[ { public class ]b4_location_type[ {
/** The first, inclusive, position in the range. */ /**
* The first, inclusive, position in the range.
*/
public ]b4_position_type[ begin; public ]b4_position_type[ begin;
/** The first position beyond the range. */ /**
* The first position beyond the range.
*/
public ]b4_position_type[ end; public ]b4_position_type[ end;
/** /**
* Create a <code>]b4_location_type[</code> denoting an empty range located at * Create a <code>]b4_location_type[</code> denoting an empty range located at
* a given point. * a given point.
* @@param loc The position at which the range is anchored. */ * @@param loc The position at which the range is anchored.
*/
public ]b4_location_type[ (]b4_position_type[ loc) { public ]b4_location_type[ (]b4_position_type[ loc) {
this.begin = this.end = loc; this.begin = this.end = loc;
} }
@@ -95,7 +155,8 @@ b4_locations_if([[
/** /**
* Create a <code>]b4_location_type[</code> from the endpoints of the range. * 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 included in the range.
* @@param end 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) { public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
this.begin = begin; this.begin = begin;
this.end = end; this.end = end;
@@ -104,7 +165,8 @@ b4_locations_if([[
/** /**
* Print a representation of the location. For this to be correct, * Print a representation of the location. For this to be correct,
* <code>]b4_position_type[</code> should override the <code>equals</code> * <code>]b4_position_type[</code> should override the <code>equals</code>
* method. */ * method.
*/
public String toString () { public String toString () {
if (begin.equals (end)) if (begin.equals (end))
return begin.toString (); return begin.toString ();
@@ -136,24 +198,28 @@ b4_locations_if([[
]b4_locations_if([[/** ]b4_locations_if([[/**
* Method to retrieve the beginning position of the last scanned token. * Method to retrieve the beginning position of the last scanned token.
* @@return the position at which the last scanned token starts. */ * @@return the position at which the last scanned token starts.
*/
]b4_position_type[ getStartPos (); ]b4_position_type[ getStartPos ();
/** /**
* Method to retrieve the ending position of the last scanned token. * Method to retrieve the ending position of the last scanned token.
* @@return the first position beyond the last scanned token. */ * @@return the first position beyond the last scanned token.
*/
]b4_position_type[ getEndPos ();]])[ ]b4_position_type[ getEndPos ();]])[
/** /**
* Method to retrieve the semantic value of the last scanned token. * Method to retrieve the semantic value of the last scanned token.
* @@return the semantic value of the last scanned token. */ * @@return the semantic value of the last scanned token.
*/
]b4_yystype[ getLVal (); ]b4_yystype[ getLVal ();
/** /**
* Entry point for the scanner. Returns the token identifier corresponding * Entry point for the scanner. Returns the token identifier corresponding
* to the next token and prepares to return the semantic value * to the next token and prepares to return the semantic value
* ]b4_locations_if([and beginning/ending positions ])[of the token. * ]b4_locations_if([and beginning/ending positions ])[of the token.
* @@return the token identifier corresponding to the next token. */ * @@return the token identifier corresponding to the next token.
*/
int yylex () ]b4_maybe_throws([b4_lex_throws])[; int yylex () ]b4_maybe_throws([b4_lex_throws])[;
/** /**
@@ -162,7 +228,8 @@ b4_locations_if([[
* *
* ]b4_locations_if([[@@param 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]])[ * error message is related]])[
* @@param msg The string for the error message. */ * @@param msg The string for the error message.
*/
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);] void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);]
} }
@@ -170,7 +237,9 @@ b4_locations_if([[
]b4_percent_code_get([[lexer]])[ ]b4_percent_code_get([[lexer]])[
} }
]])[/** The object doing lexical analysis for us. */ ]])[/**
* The object doing lexical analysis for us.
*/
private Lexer yylexer; private Lexer yylexer;
] ]
b4_parse_param_vars b4_parse_param_vars
@@ -336,39 +405,67 @@ b4_lexer_if([[
/** /**
* Returned by a Bison action in order to stop the parsing process and * Returned by a Bison action in order to stop the parsing process and
* return success (<tt>true</tt>). */ * return success (<tt>true</tt>).
*/
public static final int YYACCEPT = 0; public static final int YYACCEPT = 0;
/** /**
* Returned by a Bison action in order to stop the parsing process and * Returned by a Bison action in order to stop the parsing process and
* return failure (<tt>false</tt>). */ * return failure (<tt>false</tt>).
*/
public static final int YYABORT = 1; public static final int YYABORT = 1;
]b4_push_if([
/**
* Returned by a Bison action in order to request a new token.
*/
public static final int YYPUSH_MORE = 4;])[
/** /**
* Returned by a Bison action in order to start error recovery without * Returned by a Bison action in order to start error recovery without
* printing an error message. */ * printing an error message.
*/
public static final int YYERROR = 2; public static final int YYERROR = 2;
// Internal return codes that are not supported for user semantic /**
// actions. * Internal return codes that are not supported for user semantic
* actions.
*/
private static final int YYERRLAB = 3; private static final int YYERRLAB = 3;
private static final int YYNEWSTATE = 4; private static final int YYNEWSTATE = 4;
private static final int YYDEFAULT = 5; private static final int YYDEFAULT = 5;
private static final int YYREDUCE = 6; private static final int YYREDUCE = 6;
private static final int YYERRLAB1 = 7; private static final int YYERRLAB1 = 7;
private static final int YYRETURN = 8; private static final int YYRETURN = 8;
]b4_push_if([[ private static final int YYGETTOKEN = 9; /* Signify that a new token is expected when doing push-parsing. */]])[
private int yyerrstatus_ = 0; private int yyerrstatus_ = 0;
]b4_push_if([dnl
b4_define_state])[
/** /**
* Return whether error recovery is being done. In this state, the parser * Return whether error recovery is being done. In this state, the parser
* reads token until it reaches a known state, and then restarts normal * reads token until it reaches a known state, and then restarts normal
* operation. */ * operation.
*/
public final boolean recovering () public final boolean recovering ()
{ {
return yyerrstatus_ == 0; return yyerrstatus_ == 0;
} }
/** Compute post-reduction state.
* @@param yystate the current state
* @@param yysym the nonterminal to push on the stack
*/
private int yy_lr_goto_state_ (int yystate, int yysym)
{
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
return yytable_[yyr];
else
return yydefgoto_[yysym - yyntokens_];
}
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[ private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
{ {
]b4_yystype[ yyval; ]b4_yystype[ yyval;
@@ -399,14 +496,7 @@ b4_lexer_if([[
yylen = 0; yylen = 0;
/* Shift the result of the reduction. */ /* Shift the result of the reduction. */
yyn = yyr1_[yyn]; int yystate = yy_lr_goto_state_ (yystack.stateAt (0), yyr1_[yyn]);
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
if (0 <= yystate && yystate <= yylast_
&& yycheck_[yystate] == yystack.stateAt (0))
yystate = yytable_[yystate];
else
yystate = yydefgoto_[yyn - yyntokens_];
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[); yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
return YYNEWSTATE; return YYNEWSTATE;
} }
@@ -463,6 +553,7 @@ b4_lexer_if([[
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")"); + (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
} }
]b4_push_if([],[[
/** /**
* Parse input from the scanner that was specified at object construction * Parse input from the scanner that was specified at object construction
* time. Return whether the end of the input was reached successfully. * time. Return whether the end of the input was reached successfully.
@@ -470,46 +561,53 @@ b4_lexer_if([[
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not * @@return <tt>true</tt> if the parsing succeeds. Note that this does not
* imply that there were no syntax errors. * imply that there were no syntax errors.
*/ */
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[
]b4_push_if([
/**
* Push Parse input from external lexer
*
* @@param yylextoken current token
* @@param yylexval current lval
]b4_locations_if([ * @@param yylexloc current position])[
*
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
*/
public int push_parse (int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc]))
b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[
{ {
/// Lookahead and lookahead in internal form. ]b4_locations_if([/* @@$. */
int yychar = yyempty_; b4_location_type yyloc;])[
int yytoken = 0; ]b4_push_if([],[[
]b4_define_state[
/* State. */
int yyn = 0;
int yylen = 0;
int yystate = 0;
YYStack yystack = new YYStack ();
/* Error handling. */
int yynerrs_ = 0;
]b4_locations_if([/// The location where the error started.
]b4_location_type[ yyerrloc = null;
/// ]b4_location_type[ of the lookahead.
]b4_location_type[ yylloc = new ]b4_location_type[ (null, null);
/// @@$.
]b4_location_type[ yyloc;])
/// Semantic value of the lookahead.
b4_yystype[ yylval = null;
yycdebug ("Starting parse\n"); yycdebug ("Starting parse\n");
yyerrstatus_ = 0; yyerrstatus_ = 0;
/* Initialize the stack. */
yystack.push (yystate, yylval ]b4_locations_if([, yylloc])[);
]m4_ifdef([b4_initial_action], [ ]m4_ifdef([b4_initial_action], [
b4_dollar_pushdef([yylval], [], [yylloc])dnl b4_dollar_pushdef([yylval], [], [yylloc])dnl
/* User initialization code. */ /* User initialization code. */
b4_user_initial_action b4_user_initial_action
b4_dollar_popdef])[]dnl b4_dollar_popdef[]dnl
])[
]])[
]b4_push_if([[
if (!this.push_parse_initialized)
{
push_parse_initialize ();
]m4_ifdef([b4_initial_action], [
b4_dollar_pushdef([yylval], [], [yylloc])dnl
/* User initialization code. */
b4_user_initial_action
b4_dollar_popdef[]dnl
])[
yycdebug ("Starting parse\n");
yyerrstatus_ = 0;
} else
label = YYGETTOKEN;
[ /* Initialize the stack. */ boolean push_token_consumed = true;
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[); ]])[
int label = YYNEWSTATE;
for (;;) for (;;)
switch (label) switch (label)
{ {
@@ -522,7 +620,8 @@ b4_dollar_popdef])[]dnl
/* Accept? */ /* Accept? */
if (yystate == yyfinal_) if (yystate == yyfinal_)
return true; ]b4_push_if([{label = YYACCEPT; break;}],
[return true;])[
/* Take a decision. First try without lookahead. */ /* Take a decision. First try without lookahead. */
yyn = yypact_[yystate]; yyn = yypact_[yystate];
@@ -531,16 +630,27 @@ b4_dollar_popdef])[]dnl
label = YYDEFAULT; label = YYDEFAULT;
break; break;
} }
]b4_push_if([ /* Fall Through */
case YYGETTOKEN:])[
/* Read a lookahead token. */ /* Read a lookahead token. */
if (yychar == yyempty_) if (yychar == yyempty_)
{ {
]b4_push_if([[
if (!push_token_consumed)
return YYPUSH_MORE;
yycdebug ("Reading a token: "); yycdebug ("Reading a token: ");
yychar = yylexer.yylex ();] yychar = yylextoken;
b4_locations_if([[ yylval = yylexval;]b4_locations_if([
yylloc = new ]b4_location_type[(yylexer.getStartPos (), yylloc = yylexloc;])[
yylexer.getEndPos ());]]) push_token_consumed = false;]])[
yylval = yylexer.getLVal ();[ ]b4_push_if([],[[
yycdebug ("Reading a token: ");
yychar = yylexer.yylex ();
yylval = yylexer.getLVal ();]b4_locations_if([
yylloc = new b4_location_type (yylexer.getStartPos (),
yylexer.getEndPos ());])[
]])[
} }
/* Convert token to internal form. */ /* Convert token to internal form. */
@@ -637,10 +747,10 @@ b4_dollar_popdef])[]dnl
{ {
/* Return failure if at end of input. */ /* Return failure if at end of input. */
if (yychar == Lexer.EOF) if (yychar == Lexer.EOF)
return false; ]b4_push_if([{label = YYABORT; break;}],[return false;])[
} }
else else
yychar = yyempty_; yychar = yyempty_;
} }
/* Else will try to reuse lookahead token after shifting the error /* Else will try to reuse lookahead token after shifting the error
@@ -648,9 +758,9 @@ b4_dollar_popdef])[]dnl
label = YYERRLAB1; label = YYERRLAB1;
break; break;
/*---------------------------------------------------. /*-------------------------------------------------.
| errorlab -- error raised explicitly by YYERROR. | | errorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/ `-------------------------------------------------*/
case YYERROR: case YYERROR:
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[ ]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
@@ -682,9 +792,10 @@ b4_dollar_popdef])[]dnl
} }
} }
/* Pop the current state because it cannot handle the error token. */ /* Pop the current state because it cannot handle the
* error token. */
if (yystack.height == 0) if (yystack.height == 0)
return false; ]b4_push_if([{label = YYABORT; break;}],[return false;])[
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[ ]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
yystack.pop (); yystack.pop ();
@@ -693,7 +804,11 @@ b4_dollar_popdef])[]dnl
yystack.print (yyDebugStream); yystack.print (yyDebugStream);
} }
]b4_locations_if([ if (label == YYABORT)
/* Leave the switch. */
break;
]b4_locations_if([
/* Muck with the stack to setup for yylloc. */ /* Muck with the stack to setup for yylloc. */
yystack.push (0, null, yylloc); yystack.push (0, null, yylloc);
yystack.push (0, null, yyerrloc); yystack.push (0, null, yyerrloc);
@@ -711,13 +826,91 @@ b4_dollar_popdef])[]dnl
/* Accept. */ /* Accept. */
case YYACCEPT: case YYACCEPT:
return true; ]b4_push_if([this.push_parse_initialized = false; return YYACCEPT;],
[return true;])[
/* Abort. */ /* Abort. */
case YYABORT: case YYABORT:
return false; ]b4_push_if([this.push_parse_initialized = false; return YYABORT;],
[return false;])[
} }
}
]b4_push_if([[
boolean push_parse_initialized = false;
/**
* (Re-)Initialize the state of the push parser.
*/
public void push_parse_initialize()
{
/* Lookahead and lookahead in internal form. */
this.yychar = yyempty_;
this.yytoken = 0;
/* State. */
this.yyn = 0;
this.yylen = 0;
this.yystate = 0;
this.yystack = new YYStack ();
this.label = YYNEWSTATE;
/* Error handling. */
this.yynerrs_ = 0;
]b4_locations_if([/* The location where the error started. */
this.yyerrloc = null;
this.yylloc = new b4_location_type (null, null);])[
/* Semantic value of the lookahead. */
this.yylval = null;
yystack.push (this.yystate, this.yylval]b4_locations_if([, this.yylloc])[);
this.push_parse_initialized = true;
} }
]b4_locations_if([
/**
* Push parse given input from an external lexer.
*
* @@param yylextoken current token
* @@param yylexval current lval
* @@param yyylexpos current position
*
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
*/
public int push_parse (int yylextoken, b4_yystype yylexval, b4_position_type yylexpos)
b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])
{
return push_parse (yylextoken, yylexval, new b4_location_type (yylexpos));
}
])[]])
b4_both_if([[
/**
* Parse input from the scanner that was specified at object construction
* time. Return whether the end of the input was reached successfully.
* This version of parse () is defined only when api.push-push=both.
*
* @@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_list2([b4_lex_throws], [b4_throws])])[
{
if (yylexer == null)
throw new NullPointerException("Null Lexer");
int status;
do {
int token = yylexer.yylex();
]b4_yystype[ lval = yylexer.getLVal();
]b4_locations_if([dnl
b4_location_type yyloc = new b4_location_type (yylexer.getStartPos (),
yylexer.getEndPos ());])[
]b4_locations_if([status = push_parse(token,lval,yyloc);],[
status = push_parse(token,lval);])[
} while (status == YYPUSH_MORE);
return (status == YYACCEPT);
}
]])[
// Generate an error message. // Generate an error message.
private String yysyntax_error (int yystate, int tok) private String yysyntax_error (int yystate, int tok)
@@ -752,8 +945,8 @@ b4_dollar_popdef])[]dnl
*/ */
if (tok != yyempty_) if (tok != yyempty_)
{ {
// FIXME: This method of building the message is not compatible /* FIXME: This method of building the message is not compatible
// with internationalization. with internationalization. */
StringBuffer res = StringBuffer res =
new StringBuffer ("syntax error, unexpected "); new StringBuffer ("syntax error, unexpected ");
res.append (yytnamerr_ (yytname_[tok])); res.append (yytnamerr_ (yytname_[tok]));
@@ -802,8 +995,9 @@ b4_dollar_popdef])[]dnl
} }
/** /**
* Whether the given <code>yytable_</code> value indicates a syntax error. * Whether the given <code>yytable_</code>
* @@param yyvalue the value to check * value indicates a syntax error.
* @@param yyvalue the value to check
*/ */
private static boolean yy_table_value_is_error_ (int yyvalue) private static boolean yy_table_value_is_error_ (int yyvalue)
{ {
@@ -825,6 +1019,7 @@ b4_dollar_popdef])[]dnl
]b4_integral_parser_table_define([rline], [b4_rline], ]b4_integral_parser_table_define([rline], [b4_rline],
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[ [[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
// Report on the debug stream that the rule yyrule is going to be reduced. // Report on the debug stream that the rule yyrule is going to be reduced.
private void yy_reduce_print (int yyrule, YYStack yystack) private void yy_reduce_print (int yyrule, YYStack yystack)
{ {
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2002, 2005-2013 Free Software Foundation, Inc. ## Copyright (C) 2002, 2005-2015 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify ## 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 ## it under the terms of the GNU General Public License as published by
+24 -19
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2013 Free Software Foundation, Inc. # Copyright (C) 2002-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[2002-2013]) [2002-2015])
# b4_position_define # b4_position_define
# ------------------ # ------------------
@@ -27,7 +27,7 @@ m4_define([b4_position_define],
{ {
public:]m4_ifdef([b4_location_constructors], [[ public:]m4_ifdef([b4_location_constructors], [[
/// Construct a position. /// Construct a position.
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULL, explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u, unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u) unsigned int c = ]b4_location_initial_column[u)
: filename (f) : filename (f)
@@ -38,7 +38,7 @@ m4_define([b4_position_define],
]])[ ]])[
/// Initialization. /// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULL, void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u, unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u) unsigned int c = ]b4_location_initial_column[u)
{ {
@@ -83,7 +83,7 @@ m4_define([b4_position_define],
} }
}; };
/// Add and assign a position. /// Add \a width columns, in place.
inline position& inline position&
operator+= (position& res, int width) operator+= (position& res, int width)
{ {
@@ -91,21 +91,21 @@ m4_define([b4_position_define],
return res; return res;
} }
/// Add two position objects. /// Add \a width columns.
inline position inline position
operator+ (position res, int width) operator+ (position res, int width)
{ {
return res += width; return res += width;
} }
/// Add and assign a position. /// Subtract \a width columns, in place.
inline position& inline position&
operator-= (position& res, int width) operator-= (position& res, int width)
{ {
return res += -width; return res += -width;
} }
/// Add two position objects. /// Subtract \a width columns.
inline position inline position
operator- (position res, int width) operator- (position res, int width)
{ {
@@ -178,7 +178,7 @@ m4_define([b4_location_define],
])[ ])[
/// Initialization. /// Initialization.
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULL, void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
unsigned int l = ]b4_location_initial_line[u, unsigned int l = ]b4_location_initial_line[u,
unsigned int c = ]b4_location_initial_column[u) unsigned int c = ]b4_location_initial_column[u)
{ {
@@ -216,36 +216,42 @@ m4_define([b4_location_define],
position end; position end;
}; };
/// Join two location objects to create a location. /// Join two locations, in place.
inline location operator+ (location res, const location& end) inline location& operator+= (location& res, const location& end)
{ {
res.end = end.end; res.end = end.end;
return res; return res;
} }
/// Change end position in place. /// Join two locations.
inline location operator+ (location res, const location& end)
{
return res += end;
}
/// Add \a width columns to the end position, in place.
inline location& operator+= (location& res, int width) inline location& operator+= (location& res, int width)
{ {
res.columns (width); res.columns (width);
return res; return res;
} }
/// Change end position. /// Add \a width columns to the end position.
inline location operator+ (location res, int width) inline location operator+ (location res, int width)
{ {
return res += width; return res += width;
} }
/// Change end position in place. /// Subtract \a width columns to the end position, in place.
inline location& operator-= (location& res, int width) inline location& operator-= (location& res, int width)
{ {
return res += -width; return res += -width;
} }
/// Change end position. /// Subtract \a width columns to the end position.
inline location operator- (const location& begin, int width) inline location operator- (location res, int width)
{ {
return begin + -width; return res -= width;
} }
]b4_percent_define_flag_if([[define_location_comparison]], [[ ]b4_percent_define_flag_if([[define_location_comparison]], [[
/// Compare two location objects. /// Compare two location objects.
@@ -273,8 +279,7 @@ m4_define([b4_location_define],
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc) operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
{ {
unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0; unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
ostr << loc.begin// << "(" << loc.end << ") " ostr << loc.begin;
;
if (loc.end.filename if (loc.end.filename
&& (!loc.begin.filename && (!loc.begin.filename
|| *loc.begin.filename != *loc.end.filename)) || *loc.begin.filename != *loc.end.filename))
+2 -2
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2013 Free Software Foundation, Inc. # Copyright (C) 2002-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[2002-2013]) [2002-2015])
# b4_stack_define # b4_stack_define
# --------------- # ---------------
+15 -17
View File
@@ -1,6 +1,6 @@
# C++ skeleton for Bison # C++ skeleton for Bison
# Copyright (C) 2002-2013 Free Software Foundation, Inc. # Copyright (C) 2002-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -95,13 +95,13 @@ m4_define([b4_variant_define],
/// Empty construction. /// Empty construction.
variant ()]b4_parse_assert_if([ variant ()]b4_parse_assert_if([
: yytname_ (YY_NULL)])[ : yytypeid_ (YY_NULLPTR)])[
{} {}
/// Construct and fill. /// Construct and fill.
template <typename T> template <typename T>
variant (const T& t)]b4_parse_assert_if([ variant (const T& t)]b4_parse_assert_if([
: yytname_ (typeid (T).name ())])[ : yytypeid_ (&typeid (T))])[
{ {
YYASSERT (sizeof (T) <= S); YYASSERT (sizeof (T) <= S);
new (yyas_<T> ()) T (t); new (yyas_<T> ()) T (t);
@@ -110,7 +110,7 @@ m4_define([b4_variant_define],
/// Destruction, allowed only if empty. /// Destruction, allowed only if empty.
~variant () ~variant ()
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (!yytname_); YYASSERT (!yytypeid_);
])[} ])[}
/// Instantiate an empty \a T in here. /// Instantiate an empty \a T in here.
@@ -118,9 +118,9 @@ m4_define([b4_variant_define],
T& T&
build () build ()
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (!yytname_); YYASSERT (!yytypeid_);
YYASSERT (sizeof (T) <= S); YYASSERT (sizeof (T) <= S);
yytname_ = typeid (T).name ();])[ yytypeid_ = & typeid (T);])[
return *new (yyas_<T> ()) T; return *new (yyas_<T> ()) T;
} }
@@ -129,9 +129,9 @@ m4_define([b4_variant_define],
T& T&
build (const T& t) build (const T& t)
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (!yytname_); YYASSERT (!yytypeid_);
YYASSERT (sizeof (T) <= S); YYASSERT (sizeof (T) <= S);
yytname_ = typeid (T).name ();])[ yytypeid_ = & typeid (T);])[
return *new (yyas_<T> ()) T (t); return *new (yyas_<T> ()) T (t);
} }
@@ -140,7 +140,7 @@ m4_define([b4_variant_define],
T& T&
as () as ()
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (yytname_ == typeid (T).name ()); YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);])[ YYASSERT (sizeof (T) <= S);])[
return *yyas_<T> (); return *yyas_<T> ();
} }
@@ -150,7 +150,7 @@ m4_define([b4_variant_define],
const T& const T&
as () const as () const
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (yytname_ == typeid (T).name ()); YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);])[ YYASSERT (sizeof (T) <= S);])[
return *yyas_<T> (); return *yyas_<T> ();
} }
@@ -167,8 +167,8 @@ m4_define([b4_variant_define],
void void
swap (self_type& other) swap (self_type& other)
{]b4_parse_assert_if([ {]b4_parse_assert_if([
YYASSERT (yytname_); YYASSERT (yytypeid_);
YYASSERT (yytname_ == other.yytname_);])[ YYASSERT (*yytypeid_ == *other.yytypeid_);])[
std::swap (as<T> (), other.as<T> ()); std::swap (as<T> (), other.as<T> ());
} }
@@ -178,8 +178,7 @@ m4_define([b4_variant_define],
template <typename T> template <typename T>
void void
move (self_type& other) move (self_type& other)
{]b4_parse_assert_if([ {
YYASSERT (!yytname_);])[
build<T> (); build<T> ();
swap<T> (other); swap<T> (other);
other.destroy<T> (); other.destroy<T> ();
@@ -199,7 +198,7 @@ m4_define([b4_variant_define],
destroy () destroy ()
{ {
as<T> ().~T ();]b4_parse_assert_if([ as<T> ().~T ();]b4_parse_assert_if([
yytname_ = YY_NULL;])[ yytypeid_ = YY_NULLPTR;])[
} }
private: private:
@@ -234,7 +233,7 @@ m4_define([b4_variant_define],
} yybuffer_;]b4_parse_assert_if([ } yybuffer_;]b4_parse_assert_if([
/// Whether the content is built: if defined, the name of the stored type. /// Whether the content is built: if defined, the name of the stored type.
const char *yytname_;])[ const std::type_info *yytypeid_;])[
}; };
]]) ]])
@@ -321,7 +320,6 @@ b4_join(b4_symbol_if([$1], [has_type],
return symbol_type (b4_join([token::b4_symbol([$1], [id])], return symbol_type (b4_join([token::b4_symbol([$1], [id])],
b4_symbol_if([$1], [has_type], [v]), b4_symbol_if([$1], [has_type], [v]),
b4_locations_if([l]))); b4_locations_if([l])));
} }
])])]) ])])])
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- <!--
bison.xsl - common templates for Bison XSLT. bison.xsl - common templates for Bison XSLT.
Copyright (C) 2007-2013 Free Software Foundation, Inc. Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+6 -2
View File
@@ -3,7 +3,7 @@
<!-- <!--
xml2dot.xsl - transform Bison XML Report into DOT. xml2dot.xsl - transform Bison XML Report into DOT.
Copyright (C) 2007-2013 Free Software Foundation, Inc. Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
@@ -201,6 +201,8 @@
<xsl:if test="$point = 0"> <xsl:if test="$point = 0">
<xsl:text> .</xsl:text> <xsl:text> .</xsl:text>
</xsl:if> </xsl:if>
<!-- RHS -->
<xsl:for-each select="rhs/symbol|rhs/empty"> <xsl:for-each select="rhs/symbol|rhs/empty">
<xsl:apply-templates select="."/> <xsl:apply-templates select="."/>
<xsl:if test="$point = position()"> <xsl:if test="$point = position()">
@@ -214,7 +216,9 @@
<xsl:value-of select="."/> <xsl:value-of select="."/>
</xsl:template> </xsl:template>
<xsl:template match="empty"/> <xsl:template match="empty">
<xsl:text> %empty</xsl:text>
</xsl:template>
<xsl:template match="lookaheads"> <xsl:template match="lookaheads">
<xsl:text> [</xsl:text> <xsl:text> [</xsl:text>
+2 -7
View File
@@ -3,7 +3,7 @@
<!-- <!--
xml2text.xsl - transform Bison XML Report into plain text. xml2text.xsl - transform Bison XML Report into plain text.
Copyright (C) 2007-2013 Free Software Foundation, Inc. Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
@@ -350,12 +350,7 @@
<xsl:if test="position() = $point + 1"> <xsl:if test="position() = $point + 1">
<xsl:text> .</xsl:text> <xsl:text> .</xsl:text>
</xsl:if> </xsl:if>
<xsl:if test="$itemset = 'true' and name(.) != 'empty'"> <xsl:apply-templates select="."/>
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="$itemset != 'true'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="position() = last() and position() = $point"> <xsl:if test="position() = last() and position() = $point">
<xsl:text> .</xsl:text> <xsl:text> .</xsl:text>
</xsl:if> </xsl:if>
+3 -8
View File
@@ -3,7 +3,7 @@
<!-- <!--
xml2html.xsl - transform Bison XML Report into XHTML. xml2html.xsl - transform Bison XML Report into XHTML.
Copyright (C) 2007-2013 Free Software Foundation, Inc. Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
@@ -532,12 +532,7 @@
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<span class="point">.</span> <span class="point">.</span>
</xsl:if> </xsl:if>
<xsl:if test="$itemset = 'true' and name(.) != 'empty'"> <xsl:apply-templates select="."/>
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="$itemset != 'true'">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="position() = last() and position() = $point"> <xsl:if test="position() = last() and position() = $point">
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<span class="point">.</span> <span class="point">.</span>
@@ -563,7 +558,7 @@
</xsl:template> </xsl:template>
<xsl:template match="empty"> <xsl:template match="empty">
<xsl:text> &#949;</xsl:text> <xsl:text> %empty</xsl:text>
</xsl:template> </xsl:template>
<xsl:template match="lookaheads"> <xsl:template match="lookaheads">
+17 -34
View File
@@ -1,11 +1,11 @@
-*- C -*- -*- C -*-
# Yacc compatible skeleton for Bison # Yacc compatible skeleton for Bison
# Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, # Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation,
# Inc. # Inc.
m4_pushdef([b4_copyright_years], m4_pushdef([b4_copyright_years],
[1984, 1989-1990, 2000-2013]) [1984, 1989-1990, 2000-2015])
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -175,36 +175,19 @@ m4_define([b4_declare_scanner_communication_variables], [[
int yychar; int yychar;
]b4_pure_if([[ ]b4_pure_if([[
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* The semantic value of the lookahead symbol. */
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
/* Default value used for initialization, for pacifying older GCCs /* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */ or non-GCC compilers. */
static YYSTYPE yyval_default; YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
# define YY_INITIAL_VALUE(Value) = Value YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);]b4_locations_if([[
#endif]b4_locations_if([[
static YYLTYPE yyloc_default][]b4_yyloc_default[;]])])[
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval YY_INITIAL_VALUE (yyval_default);]b4_locations_if([[
/* Location data for the lookahead symbol. */ /* Location data for the lookahead symbol. */
YYLTYPE yylloc]b4_pure_if([ = yyloc_default], [b4_yyloc_default])[; static YYLTYPE yyloc_default]b4_yyloc_default[;
]])b4_pure_if([], [[ YYLTYPE yylloc = yyloc_default;]])],
[[/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;]b4_locations_if([[
/* Location data for the lookahead symbol. */
YYLTYPE yylloc]b4_yyloc_default[;]])[
/* Number of syntax errors so far. */ /* Number of syntax errors so far. */
int yynerrs;]])]) int yynerrs;]])])
@@ -1125,11 +1108,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes, ]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken) YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
{ {
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0; YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */ /* Internationalized format string. */
const char *yyformat = YY_NULL; const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */ /* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per /* Number of reported tokens (one for the "unexpected", one per
@@ -1204,7 +1187,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
} }
yyarg[yycount++] = yytname[yyx]; yyarg[yycount++] = yytname[yyx];
{ {
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1 if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM)) && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2; return 2;
@@ -1288,7 +1271,7 @@ static char yypstate_allocated = 0;]])b4_pull_if([
b4_function_define([[yyparse]], [[int]], b4_parse_param)[ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
{ {
return yypull_parse (YY_NULL]m4_ifset([b4_parse_param], return yypull_parse (YY_NULLPTR]m4_ifset([b4_parse_param],
[[, ]b4_args(b4_parse_param)])[); [[, ]b4_args(b4_parse_param)])[);
} }
@@ -1330,10 +1313,10 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
{ {
yypstate *yyps;]b4_pure_if([], [[ yypstate *yyps;]b4_pure_if([], [[
if (yypstate_allocated) if (yypstate_allocated)
return YY_NULL;]])[ return YY_NULLPTR;]])[
yyps = (yypstate *) malloc (sizeof *yyps); yyps = (yypstate *) malloc (sizeof *yyps);
if (!yyps) if (!yyps)
return YY_NULL; return YY_NULLPTR;
yyps->yynew = 1;]b4_pure_if([], [[ yyps->yynew = 1;]b4_pure_if([], [[
yypstate_allocated = 1;]])[ yypstate_allocated = 1;]])[
return yyps; return yyps;
+1 -1
View File
@@ -1,7 +1,7 @@
# DJGPP Maintainer's Makefile -*-Makefile-*- # DJGPP Maintainer's Makefile -*-Makefile-*-
# Requires GNU sed # Requires GNU sed
## Copyright (C) 2005-2013 Free Software Foundation, Inc. ## Copyright (C) 2005-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP. This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
Copyright (C) 2005-2013 Free Software Foundation, Inc. Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -4,7 +4,7 @@ Rem Configure Bison for DJGPP.
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
Rem format, or else stock DOS/Windows shells will refuse to run it. Rem format, or else stock DOS/Windows shells will refuse to run it.
Rem Copyright (C) 2005-2013 Free Software Foundation, Inc. Rem Copyright (C) 2005-2015 Free Software Foundation, Inc.
Rem This program is free software: you can redistribute it and/or modify Rem This program is free software: you can redistribute it and/or modify
Rem it under the terms of the GNU General Public License as published by Rem it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Sed script for additional DJGPP specific editing # Sed script for additional DJGPP specific editing
# of the configure script generated by autoconf 2.62. # of the configure script generated by autoconf 2.62.
# Copyright (C) 2005-2013 Free Software Foundation, Inc. # Copyright (C) 2005-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -3,7 +3,7 @@
# This is the config.site file for configuring GNU packages # This is the config.site file for configuring GNU packages
# which are to be built with DJGPP tools. # which are to be built with DJGPP tools.
# Copyright (C) 2005-2013 Free Software Foundation, Inc. # Copyright (C) 2005-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
# sed script for DJGPP specific editing of config.hin # sed script for DJGPP specific editing of config.hin
# Copyright (C) 2005-2013 Free Software Foundation, Inc. # Copyright (C) 2005-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -7,7 +7,7 @@ Rem This batch file unpacks the Bison distribution while simultaneously
Rem renaming some of the files whose names are invalid on DOS or conflict Rem renaming some of the files whose names are invalid on DOS or conflict
Rem with other file names after truncation to DOS 8+3 namespace. Rem with other file names after truncation to DOS 8+3 namespace.
Rem Rem
Rem Copyright (C) 2005-2013 Free Software Foundation, Inc. Rem Copyright (C) 2005-2015 Free Software Foundation, Inc.
Rem Rem
Rem This program is free software: you can redistribute it and/or modify Rem This program is free software: you can redistribute it and/or modify
Rem it under the terms of the GNU General Public License as published by Rem it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2008-2013 Free Software Foundation, Inc. ## Copyright (C) 2008-2015 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify ## 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 ## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* Subprocesses with pipes. /* Subprocesses with pipes.
Copyright (C) 2005-2013 Free Software Foundation, Inc. Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* Subprocesses with pipes. /* Subprocesses with pipes.
Copyright (C) 2005-2013 Free Software Foundation, Inc. Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Sed script for additional DJGPP specific editing # Sed script for additional DJGPP specific editing
# of the testsuite script generated by autoconf 2.61. # of the testsuite script generated by autoconf 2.61.
# Copyright (C) 2007-2013 Free Software Foundation, Inc. # Copyright (C) 2007-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1
View File
@@ -27,3 +27,4 @@
/stamp-vti /stamp-vti
/version.texi /version.texi
/yacc.1 /yacc.1
/gendocs_template_min
+143 -22
View File
@@ -1,6 +1,8 @@
\input texinfo @c -*-texinfo-*- \input texinfo @c -*-texinfo-*-
@comment %**start of header @comment %**start of header
@setfilename bison.info @setfilename bison.info
@documentencoding UTF-8
@documentlanguage en
@include version.texi @include version.texi
@settitle Bison @value{VERSION} @settitle Bison @value{VERSION}
@setchapternewpage odd @setchapternewpage odd
@@ -33,7 +35,7 @@
This manual (@value{UPDATED}) is for GNU Bison (version This manual (@value{UPDATED}) is for GNU Bison (version
@value{VERSION}), the GNU parser generator. @value{VERSION}), the GNU parser generator.
Copyright @copyright{} 1988-1993, 1995, 1998-2013 Free Software Copyright @copyright{} 1988-1993, 1995, 1998-2015 Free Software
Foundation, Inc. Foundation, Inc.
@quotation @quotation
@@ -366,6 +368,7 @@ Java Parsers
* Java Parser Interface:: Instantiating and running the parser * Java Parser Interface:: Instantiating and running the parser
* Java Scanner Interface:: Specifying the scanner for the parser * Java Scanner Interface:: Specifying the scanner for the parser
* Java Action Features:: Special features for use in actions * Java Action Features:: Special features for use in actions
* Java Push Parser Interface:: Instantiating and running the a push parser
* Java Differences:: Differences between C/C++ and Java Grammars * Java Differences:: Differences between C/C++ and Java Grammars
* Java Declarations Summary:: List of Bison declarations used with Java * Java Declarations Summary:: List of Bison declarations used with Java
@@ -3848,7 +3851,7 @@ example:
@noindent @noindent
specifies the union tag @code{value}, so the corresponding C type is specifies the union tag @code{value}, so the corresponding C type is
@code{union value}. If you do not specify a tag, it defaults to @code{union value}. If you do not specify a tag, it defaults to
@code{YYSTYPE}. @code{YYSTYPE} (@pxref{%define Summary,,api.value.union.name}).
As another extension to POSIX, you may specify multiple @code{%union} As another extension to POSIX, you may specify multiple @code{%union}
declarations; their contents are concatenated. However, only the first declarations; their contents are concatenated. However, only the first
@@ -5142,7 +5145,9 @@ value by default. However, when the parser displays a @code{STRING1} or a
@code{string1}, it formats it as a string in double quotes. It performs @code{string1}, it formats it as a string in double quotes. It performs
only the second @code{%printer} in this case, so it prints only once. only the second @code{%printer} in this case, so it prints only once.
Finally, the parser print @samp{<>} for any symbol, such as @code{TAGLESS}, Finally, the parser print @samp{<>} for any symbol, such as @code{TAGLESS},
that has no semantic type tag. See also that has no semantic type tag. @xref{Mfcalc Traces, ,Enabling Debug Traces
for @code{mfcalc}}, for a complete example.
@node Expect Decl @node Expect Decl
@@ -6009,12 +6014,12 @@ Use this @var{type} as semantic value.
@item Default Value: @item Default Value:
@itemize @minus @itemize @minus
@item @item
@code{%union} if @code{%union} is used, otherwise @dots{} @code{union-directive} if @code{%union} is used, otherwise @dots{}
@item @item
@code{int} if type tags are used (i.e., @samp{%token <@var{type}>@dots{}} or @code{int} if type tags are used (i.e., @samp{%token <@var{type}>@dots{}} or
@samp{%token <@var{type}>@dots{}} is used), otherwise @dots{} @samp{%type <@var{type}>@dots{}} is used), otherwise @dots{}
@item @item
@code{""} undefined.
@end itemize @end itemize
@item History: @item History:
@@ -6025,6 +6030,30 @@ introduced in Bison 3.0. Was introduced for Java only in 2.3b as
@c api.value.type @c api.value.type
@c ================================================== api.value.union.name
@deffn Directive {%define api.value.union.name} @var{name}
@itemize @bullet
@item Language(s):
C
@item Purpose:
The tag of the generated @code{union} (@emph{not} the name of the
@code{typedef}). This variable is set to @code{@var{id}} when @samp{%union
@var{id}} is used. There is no clear reason to give this union a name.
@item Accepted Values:
Any valid identifier.
@item Default Value:
@code{YYSTYPE}.
@item History:
Introduced in Bison 3.0.3.
@end itemize
@end deffn
@c api.value.type
@c ================================================== location_type @c ================================================== location_type
@deffn Directive {%define location_type} @deffn Directive {%define location_type}
Obsoleted by @code{api.location.type} since Bison 2.7. Obsoleted by @code{api.location.type} since Bison 2.7.
@@ -10064,18 +10093,16 @@ A category can be turned off by prefixing its name with @samp{no-}. For
instance, @option{-Wno-yacc} will hide the warnings about instance, @option{-Wno-yacc} will hide the warnings about
POSIX Yacc incompatibilities. POSIX Yacc incompatibilities.
@item -Werror[=@var{category}] @item -Werror
@itemx -Wno-error[=@var{category}] Turn enabled warnings for every @var{category} into errors, unless they are
Enable warnings falling in @var{category}, and treat them as errors. If no explicitly disabled by @option{-Wno-error=@var{category}}.
@var{category} is given, it defaults to making all enabled warnings into errors.
@item -Werror=@var{category}
Enable warnings falling in @var{category}, and treat them as errors.
@var{category} is the same as for @option{--warnings}, with the exception that @var{category} is the same as for @option{--warnings}, with the exception that
it may not be prefixed with @samp{no-} (see above). it may not be prefixed with @samp{no-} (see above).
Prefixed with @samp{no}, it deactivates the error treatment for this
@var{category}. However, the warning itself won't be disabled, or enabled, by
this option.
Note that the precedence of the @samp{=} and @samp{,} operators is such that Note that the precedence of the @samp{=} and @samp{,} operators is such that
the following commands are @emph{not} equivalent, as the first will not treat the following commands are @emph{not} equivalent, as the first will not treat
S/R conflicts as errors. S/R conflicts as errors.
@@ -10085,6 +10112,14 @@ $ bison -Werror=yacc,conflicts-sr input.y
$ bison -Werror=yacc,error=conflicts-sr input.y $ bison -Werror=yacc,error=conflicts-sr input.y
@end example @end example
@item -Wno-error
Do not turn enabled warnings for every @var{category} into errors, unless
they are explicitly enabled by @option{-Werror=@var{category}}.
@item -Wno-error=@var{category}
Deactivate the error treatment for this @var{category}. However, the warning
itself won't be disabled, or enabled, by this option.
@item -f [@var{feature}] @item -f [@var{feature}]
@itemx --feature[=@var{feature}] @itemx --feature[=@var{feature}]
Activate miscellaneous @var{feature}. @var{feature} can be one of: Activate miscellaneous @var{feature}. @var{feature} can be one of:
@@ -10347,9 +10382,23 @@ declare @code{yyerror} as follows:
int yyerror (char const *); int yyerror (char const *);
@end example @end example
Bison ignores the @code{int} value returned by this @code{yyerror}. @noindent
If you use the Yacc library's @code{main} function, your The @code{int} value returned by this @code{yyerror} is ignored.
@code{yyparse} function should have the following type signature:
The implementation of Yacc library's @code{main} function is:
@example
int main (void)
@{
setlocale (LC_ALL, "");
return yyparse ();
@}
@end example
@noindent
so if you use it, the internationalization support is enabled (e.g., error
messages are translated), and your @code{yyparse} function should have the
following type signature:
@example @example
int yyparse (void); int yyparse (void);
@@ -10651,12 +10700,17 @@ The first, inclusive, position of the range, and the first beyond.
Forwarded to the @code{end} position. Forwarded to the @code{end} position.
@end deftypemethod @end deftypemethod
@deftypemethod {location} {location} operator+ (const location& @var{end}) @deftypemethod {location} {location} operator+ (int @var{width})
@deftypemethodx {location} {location} operator+ (int @var{width})
@deftypemethodx {location} {location} operator+= (int @var{width}) @deftypemethodx {location} {location} operator+= (int @var{width})
@deftypemethodx {location} {location} operator- (int @var{width}) @deftypemethodx {location} {location} operator- (int @var{width})
@deftypemethodx {location} {location} operator-= (int @var{width}) @deftypemethodx {location} {location} operator-= (int @var{width})
Various forms of syntactic sugar. Various forms of syntactic sugar for @code{columns}.
@end deftypemethod
@deftypemethod {location} {location} operator+ (const location& @var{end})
@deftypemethodx {location} {location} operator+= (const location& @var{end})
Join two locations: starts at the position of the first one, and ends at the
position of the second.
@end deftypemethod @end deftypemethod
@deftypemethod {location} {void} step () @deftypemethod {location} {void} step ()
@@ -11500,6 +11554,7 @@ main (int argc, char *argv[])
* Java Parser Interface:: Instantiating and running the parser * Java Parser Interface:: Instantiating and running the parser
* Java Scanner Interface:: Specifying the scanner for the parser * Java Scanner Interface:: Specifying the scanner for the parser
* Java Action Features:: Special features for use in actions * Java Action Features:: Special features for use in actions
* Java Push Parser Interface:: Instantiating and running the a push parser
* Java Differences:: Differences between C/C++ and Java Grammars * Java Differences:: Differences between C/C++ and Java Grammars
* Java Declarations Summary:: List of Bison declarations used with Java * Java Declarations Summary:: List of Bison declarations used with Java
@end menu @end menu
@@ -11811,7 +11866,6 @@ The return type can be changed using @samp{%define api.value.type
@{@var{class-name}@}}. @{@var{class-name}@}}.
@end deftypemethod @end deftypemethod
@node Java Action Features @node Java Action Features
@subsection Special Features for Use in Java Actions @subsection Special Features for Use in Java Actions
@@ -11890,6 +11944,73 @@ instance in use. The @code{Location} and @code{Position} parameters are
available only if location tracking is active. available only if location tracking is active.
@end deftypefn @end deftypefn
@node Java Push Parser Interface
@subsection Java Push Parser Interface
@c - define push_parse
@findex %define api.push-pull
(The current push parsing interface is experimental and may evolve. More
user feedback will help to stabilize it.)
Normally, Bison generates a pull parser for Java.
The following Bison declaration says that you want the parser to be a push
parser (@pxref{%define Summary,,api.push-pull}):
@example
%define api.push-pull push
@end example
Most of the discussion about the Java pull Parser Interface, (@pxref{Java
Parser Interface}) applies to the push parser interface as well.
When generating a push parser, the method @code{push_parse} is created with
the following signature (depending on if locations are enabled).
@deftypemethod {YYParser} {void} push_parse ({int} @var{token}, {Object} @var{yylval})
@deftypemethodx {YYParser} {void} push_parse ({int} @var{token}, {Object} @var{yylval}, {Location} @var{yyloc})
@deftypemethodx {YYParser} {void} push_parse ({int} @var{token}, {Object} @var{yylval}, {Position} @var{yypos})
@end deftypemethod
The primary difference with respect to a pull parser is that the parser
method @code{push_parse} is invoked repeatedly to parse each token. This
function is available if either the "%define api.push-pull push" or "%define
api.push-pull both" declaration is used (@pxref{%define
Summary,,api.push-pull}). The @code{Location} and @code{Position}
parameters are available only if location tracking is active.
The value returned by the @code{push_parse} method is one of the following
four constants: @code{YYABORT}, @code{YYACCEPT}, @code{YYERROR}, or
@code{YYPUSH_MORE}. This new value, @code{YYPUSH_MORE}, may be returned if
more input is required to finish parsing the grammar.
If api.push-pull is declared as @code{both}, then the generated parser class
will also implement the @code{parse} method. This method's body is a loop
that repeatedly invokes the scanner and then passes the values obtained from
the scanner to the @code{push_parse} method.
There is one additional complication. Technically, the push parser does not
need to know about the scanner (i.e. an object implementing the
@code{YYParser.Lexer} interface), but it does need access to the
@code{yyerror} method. Currently, the @code{yyerror} method is defined in
the @code{YYParser.Lexer} interface. Hence, an implementation of that
interface is still required in order to provide an implementation of
@code{yyerror}. The current approach (and subject to change) is to require
the @code{YYParser} constructor to be given an object implementing the
@code{YYParser.Lexer} interface. This object need only implement the
@code{yyerror} method; the other methods can be stubbed since they will
never be invoked. The simplest way to do this is to add a trivial scanner
implementation to your grammar file using whatever implementation of
@code{yyerror} is desired. The following code sample shows a simple way to
accomplish this.
@example
%code lexer
@{
public Object getLVal () @{return null;@}
public int yylex () @{return 0;@}
public void yyerror (String s) @{System.err.println(s);@}
@}
@end example
@node Java Differences @node Java Differences
@subsection Differences between C/C++ and Java Grammars @subsection Differences between C/C++ and Java Grammars
+2
View File
@@ -0,0 +1,2 @@
This file is a stub, not used by the documentation. If you feel like
contributing ASCII art for example.gv, please step forward!
+25 -16
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. ## Copyright (C) 2001-2003, 2005-2015 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify ## 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 ## it under the terms of the GNU General Public License as published by
@@ -23,9 +23,10 @@ doc_bison_TEXINFOS = \
# Cannot express dependencies directly on file names because of Automake. # Cannot express dependencies directly on file names because of Automake.
# Obfuscate with a variable. # Obfuscate with a variable.
doc_bison = doc/bison doc_bison = doc/bison
$(doc_bison).dvi: $(FIGS_DOT:.dot=.eps) $(doc_bison).dvi: $(FIGS_GV:.gv=.eps)
$(doc_bison).pdf: $(FIGS_DOT:.dot=.pdf) $(doc_bison).info: $(FIGS_GV:.gv=.txt)
$(doc_bison).html: $(FIGS_DOT:.dot=.png) $(doc_bison).pdf: $(FIGS_GV:.gv=.pdf)
$(doc_bison).html: $(FIGS_GV:.gv=.png)
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
CLEANDIRS = doc/bison.t2d CLEANDIRS = doc/bison.t2d
@@ -84,11 +85,13 @@ doc/refcard.pdf: doc/refcard.tex
# repeated builds of bison.help. # repeated builds of bison.help.
EXTRA_DIST += $(top_srcdir)/doc/bison.help EXTRA_DIST += $(top_srcdir)/doc/bison.help
if ! CROSS_COMPILING
MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT) $(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
$(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp $(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp
$(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp $(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp
$(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@ $(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@
endif ! CROSS_COMPILING
## ----------- ## ## ----------- ##
@@ -105,7 +108,11 @@ remove_time_stamp = \
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/' sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
# Depend on configure to get version number changes. # Depend on configure to get version number changes.
$(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure if ! CROSS_COMPILING
MAN_DEPS = doc/bison.help doc/bison.x $(top_srcdir)/configure
endif
$(top_srcdir)/doc/bison.1: $(MAN_DEPS)
$(AM_V_GEN)$(HELP2MAN) \ $(AM_V_GEN)$(HELP2MAN) \
--include=$(top_srcdir)/doc/bison.x \ --include=$(top_srcdir)/doc/bison.x \
--output=$@.t src/bison$(EXEEXT) --output=$@.t src/bison$(EXEEXT)
@@ -117,32 +124,34 @@ $(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
fi fi
$(AM_V_at)rm -f $@*.t $(AM_V_at)rm -f $@*.t
if ENABLE_YACC
nodist_man_MANS = doc/yacc.1 nodist_man_MANS = doc/yacc.1
endif
## ----------------------------- ## ## ----------------------------- ##
## Graphviz examples generation. ## ## Graphviz examples generation. ##
## ----------------------------- ## ## ----------------------------- ##
CLEANDIRS += doc/figs CLEANFILES += $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png)
FIGS_DOT = \ FIGS_GV = \
doc/figs/example.dot \ doc/figs/example.gv \
doc/figs/example-reduce.dot doc/figs/example-shift.dot doc/figs/example-reduce.gv doc/figs/example-shift.gv
EXTRA_DIST += \ EXTRA_DIST += \
$(FIGS_DOT) \ $(FIGS_GV) $(FIGS_GV:.gv=.txt) \
$(FIGS_DOT:.dot=.eps) $(FIGS_DOT:.dot=.pdf) $(FIGS_DOT:.dot=.png) $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png)
SUFFIXES += .dot .eps .pdf .png SUFFIXES += .gv .eps .pdf .png
.dot.eps: .gv.eps:
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'` $(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
$(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp $(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp
$(AM_V_at) mv $@.tmp $@ $(AM_V_at) mv $@.tmp $@
.dot.pdf: .gv.pdf:
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'` $(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
$(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp $(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
$(AM_V_at) mv $@.tmp $@ $(AM_V_at) mv $@.tmp $@
.dot.png: .gv.png:
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'` $(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
$(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp $(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp
$(AM_V_at) mv $@.tmp $@ $(AM_V_at) mv $@.tmp $@
+1 -1
View File
@@ -19,7 +19,7 @@
\def\finalout{\overfullrule=0pt} \def\finalout{\overfullrule=0pt}
%\finalout %\finalout
% Copyright (c) 1998, 2001, 2009-2013 Free Software Foundation, Inc. % Copyright (c) 1998, 2001, 2009-2015 Free Software Foundation, Inc.
% %
% This file is part of Bison. % This file is part of Bison.
% %
+1 -1
View File
@@ -16,7 +16,7 @@ straightforward use of _build/src/bison would.)
-- --
Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -1,6 +1,6 @@
#! /usr/bin/perl -w #! /usr/bin/perl -w
# Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc. # Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc.
# #
# This file is part of Bison, the GNU Compiler Compiler. # This file is part of Bison, the GNU Compiler Compiler.
# #
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc. ## Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify ## 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 ## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2013 Free Software Foundation, Inc. # Copyright (C) 2005-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+45 -35
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc. # Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
# Don't depend on $(BISON) otherwise we would rebuild these files # Don't depend on $(BISON) otherwise we would rebuild these files
# in srcdir, including during distcheck, which is forbidden. # in srcdir, including during distcheck, which is forbidden.
examples/calc++/calc++-parser.stamp: $(BISON_IN) %D%/calc++-parser.stamp: $(BISON_IN)
SUFFIXES += .yy .stamp SUFFIXES += .yy .stamp
.yy.stamp: .yy.stamp:
$(AM_V_YACC)rm -f $@ $(AM_V_YACC)rm -f $@
@@ -27,14 +27,14 @@ SUFFIXES += .yy .stamp
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $< $(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
$(AM_V_at)mv -f $@.tmp $@ $(AM_V_at)mv -f $@.tmp $@
$(calc_sources_generated): examples/calc++/calc++-parser.stamp $(calcxx_sources_generated): %D%/calc++-parser.stamp
@test -f $@ || rm -f examples/calc++/calc++-parser.stamp @test -f $@ || rm -f %D%/calc++-parser.stamp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/calc++/calc++-parser.stamp @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/calc++-parser.stamp
CLEANFILES += \ CLEANFILES += \
$(calc_sources_generated) \ $(calcxx_sources_generated) \
examples/calc++/calc++-parser.output \ %D%/calc++-parser.output \
examples/calc++/calc++-parser.stamp \ %D%/calc++-parser.stamp \
examples/calc++/calc++-scanner.cc %D%/calc++-scanner.cc
## -------------------- ## ## -------------------- ##
@@ -42,33 +42,43 @@ CLEANFILES += \
## -------------------- ## ## -------------------- ##
# Avoid using BUILT_SOURCES which is too global. # Avoid using BUILT_SOURCES which is too global.
$(examples_calc___calc___OBJECTS): $(calc_sources_generated) $(%C%_calc___OBJECTS): $(calcxx_sources_generated)
calc_sources_extracted = \ calcxx_sources_extracted = \
examples/calc++/calc++-driver.cc \ %D%/calc++-driver.cc \
examples/calc++/calc++-driver.hh \ %D%/calc++-driver.hh \
examples/calc++/calc++-scanner.ll \ %D%/calc++-scanner.ll \
examples/calc++/calc++.cc %D%/calc++.cc
calc_extracted = \ calcxx_extracted = \
$(calc_sources_extracted) \ $(calcxx_sources_extracted) \
examples/calc++/calc++-parser.yy %D%/calc++-parser.yy
extracted += $(calc_extracted) extracted += $(calcxx_extracted)
calc_sources_generated = \ calcxx_sources_generated = \
examples/calc++/calc++-parser.cc \ %D%/calc++-parser.cc \
examples/calc++/calc++-parser.hh \ %D%/calc++-parser.hh \
examples/calc++/location.hh \ %D%/location.hh \
examples/calc++/position.hh \ %D%/position.hh \
examples/calc++/stack.hh %D%/stack.hh
calc_sources = \ calcxx_sources = \
$(calc_sources_extracted) \ $(calcxx_sources_extracted) \
$(calc_sources_generated) $(calcxx_sources_generated)
if BISON_CXX_WORKS if FLEX_CXX_WORKS
check_PROGRAMS += examples/calc++/calc++ check_PROGRAMS += %D%/calc++
nodist_examples_calc___calc___SOURCES = \ nodist_%C%_calc___SOURCES = \
$(calc_sources) $(calcxx_sources)
examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++ %C%_calc___CPPFLAGS = -I$(top_builddir)/%D%
examples_calc___calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS) %C%_calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
dist_TESTS += examples/calc++/calc++.test dist_TESTS += %D%/calc++.test
else
EXTRA_DIST += %D%/calc++.test
endif endif
## ------------ ##
## Installing. ##
## ------------ ##
calcxxdir = $(docdir)/examples/calc++
calcxx_DATA = $(calcxx_extracted)
+15 -8
View File
@@ -3,7 +3,7 @@
# This file is part of GNU Bison # This file is part of GNU Bison
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2013 Free Software # Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015 Free Software
# Foundation, Inc. # Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Usage: extexi input-file.texi ... -- [FILES to extract] # Usage: extexi [OPTION...] input-file.texi ... -- [FILES to extract]
# Look for @example environments preceded with lines such as: # Look for @example environments preceded with lines such as:
# #
@@ -35,6 +35,9 @@
use strict; use strict;
# Whether we generate synclines.
my $synclines = 0;
# normalize($block) # normalize($block)
# ----------------- # -----------------
# Remove Texinfo mark up. # Remove Texinfo mark up.
@@ -102,7 +105,7 @@ sub process ($)
{ {
# Bison supports synclines, but not Flex. # Bison supports synclines, but not Flex.
$input .= sprintf ("#line %s \"$in\"\n", $. + 1) $input .= sprintf ("#line %s \"$in\"\n", $. + 1)
if $file =~ /\.[chy]*$/; if $synclines && $file =~ /\.[chy]*$/;
next; next;
} }
elsif (/^\@end (small)?example$/) elsif (/^\@end (small)?example$/)
@@ -136,15 +139,19 @@ my @input;
my $seen_dash = 0; my $seen_dash = 0;
for my $arg (@ARGV) for my $arg (@ARGV)
{ {
if ($arg eq '--') if ($seen_dash)
{
$seen_dash = 1;
}
elsif ($seen_dash)
{ {
use File::Basename; use File::Basename;
$file_wanted{basename($arg)} = $arg; $file_wanted{basename($arg)} = $arg;
} }
elsif ($arg eq '--')
{
$seen_dash = 1;
}
elsif ($arg eq '--synclines')
{
$synclines = 1;
}
else else
{ {
push @input, $arg; push @input, $arg;
+16 -13
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2005, 2008-2013 Free Software Foundation, Inc. # Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -13,8 +13,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
dist_noinst_SCRIPTS = examples/extexi examples/test dist_noinst_SCRIPTS = %D%/extexi %D%/test
TEST_LOG_COMPILER = $(top_srcdir)/examples/test TEST_LOG_COMPILER = $(top_srcdir)/%D%/test
AM_CXXFLAGS = \ AM_CXXFLAGS = \
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS) $(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
@@ -24,20 +24,23 @@ AM_CXXFLAGS = \
## ------------ ## ## ------------ ##
doc = $(top_srcdir)/doc/bison.texi doc = $(top_srcdir)/doc/bison.texi
extexi = $(top_srcdir)/examples/extexi extexi = $(top_srcdir)/%D%/extexi
extract = VERSION="$(VERSION)" $(PERL) -f $(extexi) $(doc) -- if ENABLE_GCC_WARNINGS
extexiFLAGS = --synclines
endif
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(extexiFLAGS) $(doc) --
extracted = extracted =
CLEANFILES += $(extracted) examples/extracted.stamp CLEANFILES += $(extracted) %D%/extracted.stamp
examples/extracted.stamp: $(doc) $(extexi) %D%/extracted.stamp: $(doc) $(extexi)
$(AM_V_GEN)rm -f $@ $@.tmp $(AM_V_GEN)rm -f $@ $@.tmp
$(AM_V_at)touch $@.tmp $(AM_V_at)touch $@.tmp
$(AM_V_at)$(extract) $(extracted) $(AM_V_at)$(extract) $(extracted)
$(AM_V_at)mv $@.tmp $@ $(AM_V_at)mv $@.tmp $@
$(extracted): examples/extracted.stamp $(extracted): %D%/extracted.stamp
@test -f $@ || rm -f examples/extracted.stamp @test -f $@ || rm -f %D%/extracted.stamp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
include examples/calc++/local.mk include %D%/calc++/local.mk
include examples/mfcalc/local.mk include %D%/mfcalc/local.mk
include examples/rpcalc/local.mk include %D%/rpcalc/local.mk
+16 -13
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc. # Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -18,19 +18,22 @@
## -------------------- ## ## -------------------- ##
BUILT_SOURCES += $(mfcalc_sources) BUILT_SOURCES += $(mfcalc_sources)
CLEANFILES += examples/mfcalc/mfcalc.[ch] examples/mfcalc/mfcalc.output CLEANFILES += %D%/mfcalc.[ch] %D%/mfcalc.output
mfcalc_extracted = \ mfcalc_extracted = %D%/calc.h %D%/mfcalc.y
examples/mfcalc/calc.h \ mfcalc_sources = $(mfcalc_extracted)
examples/mfcalc/mfcalc.y
mfcalc_sources = \
$(mfcalc_extracted)
extracted += $(mfcalc_extracted) extracted += $(mfcalc_extracted)
check_PROGRAMS += examples/mfcalc/mfcalc check_PROGRAMS += %D%/mfcalc
examples_mfcalc_mfcalc_LDADD = -lm %C%_mfcalc_LDADD = -lm
nodist_examples_mfcalc_mfcalc_SOURCES = \ nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources)
$(mfcalc_sources)
examples_mfcalc_mfcalc_CPPFLAGS = -I$(top_builddir)/examples/mfcalc %C%_mfcalc_CPPFLAGS = -I$(top_builddir)/%D%
dist_TESTS += examples/mfcalc/mfcalc.test dist_TESTS += %D%/mfcalc.test
## ------------ ##
## Installing. ##
## ------------ ##
mfcalcdir = $(docdir)/examples/mfcalc
mfcalc_DATA = $(mfcalc_extracted)
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2013 Free Software Foundation, Inc. # Copyright (C) 2005-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1
View File
@@ -1,4 +1,5 @@
/calc.h /calc.h
/rpcalc
/rpcalc.c /rpcalc.c
/rpcalc.h /rpcalc.h
/rpcalc.output /rpcalc.output
+16 -12
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc. # Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -18,18 +18,22 @@
## -------------------- ## ## -------------------- ##
BUILT_SOURCES += $(rpcalc_sources) BUILT_SOURCES += $(rpcalc_sources)
CLEANFILES += examples/rpcalc/rpcalc.[ch] examples/rpcalc/rpcalc.output CLEANFILES += %D%/rpcalc.[ch] %D%/rpcalc.output
rpcalc_extracted = \ rpcalc_extracted = %D%/rpcalc.y
examples/rpcalc/rpcalc.y rpcalc_sources = $(rpcalc_extracted)
rpcalc_sources = \
$(rpcalc_extracted)
extracted += $(rpcalc_extracted) extracted += $(rpcalc_extracted)
check_PROGRAMS += examples/rpcalc/rpcalc check_PROGRAMS += %D%/rpcalc
examples_rpcalc_rpcalc_LDADD = -lm %C%_rpcalc_LDADD = -lm
nodist_examples_rpcalc_rpcalc_SOURCES = \ nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources)
$(rpcalc_sources)
examples_rpcalc_rpcalc_CPPFLAGS = -I$(top_builddir)/examples/rpcalc %C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D%
dist_TESTS += examples/rpcalc/rpcalc.test dist_TESTS += %D%/rpcalc.test
## ------------ ##
## Installing. ##
## ------------ ##
rpcalcdir = $(docdir)/examples/rpcalc
rpcalc_DATA = $(rpcalc_extracted)
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2013 Free Software Foundation, Inc. # Copyright (C) 2005-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Copyright (C) 2005-2013 Free Software Foundation, Inc. # Copyright (C) 2005-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
+12 -6
View File
@@ -1,5 +1,5 @@
/* /*
Copyright (C) 2008-2013 Free Software Foundation, Inc. Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
*/ */
%debug %debug
%skeleton "lalr1.cc" %language "c++"
%defines %defines
%define api.token.constructor %define api.token.constructor
%define api.value.type variant %define api.value.type variant
@@ -48,11 +48,17 @@ typedef std::list<std::string> strings_type;
namespace std namespace std
{ {
std::ostream& std::ostream&
operator<< (std::ostream& o, const strings_type& s) operator<< (std::ostream& o, const strings_type& ss)
{ {
std::copy (s.begin (), s.end (), o << "(" << &ss << ") {";
std::ostream_iterator<strings_type::value_type> (o, "\n")); const char *sep = "";
return o; for (strings_type::const_iterator i = ss.begin(), end = ss.end();
i != end; ++i)
{
o << sep << *i;
sep = ", ";
}
return o << "}";
} }
} }
+1 -1
Submodule gnulib updated: e28fbd787c...7585eb3f16
+4
View File
@@ -272,3 +272,7 @@
/sig-handler.c /sig-handler.c
/unistd.c /unistd.c
/wctype-h.c /wctype-h.c
/lstat.c
/unlink.c
/gettimeofday.c
/sys_time.in.h
+1 -1
View File
@@ -1,6 +1,6 @@
/* Array bitsets. /* Array bitsets.
Copyright (C) 2002-2003, 2006, 2009-2013 Free Software Foundation, Copyright (C) 2002-2003, 2006, 2009-2015 Free Software Foundation,
Inc. Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Functions to support abitsets. /* Functions to support abitsets.
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Base bitset stuff. /* Base bitset stuff.
Copyright (C) 2002-2004, 2006, 2009-2013 Free Software Foundation, Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation,
Inc. Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* General bitsets. /* General bitsets.
Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Generic bitsets. /* Generic bitsets.
Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002-2004, 2009-2015 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Bitset statistics. /* Bitset statistics.
Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Functions to support bitset statistics. /* Functions to support bitset statistics.
Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002-2004, 2009-2015 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2001-2002, 2004, 2006, 2009-2013 Free Software Copyright (C) 2001-2002, 2004, 2006, 2009-2015 Free Software
Foundation, Inc. Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
+1 -1
View File
@@ -1,6 +1,6 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
Contributed by Akim Demaille (akim@freefriends.org). Contributed by Akim Demaille (akim@freefriends.org).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2001-2002, 2004-2006, 2009-2013 Free Software Copyright (C) 2001-2002, 2004-2006, 2009-2015 Free Software
Foundation, Inc. Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
+1 -1
View File
@@ -1,6 +1,6 @@
/* Bitset vectors. /* Bitset vectors.
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Functions to support expandable bitsets. /* Functions to support expandable bitsets.
Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Functions to support ebitsets. /* Functions to support ebitsets.
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* get-errno.c - get and set errno. /* get-errno.c - get and set errno.
Copyright (C) 2002, 2006, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* get-errno.h - get and set errno. /* get-errno.h - get and set errno.
Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* Functions to support link list bitsets. /* Functions to support link list bitsets.
Copyright (C) 2002-2004, 2006, 2009-2013 Free Software Foundation, Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation,
Inc. Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Functions to support lbitsets. /* Functions to support lbitsets.
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
+1 -1
View File
@@ -1,6 +1,6 @@
/* Fake libiberty.h for Bison. /* Fake libiberty.h for Bison.
Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002-2004, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
+4 -2
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2001-2013 Free Software Foundation, Inc. # Copyright (C) 2001-2015 Free Software Foundation, Inc.
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -51,6 +51,8 @@ lib_libbison_a_SOURCES += \
lib/get-errno.c lib/get-errno.c
# The Yacc compatibility library. # The Yacc compatibility library.
lib_LIBRARIES = $(YACC_LIBRARY) if ENABLE_YACC
lib_LIBRARIES = lib/liby.a
EXTRA_LIBRARIES = lib/liby.a EXTRA_LIBRARIES = lib/liby.a
lib_liby_a_SOURCES = lib/main.c lib/yyerror.c lib_liby_a_SOURCES = lib/main.c lib/yyerror.c
endif
+1 -1
View File
@@ -1,6 +1,6 @@
/* Yacc library main function. /* Yacc library main function.
Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc. Copyright (C) 2002, 2009-2015 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler. This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -1,6 +1,6 @@
/* Timing variables for measuring compiler performance. /* Timing variables for measuring compiler performance.
Copyright (C) 2000, 2002, 2004, 2006, 2009-2013 Free Software Copyright (C) 2000, 2002, 2004, 2006, 2009-2015 Free Software
Foundation, Inc. Foundation, Inc.
Contributed by Alex Samuel <samuel@codesourcery.com> Contributed by Alex Samuel <samuel@codesourcery.com>

Some files were not shown because too many files have changed in this diff Show More