Bison 2.5.1_rc2.
* tag 'v2.5.1_rc2': (34 commits)
Bison 2.5.1_rc2.
doc: fixes.
build: fix ChangeLog generation.
c++: compute the header guards.
skeletons: remove support for unused directive.
lalr1.cc: improve Doxygen documentation.
lalr1.cc: extract stack.hh.
news: convert to double quotes.
space changes.
build: do not prototype flex-generated functions.
build: fix ChangeLog generation.
Bison 2.5.1_rc1.
tests: save/restore Autotest special files when checking XML support.
tests: AT_SAVE_SPECIAL_FILES / AT_RESTORE_SPECIAL_FILES.
tests: honor TESTSUITEFLAGS in all the check targets.
build: do not enable c++ warnings on 0 when nullptr is not supported.
maint: update gnulib.
build: config.in.h.
build: move silent rules.
glr.c: reduce variable scopes.
maint: maintainer-release-check.
maint: shush a syntax-check.
maint: prefer "commit message" to "log entry".
command line: fix minor leaks.
maint: we no longer maintain the ChangeLog.
maint: fix the generation of the synclines for bison's parser.
maint: regen.
maint: import the xmemdup0 gnulib module.
maint: remove left-over gnulib modules.
maint: ignore files imported by autopoint.
build: AC_PROG_LEX: use more readable variable names.
maint: regen src/parse-gram.[ch]
maint: simplify parse-gram.y
maint: s/strncpy/memcpy/, when equivalent
Conflicts:
Makefile.am
NEWS
data/glr.c
data/lalr1.cc
data/stack.hh
examples/rpcalc/local.mk
src/flex-scanner.h
src/getargs.c
src/output.c
src/parse-gram.c
src/parse-gram.h
src/parse-gram.y
tests/Makefile.am
tests/bison.in
-ChangeLog merge=merge-changelog
+
gen_start_date = 2012-01-16
.PHONY: gen-ChangeLog
gen-ChangeLog:
- $(AM_V_GEN)if test -d .git; then \
- $(top_srcdir)/build-aux/gitlog-to-changelog \
- --no-cluster \
- --amend=$(srcdir)/build-aux/git-log-fix \
- --since=$(gen_start_date) > $(distdir)/cl-t; \
- rm -f $(distdir)/ChangeLog; \
- mv $(distdir)/cl-t $(distdir)/ChangeLog; \
+ $(AM_V_GEN)if test -d $(srcdir)/.git; then \
+ $(top_srcdir)/build-aux/gitlog-to-changelog \
+ --strip-tab \
+ --strip-cherry-picked \
+ --no-cluster \
+ --amend=$(srcdir)/build-aux/git-log-fix \
+ --since=$(gen_start_date) > $(distdir)/cl-t; \
+ rm -f $(distdir)/ChangeLog; \
+ mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
** Future changes:
- The next major release will drop support for K&R C.
+ The next major release will drop support for generating parsers in K&R C.
** yacc.c: YYBACKUP works as expected.
*** Location support is eliminated when not requested:
- GLR parsers used to include location-related code even when
- locations were not requested, and therefore not even usable.
+ GLR parsers used to include location-related code even when locations were
+ not requested, and therefore not even usable.
*** __attribute__ is preserved:
- __attribute__ is no longer disabled when __STRICT_ANSI__ is defined
- (i.e., when -std is passed to GCC).
+ __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
+ when -std is passed to GCC).
** lalr1.java: several fixes:
- The Java parser no longer throws ArrayIndexOutOfBoundsException if
- the first token leads to a syntax error. Some minor clean ups.
+ The Java parser no longer throws ArrayIndexOutOfBoundsException if the
+ first token leads to a syntax error. Some minor clean ups.
-** C++11 compatibility:
+** Changes for C++:
- C and C++ parsers use nullptr instead of 0 when __cplusplus is
- 201103L or higher.
+*** C++11 compatibility:
-** C++ locations:
+ C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
+ or higher.
- The position and location constructors (and their initialize
- methods) accept new arguments for line and column. Several issues
- in the documentation were fixed.
+*** Header guards
+
+ The header files such as "parser.hh", "location.hh", etc. used a constant
+ name for preprocessor guards, for instance:
+
+ #ifndef BISON_LOCATION_HH
+ # define BISON_LOCATION_HH
+ ...
+ #endif // !BISON_LOCATION_HH
+
+ The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
+ case characters are converted to upper case, and series of
+ non-alphanumerical characters are converted to an underscore.
+
+ With "bison -o lang++/parser.cc", "location.hh" would now include:
+
+ #ifndef YY_LANG_LOCATION_HH
+ # define YY_LANG_LOCATION_HH
+ ...
+ #endif // !YY_LANG_LOCATION_HH
+
+*** C++ locations:
+
+ The position and location constructors (and their initialize methods)
+ accept new arguments for line and column. Several issues in the
+ documentation were fixed.
** liby is no longer asking for "rpl_fprintf" on some platforms.
*** %printer is documented
- The %printer directive, supported since at least Bison 1.50, is
- finally documented. The %mfcalc example is extended to demonstrate
- its use of printer.
+ The "%printer" directive, supported since at least Bison 1.50, is finally
+ documented. The "mfcalc" example is extended to demonstrate it.
- The C++ parsers now also support yyoutput (as an alias to
- debug_stream ()) for consistency with the C skeletons.
+ For consistency with the C skeletons, the C++ parsers now also support
+ "yyoutput" (as an alias to "debug_stream ()").
*** Several improvements have been made:
- The layout for grammar excerpts was changed to a more compact
- scheme. Named references are motivated. The description of the
- automaton description file (*.output) is updated to the current
- format. Incorrect index entries were fixed. Some other errors were
- fixed.
+ The layout for grammar excerpts was changed to a more compact scheme.
+ Named references are motivated. The description of the automaton
+ description file (*.output) is updated to the current format. Incorrect
+ index entries were fixed. Some other errors were fixed.
+
+** Building bison:
+
+*** Conflicting prototypes with recent/modified Flex.
-** Changes to the build system:
+ Fixed build problems with the current, unreleased, version of Flex, and
+ some modified versions of 2.5.35, which have modified function prototypes.
*** Warnings during the build procedure have been eliminated.
*** Several portability problems in the test suite have been fixed:
- This includes warnings with some compilers, unexpected behavior of
- tools such as diff, warning messages from the test suite itself,
- etc.
+ This includes warnings with some compilers, unexpected behavior of tools
+ such as diff, warning messages from the test suite itself, etc.
*** The install-pdf target work properly:
- Running "make install-pdf" (or -dvi, -html, -info, and -ps) no
- longer halts in the middle of its course.
+ Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
+ halts in the middle of its course.
* Changes in version 2.5 (2011-05-14):
%define lr.type canonical-lr
The default-reduction optimization in the parser tables can also be
- adjusted using `%define lr.default-reductions'. For details on both
- of these features, see the new section `Tuning LR' in the Bison
+ adjusted using "%define lr.default-reductions". For details on both
+ of these features, see the new section "Tuning LR" in the Bison
manual.
These features are experimental. More user feedback will help to
cause error recovery to begin in a different syntactic context than
the one in which the invalid token was encountered. Second, when
verbose error messages are enabled (with %error-verbose or the
- obsolete `#define YYERROR_VERBOSE'), the expected token list in the
+ obsolete "#define YYERROR_VERBOSE"), the expected token list in the
syntax error message can both contain invalid tokens and omit valid
tokens.
%define parse.lac full
- See the new section `LAC' in the Bison manual for additional
+ See the new section "LAC" in the Bison manual for additional
details including a few caveats.
LAC is an experimental feature. More user feedback will help to
except that the manner in which Bison processes multiple definitions
for the same NAME differs. Most importantly, -F and --force-define
quietly override %define, but -D and --define do not. For further
- details, see the section `Bison Options' in the Bison manual.
+ details, see the section "Bison Options" in the Bison manual.
*** Variables renamed:
Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
macro and use it in the default YYLLOC_DEFAULT. You are encouraged
- to use it. If, for instance, your location structure has `first'
- and `last' members, instead of
+ to use it. If, for instance, your location structure has "first"
+ and "last" members, instead of
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
** Verbose syntax error message fixes:
- When %error-verbose or the obsolete `#define YYERROR_VERBOSE' is
+ When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
specified, syntax error messages produced by the generated parser
include the unexpected token as well as a list of expected tokens.
The effect of %nonassoc on these verbose messages has been corrected
in order to detect a syntax error. Because no unexpected token or
expected tokens can then be reported, the verbose syntax error
message described above is suppressed, and the parser instead
- reports the simpler message, `syntax error'. Previously, this
+ reports the simpler message, "syntax error". Previously, this
suppression was sometimes erroneously triggered by %nonassoc when a
lookahead was actually required. Now verbose messages are
suppressed only when all previous lookaheads have already been
** -W/--warnings fixes:
-*** Bison now properly recognizes the `no-' versions of categories:
+*** Bison now properly recognizes the "no-" versions of categories:
For example, given the following command line, Bison now enables all
warnings except warnings for incompatibilities with POSIX Yacc:
Previously, conflict reports were independent of Bison's normal
warning system. Now, Bison recognizes the warning categories
- `conflicts-sr' and `conflicts-rr'. This change has important
+ "conflicts-sr" and "conflicts-rr". This change has important
consequences for the -W and --warnings command-line options. For
example:
expected number of conflicts is not reported, so -W and --warning
then have no effect on the conflict report.
-*** The `none' category no longer disables a preceding `error':
+*** The "none" category no longer disables a preceding "error":
For example, for the following command line, Bison now reports
errors instead of warnings for incompatibilities with POSIX Yacc:
bison -Werror,none,yacc gram.y
-*** The `none' category now disables all Bison warnings:
+*** The "none" category now disables all Bison warnings:
- Previously, the `none' category disabled only Bison warnings for
+ Previously, the "none" category disabled only Bison warnings for
which there existed a specific -W/--warning category. However,
given the following command line, Bison is now guaranteed to
suppress all warnings:
errors should no longer cause M4 to report a broken pipe on the
affected platforms.
-** `%prec IDENTIFIER' requires IDENTIFIER to be defined separately.
+** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
POSIX specifies that an error be reported for any identifier that does
not appear on the LHS of a grammar rule and that is not defined by
that YYFAIL will automatically invoke yyerror to report the syntax
error so that you don't have to. However, there are several other
subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
- inherent flaws when %error-verbose or `#define YYERROR_VERBOSE' is
+ inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
used. For a more detailed discussion, see:
http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html
Bison features compatible with it. Thus, during parser generation,
Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
rule action. In a later release, YYFAIL will be disabled for
- %error-verbose and `#define YYERROR_VERBOSE'. Eventually, YYFAIL will
+ %error-verbose and "#define YYERROR_VERBOSE". Eventually, YYFAIL will
be removed altogether.
There exists at least one case where Bison 2.5's YYFAIL warning will
Bison-defined macros for the sole purpose of suppressing C
preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
To avoid Bison's future warning, such YYFAIL uses can be moved to the
- epilogue (that is, after the second `%%') in the Bison input file. In
+ epilogue (that is, after the second "%%") in the Bison input file. In
this release (2.4.2), Bison already generates its own code to suppress
C preprocessor warnings for YYFAIL, so projects can remove their own
phony uses of YYFAIL if compatibility with Bison releases prior to
exp: exp "+" exp { $$ = $1 + $3; };
- Some grammars still depend on this `feature'. Bison 2.4.1 restores
+ Some grammars still depend on this "feature". Bison 2.4.1 restores
the previous behavior in the case of C output (specifically, when
neither %language or %skeleton or equivalent command-line options
are used) to leave more time for grammars depending on the old
%define NAME "VALUE"
-** The directive `%pure-parser' is now deprecated in favor of:
+** The directive "%pure-parser" is now deprecated in favor of:
%define api.pure
** Push Parsing
Bison can now generate an LALR(1) parser in C with a push interface. That
- is, instead of invoking `yyparse', which pulls tokens from `yylex', you can
- push one token at a time to the parser using `yypush_parse', which will
+ is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
+ push one token at a time to the parser using "yypush_parse", which will
return to the caller after processing each token. By default, the push
interface is disabled. Either of the following directives will enable it:
%define api.push_pull "push" // Just push; does not require yylex.
%define api.push_pull "both" // Push and pull; requires yylex.
- See the new section `A Push Parser' in the Bison manual for details.
+ See the new section "A Push Parser" in the Bison manual for details.
The current push parsing interface is experimental and may evolve. More user
feedback will help to stabilize it.
** Java
Bison can now generate an LALR(1) parser in Java. The skeleton is
- `data/lalr1.java'. Consider using the new %language directive instead of
+ "data/lalr1.java". Consider using the new %language directive instead of
%skeleton to select it.
- See the new section `Java Parsers' in the Bison manual for details.
+ See the new section "Java Parsers" in the Bison manual for details.
The current Java interface is experimental and may evolve. More user
feedback will help to stabilize it.
** XML Automaton Report
Bison can now generate an XML report of the LALR(1) automaton using the new
- `--xml' option. The current XML schema is experimental and may evolve. More
+ "--xml" option. The current XML schema is experimental and may evolve. More
user feedback will help to stabilize it.
** The grammar file may now specify the name of the parser header file using
%define lr.keep_unreachable_states
- See the %define entry in the `Bison Declaration Summary' in the Bison manual
+ See the %define entry in the "Bison Declaration Summary" in the Bison manual
for further discussion.
-** Lookahead Set Correction in the `.output' Report
+** Lookahead Set Correction in the ".output" Report
- When instructed to generate a `.output' file including lookahead sets
- (using `--report=lookahead', for example), Bison now prints each reduction's
+ When instructed to generate a ".output" file including lookahead sets
+ (using "--report=lookahead", for example), Bison now prints each reduction's
lookahead set only next to the associated state's one item that (1) is
associated with the same rule as the reduction and (2) has its dot at the end
of its RHS. Previously, Bison also erroneously printed the lookahead set
next to all of the state's other items associated with the same rule. This
- bug affected only the `.output' file and not the generated parser source
+ bug affected only the ".output" file and not the generated parser source
code.
-** --report-file=FILE is a new option to override the default `.output' file
+** --report-file=FILE is a new option to override the default ".output" file
name.
-** The `=' that used to be required in the following directives is now
+** The "=" that used to be required in the following directives is now
deprecated:
%file-prefix "parser"
%name-prefix "c_"
%output "parser.c"
-** An Alternative to `%{...%}' -- `%code QUALIFIER {CODE}'
+** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
Bison 2.3a provided a new set of directives as a more flexible alternative to
the traditional Yacc prologue blocks. Those have now been consolidated into
the purpose of the code and thus the location(s) where Bison should generate
it:
- 1. `%code {CODE}' replaces `%after-header {CODE}'
- 2. `%code requires {CODE}' replaces `%start-header {CODE}'
- 3. `%code provides {CODE}' replaces `%end-header {CODE}'
- 4. `%code top {CODE}' replaces `%before-header {CODE}'
+ 1. "%code {CODE}" replaces "%after-header {CODE}"
+ 2. "%code requires {CODE}" replaces "%start-header {CODE}"
+ 3. "%code provides {CODE}" replaces "%end-header {CODE}"
+ 4. "%code top {CODE}" replaces "%before-header {CODE}"
- See the %code entries in section `Bison Declaration Summary' in the Bison
- manual for a summary of the new functionality. See the new section `Prologue
- Alternatives' for a detailed discussion including the advantages of %code
+ See the %code entries in section "Bison Declaration Summary" in the Bison
+ manual for a summary of the new functionality. See the new section "Prologue
+ Alternatives" for a detailed discussion including the advantages of %code
over the traditional Yacc prologues.
The prologue alternatives are experimental. More user feedback will help to
sometimes prove to be false alarms in existing grammars employing the Yacc
constructs $0 or $-N (where N is some positive integer).
- To enable these warnings, specify the option `--warnings=midrule-values' or
- `-W', which is a synonym for `--warnings=all'.
+ To enable these warnings, specify the option "--warnings=midrule-values" or
+ "-W", which is a synonym for "--warnings=all".
-** Default %destructor or %printer with `<*>' or `<>'
+** Default %destructor or %printer with "<*>" or "<>"
Bison now recognizes two separate kinds of default %destructor's and
%printer's:
- 1. Place `<*>' in a %destructor/%printer symbol list to define a default
+ 1. Place "<*>" in a %destructor/%printer symbol list to define a default
%destructor/%printer for all grammar symbols for which you have formally
declared semantic type tags.
- 2. Place `<>' in a %destructor/%printer symbol list to define a default
+ 2. Place "<>" in a %destructor/%printer symbol list to define a default
%destructor/%printer for all grammar symbols without declared semantic
type tags.
- Bison no longer supports the `%symbol-default' notation from Bison 2.3a.
- `<*>' and `<>' combined achieve the same effect with one exception: Bison no
+ Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
+ "<*>" and "<>" combined achieve the same effect with one exception: Bison no
longer applies any %destructor to a mid-rule value if that mid-rule value is
not actually ever referenced using either $$ or $n in a semantic action.
feedback will help to determine whether they should become permanent
features.
- See the section `Freeing Discarded Symbols' in the Bison manual for further
+ See the section "Freeing Discarded Symbols" in the Bison manual for further
details.
** %left, %right, and %nonassoc can now declare token numbers. This is required
- by POSIX. However, see the end of section `Operator Precedence' in the Bison
+ by POSIX. However, see the end of section "Operator Precedence" in the Bison
manual for a caveat concerning the treatment of literal strings.
** The nonfunctional --no-parser, -n, and %no-parser options have been
%destructor { } <character>
guarantees that, when the parser discards any user-defined symbol that has a
- semantic type tag other than `<character>', it passes its semantic value to
- `free'. However, when the parser discards a `STRING1' or a `string1', it
- also prints its line number to `stdout'. It performs only the second
- `%destructor' in this case, so it invokes `free' only once.
+ semantic type tag other than "<character>", it passes its semantic value to
+ "free". However, when the parser discards a "STRING1" or a "string1", it
+ also prints its line number to "stdout". It performs only the second
+ "%destructor" in this case, so it invokes "free" only once.
[Although we failed to mention this here in the 2.3a release, the default
%destructor's and %printer's were experimental, and they were rewritten in
future versions.]
-** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with `-y',
- `--yacc', or `%yacc'), Bison no longer generates #define statements for
+** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
+ "--yacc", or "%yacc"), Bison no longer generates #define statements for
associating token numbers with token names. Removing the #define statements
helps to sanitize the global namespace during preprocessing, but POSIX Yacc
requires them. Bison still generates an enum for token names in all cases.
potentially incompatible with previous releases of Bison.
As before, you declare prologue blocks in your grammar file with the
- `%{ ... %}' syntax. To generate the pre-prologue, Bison concatenates all
+ "%{ ... %}" syntax. To generate the pre-prologue, Bison concatenates all
prologue blocks that you've declared before the first %union. To generate
the post-prologue, Bison concatenates all prologue blocks that you've
declared after the first %union.
* the code file before the contents of the header file. It does *not*
* insert it into the header file. This is a good place to put
* #include's that you want at the top of your code file. A common
- * example is `#include "system.h"'. */
+ * example is '#include "system.h"'. */
}
%start-header {
/* Bison inserts this block into both the header file and the code file.
[Although we failed to mention this here in the 2.3a release, the prologue
alternatives were experimental, and they were rewritten in future versions.]
-** The option `--report=look-ahead' has been changed to `--report=lookahead'.
+** The option "--report=look-ahead" has been changed to "--report=lookahead".
The old spelling still works, but is not documented and may be removed
in a future release.
* Changes in version 2.3, 2006-06-05:
-** GLR grammars should now use `YYRECOVERING ()' instead of `YYRECOVERING',
+** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
for compatibility with LALR(1) grammars.
** It is now documented that any definition of YYSTYPE or YYLTYPE should
The %parse-params are available in the destructors (and the
experimental printers) as per the documentation.
-** Bison now warns if it finds a stray `$' or `@' in an action.
+** Bison now warns if it finds a stray "$" or "@" in an action.
** %require "VERSION"
This specifies that the grammar file depends on features implemented
** lalr1.cc: The token and value types are now class members.
The tokens were defined as free form enums and cpp macros. YYSTYPE
was defined as a free form union. They are now class members:
- tokens are enumerations of the `yy::parser::token' struct, and the
- semantic values have the `yy::parser::semantic_type' type.
+ tokens are enumerations of the "yy::parser::token" struct, and the
+ semantic values have the "yy::parser::semantic_type" type.
If you do not want or can update to this scheme, the directive
- `%define "global_tokens_and_yystype" "1"' triggers the global
+ '%define "global_tokens_and_yystype" "1"' triggers the global
definition of tokens and YYSTYPE. This change is suitable both
for previous releases of Bison, and this one.
If you wish to update, then make sure older version of Bison will
- fail using `%require "2.2"'.
+ fail using '%require "2.2"'.
** DJGPP support added.
\f
- A new directive "%expect-rr N" specifies the expected number of
reduce/reduce conflicts in GLR parsers.
- - %token numbers can now be hexadecimal integers, e.g., `%token FOO 0x12d'.
+ - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
This is a GNU extension.
- - The option `--report=lookahead' was changed to `--report=look-ahead'.
+ - The option "--report=lookahead" was changed to "--report=look-ahead".
[However, this was changed back after 2.3.]
- Experimental %destructor support has been added to lalr1.cc.
This reverts to the behavior of Bison 1.33 and earlier, and improves
compatibility with Yacc.
- - `parse error' -> `syntax error'
- Bison now uniformly uses the term `syntax error'; formerly, the code
- and manual sometimes used the term `parse error' instead. POSIX
- requires `syntax error' in diagnostics, and it was thought better to
+ - "parse error" -> "syntax error"
+ Bison now uniformly uses the term "syntax error"; formerly, the code
+ and manual sometimes used the term "parse error" instead. POSIX
+ requires "syntax error" in diagnostics, and it was thought better to
be consistent.
- The documentation now emphasizes that yylex and yyerror must be
output as "foo\\bar.y".
- Yacc command and library now available
- The Bison distribution now installs a `yacc' command, as POSIX requires.
+ The Bison distribution now installs a "yacc" command, as POSIX requires.
Also, Bison now installs a small library liby.a containing
implementations of Yacc-compatible yyerror and main functions.
This library is normally not useful, but POSIX requires it.
** Other compatibility issues
- - %union directives can now have a tag before the `{', e.g., the
- directive `%union foo {...}' now generates the C code
- `typedef union foo { ... } YYSTYPE;'; this is for Yacc compatibility.
- The default union tag is `YYSTYPE', for compatibility with Solaris 9 Yacc.
- For consistency, YYLTYPE's struct tag is now `YYLTYPE' not `yyltype'.
+ - %union directives can now have a tag before the "{", e.g., the
+ directive "%union foo {...}" now generates the C code
+ "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
+ The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
+ For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
This is for compatibility with both Yacc and Bison 1.35.
- - `;' is output before the terminating `}' of an action, for
+ - ";" is output before the terminating "}" of an action, for
compatibility with Bison 1.35.
- Bison now uses a Yacc-style format for conflict reports, e.g.,
- `conflicts: 2 shift/reduce, 1 reduce/reduce'.
+ "conflicts: 2 shift/reduce, 1 reduce/reduce".
- - `yystype' and `yyltype' are now obsolescent macros instead of being
+ - "yystype" and "yyltype" are now obsolescent macros instead of being
typedefs or tags; they are no longer documented and are planned to be
withdrawn in a future release.
- GLR and inline
Users of Bison have to decide how they handle the portability of the
- C keyword `inline'.
+ C keyword "inline".
- - `parsing stack overflow...' -> `parser stack overflow'
- GLR parsers now report `parser stack overflow' as per the Bison manual.
+ - "parsing stack overflow..." -> "parser stack overflow"
+ GLR parsers now report "parser stack overflow" as per the Bison manual.
** Bison now warns if it detects conflicting outputs to the same file,
- e.g., it generates a warning for `bison -d -o foo.h foo.y' since
+ e.g., it generates a warning for "bison -d -o foo.h foo.y" since
that command outputs both code and header to foo.h.
** #line in output files
** Output Directory
When not in Yacc compatibility mode, when the output file was not
- specified, running `bison foo/bar.y' created `foo/bar.c'. It
- now creates `bar.c'.
+ specified, running "bison foo/bar.y" created "foo/bar.c". It
+ now creates "bar.c".
** Undefined token
The undefined token was systematically mapped to 2 which prevented
will be mapped onto another number.
** Verbose error messages
- They no longer report `..., expecting error or...' for states where
+ They no longer report "..., expecting error or..." for states where
error recovery is possible.
** End token
- Defaults to `$end' instead of `$'.
+ Defaults to "$end" instead of "$".
** Error recovery now conforms to documentation and to POSIX
When a Bison-generated parser encounters a syntax error, it now pops
Rules that can never be reduced because of conflicts are now
reported.
-** Incorrect `Token not used'
+** Incorrect "Token not used"
On a grammar such as
%token useless useful
exp: '0' %prec useful;
where a token was used to set the precedence of the last rule,
- bison reported both `useful' and `useless' as useless tokens.
+ bison reported both "useful" and "useless" as useless tokens.
** Revert the C++ namespace changes introduced in 1.31
as they caused too many portability hassles.
** Token end-of-file
The token end of file may be specified by the user, in which case,
the user symbol is used in the reports, the graphs, and the verbose
- error messages instead of `$end', which remains being the default.
+ error messages instead of "$end", which remains being the default.
For instance
%token MYEOF 0
or
Croatian, thanks to Denis Lackovic.
** Incorrect token definitions
- When given `%token 'a' "A"', Bison used to output `#define 'a' 65'.
+ When given
+ %token 'a' "A"
+ bison used to output
+ #define 'a' 65
** Token definitions as enums
Tokens are output both as the traditional #define's, and, provided
produces additional information:
- itemset
complete the core item sets with their closure
- - lookahead [changed to `look-ahead' in 1.875e through 2.3, but changed back]
+ - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
explicitly associate lookahead tokens to items
- solved
describe shift/reduce conflicts solving.
** File name clashes are detected
$ bison foo.y -d -o foo.x
- fatal error: header and parser would both be named `foo.x'
+ fatal error: header and parser would both be named "foo.x"
-** A missing `;' at the end of a rule triggers a warning
+** A missing ";" at the end of a rule triggers a warning
In accordance with POSIX, and in agreement with other
Yacc implementations, Bison will mandate this semicolon in the near
future. This eases the implementation of a Bison parser of Bison
GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
Bison dies on incorrect %expectations, we fear there will be
too many bug reports for Gettext, so _for the time being_, %expect
- does not trigger an error when the input file is named `plural.y'.
+ does not trigger an error when the input file is named "plural.y".
** Use of alloca in parsers
If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
New.
** --output
- New, aliasing `--output-file'.
+ New, aliasing "--output-file".
\f
* Changes in version 1.30, 2001-10-26:
-** `--defines' and `--graph' have now an optional argument which is the
- output file name. `-d' and `-g' do not change; they do not take any
+** "--defines" and "--graph" have now an optional argument which is the
+ output file name. "-d" and "-g" do not change; they do not take any
argument.
-** `%source_extension' and `%header_extension' are removed, failed
+** "%source_extension" and "%header_extension" are removed, failed
experiment.
** Portability fixes.
** The output file does not define const, as this caused problems when used
with common autoconfiguration schemes. If you still use ancient compilers
that lack const, compile with the equivalent of the C compiler option
- `-Dconst='. Autoconf's AC_C_CONST macro provides one way to do this.
+ "-Dconst=". Autoconf's AC_C_CONST macro provides one way to do this.
-** Added `-g' and `--graph'.
+** Added "-g" and "--graph".
** The Bison manual is now distributed under the terms of the GNU FDL.
** Added the old Bison reference card.
-** Added `--locations' and `%locations'.
+** Added "--locations" and "%locations".
-** Added `-S' and `--skeleton'.
+** Added "-S" and "--skeleton".
-** `%raw', `-r', `--raw' is disabled.
+** "%raw", "-r", "--raw" is disabled.
** Special characters are escaped when output. This solves the problems
of the #line lines with path names including backslashes.
** New directives.
- `%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose',
- `%debug', `%source_extension' and `%header_extension'.
+ "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
+ "%debug", "%source_extension" and "%header_extension".
** @$
Automatic location tracking.
Local Variables:
mode: outline
+fill-column: 76
End:
the appropriate paperwork. Second, be sure to add their name and
email address to THANKS.
-** If a change fixes a test, mention the test in the ChangeLog entry.
+** If a change fixes a test, mention the test in the commit message.
** Bug reports
-If somebody reports a new bug, mention his name in the ChangeLog entry
+If somebody reports a new bug, mention his name in the commit message
and in the test case you write. Put him into THANKS.
The correct response to most actual bugs is to write a new test case
which demonstrates the bug. Then fix the bug, re-run the test suite,
and check everything in.
-** You may find it useful to install the git-merge-changelog merge driver:
-
- http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c
-
-When following the generic installation instructions there, keep in mind that
-your clone of Bison's git repository already contains appropriate
-.gitattributes files, and running Bison's bootstrap script will make the
-necessary changes to .git/config.
-
* Hacking
lib/m4sugar/m4sugar.m4
lib/m4sugar/foreach.m4
-These files don't change very often in autoconf, so it should be
+These files don't change very often in Autoconf, so it should be
relatively straight-forward to examine the differences in order to
decide whether to update.
- Build with -DGNULIB_POSIXCHECK. It suggests gnulib modules that can
fix portability issues.
+- Check with `make syntax-check' if there are issues diagnosed by
+ gnulib.
+
- run `make maintainer-check' which:
- runs `valgrind -q bison' to run Bison under Valgrind.
- runs the parsers under Valgrind.
Bison's included XSLT style sheets with the output of --report=all and
--graph.
+- running `make maintainer-release-check' takes care of running
+ maintainer-check, maintainer-push-check and maintainer-xml-check.
+
- Change tests/atlocal/CFLAGS to add your preferred options. For
instance, `-traditional' to check that the parsers are K&R. Note
that it does not make sense for glr.c, which should be ANSI,
The version number, *and* the date of the release (including for
betas).
-** Update ChangeLog
-Should have an entry similar to `Version 1.49b.'.
+** Mention the release name in a commit message
+Should have an entry similar to `Version 2.3b.'.
** Tag the release
-Before Bison will build with the right version number, you must tag the release
-in git. Do this after all other changes. The command is similar to:
+Before Bison will build with the right version number, you must tag
+the release in git. Do this after all other changes. The command is
+similar to:
git tag -a v2.3b
-The log message can be simply:
+The commit message can be simply:
Bison 2.3b
Vin Shelton acs@alumni.princeton.edu
W.C.A. Wijngaards wouter@NLnetLabs.nl
Wayne Green wayne@infosavvy.com
+Wei Song wsong83@gmail.com
Wolfgang S. Kechel wolfgang.kechel@prs.de
Wolfram Wagner ww@mpi-sb.mpg.de
Wwp subscript@free.fr
The code bw glr.c and yacc.c is really alike, we can certainly factor
some parts.
-* Header guards
-
-From François: should we keep the directory part in the CPP guard?
-
* Yacc.c: CPP Macros
#! /bin/sh
# Print a version string.
-scriptversion=2012-04-16.16; # UTC
+scriptversion=2012-05-15.06; # UTC
# Bootstrap this package from checked-out sources.
LC_ALL=C
export LC_ALL
+# Ensure that CDPATH is not set. Otherwise, the output from cd
+# would cause trouble in at least one use below.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
local_gl_dir=gl
me=$0
p
}
'
-package=`sed -n "$extract_package_name" configure.ac` || exit
+package=$(sed -n "$extract_package_name" configure.ac) || exit
gnulib_name=lib$package
build_aux=build-aux
usage
exit;;
--gnulib-srcdir=*)
- GNULIB_SRCDIR=`expr "X$option" : 'X--gnulib-srcdir=\(.*\)'`;;
+ GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
--skip-po)
SKIP_PO=t;;
--force)
file=$1
str=$2
test -f $file || touch $file
- echo "$str" | sort_patterns - $file | cmp - $file > /dev/null \
+ echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|| { echo "$str" | sort_patterns - $file > $file.bak \
&& mv $file.bak $file; } \
|| exit 1
# A .gitignore entry that does not start with '/' applies
# recursively to subdirectories, so prepend '/' to every
# .gitignore entry.
- pattern=`echo "$pattern" | sed s,^,/,`;;
+ pattern=$(echo "$pattern" | sed s,^,/,);;
esac
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
}
$use_git || continue
fi
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
- appvar=`echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
+ appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_')
test "$appvar" = TAR && appvar=AMTAR
case $appvar in
GZIP) ;; # Do not use $GZIP: it contains gzip options.
*) eval "app=\${$appvar-$app}" ;;
esac
+
+ # Handle the still-experimental Automake-NG programs specially.
+ # They remain named as the mainstream Automake programs ("automake",
+ # and "aclocal") to avoid gratuitous incompatibilities with
+ # pre-existing usages (by, say, autoreconf, or custom autogen.sh
+ # scripts), but correctly identify themselves (as being part of
+ # "GNU automake-ng") when asked their version.
+ case $app in
+ automake-ng|aclocal-ng)
+ app=${app%-ng}
+ ($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
+ echo "$me: Error: '$app' not found or not from Automake-NG" >&2
+ ret=1
+ continue
+ } ;;
+ esac
if [ "$req_ver" = "-" ]; then
# Merely require app to exist; not all prereq apps are well-behaved
# so we have to rely on $? rather than get_version.
# When we can deduce that gnulib-tool will require patch,
# and when patch is not already listed as a prerequisite, add it, too.
-if test ! -d "$local_gl_dir" \
- || find "$local_gl_dir" -name '*.diff' -exec false {} +; then
- :
-else
+if test -d "$local_gl_dir" \
+ && ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then
case $buildreq in
*patch*) ;;
*) buildreq="patch -
test -f .gitmodules && git config --file .gitmodules "$@"
}
-gnulib_path=`git_modules_config submodule.gnulib.path`
+gnulib_path=$(git_modules_config submodule.gnulib.path)
test -z "$gnulib_path" && gnulib_path=gnulib
# Get gnulib files.
subdir=$1
domain=$2
echo "$me: getting translations into $subdir for $domain..."
- cmd=`printf "$po_download_command_format" "$domain" "$subdir"`
+ cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
eval "$cmd" && return
# Fallback to HTTP.
- cmd=`printf "$po_download_command_format2" "$subdir" "$domain"`
+ cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
eval "$cmd"
}
&& ls "$ref_po_dir"/*.po 2>/dev/null |
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
- langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
+ langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
test "$langs" = '*' && langs=x
for po in $langs; do
case $po in x) continue;; esac
# If the destination directory doesn't exist, create it.
# This is required at least for "lib/uniwidth/cjk.h".
- dst_dir=`dirname "$dst"`
+ dst_dir=$(dirname "$dst")
if ! test -d "$dst_dir"; then
mkdir -p "$dst_dir"
# If we've just created a directory like lib/uniwidth,
# tell version control system(s) it's ignorable.
# FIXME: for now, this does only one level
- parent=`dirname "$dst_dir"`
+ parent=$(dirname "$dst_dir")
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
ig=$parent/$dot_ig
- insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'`
+ insert_vc_ignore $ig "${dst_dir##*/}"
done
fi
# so that broken tools aren't confused into skipping needed builds. See
# <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
test -h "$dst" &&
- src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
- dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
+ src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
+ dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
test "$src_i" = "$dst_i" &&
- both_ls=`ls -dt "$src" "$dst"` &&
+ both_ls=$(ls -dt "$src" "$dst") &&
test "X$both_ls" = "X$dst$nl$src" || {
dot_dots=
case $src in
}
}
+version_controlled_file() {
+ parent=$1
+ file=$2
+ if test -d .git; then
+ git rm -n "$file" > /dev/null 2>&1
+ elif test -d .svn; then
+ svn log -r HEAD "$file" > /dev/null 2>&1
+ elif test -d CVS; then
+ grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
+ grep '^/[^/]*/[0-9]' > /dev/null
+ else
+ echo "$me: no version control for $file?" >&2
+ false
+ fi
+}
+
# NOTE: we have to be careful to run both autopoint and libtoolize
# before gnulib-tool, since gnulib-tool is likely to provide newer
# versions of files "installed" by these two programs.
grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
with_gettext=no
-if test $with_gettext = yes; then
- # Released autopoint has the tendency to install macros that have been
- # obsoleted in current gnulib, so run this before gnulib-tool.
- echo "$0: $AUTOPOINT --force"
- $AUTOPOINT --force || exit
-fi
+if test $with_gettext = yes || test $use_libtool = 1; then
-# Autoreconf runs aclocal before libtoolize, which causes spurious
-# warnings if the initial aclocal is confused by the libtoolized
-# (or worse out-of-date) macro directory.
-if test $use_libtool = 1; then
- echo "running: $LIBTOOLIZE --copy --install"
- $LIBTOOLIZE --copy --install
-fi
+ tempbase=.bootstrap$$
+ trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
-version_controlled_file() {
- dir=$1
- file=$2
- found=no
- if test -d CVS; then
- grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
- grep '^/[^/]*/[0-9]' > /dev/null && found=yes
- elif test -d .git; then
- git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
- elif test -d .svn; then
- svn log -r HEAD "$dir/$file" > /dev/null 2>&1 && found=yes
- else
- echo "$me: no version control for $dir/$file?" >&2
+ > $tempbase.0 > $tempbase.1 &&
+ find . ! -type d -print | sort > $tempbase.0 || exit
+
+ if test $with_gettext = yes; then
+ # Released autopoint has the tendency to install macros that have been
+ # obsoleted in current gnulib, so run this before gnulib-tool.
+ echo "$0: $AUTOPOINT --force"
+ $AUTOPOINT --force || exit
fi
- test $found = yes
-}
+
+ # Autoreconf runs aclocal before libtoolize, which causes spurious
+ # warnings if the initial aclocal is confused by the libtoolized
+ # (or worse out-of-date) macro directory.
+ # libtoolize 1.9b added the --install option; but we support back
+ # to libtoolize 1.5.22, where the install action was default.
+ if test $use_libtool = 1; then
+ install=
+ case $($LIBTOOLIZE --help) in
+ *--install*) install=--install ;;
+ esac
+ echo "running: $LIBTOOLIZE $install --copy"
+ $LIBTOOLIZE $install --copy
+ fi
+
+ find . ! -type d -print | sort >$tempbase.1
+ old_IFS=$IFS
+ IFS=$nl
+ for file in $(comm -13 $tempbase.0 $tempbase.1); do
+ IFS=$old_IFS
+ parent=${file%/*}
+ version_controlled_file "$parent" "$file" || {
+ for dot_ig in x $vc_ignore; do
+ test $dot_ig = x && continue
+ ig=$parent/$dot_ig
+ insert_vc_ignore "$ig" "${file##*/}"
+ done
+ }
+ done
+ IFS=$old_IFS
+
+ rm -f $tempbase.0 $tempbase.1
+ trap - 1 2 13 15
+fi
# Import from gnulib.
for file in $gnulib_extra_files; do
case $file in
*/INSTALL) dst=INSTALL;;
- build-aux/*) dst=$build_aux/`expr "$file" : 'build-aux/\(.*\)'`;;
+ build-aux/*) dst=$build_aux/${file#build-aux/};;
*) dst=$file;;
esac
symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit
}
' po/Makevars.template >po/Makevars || exit 1
- cat $GNULIB_SRCDIR/build-aux/po/Makefile.in.in > po/Makefile.in.in || exit 1
+ # If the 'gettext' module is in use, grab the latest Makefile.in.in.
+ # If only the 'gettext-h' module is in use, assume autopoint already
+ # put the correct version of this file into place.
+ case $gnulib_modules in
+ *gettext-h*) ;;
+ *gettext*)
+ cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in || exit 1
+ ;;
+ esac
if test -d runtime-po; then
# Similarly for runtime-po/Makevars, but not quite the same.
gettext git-version-gen gitlog-to-changelog
gpl-3.0 hash inttypes isnan javacomp-script
javaexec-script ldexpl maintainer-makefile malloc-gnu mbschr mbsrchr
- mbswidth obstack perror pipe-posix progname
+ mbswidth obstack perror progname
quote quotearg realloc-posix
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
unistd unistd-safer unlocked-io update-copyright unsetenv verify
- warnings xalloc xalloc-die xstrndup
+ warnings
+ xalloc xalloc-die xmemdup0 xstrndup
fprintf-posix printf-posix snprintf-posix sprintf-posix
vsnprintf-posix vsprintf-posix
/compile
/config.guess
/config.rpath
+/config.rpath~
/config.sub
/depcomp
/gendocs.sh
bindtextdomain=^lib/main.c$$ \
program_name=^lib/main.c$$ \
prohibit_always-defined_macros=^data/yacc.c|^djgpp/ \
+ prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
prohibit_empty_lines_at_EOF=^src/parse-gram.h$$ \
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
[gnu], [gnits]))
AM_SILENT_RULES([yes])
-AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
+AC_CONFIG_HEADERS([lib/config.h:lib/config.in.h])
# Checks for the compiler.
AC_PROG_CC_STDC
-Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings'
warn_c='-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes
-Wshadow -Wstrict-prototypes'
- warn_cxx='-Wnoexcept -Wzero-as-null-pointer-constant'
+ warn_cxx='-Wnoexcept'
AC_LANG_PUSH([C])
for i in $warn_common $warn_c;
do
do
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
done
+ gl_WARN_ADD([ -Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
+ [AC_LANG_PROGRAM([], [nullptr])])
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
# Warnings for the test suite only.
gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
# Checks for programs.
AC_PROG_LEX
-if test "$FLEX" != yes; then
- AC_MSG_ERROR([Flex is required])
-fi
+$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
AC_PROG_YACC
AC_PROG_RANLIB
AC_PROG_GNU_M4
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# b4_tocpp(STRING)
+# ----------------
+# Convert STRING into a valid C macro name.
+m4_define([b4_tocpp],
+[m4_toupper(m4_bpatsubst(m4_quote($1), [[^a-zA-Z0-9]+], [_]))])
+
+
+# b4_cpp_guard(FILE)
+# ------------------
+# A valid C macro name to use as a CPP header guard for FILE.
+m4_define([b4_cpp_guard],
+[b4_tocpp(m4_defn([b4_prefix])/[$1])])
+
+
+# b4_cpp_guard_open(FILE)
+# b4_cpp_guard_close(FILE)
+# ------------------------
+# Open/close CPP inclusion guards for FILE.
+m4_define([b4_cpp_guard_open],
+[#ifndef b4_cpp_guard([$1])
+# define b4_cpp_guard([$1])])
+
+m4_define([b4_cpp_guard_close],
+[#endif b4_comment([!b4_cpp_guard([$1])])])
+
+
## ---------------- ##
## Identification. ##
## ---------------- ##
static void
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
{
- yyGLRState* s;
int i;
- s = yyvsp[yylow0].yystate.yypred;
+ yyGLRState *s = yyvsp[yylow0].yystate.yypred;
for (i = yylow0-1; i >= yylow1; i -= 1)
{
#if YYDEBUG
{
yyGLRStackItem* yynewItems;
yyGLRStackItem* yyp0, *yyp1;
- size_t yysize, yynewSize;
+ size_t yynewSize;
size_t yyn;
- yysize = yystackp->yynextFree - yystackp->yyitems;
+ size_t yysize = yystackp->yynextFree - yystackp->yyitems;
if (YYMAXDEPTH - YYHEADROOM < yysize)
yyMemoryExhausted (yystackp);
yynewSize = 2*yysize;
YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULL)
yys1->yysemantics.yyfirstVal =
- YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
+ YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
}
else
{
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULL)
{
- yyGLRState* yyp, *yysplit = yystackp->yysplitPoint;
- yyp = yystackp->yytops.yystates[yyi];
+ yyGLRState *yysplit = yystackp->yysplitPoint;
+ yyGLRState *yyp = yystackp->yytops.yystates[yyi];
while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn)
{
if (yyp->yylrState == yynewLRState && yyp->yypred == yys)
}
else
{
- yySemanticOption** yyz0p;
- yySemanticOption* yyz1;
- yyz0p = &yys0->yysemantics.yyfirstVal;
- yyz1 = yys1->yysemantics.yyfirstVal;
+ yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal;
+ yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
while (YYID (yytrue))
{
if (yyz1 == *yyz0p || yyz1 == YY_NULL)
YYSTYPE* yyvalp]b4_locuser_formals[)
{
yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
- int yynrhs;
- int yychar_current;
- YYSTYPE yylval_current;]b4_locations_if([
- YYLTYPE yylloc_current;])[
- YYRESULTTAG yyflag;
-
- yynrhs = yyrhsLength (yyopt->yyrule);
- yyflag = yyresolveStates (yyopt->yystate, yynrhs, yystackp]b4_user_args[);
+ int yynrhs = yyrhsLength (yyopt->yyrule);
+ YYRESULTTAG yyflag =
+ yyresolveStates (yyopt->yystate, yynrhs, yystackp]b4_user_args[);
if (yyflag != yyok)
{
yyGLRState *yys;
if (yynrhs == 0)
/* Set default location. */
yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[
- yychar_current = yychar;
- yylval_current = yylval;]b4_locations_if([
- yylloc_current = yylloc;])[
- yychar = yyopt->yyrawchar;
- yylval = yyopt->yyval;]b4_locations_if([
- yylloc = yyopt->yyloc;])[
- yyflag = yyuserAction (yyopt->yyrule, yynrhs,
+ {
+ int yychar_current = yychar;
+ YYSTYPE yylval_current = yylval;]b4_locations_if([
+ YYLTYPE yylloc_current = yylloc;])[
+ yychar = yyopt->yyrawchar;
+ yylval = yyopt->yyval;]b4_locations_if([
+ yylloc = yyopt->yyloc;])[
+ yyflag = yyuserAction (yyopt->yyrule, yynrhs,
yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
- yystackp, yyvalp]b4_locuser_args[);
- yychar = yychar_current;
- yylval = yylval_current;]b4_locations_if([
- yylloc = yylloc_current;])[
+ yystackp, yyvalp]b4_locuser_args[);
+ yychar = yychar_current;
+ yylval = yylval_current;]b4_locations_if([
+ yylloc = yylloc_current;])[
+ }
return yyflag;
}
yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp]b4_user_args[);
if (!yys1->yyresolved)
{
- yySemanticOption *yyoption;
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
int yynrhs;
- int yychar_current;
- YYSTYPE yylval_current;
- YYLTYPE yylloc_current;
- yyoption = yys1->yysemantics.yyfirstVal;
+ yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
YYASSERT (yyoption != YY_NULL);
yynrhs = yyrhsLength (yyoption->yyrule);
if (yynrhs > 0)
yyGLRState *yyprevious = yyoption->yystate;
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
}
- yychar_current = yychar;
- yylval_current = yylval;
- yylloc_current = yylloc;
- yychar = yyoption->yyrawchar;
- yylval = yyoption->yyval;
- yylloc = yyoption->yyloc;
- YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
- yychar = yychar_current;
- yylval = yylval_current;
- yylloc = yylloc_current;
+ {
+ int yychar_current = yychar;
+ YYSTYPE yylval_current = yylval;
+ YYLTYPE yylloc_current = yylloc;
+ yychar = yyoption->yyrawchar;
+ yylval = yyoption->yyval;
+ yylloc = yyoption->yyloc;
+ YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
+ yychar = yychar_current;
+ yylval = yylval_current;
+ yylloc = yylloc_current;
+ }
}
}
}]])[
b4_locations_if([b4_percent_define_ifdef([[location_type]], [],
[# Backward compatibility.
- m4_define([b4_location_constructors])
- m4_include(b4_pkgdatadir/[location.cc])])])
+ m4_define([b4_location_constructors])
+ m4_include(b4_pkgdatadir/[location.cc])])])
m4_include(b4_pkgdatadir/[stack.hh])
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
m4_divert_push(0)dnl
@output(b4_spec_defines_file@)@
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
-dnl FIXME: This is wrong, we want computed header guards.
[
+/**
+ ** \file ]b4_spec_defines_file[
+ ** Define the ]b4_namespace_ref[::parser class.
+ */
+
/* C++ LALR(1) parser skeleton written by Akim Demaille. */
-#ifndef PARSER_HEADER_H
-# define PARSER_HEADER_H
+]b4_cpp_guard_open([b4_spec_defines_file])[
]b4_percent_code_get([[requires]])[
/* Redirection for backward compatibility. */
# define YYSTYPE b4_namespace_ref::b4_parser_class_name::semantic_type
#endif
-])
-b4_percent_code_get([[provides]])[]dnl
-
-[#endif /* ! defined PARSER_HEADER_H */]
+])[
+]b4_percent_code_get([[provides]])[
+]b4_cpp_guard_close([b4_spec_defines_file])
@output(b4_parser_file_name@)@
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])
b4_percent_code_get([[top]])[]dnl
b4_copyright([Positions for Bison parsers in C++])[
/**
- ** \file position.hh
+ ** \file ]b4_dir_prefix[position.hh
** Define the ]b4_namespace_ref[::position class.
*/
-#ifndef BISON_POSITION_HH
-# define BISON_POSITION_HH
+]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
# include <iostream>
# include <string>
}
]b4_namespace_close[
-#endif // not BISON_POSITION_HH]
+]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
@output(b4_dir_prefix[]location.hh@)@
b4_copyright([Locations for Bison parsers in C++])[
/**
- ** \file location.hh
+ ** \file ]b4_dir_prefix[location.hh
** Define the ]b4_namespace_ref[::location class.
*/
-#ifndef BISON_LOCATION_HH
-# define BISON_LOCATION_HH
+]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
# include <iostream>
# include <string>
]b4_namespace_close[
-#endif // not BISON_LOCATION_HH]
+]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
m4_divert_pop(0)
m4_popdef([b4_copyright_years])dnl
m4_changecom([#])
@output(b4_dir_prefix[]stack.hh@)@
b4_copyright([Stack handling for Bison parsers in C++])[
-#ifndef BISON_STACK_HH
-# define BISON_STACK_HH
+/**
+ ** \file ]b4_dir_prefix[stack.hh
+ ** Define the ]b4_namespace_ref[::stack class.
+ */
-#include <deque>
+]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
+
+# include <deque>
]b4_namespace_open[
template <class T, class S = std::deque<T> >
{
public:
slice (const S& stack, unsigned int range)
- : stack_ (stack),
- range_ (range)
+ : stack_ (stack)
+ , range_ (range)
{
}
};
]b4_namespace_close[
-#endif // not BISON_STACK_HH[]dnl
-]
+]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
m4_divert_pop(0)
m4_popdef([b4_copyright_years])dnl
m4_changecom([#])
Because Bison parsers have growing stacks, hitting the upper limit
usually results from using a right recursion instead of a left
-recursion, @xref{Recursion, ,Recursive Rules}.
+recursion, see @ref{Recursion, ,Recursive Rules}.
@vindex YYMAXDEPTH
By defining the macro @code{YYMAXDEPTH}, you can control how deep the
message. What can I do?
@end quotation
-This question is already addressed elsewhere, @xref{Recursion,
-,Recursive Rules}.
+This question is already addressed elsewhere, see @ref{Recursion, ,Recursive
+Rules}.
@node How Can I Reset the Parser
@section How Can I Reset the Parser
-Subproject commit 1a0e0aefd4b1fbef0c6e5d990bc01499fd153a0d
+Subproject commit 338dd5d4362fdf5fb29b843d4d8a8f845bc750de
/c-ctype.h
/c-strcase.h
/c-strcasecmp.c
+/c-strcaseeq.h
/c-strncasecmp.c
/calloc.c
/charset.alias
/cloexec.h
/close-hook.c
/close-hook.h
+/close-stream.c
+/close-stream.h
/close.c
+/closeout.c
+/closeout.h
/config.charset
/config.h
-/config.hin
+/config.in.h
/configmake.h
/dirname-lgpl.c
/dirname.c
/fcntl.c
/fcntl.h
/fcntl.in.h
+/fd-hook.c
+/fd-hook.h
/fd-safer-flag.c
/fd-safer.c
/float+.h
+/float.c
/float.h
/float.in.h
/fopen-safer.c
/fopen.c
+/fpending.c
+/fpending.h
/fprintf.c
/fpucw.h
/frexp.c
/frexpl.c
/fseterr.c
/fseterr.h
+/fstat.c
/getdtablesize.c
/getopt.c
/getopt.h
/isnanl-nolibm.h
/isnanl.c
/iswblank.c
+/itold.c
/ldexpl.c
/localcharset.c
/localcharset.h
/mbuiter.h
/memchr.c
/memchr.valgrind
+/msvc-inval.c
+/msvc-inval.h
+/msvc-nothrow.c
+/msvc-nothrow.h
/nonblocking.c
/nonblocking.h
/obstack.c
/obstack.h
/open.c
+/pathmax.h
/perror.c
/pipe-safer.c
-/pipe.c
/pipe2-safer.c
/pipe2.c
/printf-args.c
/printf-parse.c
/printf-parse.h
/printf.c
+/progname.c
+/progname.h
/quote.c
/quote.h
/quotearg.c
/quotearg.h
+/raise.c
/rawmemchr.c
/rawmemchr.valgrind
/realloc.c
/strchrnul.valgrind
/strdup.c
/streq.h
+/strerror-override.c
+/strerror-override.h
/strerror.c
+/strerror_r.c
/string.h
/string.in.h
/stripslash.c
/sys_stat.in.h
/sys_wait.h
/sys_wait.in.h
+/sysexits.in.h
/time.h
/time.in.h
/unistd--.h
/wctype.in.h
/wcwidth.c
/xalloc-die.c
+/xalloc-oversized.h
/xalloc.h
/xmalloc.c
/xsize.h
/xstrndup.c
/xstrndup.h
-/c-strcaseeq.h
-/fd-hook.c
-/fd-hook.h
-/float.c
-/fstat.c
-/itold.c
-/msvc-inval.c
-/msvc-inval.h
-/msvc-nothrow.c
-/msvc-nothrow.h
-/pathmax.h
-/raise.c
-/strerror-override.c
-/strerror-override.h
-/strerror_r.c
-/xalloc-oversized.h
-/close-stream.c
-/close-stream.h
-/closeout.c
-/closeout.h
-/fpending.c
-/fpending.h
-/sysexits.in.h
-/progname.c
-/progname.h
+/xmemdup0.c
+/xmemdup0.h
+/sys_types.in.h
/getdtablesize.m4
/getopt.m4
/gettext.m4
+/glibc2.m4
/glibc21.m4
/gnulib-cache.m4
/gnulib-common.m4
/iconv.m4
/include_next.m4
/inline.m4
+/intdiv0.m4
+/intl.m4
+/intl.m4~
+/intldir.m4
/intlmacosx.m4
+/intmax.m4
/intmax_t.m4
/inttypes-pri.m4
/inttypes.m4
/javacomp.m4
/javaexec.m4
/largefile.m4
+/lcmessage.m4
/ldexp.m4
/ldexpl.m4
/lib-ld.m4
/locale-fr.m4
/locale-ja.m4
/locale-zh.m4
+/lock.m4
/longlong.m4
/malloc.m4
/math_h.m4
/multiarch.m4
/nls.m4
/nocrash.m4
+/off_t.m4
/open.m4
/pathmax.m4
/perror.m4
-/pipe.m4
/pipe2.m4
/po.m4
+/po.m4~
/posix_spawn.m4
/printf-frexp.m4
/printf-frexpl.m4
/sys_ioctl_h.m4
/sys_socket_h.m4
/sys_stat_h.m4
+/sys_types_h.m4
/sys_wait_h.m4
+/sysexits.m4
/threadlib.m4
/time_h.m4
+/uintmax_t.m4
/unistd-safer.m4
/unistd_h.m4
/unlocked-io.m4
/vasnprintf.m4
/vfprintf-posix.m4
+/visibility.m4
/vsnprintf-posix.m4
/vsnprintf.m4
/vsprintf-posix.m4
/xalloc.m4
/xsize.m4
/xstrndup.m4
-/sysexits.m4
-# flex.m4 serial 1
+# flex.m4 serial 2
# Copyright (C) 2012 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# and whether Lex declares yytext as a char * by default.
m4_define([_AC_PROG_LEX_YYTEXT_DECL],
[AC_CACHE_CHECK([whether lex is flex],
- [ac_cv_prog_flex],
+ [ac_cv_prog_lex_is_flex],
[cat >conftest.l <<_ACEOF[
%option debug nodefault noinput nounput noyywrap never-interactive
%x SC_CONF_TEST
a { BEGIN SC_CONF_TEST; }
]_ACEOF
if _AC_DO_VAR([LEX conftest.l]); then
- ac_cv_prog_flex=yes
+ ac_cv_prog_lex_is_flex=yes
else
- ac_cv_prog_flex=no
+ ac_cv_prog_lex_is_flex=no
fi
])
-FLEX=
-if test $ac_cv_prog_flex = yes; then
- AC_SUBST([FLEX], [yes])dnl
-fi
+AC_SUBST([LEX_IS_FLEX],
+ [`test "$ac_cv_prog_lex_is_flex" = yes && echo true || echo false`])dnl
cat >conftest.l <<_ACEOF[
%%
/Makefile
/Makefile.in
/Makefile.in.in
+/Makefile.in.in~
/Makevars
/Makevars.template
/POTFILES
/Makefile
/Makefile.in
/Makefile.in.in
+/Makefile.in.in~
/Makevars
/Makevars.template
/POTFILES
# error "FLEX_PREFIX not defined"
#endif
+/* Whether this version of Flex is (strictly) greater than
+ Major.Minor.Subminor. */
+#define FLEX_VERSION_GT(Major, Minor, Subminor) \
+ (defined YY_FLEX_MAJOR_VERSION \
+ && (Major < YY_FLEX_MAJOR_VERSION \
+ || (Major == YY_FLEX_MAJOR_VERSION \
+ && (defined YY_FLEX_MINOR_VERSION \
+ && (Minor < YY_FLEX_MINOR_VERSION \
+ || (Minor == YY_FLEX_MINOR_VERSION \
+ && defined YY_FLEX_SUBMINOR_VERSION \
+ && Subminor < YY_FLEX_SUBMINOR_VERSION))))))
+
/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */
+#if ! FLEX_VERSION_GT (2, 5, 31)
int FLEX_PREFIX (get_lineno) (void);
FILE *FLEX_PREFIX (get_in) (void);
FILE *FLEX_PREFIX (get_out) (void);
int FLEX_PREFIX (get_debug) (void);
void FLEX_PREFIX (set_debug) (int);
int FLEX_PREFIX (lex_destroy) (void);
+#endif
#define last_string FLEX_PREFIX (last_string)
versions according to the Flex manual) leak memory if yylex_destroy is not
invoked. However, yylex_destroy is not defined before Flex 2.5.9, so give
an implementation here that at least appears to work with Flex 2.5.4. */
-#if !defined YY_FLEX_MAJOR_VERSION || YY_FLEX_MAJOR_VERSION < 2 \
- || (YY_FLEX_MAJOR_VERSION == 2 \
- && (!defined YY_FLEX_MINOR_VERSION || YY_FLEX_MINOR_VERSION < 5 \
- || (YY_FLEX_MINOR_VERSION == 5 \
- && (!defined YY_FLEX_SUBMINOR_VERSION \
- || YY_FLEX_SUBMINOR_VERSION < 9))))
+#if ! FLEX_VERSION_GT (2, 5, 9)
# define yylex_destroy() yy_delete_buffer (YY_CURRENT_BUFFER)
#endif
static struct obstack obstack_for_string;
-#define STRING_GROW \
+# define STRING_GROW \
obstack_grow (&obstack_for_string, yytext, yyleng)
-#define STRING_FINISH \
+# define STRING_FINISH \
do { \
obstack_1grow (&obstack_for_string, '\0'); \
last_string = obstack_finish (&obstack_for_string); \
} while (0)
-#define STRING_FREE \
+# define STRING_FREE \
obstack_free (&obstack_for_string, last_string)
#endif
/* Here, the -d and --defines options are differentiated. */
defines_flag = true;
if (optarg)
- spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
+ {
+ free (spec_defines_file);
+ spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
+ }
break;
case 'g':
graph_flag = true;
if (optarg)
- spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
+ {
+ free (spec_graph_file);
+ spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
+ }
break;
case 'h':
case 'x':
xml_flag = true;
if (optarg)
- spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
+ {
+ free (spec_xml_file);
+ spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
+ }
break;
case 'y':
exit (EXIT_SUCCESS);
case REPORT_FILE_OPTION:
+ free (spec_verbose_file);
spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
break;
#include "symlist.h"
#include "scan-gram.h"
#include "scan-code.h"
+#include "xmemdup0.h"
#define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
static YYLTYPE lloc_default (YYLTYPE const *, int);
xmalloc (dir_length + 1 + strlen (skeleton_user) + 1);
if (dir_length > 0)
{
- strncpy (skeleton_build, current_file, dir_length);
+ memcpy (skeleton_build, current_file, dir_length);
skeleton_build[dir_length++] = '/';
}
strcpy (skeleton_build + dir_length, skeleton_user);
complain_at (loc, _("missing identifier in parameter declaration"));
else
{
- char *name;
- size_t name_len;
-
- for (name_len = 1;
- memchr (alphanum, name_start[name_len], sizeof alphanum);
- name_len++)
- continue;
-
- name = xmalloc (name_len + 1);
- memcpy (name, name_start, name_len);
- name[name_len] = '\0';
+ char *name = xmemdup0 (name_start, strspn (name_start, alphanum));
if (type & param_lex)
muscle_pair_list_grow ("lex_param", decl, name);
if (type & param_parse)
"@oline@" fprintf (yyout, "%d", out_lineno + 1);
"@ofile@" QPUTS (outname);
-"@dir_prefix@" QPUTS (dir_prefix);
@[a-z_]+"(" {
yytext[yyleng-1] = '\0';
])])
+# AT_SAVE_SPECIAL_FILES / AT_RESTORE_SPECIAL_FILES
+# ------------------------------------------------
+# Don't interfere with caller's files.
+m4_divert_text([PREPARE_TESTS],
+[at_save_special_files ()
+{
+ for at_save_file in stderr experr expout
+ do
+ test ! -f $at_save_file || mv $at_save_file at-bison-check-$at_save_file.bak
+ done
+}
+
+at_restore_special_files ()
+{
+ for at_save_file in stderr experr expout
+ do
+ test ! -f at-bison-check-$at_save_file.bak ||
+ mv at-bison-check-$at_save_file.bak $at_save_file
+ done
+}
+])
+
+m4_define([AT_SAVE_SPECIAL_FILES], [at_save_special_files])
+m4_define([AT_RESTORE_SPECIAL_FILES], [at_restore_special_files])
+
+
+
## ------------------------------- ##
## Macros decoding Bison options. ##
## ------------------------------- ##
# are added after the grammar file name, so skip these checks
# in that case.
if test -z "${POSIXLY_CORRECT+set}"; then
- # Don't interfere with caller's files.
- if test -f stderr; then mv stderr at-bison-check-stderr.bak; fi
- if test -f experr; then mv experr at-bison-check-experr.bak; fi
- if test -f expout; then mv expout at-bison-check-expout.bak; fi
+ ]AT_SAVE_SPECIAL_FILES[
# To avoid expanding it repeatedly, store specified stdout.
]AT_DATA([expout], [$3])[
]AT_CHECK(AT_QUELL_VALGRIND[[ bison ]$1[ --warnings=none \
-Werror]], [[0]], [expout])[
- # Restore caller's files.
- if test -f at-bison-check-expout.bak; then
- mv at-bison-check-expout.bak expout
- fi
- if test -f at-bison-check-experr.bak; then
- mv at-bison-check-experr.bak experr
- fi
- if test -f at-bison-check-stderr.bak; then
- mv at-bison-check-stderr.bak stderr
- fi
+ ]AT_RESTORE_SPECIAL_FILES[
fi
]])
])
# defined. It doesn't make sense to invoke this macro if Bison is expected to
# have a non-zero exit status.
m4_define([AT_BISON_CHECK_XML],
-[[if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then
- mkdir xml-tests]
+[[if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then]
+ AT_SAVE_SPECIAL_FILES
+ [mkdir xml-tests]
m4_pushdef([AT_BISON_ARGS],
[m4_bpatsubsts([[$1]],
[--report(-file)?=[^][ ]*], [],
AT_CHECK([[$XSLTPROC \
`]]AT_QUELL_VALGRIND[[ bison --print-datadir`/xslt/xml2dot.xsl \
xml-tests/test.xml]], [[0]], [expout])
- [rm -rf xml-tests expout
-fi]])
+ [rm -rf xml-tests expout]
+ AT_RESTORE_SPECIAL_FILES
+[fi]])
# AT_QUELL_VALGRIND
# -----------------
# output files have the same name.
[cp $abs_top_srcdir/src/parse-gram.y input.y]
AT_BISON_CHECK([[-o input.c -Dlr.type=lalr input.y]])
-[mv input.c expout]
+[mv input.c lalr.c]
+AT_CAPTURE_FILE([lalr.c])
AT_BISON_CHECK([[-o input.c -Dlr.type=ielr input.y]])
[mv input.c ielr.c]
-AT_CHECK([[cat ielr.c]], [[0]], [[expout]])
+AT_CAPTURE_FILE([ielr.c])
+AT_CHECK([[diff lalr.c ielr.c]], [[0]])
AT_CLEANUP