mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-13 20:55:15 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52ca964032 | ||
|
|
485b319598 | ||
|
|
1ed94b7c84 | ||
|
|
b119971aef | ||
|
|
2a0f5b17b4 |
+1
-1
@@ -11,7 +11,6 @@
|
|||||||
/INSTALL
|
/INSTALL
|
||||||
/Makefile
|
/Makefile
|
||||||
/Makefile.in
|
/Makefile.in
|
||||||
/README-release
|
|
||||||
/_*
|
/_*
|
||||||
/a.exe
|
/a.exe
|
||||||
/a.out
|
/a.out
|
||||||
@@ -32,3 +31,4 @@
|
|||||||
/patches
|
/patches
|
||||||
/releases
|
/releases
|
||||||
/stamp-h*
|
/stamp-h*
|
||||||
|
/README-release
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
2.7.91
|
2.6
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ and nasty bugs.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1998-2013 Free Software Foundation, Inc.
|
Copyright (C) 1998-2012 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
@@ -26733,7 +26733,7 @@
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1987-1988, 1991-2013 Free Software Foundation,
|
Copyright (C) 1987-1988, 1991-2012 Free Software Foundation,
|
||||||
Inc.
|
Inc.
|
||||||
|
|
||||||
Copying and distribution of this file, with or without
|
Copying and distribution of this file, with or without
|
||||||
|
|||||||
+7
-6
@@ -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-2012 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
|
||||||
@@ -32,8 +32,8 @@ EXTRA_DIST = .prev-version .version \
|
|||||||
## version of Bison nearby...
|
## version of Bison nearby...
|
||||||
BISON = $(top_builddir)/tests/bison
|
BISON = $(top_builddir)/tests/bison
|
||||||
BISON_IN = $(top_srcdir)/tests/bison.in
|
BISON_IN = $(top_srcdir)/tests/bison.in
|
||||||
YACC = $(BISON) -o y.tab.c
|
YACC = $(BISON) -y
|
||||||
AM_YFLAGS = -d -v -Werror -Wall -Wno-yacc --report=all
|
AM_YFLAGS = -d -v --warnings=all,error --report=all
|
||||||
|
|
||||||
# Initialization before completion by local.mk's.
|
# Initialization before completion by local.mk's.
|
||||||
AM_CFLAGS = $(WARN_CFLAGS)
|
AM_CFLAGS = $(WARN_CFLAGS)
|
||||||
@@ -78,11 +78,12 @@ dist-hook: gen-ChangeLog
|
|||||||
|
|
||||||
.PHONY: update-b4-copyright update-package-copyright-year
|
.PHONY: update-b4-copyright update-package-copyright-year
|
||||||
update-b4-copyright:
|
update-b4-copyright:
|
||||||
$(AM_V_GEN)find $(srcdir)/data -type f \
|
find data -type f \
|
||||||
| xargs $(srcdir)/build-aux/$@
|
| grep -v -E '^data/bison.m4$$' \
|
||||||
|
| xargs $(build_aux)/$@
|
||||||
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
||||||
update-package-copyright-year:
|
update-package-copyright-year:
|
||||||
$(AM_V_GEN)$(srcdir)/build-aux/$@ $(srcdir)/configure.ac
|
$(build_aux)/$@ configure.ac
|
||||||
|
|
||||||
gen_start_date = 2012-01-16
|
gen_start_date = 2012-01-16
|
||||||
.PHONY: gen-ChangeLog
|
.PHONY: gen-ChangeLog
|
||||||
|
|||||||
@@ -1,154 +1,14 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
* Noteworthy changes in release 3.0 (2013-07-25) [stable]
|
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||||
|
|
||||||
** WARNING: Future backward-incompatibilities!
|
** Warnings
|
||||||
|
|
||||||
Like other GNU packages, Bison will start using some of the C99 features
|
*** Warning categories are now displayed in warnings
|
||||||
for its own code, especially the definition of variables after statements.
|
|
||||||
The generated C parsers still aim at C90.
|
|
||||||
|
|
||||||
** Backward incompatible changes
|
For instance:
|
||||||
|
|
||||||
*** Obsolete features
|
foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
|
||||||
|
|
||||||
Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
|
|
||||||
|
|
||||||
Support for yystype and yyltype is removed (deprecated in Bison 1.875):
|
|
||||||
use YYSTYPE and YYLTYPE.
|
|
||||||
|
|
||||||
Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
|
|
||||||
1.875): use %lex-param, %parse-param, or %param.
|
|
||||||
|
|
||||||
Missing semicolons at the end of actions are no longer added (as announced
|
|
||||||
in the release 2.5).
|
|
||||||
|
|
||||||
*** Use of YACC='bison -y'
|
|
||||||
|
|
||||||
TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
|
|
||||||
Bison extensions.
|
|
||||||
|
|
||||||
Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
|
|
||||||
Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
|
|
||||||
'y.tab.h' and 'y.outout') to be generated from 'foo.y'.
|
|
||||||
|
|
||||||
To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
|
|
||||||
implementation of Yacc, was using Bison as 'bison -y'. While it does
|
|
||||||
ensure compatible output file names, it also enables warnings for
|
|
||||||
incompatibilities with POSIX Yacc. In other words, 'bison -y' triggers
|
|
||||||
warnings for Bison extensions.
|
|
||||||
|
|
||||||
Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
|
|
||||||
(which also generates 'y.tab.h' and 'y.output' when needed).
|
|
||||||
Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
|
|
||||||
flags (YFLAGS, or AM_YFLAGS with Automake).
|
|
||||||
|
|
||||||
** Bug fixes
|
|
||||||
|
|
||||||
*** The epilogue is no longer affected by internal #defines (glr.c)
|
|
||||||
|
|
||||||
The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
|
|
||||||
generated code. These weren't properly undefined before the inclusion of
|
|
||||||
the user epilogue, so functions such as the following were butchered by the
|
|
||||||
preprocessor expansion:
|
|
||||||
|
|
||||||
int yylex (YYSTYPE *yylval);
|
|
||||||
|
|
||||||
This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
|
|
||||||
identifiers for user-provided variables.
|
|
||||||
|
|
||||||
*** stdio.h is no longer needed when locations are enabled (yacc.c)
|
|
||||||
|
|
||||||
Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
|
|
||||||
locations are enabled. This is fixed.
|
|
||||||
|
|
||||||
*** Warnings about useless %pure-parser/%define api.pure are restored
|
|
||||||
|
|
||||||
** Diagnostics reported by Bison
|
|
||||||
|
|
||||||
Most of these features were contributed by Théophile Ranquet and Victor
|
|
||||||
Santet.
|
|
||||||
|
|
||||||
*** Carets
|
|
||||||
|
|
||||||
Version 2.7 introduced caret errors, for a prettier output. These are now
|
|
||||||
activated by default. The old format can still be used by invoking Bison
|
|
||||||
with -fno-caret (or -fnone).
|
|
||||||
|
|
||||||
Some error messages that reproduced excerpts of the grammar are now using
|
|
||||||
the caret information only. For instance on:
|
|
||||||
|
|
||||||
%%
|
|
||||||
exp: 'a' | 'a';
|
|
||||||
|
|
||||||
Bison 2.7 reports:
|
|
||||||
|
|
||||||
in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
|
||||||
in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
|
|
||||||
|
|
||||||
Now bison reports:
|
|
||||||
|
|
||||||
in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
|
||||||
in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
|
|
||||||
exp: 'a' | 'a';
|
|
||||||
^^^
|
|
||||||
|
|
||||||
and "bison -fno-caret" reports:
|
|
||||||
|
|
||||||
in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
|
||||||
in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
|
|
||||||
|
|
||||||
*** Enhancements of the -Werror option
|
|
||||||
|
|
||||||
The -Werror=CATEGORY option is now recognized, and will treat specified
|
|
||||||
warnings as errors. The warnings need not have been explicitly activated
|
|
||||||
using the -W option, this is similar to what GCC 4.7 does.
|
|
||||||
|
|
||||||
For example, given the following command line, Bison will treat both
|
|
||||||
warnings related to POSIX Yacc incompatibilities and S/R conflicts as
|
|
||||||
errors (and only those):
|
|
||||||
|
|
||||||
$ bison -Werror=yacc,error=conflicts-sr input.y
|
|
||||||
|
|
||||||
If no categories are specified, -Werror will make all active warnings into
|
|
||||||
errors. For example, the following line does the same the previous example:
|
|
||||||
|
|
||||||
$ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
|
|
||||||
|
|
||||||
(By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
|
|
||||||
|
|
||||||
Note that the categories in this -Werror option may not be prefixed with
|
|
||||||
"no-". However, -Wno-error[=CATEGORY] is valid.
|
|
||||||
|
|
||||||
Note that -y enables -Werror=yacc. Therefore it is now possible to require
|
|
||||||
Yacc-like behavior (e.g., always generate y.tab.c), but to report
|
|
||||||
incompatibilities as warnings: "-y -Wno-error=yacc".
|
|
||||||
|
|
||||||
*** The display of warnings is now richer
|
|
||||||
|
|
||||||
The option that controls a given warning is now displayed:
|
|
||||||
|
|
||||||
foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
|
|
||||||
|
|
||||||
In the case of warnings treated as errors, the prefix is changed from
|
|
||||||
"warning: " to "error: ", and the suffix is displayed, in a manner similar
|
|
||||||
to GCC, as [-Werror=CATEGORY].
|
|
||||||
|
|
||||||
For instance, where the previous version of Bison would report (and exit
|
|
||||||
with failure):
|
|
||||||
|
|
||||||
bison: warnings being treated as errors
|
|
||||||
input.y:1.1: warning: stray ',' treated as white space
|
|
||||||
|
|
||||||
it now reports:
|
|
||||||
|
|
||||||
input.y:1.1: error: stray ',' treated as white space [-Werror=other]
|
|
||||||
|
|
||||||
*** Deprecated constructs
|
|
||||||
|
|
||||||
The new 'deprecated' warning category flags obsolete constructs whose
|
|
||||||
support will be discontinued. It is enabled by default. These warnings
|
|
||||||
used to be reported as 'other' warnings.
|
|
||||||
|
|
||||||
*** Useless semantic types
|
*** Useless semantic types
|
||||||
|
|
||||||
@@ -167,17 +27,18 @@ GNU Bison NEWS
|
|||||||
3.28-34: warning: type <type3> is used, but is not associated to any symbol
|
3.28-34: warning: type <type3> is used, but is not associated to any symbol
|
||||||
4.28-34: warning: type <type4> is used, but is not associated to any symbol
|
4.28-34: warning: type <type4> is used, but is not associated to any symbol
|
||||||
|
|
||||||
*** Undefined but unused symbols
|
*** Undeclared symbols
|
||||||
|
|
||||||
Bison used to raise an error for undefined symbols that are not used in
|
Bison used to raise an error for %printer and %destructor directives for
|
||||||
the grammar. This is now only a warning.
|
undefined symbols.
|
||||||
|
|
||||||
%printer {} symbol1
|
%printer {} symbol1
|
||||||
%destructor {} symbol2
|
%destructor {} symbol2
|
||||||
%type <type> symbol3
|
|
||||||
%%
|
%%
|
||||||
exp: "a";
|
exp: "a";
|
||||||
|
|
||||||
|
This is now only a warning.
|
||||||
|
|
||||||
*** Useless destructors or printers
|
*** Useless destructors or printers
|
||||||
|
|
||||||
Bison now warns about useless destructors or printers. In the following
|
Bison now warns about useless destructors or printers. In the following
|
||||||
@@ -192,57 +53,6 @@ GNU Bison NEWS
|
|||||||
%printer {} token1 <type1> <type3>
|
%printer {} token1 <type1> <type3>
|
||||||
%destructor {} token2 <type2> <type4>
|
%destructor {} token2 <type2> <type4>
|
||||||
|
|
||||||
*** Conflicts
|
|
||||||
|
|
||||||
The warnings and error messages about shift/reduce and reduce/reduce
|
|
||||||
conflicts have been normalized. For instance on the following foo.y file:
|
|
||||||
|
|
||||||
%glr-parser
|
|
||||||
%%
|
|
||||||
exp: exp '+' exp | '0' | '0';
|
|
||||||
|
|
||||||
compare the previous version of bison:
|
|
||||||
|
|
||||||
$ bison foo.y
|
|
||||||
foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
|
|
||||||
$ bison -Werror foo.y
|
|
||||||
bison: warnings being treated as errors
|
|
||||||
foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
|
|
||||||
|
|
||||||
with the new behavior:
|
|
||||||
|
|
||||||
$ bison foo.y
|
|
||||||
foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
|
||||||
foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
|
||||||
$ bison -Werror foo.y
|
|
||||||
foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
|
|
||||||
foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
|
|
||||||
|
|
||||||
When %expect or %expect-rr is used, such as with bar.y:
|
|
||||||
|
|
||||||
%expect 0
|
|
||||||
%glr-parser
|
|
||||||
%%
|
|
||||||
exp: exp '+' exp | '0' | '0';
|
|
||||||
|
|
||||||
Former behavior:
|
|
||||||
|
|
||||||
$ bison bar.y
|
|
||||||
bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
|
|
||||||
bar.y: expected 0 shift/reduce conflicts
|
|
||||||
bar.y: expected 0 reduce/reduce conflicts
|
|
||||||
|
|
||||||
New one:
|
|
||||||
|
|
||||||
$ bison bar.y
|
|
||||||
bar.y: error: shift/reduce conflicts: 1 found, 0 expected
|
|
||||||
bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
|
|
||||||
|
|
||||||
** Incompatibilities with POSIX Yacc
|
|
||||||
|
|
||||||
The 'yacc' category is no longer part of '-Wall', enable it explicitly
|
|
||||||
with '-Wyacc'.
|
|
||||||
|
|
||||||
** Additional yylex/yyparse arguments
|
** Additional yylex/yyparse arguments
|
||||||
|
|
||||||
The new directive %param declares additional arguments to both yylex and
|
The new directive %param declares additional arguments to both yylex and
|
||||||
@@ -258,285 +68,13 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
%param {arg1_type *arg1} {arg2_type *arg2}
|
%param {arg1_type *arg1} {arg2_type *arg2}
|
||||||
|
|
||||||
** Types of values for %define variables
|
|
||||||
|
|
||||||
Bison used to make no difference between '%define foo bar' and '%define
|
|
||||||
foo "bar"'. The former is now called a 'keyword value', and the latter a
|
|
||||||
'string value'. A third kind was added: 'code values', such as '%define
|
|
||||||
foo {bar}'.
|
|
||||||
|
|
||||||
Keyword variables are used for fixed value sets, e.g.,
|
|
||||||
|
|
||||||
%define lr.type lalr
|
|
||||||
|
|
||||||
Code variables are used for value in the target language, e.g.,
|
|
||||||
|
|
||||||
%define api.value.type {struct semantic_type}
|
|
||||||
|
|
||||||
String variables are used remaining cases, e.g. file names.
|
|
||||||
|
|
||||||
** Variable api.token.prefix
|
|
||||||
|
|
||||||
The variable api.token.prefix changes the way tokens are identified in
|
|
||||||
the generated files. This is especially useful to avoid collisions
|
|
||||||
with identifiers in the target language. For instance
|
|
||||||
|
|
||||||
%token FILE for ERROR
|
|
||||||
%define api.token.prefix {TOK_}
|
|
||||||
%%
|
|
||||||
start: FILE for ERROR;
|
|
||||||
|
|
||||||
will generate the definition of the symbols TOK_FILE, TOK_for, and
|
|
||||||
TOK_ERROR in the generated sources. In particular, the scanner must
|
|
||||||
use these prefixed token names, although the grammar itself still
|
|
||||||
uses the short names (as in the sample rule given above).
|
|
||||||
|
|
||||||
** Variable api.value.type
|
|
||||||
|
|
||||||
This new %define variable supersedes the #define macro YYSTYPE. The use
|
|
||||||
of YYSTYPE is discouraged. In particular, #defining YYSTYPE *and* either
|
|
||||||
using %union or %defining api.value.type results in undefined behavior.
|
|
||||||
|
|
||||||
Either define api.value.type, or use "%union":
|
|
||||||
|
|
||||||
%union
|
|
||||||
{
|
|
||||||
int ival;
|
|
||||||
char *sval;
|
|
||||||
}
|
|
||||||
%token <ival> INT "integer"
|
|
||||||
%token <sval> STRING "string"
|
|
||||||
%printer { fprintf (yyo, "%d", $$); } <ival>
|
|
||||||
%destructor { free ($$); } <sval>
|
|
||||||
|
|
||||||
/* In yylex(). */
|
|
||||||
yylval.ival = 42; return INT;
|
|
||||||
yylval.sval = "42"; return STRING;
|
|
||||||
|
|
||||||
The %define variable api.value.type supports both keyword and code values.
|
|
||||||
|
|
||||||
The keyword value 'union' means that the user provides genuine types, not
|
|
||||||
union member names such as "ival" and "sval" above (WARNING: will fail if
|
|
||||||
-y/--yacc/%yacc is enabled).
|
|
||||||
|
|
||||||
%define api.value.type union
|
|
||||||
%token <int> INT "integer"
|
|
||||||
%token <char *> STRING "string"
|
|
||||||
%printer { fprintf (yyo, "%d", $$); } <int>
|
|
||||||
%destructor { free ($$); } <char *>
|
|
||||||
|
|
||||||
/* In yylex(). */
|
|
||||||
yylval.INT = 42; return INT;
|
|
||||||
yylval.STRING = "42"; return STRING;
|
|
||||||
|
|
||||||
The keyword value variant is somewhat equivalent, but for C++ special
|
|
||||||
provision is made to allow classes to be used (more about this below).
|
|
||||||
|
|
||||||
%define api.value.type variant
|
|
||||||
%token <int> INT "integer"
|
|
||||||
%token <std::string> STRING "string"
|
|
||||||
|
|
||||||
Code values (in braces) denote user defined types. This is where YYSTYPE
|
|
||||||
used to be used.
|
|
||||||
|
|
||||||
%code requires
|
|
||||||
{
|
|
||||||
struct my_value
|
|
||||||
{
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
is_int, is_string
|
|
||||||
} kind;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
int ival;
|
|
||||||
char *sval;
|
|
||||||
} u;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
%define api.value.type {struct my_value}
|
|
||||||
%token <u.ival> INT "integer"
|
|
||||||
%token <u.sval> STRING "string"
|
|
||||||
%printer { fprintf (yyo, "%d", $$); } <u.ival>
|
|
||||||
%destructor { free ($$); } <u.sval>
|
|
||||||
|
|
||||||
/* In yylex(). */
|
|
||||||
yylval.u.ival = 42; return INT;
|
|
||||||
yylval.u.sval = "42"; return STRING;
|
|
||||||
|
|
||||||
** Variable parse.error
|
|
||||||
|
|
||||||
This variable controls the verbosity of error messages. The use of the
|
|
||||||
%error-verbose directive is deprecated in favor of "%define parse.error
|
|
||||||
verbose".
|
|
||||||
|
|
||||||
** Renamed %define variables
|
|
||||||
|
|
||||||
The following variables have been renamed for consistency. Backward
|
|
||||||
compatibility is ensured, but upgrading is recommended.
|
|
||||||
|
|
||||||
lr.default-reductions -> lr.default-reduction
|
|
||||||
lr.keep-unreachable-states -> lr.keep-unreachable-state
|
|
||||||
namespace -> api.namespace
|
|
||||||
stype -> api.value.type
|
|
||||||
|
|
||||||
** Semantic predicates
|
|
||||||
|
|
||||||
Contributed by Paul Hilfinger.
|
|
||||||
|
|
||||||
The new, experimental, semantic-predicate feature allows actions of the
|
|
||||||
form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
|
|
||||||
YYERROR) if the expression evaluates to 0, and are evaluated immediately
|
|
||||||
in GLR parsers, rather than being deferred. The result is that they allow
|
|
||||||
the programmer to prune possible parses based on the values of run-time
|
|
||||||
expressions.
|
|
||||||
|
|
||||||
** The directive %expect-rr is now an error in non GLR mode
|
|
||||||
|
|
||||||
It used to be an error only if used in non GLR mode, _and_ if there are
|
|
||||||
reduce/reduce conflicts.
|
|
||||||
|
|
||||||
** Tokens are numbered in their order of appearance
|
|
||||||
|
|
||||||
Contributed by Valentin Tolmer.
|
|
||||||
|
|
||||||
With '%token A B', A had a number less than the one of B. However,
|
|
||||||
precedence declarations used to generate a reversed order. This is now
|
|
||||||
fixed, and introducing tokens with any of %token, %left, %right,
|
|
||||||
%precedence, or %nonassoc yields the same result.
|
|
||||||
|
|
||||||
When mixing declarations of tokens with a litteral character (e.g., 'a')
|
|
||||||
or with an identifier (e.g., B) in a precedence declaration, Bison
|
|
||||||
numbered the litteral characters first. For example
|
|
||||||
|
|
||||||
%right A B 'c' 'd'
|
|
||||||
|
|
||||||
would lead to the tokens declared in this order: 'c' 'd' A B. Again, the
|
|
||||||
input order is now preserved.
|
|
||||||
|
|
||||||
These changes were made so that one can remove useless precedence and
|
|
||||||
associativity declarations (i.e., map %nonassoc, %left or %right to
|
|
||||||
%precedence, or to %token) and get exactly the same output.
|
|
||||||
|
|
||||||
** Useless precedence and associativity
|
|
||||||
|
|
||||||
Contributed by Valentin Tolmer.
|
|
||||||
|
|
||||||
When developing and maintaining a grammar, useless associativity and
|
|
||||||
precedence directives are common. They can be a nuisance: new ambiguities
|
|
||||||
arising are sometimes masked because their conflicts are resolved due to
|
|
||||||
the extra precedence or associativity information. Furthermore, it can
|
|
||||||
hinder the comprehension of a new grammar: one will wonder about the role
|
|
||||||
of a precedence, where in fact it is useless. The following changes aim
|
|
||||||
at detecting and reporting these extra directives.
|
|
||||||
|
|
||||||
*** Precedence warning category
|
|
||||||
|
|
||||||
A new category of warning, -Wprecedence, was introduced. It flags the
|
|
||||||
useless precedence and associativity directives.
|
|
||||||
|
|
||||||
*** Useless associativity
|
|
||||||
|
|
||||||
Bison now warns about symbols with a declared associativity that is never
|
|
||||||
used to resolve conflicts. In that case, using %precedence is sufficient;
|
|
||||||
the parsing tables will remain unchanged. Solving these warnings may raise
|
|
||||||
useless precedence warnings, as the symbols no longer have associativity.
|
|
||||||
For example:
|
|
||||||
|
|
||||||
%left '+'
|
|
||||||
%left '*'
|
|
||||||
%%
|
|
||||||
exp:
|
|
||||||
"number"
|
|
||||||
| exp '+' "number"
|
|
||||||
| exp '*' exp
|
|
||||||
;
|
|
||||||
|
|
||||||
will produce a
|
|
||||||
|
|
||||||
warning: useless associativity for '+', use %precedence [-Wprecedence]
|
|
||||||
%left '+'
|
|
||||||
^^^
|
|
||||||
|
|
||||||
*** Useless precedence
|
|
||||||
|
|
||||||
Bison now warns about symbols with a declared precedence and no declared
|
|
||||||
associativity (i.e., declared with %precedence), and whose precedence is
|
|
||||||
never used. In that case, the symbol can be safely declared with %token
|
|
||||||
instead, without modifying the parsing tables. For example:
|
|
||||||
|
|
||||||
%precedence '='
|
|
||||||
%%
|
|
||||||
exp: "var" '=' "number";
|
|
||||||
|
|
||||||
will produce a
|
|
||||||
|
|
||||||
warning: useless precedence for '=' [-Wprecedence]
|
|
||||||
%precedence '='
|
|
||||||
^^^
|
|
||||||
|
|
||||||
*** Useless precedence and associativity
|
|
||||||
|
|
||||||
In case of both useless precedence and associativity, the issue is flagged
|
|
||||||
as follows:
|
|
||||||
|
|
||||||
%nonassoc '='
|
|
||||||
%%
|
|
||||||
exp: "var" '=' "number";
|
|
||||||
|
|
||||||
The warning is:
|
|
||||||
|
|
||||||
warning: useless precedence and associativity for '=' [-Wprecedence]
|
|
||||||
%nonassoc '='
|
|
||||||
^^^
|
|
||||||
|
|
||||||
** Empty rules
|
|
||||||
|
|
||||||
With help from Joel E. Denny and Gabriel Rassoul.
|
|
||||||
|
|
||||||
Empty rules (i.e., with an empty right-hand side) can now be explicitly
|
|
||||||
marked by the new %empty directive. Using %empty on a non-empty rule is
|
|
||||||
an error. The new -Wempty-rule warning reports empty rules without
|
|
||||||
%empty. On the following grammar:
|
|
||||||
|
|
||||||
%%
|
|
||||||
s: a b c;
|
|
||||||
a: ;
|
|
||||||
b: %empty;
|
|
||||||
c: 'a' %empty;
|
|
||||||
|
|
||||||
bison reports:
|
|
||||||
|
|
||||||
3.4-5: warning: empty rule without %empty [-Wempty-rule]
|
|
||||||
a: {}
|
|
||||||
^^
|
|
||||||
5.8-13: error: %empty on non-empty rule
|
|
||||||
c: 'a' %empty {};
|
|
||||||
^^^^^^
|
|
||||||
|
|
||||||
** Java skeleton improvements
|
** Java skeleton improvements
|
||||||
|
|
||||||
The constants for token names were moved to the Lexer interface. Also, it
|
The constants for token names were moved to the Lexer interface.
|
||||||
is possible to add code to the parser's constructors using "%code init"
|
Also, it is possible to add code to the parser's constructors using
|
||||||
and "%define init_throws".
|
"%code init" and "%define init_throws".
|
||||||
Contributed by Paolo Bonzini.
|
|
||||||
|
|
||||||
The Java skeleton now supports push parsing.
|
** C++ skeleton improvements
|
||||||
Contributed by Dennis Heimbigner.
|
|
||||||
|
|
||||||
** C++ skeletons improvements
|
|
||||||
|
|
||||||
*** The parser header is no longer mandatory (lalr1.cc, glr.cc)
|
|
||||||
|
|
||||||
Using %defines is now optional. Without it, the needed support classes
|
|
||||||
are defined in the generated parser, instead of additional files (such as
|
|
||||||
location.hh, position.hh and stack.hh).
|
|
||||||
|
|
||||||
*** Locations are no longer mandatory (lalr1.cc, glr.cc)
|
|
||||||
|
|
||||||
Both lalr1.cc and glr.cc no longer require %location.
|
|
||||||
|
|
||||||
*** syntax_error exception (lalr1.cc)
|
|
||||||
|
|
||||||
The C++ parser features a syntax_error exception, which can be
|
The C++ parser features a syntax_error exception, which can be
|
||||||
thrown from the scanner or from user rules to raise syntax errors.
|
thrown from the scanner or from user rules to raise syntax errors.
|
||||||
@@ -545,320 +83,53 @@ GNU Bison NEWS
|
|||||||
used by the scanner, or rejecting invalid combinations from a
|
used by the scanner, or rejecting invalid combinations from a
|
||||||
factory invoked by the user actions).
|
factory invoked by the user actions).
|
||||||
|
|
||||||
*** %define api.value.type variant
|
** Variable api.tokens.prefix
|
||||||
|
|
||||||
This is based on a submission from Michiel De Wilde. With help
|
The variable api.tokens.prefix changes the way tokens are identified in
|
||||||
from Théophile Ranquet.
|
the generated files. This is especially useful to avoid collisions
|
||||||
|
with identifiers in the target language. For instance
|
||||||
|
|
||||||
In this mode, complex C++ objects can be used as semantic values. For
|
%token FILE for ERROR
|
||||||
instance:
|
%define api.tokens.prefix "TOK_"
|
||||||
|
|
||||||
%token <::std::string> TEXT;
|
|
||||||
%token <int> NUMBER;
|
|
||||||
%token SEMICOLON ";"
|
|
||||||
%type <::std::string> item;
|
|
||||||
%type <::std::list<std::string>> list;
|
|
||||||
%%
|
%%
|
||||||
result:
|
start: FILE for ERROR;
|
||||||
list { std::cout << $1 << std::endl; }
|
|
||||||
;
|
|
||||||
|
|
||||||
list:
|
will generate the definition of the symbols TOK_FILE, TOK_for, and
|
||||||
%empty { /* Generates an empty string list. */ }
|
TOK_ERROR in the generated sources. In particular, the scanner must
|
||||||
| list item ";" { std::swap ($$, $1); $$.push_back ($2); }
|
use these prefixed token names, although the grammar itself still
|
||||||
;
|
uses the short names (as in the sample rule given above).
|
||||||
|
|
||||||
item:
|
** Variable api.namespace
|
||||||
TEXT { std::swap ($$, $1); }
|
|
||||||
| NUMBER { $$ = string_cast ($1); }
|
|
||||||
;
|
|
||||||
|
|
||||||
*** %define api.token.constructor
|
The "namespace" variable is renamed "api.namespace". Backward
|
||||||
|
compatibility is ensured, but upgrading is recommended.
|
||||||
|
|
||||||
When variants are enabled, Bison can generate functions to build the
|
** Variable parse.error
|
||||||
tokens. This guarantees that the token type (e.g., NUMBER) is consistent
|
|
||||||
with the semantic value (e.g., int):
|
|
||||||
|
|
||||||
parser::symbol_type yylex ()
|
The variable error controls the verbosity of error messages. The
|
||||||
{
|
use of the %error-verbose directive is deprecated in favor of
|
||||||
parser::location_type loc = ...;
|
%define parse.error "verbose".
|
||||||
...
|
|
||||||
return parser::make_TEXT ("Hello, world!", loc);
|
|
||||||
...
|
|
||||||
return parser::make_NUMBER (42, loc);
|
|
||||||
...
|
|
||||||
return parser::make_SEMICOLON (loc);
|
|
||||||
...
|
|
||||||
}
|
|
||||||
|
|
||||||
*** C++ locations
|
** Semantic predicates
|
||||||
|
|
||||||
There are operator- and operator-= for 'location'. Negative line/column
|
The new, experimental, semantic-predicate feature allows actions of
|
||||||
increments can no longer underflow the resulting value.
|
the form %?{ BOOLEAN-EXPRESSION }, which cause syntax errors (as for
|
||||||
|
YYERROR) if the expression evaluates to 0, and are evaluated immediately
|
||||||
|
in GLR parsers, rather than being deferred. The result is that they
|
||||||
|
allow the programmer to prune possible parses based on the values of
|
||||||
|
run-time expressions.
|
||||||
|
|
||||||
* Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
|
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||||
|
|
||||||
** Bug fixes
|
|
||||||
|
|
||||||
*** Fix compiler attribute portability (yacc.c)
|
|
||||||
|
|
||||||
With locations enabled, __attribute__ was used unprotected.
|
|
||||||
|
|
||||||
*** Fix some compiler warnings (lalr1.cc)
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.7 (2012-12-12) [stable]
|
|
||||||
|
|
||||||
** Bug fixes
|
|
||||||
|
|
||||||
Warnings about uninitialized yylloc in yyparse have been fixed.
|
|
||||||
|
|
||||||
Restored C90 compliance (yet no report was ever made).
|
|
||||||
|
|
||||||
** Diagnostics are improved
|
|
||||||
|
|
||||||
Contributed by Théophile Ranquet.
|
|
||||||
|
|
||||||
*** Changes in the format of error messages
|
|
||||||
|
|
||||||
This used to be the format of many error reports:
|
|
||||||
|
|
||||||
input.y:2.7-12: %type redeclaration for exp
|
|
||||||
input.y:1.7-12: previous declaration
|
|
||||||
|
|
||||||
It is now:
|
|
||||||
|
|
||||||
input.y:2.7-12: error: %type redeclaration for exp
|
|
||||||
input.y:1.7-12: previous declaration
|
|
||||||
|
|
||||||
*** New format for error reports: carets
|
|
||||||
|
|
||||||
Caret errors have been added to Bison:
|
|
||||||
|
|
||||||
input.y:2.7-12: error: %type redeclaration for exp
|
|
||||||
%type <sval> exp
|
|
||||||
^^^^^^
|
|
||||||
input.y:1.7-12: previous declaration
|
|
||||||
%type <ival> exp
|
|
||||||
^^^^^^
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
input.y:3.20-23: error: ambiguous reference: '$exp'
|
|
||||||
exp: exp '+' exp { $exp = $1 + $3; };
|
|
||||||
^^^^
|
|
||||||
input.y:3.1-3: refers to: $exp at $$
|
|
||||||
exp: exp '+' exp { $exp = $1 + $3; };
|
|
||||||
^^^
|
|
||||||
input.y:3.6-8: refers to: $exp at $1
|
|
||||||
exp: exp '+' exp { $exp = $1 + $3; };
|
|
||||||
^^^
|
|
||||||
input.y:3.14-16: refers to: $exp at $3
|
|
||||||
exp: exp '+' exp { $exp = $1 + $3; };
|
|
||||||
^^^
|
|
||||||
|
|
||||||
The default behavior for now is still not to display these unless
|
|
||||||
explicitly asked with -fcaret (or -fall). However, in a later release, it
|
|
||||||
will be made the default behavior (but may still be deactivated with
|
|
||||||
-fno-caret).
|
|
||||||
|
|
||||||
** New value for %define variable: api.pure full
|
|
||||||
|
|
||||||
The %define variable api.pure requests a pure (reentrant) parser. However,
|
|
||||||
for historical reasons, using it in a location-tracking Yacc parser
|
|
||||||
resulted in a yyerror function that did not take a location as a
|
|
||||||
parameter. With this new value, the user may request a better pure parser,
|
|
||||||
where yyerror does take a location as a parameter (in location-tracking
|
|
||||||
parsers).
|
|
||||||
|
|
||||||
The use of "%define api.pure true" is deprecated in favor of this new
|
|
||||||
"%define api.pure full".
|
|
||||||
|
|
||||||
** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
|
|
||||||
|
|
||||||
The %define variable api.location.type defines the name of the type to use
|
|
||||||
for locations. When defined, Bison no longer generates the position.hh
|
|
||||||
and location.hh files, nor does the parser will include them: the user is
|
|
||||||
then responsible to define her type.
|
|
||||||
|
|
||||||
This can be used in programs with several parsers to factor their location
|
|
||||||
and position files: let one of them generate them, and the others just use
|
|
||||||
them.
|
|
||||||
|
|
||||||
This feature was actually introduced, but not documented, in Bison 2.5,
|
|
||||||
under the name "location_type" (which is maintained for backward
|
|
||||||
compatibility).
|
|
||||||
|
|
||||||
For consistency, lalr1.java's %define variables location_type and
|
|
||||||
position_type are deprecated in favor of api.location.type and
|
|
||||||
api.position.type.
|
|
||||||
|
|
||||||
** Exception safety (lalr1.cc)
|
|
||||||
|
|
||||||
The parse function now catches exceptions, uses the %destructors to
|
|
||||||
release memory (the lookahead symbol and the symbols pushed on the stack)
|
|
||||||
before re-throwing the exception.
|
|
||||||
|
|
||||||
This feature is somewhat experimental. User feedback would be
|
|
||||||
appreciated.
|
|
||||||
|
|
||||||
** Graph improvements in DOT and XSLT
|
|
||||||
|
|
||||||
Contributed by Théophile Ranquet.
|
|
||||||
|
|
||||||
The graphical presentation of the states is more readable: their shape is
|
|
||||||
now rectangular, the state number is clearly displayed, and the items are
|
|
||||||
numbered and left-justified.
|
|
||||||
|
|
||||||
The reductions are now explicitly represented as transitions to other
|
|
||||||
diamond shaped nodes.
|
|
||||||
|
|
||||||
These changes are present in both --graph output and xml2dot.xsl XSLT
|
|
||||||
processing, with minor (documented) differences.
|
|
||||||
|
|
||||||
** %language is no longer an experimental feature.
|
|
||||||
|
|
||||||
The introduction of this feature, in 2.4, was four years ago. The
|
|
||||||
--language option and the %language directive are no longer experimental.
|
|
||||||
|
|
||||||
** Documentation
|
|
||||||
|
|
||||||
The sections about shift/reduce and reduce/reduce conflicts resolution
|
|
||||||
have been fixed and extended.
|
|
||||||
|
|
||||||
Although introduced more than four years ago, XML and Graphviz reports
|
|
||||||
were not properly documented.
|
|
||||||
|
|
||||||
The translation of mid-rule actions is now described.
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
|
|
||||||
|
|
||||||
We consider compiler warnings about Bison generated parsers to be bugs.
|
|
||||||
Rather than working around them in your own project, please consider
|
|
||||||
reporting them to us.
|
|
||||||
|
|
||||||
** Bug fixes
|
|
||||||
|
|
||||||
Warnings about uninitialized yylval and/or yylloc for push parsers with a
|
|
||||||
pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
|
|
||||||
3.2.
|
|
||||||
|
|
||||||
Other issues in the test suite have been addressed.
|
|
||||||
|
|
||||||
Null characters are correctly displayed in error messages.
|
|
||||||
|
|
||||||
When possible, yylloc is correctly initialized before calling yylex. It
|
|
||||||
is no longer necessary to initialize it in the %initial-action.
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
|
|
||||||
|
|
||||||
Bison 2.6.3's --version was incorrect. This release fixes this issue.
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
|
|
||||||
|
|
||||||
** Bug fixes
|
|
||||||
|
|
||||||
Bugs and portability issues in the test suite have been fixed.
|
|
||||||
|
|
||||||
Some errors in translations have been addressed, and --help now directs
|
|
||||||
users to the appropriate place to report them.
|
|
||||||
|
|
||||||
Stray Info files shipped by accident are removed.
|
|
||||||
|
|
||||||
Incorrect definitions of YY_, issued by yacc.c when no parser header is
|
|
||||||
generated, are removed.
|
|
||||||
|
|
||||||
All the generated headers are self-contained.
|
|
||||||
|
|
||||||
** Header guards (yacc.c, glr.c, glr.cc)
|
|
||||||
|
|
||||||
In order to avoid collisions, the header guards are now
|
|
||||||
YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
|
|
||||||
For instance the header generated from
|
|
||||||
|
|
||||||
%define api.prefix "calc"
|
|
||||||
%defines "lib/parse.h"
|
|
||||||
|
|
||||||
will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
|
|
||||||
|
|
||||||
** Fix compiler warnings in the generated parser (yacc.c, glr.c)
|
|
||||||
|
|
||||||
The compilation of pure parsers (%define api.pure) can trigger GCC
|
|
||||||
warnings such as:
|
|
||||||
|
|
||||||
input.c: In function 'yyparse':
|
|
||||||
input.c:1503:12: warning: 'yylval' may be used uninitialized in this
|
|
||||||
function [-Wmaybe-uninitialized]
|
|
||||||
*++yyvsp = yylval;
|
|
||||||
^
|
|
||||||
|
|
||||||
This is now fixed; pragmas to avoid these warnings are no longer needed.
|
|
||||||
|
|
||||||
Warnings from clang ("equality comparison with extraneous parentheses" and
|
|
||||||
"function declared 'noreturn' should not return") have also been
|
|
||||||
addressed.
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
|
|
||||||
|
|
||||||
** Bug fixes
|
|
||||||
|
|
||||||
Buffer overruns, complaints from Flex, and portability issues in the test
|
|
||||||
suite have been fixed.
|
|
||||||
|
|
||||||
** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
|
|
||||||
|
|
||||||
Trailing end-of-lines in %parse-param or %lex-param would result in
|
|
||||||
invalid C++. This is fixed.
|
|
||||||
|
|
||||||
** Spurious spaces and end-of-lines
|
|
||||||
|
|
||||||
The generated files no longer end (nor start) with empty lines.
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
|
|
||||||
|
|
||||||
Bison no longer executes user-specified M4 code when processing a grammar.
|
|
||||||
|
|
||||||
** Future Changes
|
|
||||||
|
|
||||||
In addition to the removal of the features announced in Bison 2.6, the
|
|
||||||
next major release will remove the "Temporary hack for adding a semicolon
|
|
||||||
to the user action", as announced in the release 2.5. Instead of:
|
|
||||||
|
|
||||||
exp: exp "+" exp { $$ = $1 + $3 };
|
|
||||||
|
|
||||||
write:
|
|
||||||
|
|
||||||
exp: exp "+" exp { $$ = $1 + $3; };
|
|
||||||
|
|
||||||
** Bug fixes
|
|
||||||
|
|
||||||
*** Type names are now properly escaped.
|
|
||||||
|
|
||||||
*** glr.cc: set_debug_level and debug_level work as expected.
|
|
||||||
|
|
||||||
*** Stray @ or $ in actions
|
|
||||||
|
|
||||||
While Bison used to warn about stray $ or @ in action rules, it did not
|
|
||||||
for other actions such as printers, destructors, or initial actions. It
|
|
||||||
now does.
|
|
||||||
|
|
||||||
** Type names in actions
|
|
||||||
|
|
||||||
For consistency with rule actions, it is now possible to qualify $$ by a
|
|
||||||
type-name in destructors, printers, and initial actions. For instance:
|
|
||||||
|
|
||||||
%printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
|
|
||||||
|
|
||||||
will display two values for each typed and untyped symbol (provided
|
|
||||||
that YYSTYPE has both "ival" and "fval" fields).
|
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6 (2012-07-19) [stable]
|
* Noteworthy changes in release 2.6 (2012-07-19) [stable]
|
||||||
|
|
||||||
** Future changes
|
** Future changes:
|
||||||
|
|
||||||
The next major release of Bison will drop support for the following
|
The next major release of Bison will drop support for the following
|
||||||
deprecated features. Please report disagreements to [email protected].
|
deprecated features. Please report disagreements to [email protected].
|
||||||
|
|
||||||
*** K&R C parsers
|
*** K&C parsers
|
||||||
|
|
||||||
Support for generating parsers in K&R C will be removed. Parsers
|
Support for generating parsers in K&R C will be removed. Parsers
|
||||||
generated for C support ISO C90, and are tested with ISO C99 and ISO C11
|
generated for C support ISO C90, and are tested with ISO C99 and ISO C11
|
||||||
@@ -1115,7 +386,6 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
These features are experimental in this version. More user feedback
|
These features are experimental in this version. More user feedback
|
||||||
will help to stabilize them.
|
will help to stabilize them.
|
||||||
Contributed by Alex Rozenman.
|
|
||||||
|
|
||||||
** IELR(1) and canonical LR(1):
|
** IELR(1) and canonical LR(1):
|
||||||
|
|
||||||
@@ -1146,9 +416,7 @@ GNU Bison NEWS
|
|||||||
These features are experimental. More user feedback will help to
|
These features are experimental. More user feedback will help to
|
||||||
stabilize them.
|
stabilize them.
|
||||||
|
|
||||||
** LAC (Lookahead Correction) for syntax error handling
|
** LAC (Lookahead Correction) for syntax error handling:
|
||||||
|
|
||||||
Contributed by Joel E. Denny.
|
|
||||||
|
|
||||||
Canonical LR, IELR, and LALR can suffer from a couple of problems
|
Canonical LR, IELR, and LALR can suffer from a couple of problems
|
||||||
upon encountering a syntax error. First, the parser might perform
|
upon encountering a syntax error. First, the parser might perform
|
||||||
@@ -1634,7 +902,6 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
The current Java interface is experimental and may evolve. More user
|
The current Java interface is experimental and may evolve. More user
|
||||||
feedback will help to stabilize it.
|
feedback will help to stabilize it.
|
||||||
Contributed by Paolo Bonzini.
|
|
||||||
|
|
||||||
** %language
|
** %language
|
||||||
|
|
||||||
@@ -1648,7 +915,6 @@ GNU Bison NEWS
|
|||||||
Bison can now generate an XML report of the LALR(1) automaton using the new
|
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.
|
user feedback will help to stabilize it.
|
||||||
Contributed by Wojciech Polak.
|
|
||||||
|
|
||||||
** The grammar file may now specify the name of the parser header file using
|
** The grammar file may now specify the name of the parser header file using
|
||||||
%defines. For example:
|
%defines. For example:
|
||||||
@@ -2625,7 +1891,7 @@ Output file does not redefine const for C++.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1995-2013 Free Software Foundation, Inc.
|
Copyright (C) 1995-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Parser Generator.
|
This file is part of Bison, the GNU Parser Generator.
|
||||||
|
|
||||||
@@ -2660,12 +1926,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
||||||
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
||||||
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
|
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
|
||||||
LocalWords: TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
|
LocalWords: TOK
|
||||||
LocalWords: Théophile Ranquet Santet fno fnone stype associativity Tolmer
|
|
||||||
LocalWords: Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
|
|
||||||
LocalWords: redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
|
|
||||||
LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
|
|
||||||
LocalWords: Alexandre MERCHANTABILITY yytype
|
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ to the bison package.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2005, 2009-2013 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2005, 2009-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ not answer them, please send mail to <[email protected]>.
|
|||||||
|
|
||||||
* Bug reports
|
* Bug reports
|
||||||
Please send bug reports to <[email protected]>. Please include the
|
Please send bug reports to <[email protected]>. Please include the
|
||||||
version number from 'bison --version', and a complete, self-contained
|
version number from `bison --version', and a complete, self-contained
|
||||||
test case in each bug report.
|
test case in each bug report.
|
||||||
|
|
||||||
* Copyright statements
|
* Copyright statements
|
||||||
@@ -44,7 +44,7 @@ End:
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2013 Free Software
|
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2012 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
@@ -12,7 +12,7 @@ the problems you encounter.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004, 2009-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+13
-49
@@ -50,17 +50,16 @@ These requirements do not apply when building from a distribution tarball.
|
|||||||
|
|
||||||
** Requirements
|
** Requirements
|
||||||
|
|
||||||
We've opted to keep only the highest-level sources in the repository. This
|
We've opted to keep only the highest-level sources in the repository.
|
||||||
eases our maintenance burden, (fewer merges etc.), but imposes more
|
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
||||||
requirements on anyone wishing to build from the just-checked-out sources.
|
requirements on anyone wishing to build from the just-checked-out sources.
|
||||||
For example, you have to use the latest stable versions of the maintainer
|
For example, you have to use the latest stable versions of the maintainer
|
||||||
tools we depend upon, including:
|
tools we depend upon, including:
|
||||||
|
|
||||||
- Autoconf <http://www.gnu.org/software/autoconf/>
|
|
||||||
- Automake <http://www.gnu.org/software/automake/>
|
- Automake <http://www.gnu.org/software/automake/>
|
||||||
|
- Autoconf <http://www.gnu.org/software/autoconf/>
|
||||||
- Flex <http://www.gnu.org/software/flex/>
|
- Flex <http://www.gnu.org/software/flex/>
|
||||||
- Gettext <http://www.gnu.org/software/gettext/>
|
- Gettext <http://www.gnu.org/software/gettext/>
|
||||||
- Graphviz <http://www.graphviz.org>
|
|
||||||
- Gzip <http://www.gnu.org/software/gzip/>
|
- Gzip <http://www.gnu.org/software/gzip/>
|
||||||
- Perl <http://www.cpan.org/>
|
- Perl <http://www.cpan.org/>
|
||||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||||
@@ -69,16 +68,16 @@ tools we depend upon, including:
|
|||||||
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.
|
||||||
|
|
||||||
Bison is written using Bison grammars, so there are bootstrapping issues.
|
Bison is written using Bison grammars, so there are bootstrapping
|
||||||
The bootstrap script attempts to discover when the C code generated from the
|
issues. The bootstrap script attempts to discover when the C code
|
||||||
grammars is out of date, and to bootstrap with an out-of-date version of the
|
generated from the grammars is out of date, and to bootstrap with an
|
||||||
C code, but the process is not foolproof. Also, you may run into similar
|
out-of-date version of the C code, but the process is not foolproof.
|
||||||
problems yourself if you modify Bison.
|
Also, you may run into similar problems yourself if you modify Bison.
|
||||||
|
|
||||||
Only building the initial full source tree will be a bit painful. Later,
|
Only building the initial full source tree will be a bit painful.
|
||||||
after synchronizing from the repository a plain 'make' should be sufficient.
|
Later, after synchronizing from the repository a plain 'make' should
|
||||||
Note, however, that when gnulib is updated, running './bootstrap' again
|
be sufficient. Note, however, that when gnulib is updated, running
|
||||||
might be needed.
|
'./bootstrap' again might be needed.
|
||||||
|
|
||||||
** First checkout
|
** First checkout
|
||||||
|
|
||||||
@@ -176,41 +175,6 @@ decide whether to update.
|
|||||||
** make check
|
** make check
|
||||||
Use liberally.
|
Use liberally.
|
||||||
|
|
||||||
** TESTSUITEFLAGS
|
|
||||||
|
|
||||||
The default is for make check to run all tests sequentially. This can be
|
|
||||||
very time consumming when checking repeatedly or on slower setups. This can
|
|
||||||
be sped up in two ways:
|
|
||||||
|
|
||||||
Using -j, in a make-like fashion, for example:
|
|
||||||
$ make check TESTSUITEFLAGS='-j8'
|
|
||||||
|
|
||||||
Running only the tests of a certain category, as specified in the AT files
|
|
||||||
with AT_KEYWORDS([[category]]). Categories include:
|
|
||||||
- c++, for c++ parsers
|
|
||||||
- deprec, for tests concerning deprecated constructs.
|
|
||||||
- glr, for glr parsers
|
|
||||||
- java, for java parsers
|
|
||||||
- report, for automaton dumps
|
|
||||||
|
|
||||||
To run a specific set of tests, use -k (for "keyword"). For example:
|
|
||||||
$ make check TESTSUITEFLAGS='-k c++'
|
|
||||||
|
|
||||||
Both can be combined.
|
|
||||||
|
|
||||||
** Typical errors
|
|
||||||
If the test suite shows failures such as the following one
|
|
||||||
|
|
||||||
.../bison/lib/getopt.h:196:8: error: redefinition of 'struct option'
|
|
||||||
/usr/include/getopt.h:54:8: error: previous definition of 'struct option'
|
|
||||||
|
|
||||||
it probably means that some file was compiled without
|
|
||||||
AT_DATA_SOURCE_PROLOGUE. This error is due to the fact that our -I options
|
|
||||||
pick up gnulib's replacement headers, such as getopt.h, and this will go
|
|
||||||
wrong if config.h was not included first.
|
|
||||||
|
|
||||||
See tests/local.at for details.
|
|
||||||
|
|
||||||
** make maintainer-check-valgrind
|
** make maintainer-check-valgrind
|
||||||
This target uses valgrind both to check bison, and the generated parsers.
|
This target uses valgrind both to check bison, and the generated parsers.
|
||||||
|
|
||||||
@@ -440,7 +404,7 @@ Push these changes.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002-2005, 2007-2013 Free Software Foundation, Inc.
|
Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ Bison supports the @N construction, which gives you access to
|
|||||||
the starting and ending line number and character number associated
|
the starting and ending line number and character number associated
|
||||||
with any of the symbols in the current rule.
|
with any of the symbols in the current rule.
|
||||||
|
|
||||||
Also, Bison supports the command '%expect N' which says not to mention
|
Also, Bison supports the command `%expect N' which says not to mention
|
||||||
the conflicts if there are N shift/reduce conflicts and no reduce/reduce
|
the conflicts if there are N shift/reduce conflicts and no reduce/reduce
|
||||||
conflicts.
|
conflicts.
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
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]
|
|
||||||
Airy Andre [email protected]
|
Airy Andre [email protected]
|
||||||
Akim Demaille akim@lrde.epita.fr
|
Akim Demaille akim@freefriends.org
|
||||||
Albert Chin-A-Young [email protected]
|
Albert Chin-A-Young [email protected]
|
||||||
Alexander Belopolsky [email protected]
|
Alexander Belopolsky [email protected]
|
||||||
Alexandre Duret-Lutz adl@lrde.epita.fr
|
Alexandre Duret-Lutz adl@src.lip6.fr
|
||||||
Andreas Schwab [email protected]
|
Andreas Schwab [email protected]
|
||||||
Andrew Suffield [email protected]
|
Andrew Suffield [email protected]
|
||||||
Angelo Borsotti [email protected]
|
Angelo Borsotti [email protected]
|
||||||
@@ -14,7 +13,6 @@ Anthony Heading [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]
|
|
||||||
Benoit Perrot [email protected]
|
Benoit Perrot [email protected]
|
||||||
Bernd Kiefer [email protected]
|
Bernd Kiefer [email protected]
|
||||||
Bert Deknuydt [email protected]
|
Bert Deknuydt [email protected]
|
||||||
@@ -29,16 +27,13 @@ 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 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]
|
||||||
Dennis Clarke [email protected]
|
|
||||||
Derek M. Jones [email protected]
|
Derek M. Jones [email protected]
|
||||||
Di-an Jan [email protected]
|
Di-an Jan [email protected]
|
||||||
Dick Streefland [email protected]
|
Dick Streefland [email protected]
|
||||||
Didier Godefroy [email protected]
|
Didier Godefroy [email protected]
|
||||||
Efi Fogel [email protected]
|
|
||||||
Enrico Scholz [email protected]
|
Enrico Scholz [email protected]
|
||||||
Eric Blake [email protected]
|
Eric Blake [email protected]
|
||||||
Evgeny Stambulchik [email protected]
|
Evgeny Stambulchik [email protected]
|
||||||
@@ -46,7 +41,6 @@ Fabrice Bauzac [email protected]
|
|||||||
Florian Krohm [email protected]
|
Florian Krohm [email protected]
|
||||||
Frank Heckenbach [email protected]
|
Frank Heckenbach [email protected]
|
||||||
Frans Englich [email protected]
|
Frans Englich [email protected]
|
||||||
Gabriel Rassoul [email protected]
|
|
||||||
Georg Sauthoff [email protected]
|
Georg Sauthoff [email protected]
|
||||||
George Neuner [email protected]
|
George Neuner [email protected]
|
||||||
Gilles Espinasse [email protected]
|
Gilles Espinasse [email protected]
|
||||||
@@ -61,7 +55,6 @@ Jim Kent [email protected]
|
|||||||
Jim Meyering [email protected]
|
Jim Meyering [email protected]
|
||||||
Joel E. Denny [email protected]
|
Joel E. Denny [email protected]
|
||||||
Johan van Selst [email protected]
|
Johan van Selst [email protected]
|
||||||
Jonathan Fabrizio [email protected]
|
|
||||||
Jonathan Nieder [email protected]
|
Jonathan Nieder [email protected]
|
||||||
Juan Manuel Guerrero [email protected]
|
Juan Manuel Guerrero [email protected]
|
||||||
Kees Zeelenberg [email protected]
|
Kees Zeelenberg [email protected]
|
||||||
@@ -70,8 +63,6 @@ Laurent Mascherpa [email protected]
|
|||||||
Lie Yan [email protected]
|
Lie Yan [email protected]
|
||||||
Magnus Fromreide [email protected]
|
Magnus Fromreide [email protected]
|
||||||
Marc Autret [email protected]
|
Marc Autret [email protected]
|
||||||
Marc Mendiola [email protected]
|
|
||||||
Mark Boyall [email protected]
|
|
||||||
Martin Jacobs [email protected]
|
Martin Jacobs [email protected]
|
||||||
Martin Mokrejs [email protected]
|
Martin Mokrejs [email protected]
|
||||||
Martin Nylin [email protected]
|
Martin Nylin [email protected]
|
||||||
@@ -84,23 +75,18 @@ Mickael Labau [email protected]
|
|||||||
Mike Castle [email protected]
|
Mike Castle [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]
|
|
||||||
Nicolas Burrus [email protected]
|
Nicolas Burrus [email protected]
|
||||||
Nicolas Tisserand [email protected]
|
Nicolas Tisserand [email protected]
|
||||||
Noah Friedman [email protected]
|
Noah Friedman [email protected]
|
||||||
Odd Arild Olsen [email protected]
|
Odd Arild Olsen [email protected]
|
||||||
Oleg Smolsky [email protected]
|
Oleg Smolsky [email protected]
|
||||||
Oleksii Taran [email protected]
|
|
||||||
Paolo Bonzini [email protected]
|
Paolo Bonzini [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]
|
||||||
Per Allansson [email protected]
|
Per Allansson [email protected]
|
||||||
Peter Eisentraut [email protected]
|
|
||||||
Peter Fales [email protected]
|
Peter Fales [email protected]
|
||||||
Peter Hamorsky [email protected]
|
Peter Hamorsky [email protected]
|
||||||
Peter Simons [email protected]
|
|
||||||
Petr Machata [email protected]
|
|
||||||
Piotr Gackiewicz [email protected]
|
Piotr Gackiewicz [email protected]
|
||||||
Quentin Hocquet [email protected]
|
Quentin Hocquet [email protected]
|
||||||
Quoc Peyrot [email protected]
|
Quoc Peyrot [email protected]
|
||||||
@@ -108,10 +94,7 @@ R Blake [email protected]
|
|||||||
Raja R Harinath [email protected]
|
Raja R Harinath [email protected]
|
||||||
Ralf Wildenhues [email protected]
|
Ralf Wildenhues [email protected]
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
Rob Vermaas [email protected]
|
|
||||||
Robert Anisko [email protected]
|
Robert Anisko [email protected]
|
||||||
Rob Conde [email protected]
|
|
||||||
Roland Levillain [email protected]
|
|
||||||
Satya Kiran Popuri [email protected]
|
Satya Kiran Popuri [email protected]
|
||||||
Sebastian Setzer [email protected]
|
Sebastian Setzer [email protected]
|
||||||
Sebastien Fricker [email protected]
|
Sebastien Fricker [email protected]
|
||||||
@@ -119,8 +102,7 @@ Sergei Steshenko [email protected]
|
|||||||
Shura [email protected]
|
Shura [email protected]
|
||||||
Stefano Lattarini [email protected]
|
Stefano Lattarini [email protected]
|
||||||
Steve Murphy [email protected]
|
Steve Murphy [email protected]
|
||||||
Sum Wu [email protected]
|
Summum Bonum [email protected]
|
||||||
Théophile Ranquet [email protected]
|
|
||||||
Thiru Ramakrishnan [email protected]
|
Thiru Ramakrishnan [email protected]
|
||||||
Tim Josling [email protected]
|
Tim Josling [email protected]
|
||||||
Tim Landscheidt [email protected]
|
Tim Landscheidt [email protected]
|
||||||
@@ -130,13 +112,10 @@ Tom Tromey [email protected]
|
|||||||
Tommy Nordgren [email protected]
|
Tommy Nordgren [email protected]
|
||||||
Troy A. Johnson [email protected]
|
Troy A. Johnson [email protected]
|
||||||
Tys Lefering [email protected]
|
Tys Lefering [email protected]
|
||||||
Valentin Tolmer [email protected]
|
|
||||||
Victor Khomenko [email protected]
|
|
||||||
Vin Shelton [email protected]
|
Vin Shelton [email protected]
|
||||||
W.C.A. Wijngaards [email protected]
|
W.C.A. Wijngaards [email protected]
|
||||||
Wayne Green [email protected]
|
Wayne Green [email protected]
|
||||||
Wei Song [email protected]
|
Wei Song [email protected]
|
||||||
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]
|
||||||
@@ -147,12 +126,11 @@ thank them! Please, help us keeping this list up to date.
|
|||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: text
|
mode: text
|
||||||
coding: utf-8
|
|
||||||
End:
|
End:
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
Copyright (C) 2000-2012 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,63 +1,8 @@
|
|||||||
* Short term
|
* Short term
|
||||||
** Graphviz display code thoughts
|
** Variable names.
|
||||||
The code for the --graph option is over two files: print_graph, and
|
What should we name `variant' and `lex_symbol'?
|
||||||
graphviz. This is because Bison used to also produce VCG graphs, but since
|
|
||||||
this is no longer true, maybe we could consider these files for fusion.
|
|
||||||
|
|
||||||
An other consideration worth noting is that print_graph.c (correct me if I
|
** Update the documentation on gnu.org
|
||||||
am wrong) should contain generic functions, whereas graphviz.c and other
|
|
||||||
potential files should contain just the specific code for that output
|
|
||||||
format. It will probably prove difficult to tell if the implementation is
|
|
||||||
actually generic whilst only having support for a single format, but it
|
|
||||||
would be nice to keep stuff a bit tidier: right now, the construction of the
|
|
||||||
bitset used to show reductions is in the graphviz-specific code, and on the
|
|
||||||
opposite side we have some use of \l, which is graphviz-specific, in what
|
|
||||||
should be generic code.
|
|
||||||
|
|
||||||
Little effort seems to have been given to factoring these files and their
|
|
||||||
rint{,-xml} counterpart. We would very much like to re-use the pretty format
|
|
||||||
of states from .output for the graphs, etc.
|
|
||||||
|
|
||||||
Also, the underscore in print_graph.[ch] isn't very fitting considering the
|
|
||||||
dashes in the other filenames.
|
|
||||||
|
|
||||||
Since graphviz dies on medium-to-big grammars, maybe consider an other tool?
|
|
||||||
|
|
||||||
** push-parser
|
|
||||||
Check it too when checking the different kinds of parsers. And be
|
|
||||||
sure to check that the initial-action is performed once per parsing.
|
|
||||||
|
|
||||||
** m4 names
|
|
||||||
b4_shared_declarations is no longer what it is. Make it
|
|
||||||
b4_parser_declaration for instance.
|
|
||||||
|
|
||||||
** yychar in lalr1.cc
|
|
||||||
There is a large difference bw maint and master on the handling of
|
|
||||||
yychar (which was removed in lalr1.cc). See what needs to be
|
|
||||||
back-ported.
|
|
||||||
|
|
||||||
|
|
||||||
/* User semantic actions sometimes alter yychar, and that requires
|
|
||||||
that yytoken be updated with the new translation. We take the
|
|
||||||
approach of translating immediately before every use of yytoken.
|
|
||||||
One alternative is translating here after every semantic action,
|
|
||||||
but that translation would be missed if the semantic action
|
|
||||||
invokes YYABORT, YYACCEPT, or YYERROR immediately after altering
|
|
||||||
yychar. In the case of YYABORT or YYACCEPT, an incorrect
|
|
||||||
destructor might then be invoked immediately. In the case of
|
|
||||||
YYERROR, subsequent parser actions might lead to an incorrect
|
|
||||||
destructor call or verbose syntax error message before the
|
|
||||||
lookahead is translated. */
|
|
||||||
|
|
||||||
/* Make sure we have latest lookahead translation. See comments at
|
|
||||||
user semantic actions for why this is necessary. */
|
|
||||||
yytoken = yytranslate_ (yychar);
|
|
||||||
|
|
||||||
|
|
||||||
** stack.hh
|
|
||||||
Get rid of it. The original idea is nice, but actually it makes
|
|
||||||
the code harder to follow, and uselessly different from the other
|
|
||||||
skeletons.
|
|
||||||
|
|
||||||
** Get rid of fake #lines [Bison: ...]
|
** Get rid of fake #lines [Bison: ...]
|
||||||
Possibly as simple as checking whether the column number is nonnegative.
|
Possibly as simple as checking whether the column number is nonnegative.
|
||||||
@@ -85,7 +30,14 @@ since it is no longer bound to a particular parser, it's just a
|
|||||||
** Rename LR0.cc
|
** Rename LR0.cc
|
||||||
as lr0.cc, why upper case?
|
as lr0.cc, why upper case?
|
||||||
|
|
||||||
|
** bench several bisons.
|
||||||
|
Enhance bench.pl with %b to run different bisons.
|
||||||
|
|
||||||
* Various
|
* Various
|
||||||
|
** Warnings
|
||||||
|
Warnings about type tags that are used in printer and dtors, but not
|
||||||
|
for symbols?
|
||||||
|
|
||||||
** YYERRCODE
|
** YYERRCODE
|
||||||
Defined to 256, but not used, not documented. Probably the token
|
Defined to 256, but not used, not documented. Probably the token
|
||||||
number for the error token, which POSIX wants to be 256, but which
|
number for the error token, which POSIX wants to be 256, but which
|
||||||
@@ -131,6 +83,9 @@ so both 256 and 257 are "mysterious".
|
|||||||
"\"end of command\"", "error", "$undefined", "\"=\"", "\"break\"",
|
"\"end of command\"", "error", "$undefined", "\"=\"", "\"break\"",
|
||||||
|
|
||||||
|
|
||||||
|
** YYFAIL
|
||||||
|
It is seems to be *really* obsolete now, shall we remove it?
|
||||||
|
|
||||||
** yychar == yyempty_
|
** yychar == yyempty_
|
||||||
The code in yyerrlab reads:
|
The code in yyerrlab reads:
|
||||||
|
|
||||||
@@ -148,6 +103,12 @@ really possible? The test suite does not exercise this case.
|
|||||||
This shows that it would be interesting to manage to install skeleton
|
This shows that it would be interesting to manage to install skeleton
|
||||||
coverage analysis to the test suite.
|
coverage analysis to the test suite.
|
||||||
|
|
||||||
|
** Table definitions
|
||||||
|
It should be very easy to factor the definition of the various tables,
|
||||||
|
including the separation bw declaration and definition. See for
|
||||||
|
instance b4_table_define in lalr1.cc. This way, we could even factor
|
||||||
|
C vs. C++ definitions.
|
||||||
|
|
||||||
* From lalr1.cc to yacc.c
|
* From lalr1.cc to yacc.c
|
||||||
** Single stack
|
** Single stack
|
||||||
Merging the three stacks in lalr1.cc simplified the code, prompted for
|
Merging the three stacks in lalr1.cc simplified the code, prompted for
|
||||||
@@ -176,13 +137,13 @@ part of $default. Should we make the two reductions explicit, or just
|
|||||||
keep $default? See the following point.
|
keep $default? See the following point.
|
||||||
|
|
||||||
** Disabled Reductions
|
** Disabled Reductions
|
||||||
See 'tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
|
See `tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
|
||||||
what we want to do.
|
what we want to do.
|
||||||
|
|
||||||
** Documentation
|
** Documentation
|
||||||
Extend with error productions. The hard part will probably be finding
|
Extend with error productions. The hard part will probably be finding
|
||||||
the right rule so that a single state does not exhibit too many yet
|
the right rule so that a single state does not exhibit too many yet
|
||||||
undocumented ''features''. Maybe an empty action ought to be
|
undocumented ``features''. Maybe an empty action ought to be
|
||||||
presented too. Shall we try to make a single grammar with all these
|
presented too. Shall we try to make a single grammar with all these
|
||||||
features, or should we have several very small grammars?
|
features, or should we have several very small grammars?
|
||||||
|
|
||||||
@@ -243,9 +204,9 @@ into
|
|||||||
exp: exp '+' exp | exp '&' exp;
|
exp: exp '+' exp | exp '&' exp;
|
||||||
|
|
||||||
when there are no actions. This can significantly speed up some
|
when there are no actions. This can significantly speed up some
|
||||||
grammars. I can't find the papers. In particular the book 'LR
|
grammars. I can't find the papers. In particular the book `LR
|
||||||
parsing: Theory and Practice' is impossible to find, but according to
|
parsing: Theory and Practice' is impossible to find, but according to
|
||||||
'Parsing Techniques: a Practical Guide', it includes information about
|
`Parsing Techniques: a Practical Guide', it includes information about
|
||||||
this issue. Does anybody have it?
|
this issue. Does anybody have it?
|
||||||
|
|
||||||
|
|
||||||
@@ -273,6 +234,9 @@ Paul notes:
|
|||||||
tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
|
tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
|
||||||
the source code. This should get fixed.
|
the source code. This should get fixed.
|
||||||
|
|
||||||
|
* --graph
|
||||||
|
Show reductions.
|
||||||
|
|
||||||
* Broken options ?
|
* Broken options ?
|
||||||
** %token-table
|
** %token-table
|
||||||
** Skeleton strategy
|
** Skeleton strategy
|
||||||
@@ -369,7 +333,7 @@ End:
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2001-2004, 2006, 2008-2013 Free Software Foundation, Inc.
|
Copyright (C) 2001-2004, 2006, 2008-2012 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,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Print a version string.
|
# Print a version string.
|
||||||
scriptversion=2013-07-03.20; # UTC
|
scriptversion=2012-07-19.14; # 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-2012 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
|
||||||
@@ -140,21 +140,20 @@ po_download_command_format2=\
|
|||||||
"wget --mirror -nd -q -np -A.po -P '%s' \
|
"wget --mirror -nd -q -np -A.po -P '%s' \
|
||||||
http://translationproject.org/latest/%s/"
|
http://translationproject.org/latest/%s/"
|
||||||
|
|
||||||
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
|
||||||
# fall back to the package name (1st argument with munging)
|
|
||||||
extract_package_name='
|
extract_package_name='
|
||||||
/^AC_INIT(\[*/{
|
/^AC_INIT(/{
|
||||||
s///
|
/.*,.*,.*, */{
|
||||||
/^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
|
s///
|
||||||
s//\1/
|
s/[][]//g
|
||||||
s/[],)].*//
|
s/)$//
|
||||||
p
|
p
|
||||||
q
|
q
|
||||||
}
|
}
|
||||||
s/[],)].*//
|
s/AC_INIT(\[*//
|
||||||
|
s/]*,.*//
|
||||||
s/^GNU //
|
s/^GNU //
|
||||||
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||||
s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
|
s/[^A-Za-z0-9_]/-/g
|
||||||
p
|
p
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
@@ -256,12 +255,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
|
||||||
"
|
"
|
||||||
|
|
||||||
@@ -307,34 +306,34 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
|
|||||||
die "Bootstrapping from a non-checked-out distribution is risky."
|
die "Bootstrapping from a non-checked-out distribution is risky."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Strip blank and comment lines to leave significant entries.
|
# Ensure that lines starting with ! sort last, per gitignore conventions
|
||||||
gitignore_entries() {
|
# for whitelisting exceptions after a more generic blacklist pattern.
|
||||||
sed '/^#/d; /^$/d' "$@"
|
sort_patterns() {
|
||||||
|
sort -u "$@" | sed '/^!/ {
|
||||||
|
H
|
||||||
|
d
|
||||||
|
}
|
||||||
|
$ {
|
||||||
|
P
|
||||||
|
x
|
||||||
|
s/^\n//
|
||||||
|
}' | sed '/^$/d'
|
||||||
}
|
}
|
||||||
|
|
||||||
# If $STR is not already on a line by itself in $FILE, insert it at the start.
|
# If $STR is not already on a line by itself in $FILE, insert it,
|
||||||
# Entries are inserted at the start of the ignore list to ensure existing
|
# sorting the new contents of the file and replacing $FILE with the result.
|
||||||
# entries starting with ! are not overridden. Such entries support
|
insert_sorted_if_absent() {
|
||||||
# whitelisting exceptions after a more generic blacklist pattern.
|
|
||||||
insert_if_absent() {
|
|
||||||
file=$1
|
file=$1
|
||||||
str=$2
|
str=$2
|
||||||
test -f $file || touch $file
|
test -f $file || touch $file
|
||||||
test -r $file || die "Error: failed to read ignore file: $file"
|
echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|
||||||
duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
|
|| { echo "$str" | sort_patterns - $file > $file.bak \
|
||||||
if [ "$duplicate_entries" ] ; then
|
&& mv $file.bak $file; } \
|
||||||
die "Error: Duplicate entries in $file: " $duplicate_entries
|
|| die "insert_sorted_if_absent $file $str: failed"
|
||||||
fi
|
|
||||||
linesold=$(gitignore_entries $file | wc -l)
|
|
||||||
linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | wc -l)
|
|
||||||
if [ $linesold != $linesnew ] ; then
|
|
||||||
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|
|
||||||
|| die "insert_if_absent $file $str: failed"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
||||||
# insert_if_absent.
|
# insert_sorted_if_absent.
|
||||||
insert_vc_ignore() {
|
insert_vc_ignore() {
|
||||||
vc_ignore_file="$1"
|
vc_ignore_file="$1"
|
||||||
pattern="$2"
|
pattern="$2"
|
||||||
@@ -345,7 +344,7 @@ insert_vc_ignore() {
|
|||||||
# .gitignore entry.
|
# .gitignore entry.
|
||||||
pattern=$(echo "$pattern" | sed s,^,/,);;
|
pattern=$(echo "$pattern" | sed s,^,/,);;
|
||||||
esac
|
esac
|
||||||
insert_if_absent "$vc_ignore_file" "$pattern"
|
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
||||||
@@ -551,7 +550,7 @@ 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 $use_git && test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
if test -d .git && (git --version) >/dev/null 2>/dev/null ; 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 (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
|
||||||
@@ -574,17 +573,13 @@ git_modules_config () {
|
|||||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
if $use_git; then
|
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
# Get gnulib files.
|
||||||
# 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 || exit $?
|
||||||
@@ -605,8 +600,8 @@ case ${GNULIB_SRCDIR--} in
|
|||||||
GNULIB_SRCDIR=$gnulib_path
|
GNULIB_SRCDIR=$gnulib_path
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Use GNULIB_SRCDIR directly or as a reference.
|
# Use GNULIB_SRCDIR as a reference.
|
||||||
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
if 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
|
||||||
@@ -632,19 +627,12 @@ 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..."
|
||||||
case $(sh -c 'echo "$1"' -- a) in
|
|
||||||
a) ignored=--;;
|
|
||||||
*) ignored=ignored;;
|
|
||||||
esac
|
|
||||||
exec sh -c \
|
exec sh -c \
|
||||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||||
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
-- "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||||
"$0" "$@" --no-bootstrap-sync
|
"$0" "$@" --no-bootstrap-sync
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
@@ -901,21 +889,20 @@ find "$m4_base" "$source_base" \
|
|||||||
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
||||||
-type l -xtype l -delete > /dev/null 2>&1
|
-type l -xtype l -delete > /dev/null 2>&1
|
||||||
|
|
||||||
# Invoke autoreconf with --force --install to ensure upgrades of tools
|
|
||||||
# such as ylwrap.
|
|
||||||
AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
|
|
||||||
|
|
||||||
# Some systems (RHEL 5) are using ancient autotools, for which the
|
# Some systems (RHEL 5) are using ancient autotools, for which the
|
||||||
# --no-recursive option had not been invented. Detect that lack and
|
# --no-recursive option had not been invented. Detect that lack and
|
||||||
# omit the option when it's not supported. FIXME in 2017: remove this
|
# omit the option when it's not supported. FIXME in 2017: remove this
|
||||||
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
|
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
|
||||||
|
no_recursive=
|
||||||
case $($AUTORECONF --help) in
|
case $($AUTORECONF --help) in
|
||||||
*--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";;
|
*--no-recursive*) no_recursive=--no-recursive;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
|
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
|
||||||
echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
|
echo "running: AUTOPOINT=true LIBTOOLIZE=true " \
|
||||||
AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \
|
"$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS"
|
||||||
|
AUTOPOINT=true LIBTOOLIZE=true \
|
||||||
|
$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \
|
||||||
|| die "autoreconf failed"
|
|| die "autoreconf failed"
|
||||||
|
|
||||||
# Get some extra files from gnulib, overriding existing files.
|
# Get some extra files from gnulib, overriding existing files.
|
||||||
|
|||||||
+7
-11
@@ -1,6 +1,6 @@
|
|||||||
# Bootstrap configuration.
|
# Bootstrap configuration.
|
||||||
|
|
||||||
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2012 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,16 +20,11 @@ gnulib_modules='
|
|||||||
argmatch assert calloc-posix close closeout config-h c-strcase
|
argmatch assert calloc-posix close closeout config-h c-strcase
|
||||||
configmake
|
configmake
|
||||||
dirname
|
dirname
|
||||||
error extensions fdl fopen-safer
|
error extensions fdl fopen-safer getopt-gnu
|
||||||
getopt-gnu
|
|
||||||
gettext git-version-gen gitlog-to-changelog
|
gettext git-version-gen gitlog-to-changelog
|
||||||
gpl-3.0 hash inttypes isnan javacomp-script
|
gpl-3.0 hash inttypes isnan javacomp-script
|
||||||
javaexec-script ldexpl malloc-gnu
|
javaexec-script ldexpl malloc-gnu
|
||||||
mbswidth
|
mbswidth obstack perror progname
|
||||||
non-recursive-gnulib-prefix-hack
|
|
||||||
obstack
|
|
||||||
obstack-printf
|
|
||||||
perror progname
|
|
||||||
quote quotearg
|
quote quotearg
|
||||||
readme-release
|
readme-release
|
||||||
realloc-posix
|
realloc-posix
|
||||||
@@ -50,8 +45,9 @@ gnulib_modules='
|
|||||||
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||||
--from-code=UTF-8\\\
|
--from-code=UTF-8\\\
|
||||||
--flag=asprintf:2:c-format\\\
|
--flag=asprintf:2:c-format\\\
|
||||||
--flag=complain:3:c-format\\\
|
--flag=complain:2:c-format\\\
|
||||||
--flag=complain_indent:4:c-format\\\
|
--flag=complain_at:3:c-format\\\
|
||||||
|
--flag=complain_at_indent:4:c-format\\\
|
||||||
--flag=unexpected_end:2:c-format\\\
|
--flag=unexpected_end:2:c-format\\\
|
||||||
'
|
'
|
||||||
XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
|
XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
|
||||||
@@ -80,7 +76,7 @@ gnulib_tool_option_extras='--symlink --makefile-name=gnulib.mk'
|
|||||||
bootstrap_post_import_hook()
|
bootstrap_post_import_hook()
|
||||||
{
|
{
|
||||||
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
|
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
|
||||||
build-aux/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk
|
etc/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk
|
||||||
|
|
||||||
# Ensure that ChangeLog exists, for automake.
|
# Ensure that ChangeLog exists, for automake.
|
||||||
test -f ChangeLog || touch ChangeLog
|
test -f ChangeLog || touch ChangeLog
|
||||||
|
|||||||
@@ -26,4 +26,3 @@
|
|||||||
/vc-list-files
|
/vc-list-files
|
||||||
/warn-on-use.h
|
/warn-on-use.h
|
||||||
/ylwrap
|
/ylwrap
|
||||||
/prefix-gnulib-mk
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2012 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,8 +1,3 @@
|
|||||||
# This file is expected to be used via gitlog-to-changelog's --amend=FILE
|
# This file is expected to be used via gitlog-to-changelog's --amend=FILE
|
||||||
# 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.
|
||||||
|
|
||||||
0db2648930e3b6c376a539aabe368aade83ee29a
|
|
||||||
s/--flags/--feature/;
|
|
||||||
s/flag_flag/feature_flag/;
|
|
||||||
s/\bflag\b/feature/;
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
# 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
|
|
||||||
}
|
|
||||||
+3
-2
@@ -1,4 +1,6 @@
|
|||||||
# Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
## Makefile for Bison testsuite.
|
||||||
|
|
||||||
|
# Copyright (C) 2000-2012 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 +18,6 @@
|
|||||||
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
|
||||||
|
|||||||
@@ -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-2012 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
|
||||||
|
|||||||
@@ -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-2012 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,5 +1,5 @@
|
|||||||
# Customize maint.mk -*- makefile -*-
|
# Customize maint.mk -*- makefile -*-
|
||||||
# Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2008-2012 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,7 +24,6 @@ regen: _version
|
|||||||
|
|
||||||
# Used in maint.mk's web-manual rule
|
# Used in maint.mk's web-manual rule
|
||||||
manual_title = The Yacc-compatible Parser Generator
|
manual_title = The Yacc-compatible Parser Generator
|
||||||
gendocs_options_ = -I $(abs_top_srcdir)/doc -I $(abs_top_builddir)/doc
|
|
||||||
|
|
||||||
# It's useful to run maintainer-*check* targets during development, but we
|
# It's useful to run maintainer-*check* targets during development, but we
|
||||||
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
||||||
@@ -55,126 +54,19 @@ update-copyright: update-b4-copyright update-package-copyright-year
|
|||||||
update-copyright-env = \
|
update-copyright-env = \
|
||||||
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
||||||
|
|
||||||
|
|
||||||
## -------------------- ##
|
|
||||||
## More syntax-checks. ##
|
|
||||||
## -------------------- ##
|
|
||||||
|
|
||||||
# At least for Mac OS X's grep, the order between . and [ in "[^.[]"
|
|
||||||
# matters:
|
|
||||||
# $ LC_ALL=fr_FR grep -nE '[^[.]' /dev/null
|
|
||||||
# $ LC_ALL=C grep -nE '[^[.]' /dev/null
|
|
||||||
# grep: invalid collating element or class
|
|
||||||
# $ LC_ALL=fr_FR grep -nE '[^.[]' /dev/null
|
|
||||||
# $ LC_ALL=C grep -nE '[^.[]' /dev/null
|
|
||||||
sc_at_parser_check:
|
|
||||||
@prohibit='AT_PARSER_CHECK\(\[+[^.[]|AT_CHECK\(\[+\./' \
|
|
||||||
halt='use AT_PARSER_CHECK for and only for generated parsers' \
|
|
||||||
$(_sc_search_regexp)
|
|
||||||
|
|
||||||
# Indent only with spaces.
|
|
||||||
# Taken from Coreutils.
|
|
||||||
sc_prohibit_tab_based_indentation:
|
|
||||||
@prohibit='^ * ' \
|
|
||||||
halt='TAB in indentation; use only spaces' \
|
|
||||||
$(_sc_search_regexp)
|
|
||||||
|
|
||||||
# Prohibit the use of `...` in tests/. Use $(...) instead.
|
|
||||||
# Taken from Coreutils.
|
|
||||||
# Not ready for Bison yet.
|
|
||||||
#sc_prohibit_test_backticks:
|
|
||||||
# @prohibit='`' in_vc_files='^tests/' \
|
|
||||||
# halt='use $$(...), not `...` in tests/' \
|
|
||||||
# $(_sc_search_regexp)
|
|
||||||
|
|
||||||
# Enforce recommended preprocessor indentation style.
|
|
||||||
# Taken from Coreutils.
|
|
||||||
sc_preprocessor_indentation:
|
|
||||||
@if cppi --version >/dev/null 2>&1; then \
|
|
||||||
$(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c \
|
|
||||||
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
|
|
||||||
exit 1; }; \
|
|
||||||
else \
|
|
||||||
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
# Taken from Coreutils.
|
|
||||||
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
|
|
||||||
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
|
|
||||||
_pre_anchored = ^\($(_pre)\)
|
|
||||||
_comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
|
|
||||||
# help font-lock mode: '
|
|
||||||
|
|
||||||
# A sed expression that removes ANSI C and ISO C99 comments.
|
|
||||||
# Derived from the one in GNU gettext's 'moopp' preprocessor.
|
|
||||||
_sed_remove_comments = \
|
|
||||||
/[/][/*]/{ \
|
|
||||||
ta; \
|
|
||||||
:a; \
|
|
||||||
s,$(_pre_anchored)//.*,\1,; \
|
|
||||||
te; \
|
|
||||||
s,$(_pre_anchored)/[*]\($(_comment_and_close),\1 ,; \
|
|
||||||
ta; \
|
|
||||||
/^$(_pre)[/][*]/{ \
|
|
||||||
s,$(_pre_anchored)/[*].*,\1 ,; \
|
|
||||||
tu; \
|
|
||||||
:u; \
|
|
||||||
n; \
|
|
||||||
s,^\($(_comment_and_close),,; \
|
|
||||||
tv; \
|
|
||||||
s,^.*$$,,; \
|
|
||||||
bu; \
|
|
||||||
:v; \
|
|
||||||
}; \
|
|
||||||
:e; \
|
|
||||||
}
|
|
||||||
# Quote all single quotes.
|
|
||||||
_sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
|
|
||||||
# help font-lock mode: '
|
|
||||||
|
|
||||||
_space_before_paren_exempt =? \\n\\$$
|
|
||||||
_space_before_paren_exempt = \
|
|
||||||
(^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init)|symbol)
|
|
||||||
# Ensure that there is a space before each open parenthesis in C code.
|
|
||||||
sc_space_before_open_paren:
|
|
||||||
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
|
||||||
fail=0; \
|
|
||||||
for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \
|
|
||||||
sed '$(_sed_rm_comments_q)' $$c 2>/dev/null \
|
|
||||||
| grep -i '[[:alnum:]](' \
|
|
||||||
| grep -vE '$(_space_before_paren_exempt)' \
|
|
||||||
| grep . && { fail=1; echo "*** $$c"; }; \
|
|
||||||
done; \
|
|
||||||
test $$fail = 1 && \
|
|
||||||
{ echo '$(ME): the above files lack a space-before-open-paren' \
|
|
||||||
1>&2; exit 1; } || :; \
|
|
||||||
else :; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
## -------------------------- ##
|
|
||||||
## syntax-checks exceptions. ##
|
|
||||||
## -------------------------- ##
|
|
||||||
|
|
||||||
exclude = \
|
exclude = \
|
||||||
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
||||||
$(call exclude, \
|
$(call exclude, \
|
||||||
bindtextdomain=^lib/main.c$$ \
|
bindtextdomain=^lib/main.c$$ \
|
||||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
|
||||||
program_name=^lib/main.c$$ \
|
program_name=^lib/main.c$$ \
|
||||||
prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \
|
prohibit_always-defined_macros=^data/yacc.c|^djgpp/ \
|
||||||
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
||||||
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
||||||
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
||||||
prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \
|
|
||||||
prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \
|
|
||||||
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
||||||
prohibit_doubled_word=^tests/named-refs.at$$ \
|
prohibit_empty_lines_at_EOF=^src/parse-gram.h$$ \
|
||||||
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
prohibit_strcmp=^doc/bison\.texi$$ \
|
||||||
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
|
||||||
prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \
|
|
||||||
prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git \
|
|
||||||
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
||||||
space_before_open_paren=^(data/|djgpp/) \
|
space_tab=^tests/(input|c\+\+)\.at$$ \
|
||||||
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$) \
|
||||||
)
|
)
|
||||||
|
|||||||
+25
-74
@@ -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-2012 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,7 +18,7 @@
|
|||||||
# In order for some versions of Sun Studio to compile our C++ test cases
|
# In order for some versions of Sun Studio to compile our C++ test cases
|
||||||
# correctly, we need Autoconf 2.64 or better to handle the restrict
|
# correctly, we need Autoconf 2.64 or better to handle the restrict
|
||||||
# keyword in at least string.h from gnulib. We need Autoconf 2.68 or
|
# keyword in at least string.h from gnulib. We need Autoconf 2.68 or
|
||||||
# better to avoid a typo in the 'configure --help' entry for the YACC
|
# better to avoid a typo in the `configure --help' entry for the YACC
|
||||||
# environment variable.
|
# environment variable.
|
||||||
AC_PREREQ([2.68])
|
AC_PREREQ([2.68])
|
||||||
m4_pattern_forbid([^gl_[A-Z]])
|
m4_pattern_forbid([^gl_[A-Z]])
|
||||||
@@ -26,7 +26,7 @@ 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], [2012])
|
||||||
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])
|
||||||
|
|
||||||
@@ -60,20 +60,6 @@ AC_PROG_CXX
|
|||||||
# Gnulib (early checks).
|
# Gnulib (early checks).
|
||||||
gl_EARLY
|
gl_EARLY
|
||||||
|
|
||||||
# Gnulib uses '#pragma GCC diagnostic push' to silence some
|
|
||||||
# warnings, but older gcc doesn't support this.
|
|
||||||
AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
|
||||||
[lv_cv_gcc_pragma_push_works], [
|
|
||||||
save_CFLAGS=$CFLAGS
|
|
||||||
CFLAGS='-Wunknown-pragmas -Werror'
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
]])],
|
|
||||||
[lv_cv_gcc_pragma_push_works=yes],
|
|
||||||
[lv_cv_gcc_pragma_push_works=no])
|
|
||||||
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)],
|
||||||
[case $enable_gcc_warnings in
|
[case $enable_gcc_warnings in
|
||||||
@@ -83,53 +69,23 @@ AC_ARG_ENABLE([gcc-warnings],
|
|||||||
[enable_gcc_warnings=no])
|
[enable_gcc_warnings=no])
|
||||||
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
|
||||||
-Wformat -Wpointer-arith -Wwrite-strings'
|
-Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings'
|
||||||
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
warn_c='-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes
|
||||||
|
-Wshadow -Wstrict-prototypes'
|
||||||
warn_cxx='-Wnoexcept'
|
warn_cxx='-Wnoexcept'
|
||||||
# Warnings for the test suite only.
|
|
||||||
#
|
|
||||||
# -fno-color-diagnostics: Clang's use of colors in the error
|
|
||||||
# messages is confusing the tests looking at the compiler's output
|
|
||||||
# (e.g., synclines.at).
|
|
||||||
warn_tests='-Wundef -pedantic -Wsign-compare -fno-color-diagnostics'
|
|
||||||
|
|
||||||
AC_LANG_PUSH([C])
|
AC_LANG_PUSH([C])
|
||||||
# Clang supports many of GCC's -W options, but only issues warnings
|
|
||||||
# on the ones it does not recognize. In that case, gl_WARN_ADD
|
|
||||||
# thinks the option is supported, and unknown options are then added
|
|
||||||
# to CFLAGS. But then, when -Werror is added in the test suite for
|
|
||||||
# instance, the warning about the unknown option turns into an
|
|
||||||
# error.
|
|
||||||
#
|
|
||||||
# This should be addressed by gnulib's gl_WARN_ADD, but in the
|
|
||||||
# meanwhile, turn warnings about unknown options into errors in
|
|
||||||
# CFLAGS, and restore CFLAGS after the tests.
|
|
||||||
save_CFLAGS=$CFLAGS
|
|
||||||
gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
|
|
||||||
for i in $warn_common $warn_c;
|
for i in $warn_common $warn_c;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
||||||
done
|
done
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
||||||
|
|
||||||
# Warnings for the test suite, and maybe for bison if GCC is modern
|
|
||||||
# enough.
|
|
||||||
gl_WARN_ADD([-Wmissing-declarations], [WARN_CFLAGS_TEST])
|
|
||||||
gl_WARN_ADD([-Wmissing-prototypes], [WARN_CFLAGS_TEST])
|
|
||||||
test $lv_cv_gcc_pragma_push_works = yes &&
|
|
||||||
AS_VAR_APPEND([WARN_CFLAGS], [" $WARN_CFLAGS_TEST"])
|
|
||||||
|
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
for i in $warn_tests;
|
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
|
||||||
do
|
gl_WARN_ADD([-pedantic], [WARN_CFLAGS_TEST])
|
||||||
gl_WARN_ADD([$i], [WARN_CFLAGS_TEST])
|
|
||||||
done
|
|
||||||
CFLAGS=$save_CFLAGS
|
|
||||||
AC_LANG_POP([C])
|
AC_LANG_POP([C])
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
save_CXXFLAGS=$CXXFLAGS
|
|
||||||
gl_WARN_ADD([-Werror=unknown-warning-option], [CXXFLAGS])
|
|
||||||
for i in $warn_common $warn_cxx;
|
for i in $warn_common $warn_cxx;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
||||||
@@ -138,24 +94,13 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
[AC_LANG_PROGRAM([], [nullptr])])
|
[AC_LANG_PROGRAM([], [nullptr])])
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
for i in $warn_tests;
|
gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
|
||||||
do
|
gl_WARN_ADD([-pedantic], [WARN_CXXFLAGS_TEST])
|
||||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS_TEST])
|
|
||||||
done
|
|
||||||
# Clang++ 3.2+ reject C code generated by Flex.
|
|
||||||
gl_WARN_ADD([-Wno-null-conversion], [FLEX_SCANNER_CXXFLAGS])
|
|
||||||
# So does G++ 4.8...
|
|
||||||
gl_WARN_ADD([-Wno-sign-compare], [FLEX_SCANNER_CXXFLAGS])
|
|
||||||
# ... possiby in std=c++11 mode.
|
|
||||||
gl_WARN_ADD([-Wno-zero-as-null-pointer-constant], [FLEX_SCANNER_CXXFLAGS])
|
|
||||||
CXXFLAGS=$save_CXXFLAGS
|
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||||
BISON_C_COMPILER_POSIXLY_CORRECT
|
|
||||||
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||||
BISON_CXX_COMPILER_POSIXLY_CORRECT
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([yacc],
|
AC_ARG_ENABLE([yacc],
|
||||||
[AC_HELP_STRING([--disable-yacc],
|
[AC_HELP_STRING([--disable-yacc],
|
||||||
@@ -173,7 +118,6 @@ AC_SUBST([YACC_SCRIPT])
|
|||||||
AC_SUBST([YACC_LIBRARY])
|
AC_SUBST([YACC_LIBRARY])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AM_MISSING_PROG([DOT], [dot])
|
|
||||||
AC_PROG_LEX
|
AC_PROG_LEX
|
||||||
$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
|
$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
@@ -230,16 +174,10 @@ case $VALGRIND:$host_os in
|
|||||||
'':*) ;;
|
'':*) ;;
|
||||||
*:darwin*)
|
*:darwin*)
|
||||||
# See README-hacking.
|
# See README-hacking.
|
||||||
# VALGRIND+='-q --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
|
# VALGRIND+=' --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
|
||||||
VALGRIND=;;
|
VALGRIND=;;
|
||||||
*:*)
|
*:*)
|
||||||
suppfile=build-aux/$host_os.valgrind
|
AC_SUBST([VALGRIND_PREBISON], [$VALGRIND -q]);;
|
||||||
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
|
||||||
|
|
||||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||||
@@ -249,6 +187,19 @@ AC_SUBST([GCC])
|
|||||||
gt_JAVACOMP([1.3], [1.4])
|
gt_JAVACOMP([1.3], [1.4])
|
||||||
gt_JAVAEXEC
|
gt_JAVAEXEC
|
||||||
|
|
||||||
|
# We use gnulib, but from lib/local.mk instead of lib/Makefile.am.
|
||||||
|
# So prefix paths with lib/. See also etc/prefix-gnulib-mk.
|
||||||
|
gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, , lib/,g'`
|
||||||
|
# Listing the names of the variables to prefix is error-prone.
|
||||||
|
# Rather, adjust all the AC_SUBST variables whose name ends in '_H',
|
||||||
|
# and whose content ends in '.h'.
|
||||||
|
for ac_var in $ac_subst_vars
|
||||||
|
do
|
||||||
|
eval "ac_val=\$$ac_var"
|
||||||
|
case $ac_var=$ac_val in
|
||||||
|
(*_H=*.h) eval "$ac_var=lib/\$$ac_var";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
doc/yacc.1])
|
doc/yacc.1])
|
||||||
|
|||||||
+2
-2
@@ -27,7 +27,7 @@ Currently, the supported skeletons are:
|
|||||||
These skeletons are the only ones supported by the Bison team.
|
These skeletons are the only ones supported by the Bison team.
|
||||||
Because the interface between skeletons and the bison program is not
|
Because the interface between skeletons and the bison program is not
|
||||||
finished, *we are not bound to it*. In particular, Bison is not
|
finished, *we are not bound to it*. In particular, Bison is not
|
||||||
mature enough for us to consider that "foreign skeletons" are
|
mature enough for us to consider that ``foreign skeletons'' are
|
||||||
supported.
|
supported.
|
||||||
|
|
||||||
* m4sugar
|
* m4sugar
|
||||||
@@ -52,7 +52,7 @@ into various formats.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2008-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+104
-289
@@ -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-2012 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
|
||||||
@@ -61,44 +61,6 @@ This special exception was added by the Free Software Foundation in
|
|||||||
version 2.2 of Bison.])])
|
version 2.2 of Bison.])])
|
||||||
|
|
||||||
|
|
||||||
## -------- ##
|
|
||||||
## Output. ##
|
|
||||||
## -------- ##
|
|
||||||
|
|
||||||
# b4_output_begin(FILE)
|
|
||||||
# ---------------------
|
|
||||||
# Enable output, i.e., send to diversion 0, expand after "#", and
|
|
||||||
# generate the tag to output into FILE. Must be followed by EOL.
|
|
||||||
m4_define([b4_output_begin],
|
|
||||||
[m4_changecom()
|
|
||||||
m4_divert_push(0)dnl
|
|
||||||
@output(m4_unquote([$1])@)@dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_output_end()
|
|
||||||
# ---------------
|
|
||||||
# Output nothing, restore # as comment character (no expansions after #).
|
|
||||||
m4_define([b4_output_end],
|
|
||||||
[m4_divert_pop(0)
|
|
||||||
m4_changecom([#])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_divert_kill(CODE)
|
|
||||||
# --------------------
|
|
||||||
# Expand CODE for its side effects, discard its output.
|
|
||||||
m4_define([b4_divert_kill],
|
|
||||||
[m4_divert_text([KILL], [$1])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_define_silent(MACRO, CODE)
|
|
||||||
# -----------------------------
|
|
||||||
# Same as m4_define, but throw away the expansion of CODE.
|
|
||||||
m4_define([b4_define_silent],
|
|
||||||
[m4_define([$1], [b4_divert_kill([$2])])])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Error handling. ##
|
## Error handling. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -120,16 +82,30 @@ _m4eof
|
|||||||
])dnl
|
])dnl
|
||||||
m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])])
|
m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])])
|
||||||
|
|
||||||
# b4_error(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
|
# b4_error(KIND, FORMAT, [ARG1], [ARG2], ...)
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------
|
||||||
# Write @KIND(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
# Write @KIND(FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
||||||
#
|
#
|
||||||
# For example:
|
# For example:
|
||||||
#
|
#
|
||||||
# b4_error([[complain]], [[input.y:2.3]], [[input.y:5.4]],
|
# b4_error([[warn]], [[invalid value for '%s': %s]], [[foo]], [[3]])
|
||||||
# [[invalid %s]], [[foo]])
|
|
||||||
m4_define([b4_error],
|
m4_define([b4_error],
|
||||||
[b4_cat([[@complain][(]$1[@,]$2[@,]$3[@,]$4[]]dnl
|
[b4_cat([[@]$1[(]$2[]]dnl
|
||||||
|
[m4_if([$#], [2], [],
|
||||||
|
[m4_foreach([b4_arg],
|
||||||
|
m4_dquote(m4_shift(m4_shift($@))),
|
||||||
|
[[@,]b4_arg])])[@)]])])
|
||||||
|
|
||||||
|
# b4_error_at(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# ----------------------------------------------------------
|
||||||
|
# Write @KIND_at(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_error_at([[complain]], [[input.y:2.3]], [[input.y:5.4]],
|
||||||
|
# [[invalid %s]], [[foo]])
|
||||||
|
m4_define([b4_error_at],
|
||||||
|
[b4_cat([[@]$1[_at(]$2[@,]$3[@,]$4[]]dnl
|
||||||
[m4_if([$#], [4], [],
|
[m4_if([$#], [4], [],
|
||||||
[m4_foreach([b4_arg],
|
[m4_foreach([b4_arg],
|
||||||
m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),
|
m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),
|
||||||
@@ -149,21 +125,21 @@ m4_define([b4_error],
|
|||||||
# m4_define([asdf], [ASDF])
|
# m4_define([asdf], [ASDF])
|
||||||
# m4_define([fsa], [FSA])
|
# m4_define([fsa], [FSA])
|
||||||
# m4_define([fdsa], [FDSA])
|
# m4_define([fdsa], [FDSA])
|
||||||
# b4_warn_at([[[asdf), asdf]]], [[[fsa), fsa]]], [[[fdsa), fdsa]]])
|
# b4_warn([[[asdf), asdf]]], [[[fsa), fsa]]], [[[fdsa), fdsa]]])
|
||||||
# b4_warn_at([[asdf), asdf]], [[fsa), fsa]], [[fdsa), fdsa]])
|
# b4_warn([[asdf), asdf]], [[fsa), fsa]], [[fdsa), fdsa]])
|
||||||
# b4_warn_at()
|
# b4_warn()
|
||||||
# b4_warn_at(1)
|
# b4_warn(1)
|
||||||
# b4_warn_at(1, 2)
|
# b4_warn(1, 2)
|
||||||
#
|
#
|
||||||
# Should produce this without newlines:
|
# Should produce this without newlines:
|
||||||
#
|
#
|
||||||
# @warn_at([asdf), asdf]@,@,@,[fsa), fsa]@,[fdsa), fdsa]@)
|
# @warn([asdf), asdf]@,[fsa), fsa]@,[fdsa), fdsa]@)
|
||||||
# @warn(asdf), asdf@,@,@,fsa), fsa@,fdsa), fdsa@)
|
# @warn(asdf), asdf@,fsa), fsa@,fdsa), fdsa@)
|
||||||
# @warn(@)
|
# @warn(@)
|
||||||
# @warn(1@)
|
# @warn(1@)
|
||||||
# @warn(1@,2@)
|
# @warn(1@,2@)
|
||||||
m4_define([b4_warn],
|
m4_define([b4_warn],
|
||||||
[b4_error([[warn]], [], [], $@)])
|
[b4_error([[warn]], $@)])
|
||||||
|
|
||||||
# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
@@ -173,15 +149,15 @@ m4_define([b4_warn],
|
|||||||
#
|
#
|
||||||
# b4_warn_at([[input.y:2.3]], [[input.y:5.4]], [[invalid %s]], [[foo]])
|
# b4_warn_at([[input.y:2.3]], [[input.y:5.4]], [[invalid %s]], [[foo]])
|
||||||
m4_define([b4_warn_at],
|
m4_define([b4_warn_at],
|
||||||
[b4_error([[warn]], $@)])
|
[b4_error_at([[warn]], $@)])
|
||||||
|
|
||||||
# b4_complain(FORMAT, [ARG1], [ARG2], ...)
|
# b4_complain(FORMAT, [ARG1], [ARG2], ...)
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# Bounce to b4_complain_at.
|
# Write @complain(FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
||||||
#
|
#
|
||||||
# See b4_warn example.
|
# See b4_warn example.
|
||||||
m4_define([b4_complain],
|
m4_define([b4_complain],
|
||||||
[b4_error([[complain]], [], [], $@)])
|
[b4_error([[complain]], $@)])
|
||||||
|
|
||||||
# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
@@ -189,15 +165,15 @@ m4_define([b4_complain],
|
|||||||
#
|
#
|
||||||
# See b4_warn_at example.
|
# See b4_warn_at example.
|
||||||
m4_define([b4_complain_at],
|
m4_define([b4_complain_at],
|
||||||
[b4_error([[complain]], $@)])
|
[b4_error_at([[complain]], $@)])
|
||||||
|
|
||||||
# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
|
# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Bounce to b4_fatal_at.
|
# Write @fatal(FORMAT@,ARG1@,ARG2@,...@) to stdout and exit.
|
||||||
#
|
#
|
||||||
# See b4_warn example.
|
# See b4_warn example.
|
||||||
m4_define([b4_fatal],
|
m4_define([b4_fatal],
|
||||||
[b4_error([[fatal]], [], [], $@)dnl
|
[b4_error([[fatal]], $@)dnl
|
||||||
m4_exit(1)])
|
m4_exit(1)])
|
||||||
|
|
||||||
# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
@@ -206,7 +182,7 @@ m4_exit(1)])
|
|||||||
#
|
#
|
||||||
# See b4_warn_at example.
|
# See b4_warn_at example.
|
||||||
m4_define([b4_fatal_at],
|
m4_define([b4_fatal_at],
|
||||||
[b4_error([[fatal]], $@)dnl
|
[b4_error_at([[fatal]], $@)dnl
|
||||||
m4_exit(1)])
|
m4_exit(1)])
|
||||||
|
|
||||||
|
|
||||||
@@ -230,23 +206,23 @@ m4_define([b4_subtract],
|
|||||||
[m4_eval([$1 - $2])],
|
[m4_eval([$1 - $2])],
|
||||||
[($1) - ($2)])])
|
[($1) - ($2)])])
|
||||||
|
|
||||||
# b4_join(ARG1, ...)
|
# b4_args(ARG1, ...)
|
||||||
# _b4_join(ARG1, ...)
|
# _b4_args(ARG1, ...)
|
||||||
# -------------------
|
# -------------------
|
||||||
# Join with comma, skipping empty arguments.
|
# Join with comma, skipping empty arguments.
|
||||||
# b4_join calls itself recursively until it sees the first non-empty
|
# b4_args calls itself recursively until it sees the first non-empty
|
||||||
# argument, then calls _b4_join which prepends each non-empty argument
|
# argument, then calls _b4_args which prepends each non-empty argument
|
||||||
# with a comma.
|
# with a comma.
|
||||||
m4_define([b4_join],
|
m4_define([b4_args],
|
||||||
[m4_if([$#$1],
|
[m4_if([$#$1],
|
||||||
[1], [],
|
[1], [],
|
||||||
[m4_ifval([$1],
|
[m4_ifval([$1],
|
||||||
[$1[]_$0(m4_shift($@))],
|
[$1[]_$0(m4_shift($@))],
|
||||||
[$0(m4_shift($@))])])])
|
[$0(m4_shift($@))])])])
|
||||||
|
|
||||||
# _b4_join(ARGS1, ...)
|
# _b4_args(ARGS1, ...)
|
||||||
# --------------------
|
# --------------------
|
||||||
m4_define([_b4_join],
|
m4_define([_b4_args],
|
||||||
[m4_if([$#$1],
|
[m4_if([$#$1],
|
||||||
[1], [],
|
[1], [],
|
||||||
[m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])
|
[m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])
|
||||||
@@ -264,30 +240,30 @@ m4_define([b4_integral_parser_tables_map],
|
|||||||
STATE-NUM.]])
|
STATE-NUM.]])
|
||||||
|
|
||||||
$1([defact], [b4_defact],
|
$1([defact], [b4_defact],
|
||||||
[[YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
|
[[YYDEFACT[S] -- default reduction number in state S. Performed when
|
||||||
Performed when YYTABLE does not specify something else to do. Zero
|
YYTABLE does not specify something else to do. Zero means the default
|
||||||
means the default is an error.]])
|
is an error.]])
|
||||||
|
|
||||||
$1([pgoto], [b4_pgoto], [[YYPGOTO[NTERM-NUM].]])
|
$1([pgoto], [b4_pgoto], [[YYPGOTO[NTERM-NUM].]])
|
||||||
|
|
||||||
$1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]])
|
$1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]])
|
||||||
|
|
||||||
$1([table], [b4_table],
|
$1([table], [b4_table],
|
||||||
[[YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
|
[[YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
positive, shift that token. If negative, reduce the rule whose
|
positive, shift that token. If negative, reduce the rule which
|
||||||
number is the opposite. If YYTABLE_NINF, syntax error.]])
|
number is the opposite. If YYTABLE_NINF, syntax error.]])
|
||||||
|
|
||||||
$1([check], [b4_check])
|
$1([check], [b4_check])
|
||||||
|
|
||||||
$1([stos], [b4_stos],
|
$1([stos], [b4_stos],
|
||||||
[[YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
[[STOS_[STATE-NUM] -- The (internal number of the) accessing
|
||||||
symbol of state STATE-NUM.]])
|
symbol of state STATE-NUM.]])
|
||||||
|
|
||||||
$1([r1], [b4_r1],
|
$1([r1], [b4_r1],
|
||||||
[[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]])
|
[[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]])
|
||||||
|
|
||||||
$1([r2], [b4_r2],
|
$1([r2], [b4_r2],
|
||||||
[[YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.]])
|
[[YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.]])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -314,7 +290,7 @@ m4_define([b4_flag_if],
|
|||||||
[m4_case(b4_$1_flag,
|
[m4_case(b4_$1_flag,
|
||||||
[0], [$3],
|
[0], [$3],
|
||||||
[1], [$2],
|
[1], [$2],
|
||||||
[m4_fatal([invalid $1 value: ]b4_$1_flag)])])
|
[m4_fatal([invalid $1 value: ]$1)])])
|
||||||
|
|
||||||
|
|
||||||
# b4_define_flag_if(FLAG)
|
# b4_define_flag_if(FLAG)
|
||||||
@@ -327,7 +303,7 @@ m4_define([b4_define_flag_if],
|
|||||||
# _b4_define_flag_if($1, $2, FLAG)
|
# _b4_define_flag_if($1, $2, FLAG)
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# Work around the impossibility to define macros inside macros,
|
# Work around the impossibility to define macros inside macros,
|
||||||
# because issuing '[$1]' is not possible in M4. GNU M4 should provide
|
# because issuing `[$1]' is not possible in M4. GNU M4 should provide
|
||||||
# $$1 a la M5/TeX.
|
# $$1 a la M5/TeX.
|
||||||
m4_define([_b4_define_flag_if],
|
m4_define([_b4_define_flag_if],
|
||||||
[m4_if([$1$2], $[1]$[2], [],
|
[m4_if([$1$2], $[1]$[2], [],
|
||||||
@@ -355,38 +331,6 @@ b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
|||||||
# macro per (token, field), where field can has_id, id, etc.: see
|
# macro per (token, field), where field can has_id, id, etc.: see
|
||||||
# src/output.c:prepare_symbols_definitions().
|
# src/output.c:prepare_symbols_definitions().
|
||||||
#
|
#
|
||||||
# The various FIELDS are:
|
|
||||||
#
|
|
||||||
# - has_id: 0 or 1.
|
|
||||||
# Whether the symbol has an id.
|
|
||||||
# - id: string
|
|
||||||
# If has_id, the id. Guaranteed to be usable as a C identifier.
|
|
||||||
# Prefixed by api.token.prefix if defined.
|
|
||||||
# - tag: string.
|
|
||||||
# A representat of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
|
||||||
# - user_number: integer
|
|
||||||
# The assigned (external) number as used by yylex.
|
|
||||||
# - is_token: 0 or 1
|
|
||||||
# Whether this is a terminal symbol.
|
|
||||||
# - number: integer
|
|
||||||
# The internalized number (used after yytranslate).
|
|
||||||
# - has_type: 0, 1
|
|
||||||
# Whether has a semantic value.
|
|
||||||
# - type_tag: string
|
|
||||||
# When api.value.type=union, the generated name for the union member.
|
|
||||||
# yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
|
||||||
# - type
|
|
||||||
# If it has a semantic value, its type tag, or, if variant are used,
|
|
||||||
# its type.
|
|
||||||
# In the case of api.value.type=union, type is the real type (e.g. int).
|
|
||||||
# - has_printer: 0, 1
|
|
||||||
# - printer: string
|
|
||||||
# - printer_file: string
|
|
||||||
# - printer_line: integer
|
|
||||||
# If the symbol has a printer, everything about it.
|
|
||||||
# - has_destructor, destructor, destructor_file, destructor_line
|
|
||||||
# Likewise.
|
|
||||||
#
|
|
||||||
# The following macros provide access to these values.
|
# The following macros provide access to these values.
|
||||||
|
|
||||||
# b4_symbol_(NUM, FIELD)
|
# b4_symbol_(NUM, FIELD)
|
||||||
@@ -400,10 +344,10 @@ m4_define([b4_symbol_],
|
|||||||
# b4_symbol(NUM, FIELD)
|
# b4_symbol(NUM, FIELD)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
||||||
# undefined. If FIELD = id, prepend the token prefix.
|
# undefined. If FIELD = id, prepend the prefix.
|
||||||
m4_define([b4_symbol],
|
m4_define([b4_symbol],
|
||||||
[m4_case([$2],
|
[m4_case([$2],
|
||||||
[id], [m4_do([b4_percent_define_get([api.token.prefix])],
|
[id], [m4_do([b4_percent_define_get([api.tokens.prefix])],
|
||||||
[b4_symbol_([$1], [id])])],
|
[b4_symbol_([$1], [id])])],
|
||||||
[b4_symbol_($@)])])
|
[b4_symbol_($@)])])
|
||||||
|
|
||||||
@@ -419,14 +363,6 @@ m4_define([b4_symbol_if],
|
|||||||
[m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
|
[m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_tag_comment(SYMBOL-NUM)
|
|
||||||
# ---------------------------------
|
|
||||||
# Issue a comment giving the tag of symbol NUM.
|
|
||||||
m4_define([b4_symbol_tag_comment],
|
|
||||||
[b4_comment([b4_symbol([$1], [tag])])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_action_location(SYMBOL-NUM, KIND)
|
# b4_symbol_action_location(SYMBOL-NUM, KIND)
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
# Report the location of the KIND action as FILE:LINE.
|
# Report the location of the KIND action as FILE:LINE.
|
||||||
@@ -440,17 +376,19 @@ m4_define([b4_symbol_action_location],
|
|||||||
# Same as in C, but using references instead of pointers.
|
# Same as in C, but using references instead of pointers.
|
||||||
m4_define([b4_symbol_action],
|
m4_define([b4_symbol_action],
|
||||||
[b4_symbol_if([$1], [has_$2],
|
[b4_symbol_if([$1], [has_$2],
|
||||||
[b4_dollar_pushdef([(*yyvaluep)],
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
b4_symbol_if([$1], [has_type],
|
[b4_symbol_value([(*yyvaluep)],
|
||||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
b4_symbol_if([$1], [has_type],
|
||||||
[(*yylocationp)])dnl
|
[b4_symbol([$1], [type])]))])dnl
|
||||||
b4_symbol_case_([$1])[]dnl
|
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
||||||
|
b4_symbol_case_([$1])
|
||||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
||||||
b4_symbol([$1], [$2])
|
b4_symbol([$1], [$2])
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
b4_dollar_popdef[]dnl
|
m4_popdef([b4_at_dollar])dnl
|
||||||
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
@@ -461,29 +399,11 @@ m4_define([b4_symbol_destructor], [b4_symbol_action([$1], [destructor])])
|
|||||||
m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_actions(KIND, [TYPE = yytype])
|
|
||||||
# ----------------------------------------
|
|
||||||
# Emit the symbol actions for KIND ("printer" or "destructor").
|
|
||||||
# Dispatch on TYPE.
|
|
||||||
m4_define([b4_symbol_actions],
|
|
||||||
[m4_pushdef([b4_actions_], m4_expand([b4_symbol_foreach([b4_symbol_$1])]))dnl
|
|
||||||
m4_ifval(m4_defn([b4_actions_]),
|
|
||||||
[switch (m4_default([$2], [yytype]))
|
|
||||||
{
|
|
||||||
m4_defn([b4_actions_])
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}dnl
|
|
||||||
],
|
|
||||||
[YYUSE (m4_default([$2], [yytype]));])dnl
|
|
||||||
m4_popdef([b4_actions_])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
# b4_symbol_case_(SYMBOL-NUM)
|
# b4_symbol_case_(SYMBOL-NUM)
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# Issue a "case NUM" for SYMBOL-NUM.
|
# Issue a "case NUM" for SYMBOL-NUM.
|
||||||
m4_define([b4_symbol_case_],
|
m4_define([b4_symbol_case_],
|
||||||
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
[ case b4_symbol([$1], [number]): // b4_symbol([$1], [tag])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -541,12 +461,9 @@ m4_define([b4_token_format],
|
|||||||
# ---------------------
|
# ---------------------
|
||||||
# Run actions for the symbol NUMS that all have the same type-name.
|
# Run actions for the symbol NUMS that all have the same type-name.
|
||||||
# Skip NUMS that have no type-name.
|
# Skip NUMS that have no type-name.
|
||||||
#
|
|
||||||
# To specify the action to run, define b4_dollar_dollar(NUMBER,
|
|
||||||
# TAG, TYPE).
|
|
||||||
m4_define([b4_type_action_],
|
m4_define([b4_type_action_],
|
||||||
[b4_symbol_if([$1], [has_type],
|
[b4_symbol_if([$1], [has_type],
|
||||||
[m4_map([ b4_symbol_case_], [$@])[]dnl
|
[m4_map_args([b4_symbol_case_], $@)[]dnl
|
||||||
b4_dollar_dollar([b4_symbol([$1], [number])],
|
b4_dollar_dollar([b4_symbol([$1], [number])],
|
||||||
[b4_symbol([$1], [tag])],
|
[b4_symbol([$1], [tag])],
|
||||||
[b4_symbol([$1], [type])]);
|
[b4_symbol([$1], [type])]);
|
||||||
@@ -578,21 +495,11 @@ m4_define([b4_basename],
|
|||||||
# -----------------------
|
# -----------------------
|
||||||
m4_define([b4_syncline],
|
m4_define([b4_syncline],
|
||||||
[b4_flag_if([synclines],
|
[b4_flag_if([synclines],
|
||||||
[b4_sync_start([$1], [$2]) b4_sync_end([__line__],
|
[b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
|
||||||
[b4_basename(m4_quote(__file__))])[]dnl
|
b4_sync_start([$1], [$2])])])
|
||||||
])])
|
|
||||||
|
|
||||||
# b4_sync_start(LINE, FILE)
|
|
||||||
# -----------------------
|
|
||||||
# Syncline for the new place. Typically a directive for the compiler.
|
|
||||||
m4_define([b4_sync_start], [b4_comment([$2:$1])])
|
|
||||||
|
|
||||||
# b4_sync_end(LINE, FILE)
|
|
||||||
# -----------------------
|
|
||||||
# Syncline for the current place, which ends. Typically a comment
|
|
||||||
# left for the reader.
|
|
||||||
m4_define([b4_sync_end], [b4_comment([$2:$1])])
|
|
||||||
|
|
||||||
|
m4_define([b4_sync_end], [b4_comment([Line $1 of $2])])
|
||||||
|
m4_define([b4_sync_start], [b4_comment([Line $1 of $2])])
|
||||||
|
|
||||||
# b4_user_code(USER-CODE)
|
# b4_user_code(USER-CODE)
|
||||||
# -----------------------
|
# -----------------------
|
||||||
@@ -614,14 +521,14 @@ m4_define([b4_define_user_code],
|
|||||||
# b4_user_initial_action
|
# b4_user_initial_action
|
||||||
# b4_user_post_prologue
|
# b4_user_post_prologue
|
||||||
# b4_user_pre_prologue
|
# b4_user_pre_prologue
|
||||||
# b4_user_union_members
|
# b4_user_stype
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Macros that issue user code, ending with synclines.
|
# Macros that issue user code, ending with synclines.
|
||||||
b4_define_user_code([actions])
|
b4_define_user_code([actions])
|
||||||
b4_define_user_code([initial_action])
|
b4_define_user_code([initial_action])
|
||||||
b4_define_user_code([post_prologue])
|
b4_define_user_code([post_prologue])
|
||||||
b4_define_user_code([pre_prologue])
|
b4_define_user_code([pre_prologue])
|
||||||
b4_define_user_code([union_members])
|
b4_define_user_code([stype])
|
||||||
|
|
||||||
|
|
||||||
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
|
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
|
||||||
@@ -702,9 +609,9 @@ m4_define([b4_percent_define_use],
|
|||||||
# b4_percent_define_get([[foo]])
|
# b4_percent_define_get([[foo]])
|
||||||
m4_define([b4_percent_define_get],
|
m4_define([b4_percent_define_get],
|
||||||
[b4_percent_define_use([$1])dnl
|
[b4_percent_define_use([$1])dnl
|
||||||
b4_percent_define_ifdef_([$1],
|
m4_ifdef([b4_percent_define(]$1[)],
|
||||||
[m4_indir([b4_percent_define(]$1[)])],
|
[m4_indir([b4_percent_define(]$1[)])],
|
||||||
[$2])])
|
[$2])])
|
||||||
|
|
||||||
# b4_percent_define_get_loc(VARIABLE)
|
# b4_percent_define_get_loc(VARIABLE)
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
@@ -723,21 +630,7 @@ m4_define([b4_percent_define_get_loc],
|
|||||||
[m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
|
[m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
|
||||||
b4_loc[]dnl
|
b4_loc[]dnl
|
||||||
m4_popdef([b4_loc])],
|
m4_popdef([b4_loc])],
|
||||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[b4_percent_define_get_loc: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
# b4_percent_define_get_kind(VARIABLE)
|
|
||||||
# ------------------------------------
|
|
||||||
# Get the kind (code, keyword, string) of VARIABLE, i.e., how its
|
|
||||||
# value was defined (braces, not delimiters, quotes).
|
|
||||||
#
|
|
||||||
# If the %define variable VARIABLE is undefined, complain fatally
|
|
||||||
# since that's a Bison or skeleton error. Don't record this as a
|
|
||||||
# Bison usage of VARIABLE as there's no reason to suspect that the
|
|
||||||
# user-supplied value has yet influenced the output.
|
|
||||||
m4_define([b4_percent_define_get_kind],
|
|
||||||
[m4_ifdef([b4_percent_define_kind(]$1[)],
|
|
||||||
[m4_indir([b4_percent_define_kind(]$1[)])],
|
|
||||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
|
||||||
|
|
||||||
# b4_percent_define_get_syncline(VARIABLE)
|
# b4_percent_define_get_syncline(VARIABLE)
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
@@ -754,20 +647,7 @@ m4_define([b4_percent_define_get_kind],
|
|||||||
m4_define([b4_percent_define_get_syncline],
|
m4_define([b4_percent_define_get_syncline],
|
||||||
[m4_ifdef([b4_percent_define_syncline(]$1[)],
|
[m4_ifdef([b4_percent_define_syncline(]$1[)],
|
||||||
[m4_indir([b4_percent_define_syncline(]$1[)])],
|
[m4_indir([b4_percent_define_syncline(]$1[)])],
|
||||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[b4_percent_define_get_syncline: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
# b4_percent_define_ifdef_(VARIABLE, IF-TRUE, [IF-FALSE])
|
|
||||||
# ------------------------------------------------------
|
|
||||||
# If the %define variable VARIABLE is defined, expand IF-TRUE, else expand
|
|
||||||
# IF-FALSE. Don't record usage of VARIABLE.
|
|
||||||
#
|
|
||||||
# For example:
|
|
||||||
#
|
|
||||||
# b4_percent_define_ifdef_([[foo]], [[it's defined]], [[it's undefined]])
|
|
||||||
m4_define([b4_percent_define_ifdef_],
|
|
||||||
[m4_ifdef([b4_percent_define(]$1[)],
|
|
||||||
[$2],
|
|
||||||
[$3])])
|
|
||||||
|
|
||||||
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
@@ -780,9 +660,9 @@ m4_define([b4_percent_define_ifdef_],
|
|||||||
#
|
#
|
||||||
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
||||||
m4_define([b4_percent_define_ifdef],
|
m4_define([b4_percent_define_ifdef],
|
||||||
[b4_percent_define_ifdef_([$1],
|
[m4_ifdef([b4_percent_define(]$1[)],
|
||||||
[b4_percent_define_use([$1])$2],
|
[b4_percent_define_use([$1])$2],
|
||||||
[$3])])
|
[$3])])
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
## --------- ##
|
||||||
@@ -811,11 +691,11 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
[[invalid value for %%define Boolean variable '%s']],
|
[[invalid value for %%define Boolean variable '%s']],
|
||||||
[$1])],
|
[$1])],
|
||||||
[[b4_percent_define_flag_if($1)]])])],
|
[[b4_percent_define_flag_if($1)]])])],
|
||||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[b4_percent_define_flag_if: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_default(VARIABLE, DEFAULT, [KIND = keyword])
|
# b4_percent_define_default(VARIABLE, DEFAULT)
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------
|
||||||
# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly. That is,
|
# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly. That is,
|
||||||
# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
|
# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
|
||||||
# Don't record this as a Bison usage of VARIABLE as there's no reason to
|
# Don't record this as a Bison usage of VARIABLE as there's no reason to
|
||||||
@@ -825,43 +705,25 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
#
|
#
|
||||||
# b4_percent_define_default([[foo]], [[default value]])
|
# b4_percent_define_default([[foo]], [[default value]])
|
||||||
m4_define([b4_percent_define_default],
|
m4_define([b4_percent_define_default],
|
||||||
[b4_percent_define_ifdef_([$1], [],
|
[m4_ifndef([b4_percent_define(]$1[)],
|
||||||
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
||||||
m4_define([b4_percent_define_kind(]$1[)],
|
|
||||||
[m4_default([$3], [keyword])])dnl
|
|
||||||
m4_define([b4_percent_define_loc(]$1[)],
|
m4_define([b4_percent_define_loc(]$1[)],
|
||||||
[[[[<skeleton default value>:-1.-1]],
|
[[[[<skeleton default value>:-1.-1]],
|
||||||
[[<skeleton default value>:-1.-1]]]])dnl
|
[[<skeleton default value>:-1.-1]]]])dnl
|
||||||
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_if_define(NAME, [VARIABLE = NAME])
|
# b4_percent_define_if_define(VARIABLE)
|
||||||
# ----------------------------------------------------
|
# -------------------------------------
|
||||||
# Define b4_NAME_if that executes its $1 or $2 depending whether
|
# Define b4_VARIABLE_if that executes its $1 or $2 depending whether
|
||||||
# VARIABLE was %defined. The characters '.' and `-' in VARIABLE are mapped
|
# VARIABLE was %defined. The characters `.' and `-' in VARIABLE are mapped
|
||||||
# to '_'.
|
# to `_'.
|
||||||
m4_define([b4_percent_define_if_define_],
|
m4_define([b4_percent_define_if_define_],
|
||||||
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
||||||
[b4_percent_define_flag_if(m4_default([$2], [$1]),
|
[b4_percent_define_flag_if([$1], [$2], [$3])])])
|
||||||
[$3], [$4])])])
|
|
||||||
m4_define([b4_percent_define_if_define],
|
m4_define([b4_percent_define_if_define],
|
||||||
[b4_percent_define_default([m4_default([$2], [$1])], [[false]])
|
[b4_percent_define_default([[$1]], [[false]])
|
||||||
b4_percent_define_if_define_([$1], [$2], $[1], $[2])])
|
b4_percent_define_if_define_([$1], $[1], $[2])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_check_kind(VARIABLE, KIND, [DIAGNOSTIC = complain])
|
|
||||||
# ---------------------------------------------------------------------
|
|
||||||
m4_define([b4_percent_define_check_kind],
|
|
||||||
[b4_percent_define_ifdef_([$1],
|
|
||||||
[m4_if(b4_percent_define_get_kind([$1]), [$2], [],
|
|
||||||
[b4_error([m4_default([$3], [complain])],
|
|
||||||
b4_percent_define_get_loc([$1]),
|
|
||||||
[m4_case([$2],
|
|
||||||
[code], [[%%define variable '%s' requires '{...}' values]],
|
|
||||||
[keyword], [[%%define variable '%s' requires keyword values]],
|
|
||||||
[string], [[%%define variable '%s' requires '"..."' values]])],
|
|
||||||
[$1])])])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_check_values(VALUES)
|
# b4_percent_define_check_values(VALUES)
|
||||||
@@ -885,9 +747,8 @@ m4_define([b4_percent_define_check_values],
|
|||||||
[_b4_percent_define_check_values(b4_sublist)])])
|
[_b4_percent_define_check_values(b4_sublist)])])
|
||||||
|
|
||||||
m4_define([_b4_percent_define_check_values],
|
m4_define([_b4_percent_define_check_values],
|
||||||
[b4_percent_define_ifdef_([$1],
|
[m4_ifdef([b4_percent_define(]$1[)],
|
||||||
[b4_percent_define_check_kind(]$1[, [keyword], [deprecated])dnl
|
[m4_pushdef([b4_good_value], [0])dnl
|
||||||
m4_pushdef([b4_good_value], [0])dnl
|
|
||||||
m4_if($#, 1, [],
|
m4_if($#, 1, [],
|
||||||
[m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
[m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
||||||
[m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
|
[m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
|
||||||
@@ -898,11 +759,11 @@ m4_define([_b4_percent_define_check_values],
|
|||||||
[$1],
|
[$1],
|
||||||
m4_dquote(m4_indir([b4_percent_define(]$1[)])))
|
m4_dquote(m4_indir([b4_percent_define(]$1[)])))
|
||||||
m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
||||||
[b4_error([[note]], b4_percent_define_get_loc([$1]), []
|
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
||||||
[[accepted value: '%s']],
|
[[accepted value: '%s']],
|
||||||
m4_dquote(b4_value))])])dnl
|
m4_dquote(b4_value))])])dnl
|
||||||
m4_popdef([b4_good_value])],
|
m4_popdef([b4_good_value])],
|
||||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[b4_percent_define_check_values: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
# b4_percent_code_get([QUALIFIER])
|
# b4_percent_code_get([QUALIFIER])
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
@@ -943,23 +804,21 @@ m4_define([b4_percent_code_ifdef],
|
|||||||
## Common variables. ##
|
## Common variables. ##
|
||||||
## ------------------ ##
|
## ------------------ ##
|
||||||
|
|
||||||
|
# Default values for %define.
|
||||||
|
# ---------------------------
|
||||||
|
# If the api.tokens.prefix, it is empty.
|
||||||
|
m4_percent_define_default([[api.tokens.prefix]], [[]])
|
||||||
|
|
||||||
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
||||||
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
||||||
# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT])
|
# b4_lex_symbol_if([IF-YYLEX-RETURNS-A-COMPLETE-SYMBOL], [IF-NOT])
|
||||||
|
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
b4_percent_define_if_define([token_ctor], [api.token.constructor])
|
b4_percent_define_if_define([lex_symbol])
|
||||||
b4_percent_define_if_define([locations]) # Whether locations are tracked.
|
b4_percent_define_if_define([locations]) # Whether locations are tracked.
|
||||||
b4_percent_define_if_define([parse.assert])
|
b4_percent_define_if_define([parse.assert])
|
||||||
b4_percent_define_if_define([parse.trace])
|
b4_percent_define_if_define([parse.trace])
|
||||||
|
b4_percent_define_if_define([variant])
|
||||||
|
|
||||||
# b4_bison_locations_if([IF-TRUE])
|
|
||||||
# --------------------------------
|
|
||||||
# Expand IF-TRUE if using locations, and using the default location
|
|
||||||
# type.
|
|
||||||
m4_define([b4_bison_locations_if],
|
|
||||||
[b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [], [$1])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
|
# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
|
||||||
@@ -979,17 +838,6 @@ b4_define_flag_if([error_verbose])
|
|||||||
b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
|
b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
|
||||||
|
|
||||||
|
|
||||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
|
||||||
# ----------------------------------------------
|
|
||||||
b4_percent_define_if_define([variant])
|
|
||||||
m4_define([b4_variant_flag], [[0]])
|
|
||||||
b4_percent_define_ifdef([[api.value.type]],
|
|
||||||
[m4_case(b4_percent_define_get_kind([[api.value.type]]), [keyword],
|
|
||||||
[m4_case(b4_percent_define_get([[api.value.type]]), [variant],
|
|
||||||
[m4_define([b4_variant_flag], [[1]])])])])
|
|
||||||
b4_define_flag_if([variant])
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------------------------------------------------- ##
|
## ----------------------------------------------------------- ##
|
||||||
## After processing the skeletons, check that all the user's ##
|
## After processing the skeletons, check that all the user's ##
|
||||||
## %define variables and %code qualifiers were used by Bison. ##
|
## %define variables and %code qualifiers were used by Bison. ##
|
||||||
@@ -1021,43 +869,10 @@ m4_define_default([b4_parse_param], [])
|
|||||||
m4_define_default([b4_location_initial_column], [1])
|
m4_define_default([b4_location_initial_column], [1])
|
||||||
m4_define_default([b4_location_initial_line], [1])
|
m4_define_default([b4_location_initial_line], [1])
|
||||||
|
|
||||||
|
# Sanity checks.
|
||||||
## --------------- ##
|
|
||||||
## Sanity checks. ##
|
|
||||||
## --------------- ##
|
|
||||||
|
|
||||||
# api.location.prefix={...} (Java and C++).
|
|
||||||
b4_percent_define_check_kind([api.location.type], [code], [deprecated])
|
|
||||||
|
|
||||||
# api.position.prefix={...} (Java).
|
|
||||||
b4_percent_define_check_kind([api.position.type], [code], [deprecated])
|
|
||||||
|
|
||||||
# api.prefix >< %name-prefix.
|
|
||||||
b4_percent_define_check_kind([api.prefix], [code], [deprecated])
|
|
||||||
b4_percent_define_ifdef([api.prefix],
|
b4_percent_define_ifdef([api.prefix],
|
||||||
[m4_ifdef([b4_prefix],
|
[m4_ifdef([b4_prefix],
|
||||||
[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
|
[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
|
||||||
[['%s' and '%s' cannot be used together]],
|
[['%s' and '%s' cannot be used together]],
|
||||||
[%name-prefix],
|
[%name-prefix],
|
||||||
[%define api.prefix])])])
|
[%define api.prefix])])])
|
||||||
|
|
||||||
# api.token.prefix={...}
|
|
||||||
# Make it a warning for those who used betas of Bison 3.0.
|
|
||||||
b4_percent_define_check_kind([api.token.prefix], [code], [deprecated])
|
|
||||||
|
|
||||||
# api.value.type >< %union.
|
|
||||||
b4_percent_define_ifdef([api.value.type],
|
|
||||||
[m4_ifdef([b4_union_members],
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([api.value.type]),
|
|
||||||
[['%s' and '%s' cannot be used together]],
|
|
||||||
[%union],
|
|
||||||
[%define api.value.type])])])
|
|
||||||
|
|
||||||
# api.value.type=union >< %yacc.
|
|
||||||
b4_percent_define_ifdef([api.value.type],
|
|
||||||
[m4_if(b4_percent_define_get([api.value.type]), [union],
|
|
||||||
[b4_yacc_if(dnl
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([api.value.type]),
|
|
||||||
[['%s' and '%s' cannot be used together]],
|
|
||||||
[%yacc],
|
|
||||||
[%define api.value.type "union"])])])])
|
|
||||||
|
|||||||
+1
-1
@@ -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-2012 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
|
||||||
|
|||||||
+125
-210
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2012 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,19 +19,6 @@
|
|||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c.m4])
|
m4_include(b4_pkgdatadir/[c.m4])
|
||||||
|
|
||||||
# b4_comment(TEXT, [PREFIX])
|
|
||||||
# --------------------------
|
|
||||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_comment],
|
|
||||||
[b4_comment_([$1], [$2// ], [$2// ])])
|
|
||||||
|
|
||||||
## -------- ##
|
|
||||||
## Checks. ##
|
|
||||||
## -------- ##
|
|
||||||
|
|
||||||
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([parser_class_name], [code], [deprecated])
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -41,10 +28,9 @@ b4_percent_define_default([[parser_class_name]], [[parser]])
|
|||||||
# Don't do that so that we remember whether we're using a user
|
# Don't do that so that we remember whether we're using a user
|
||||||
# request, or the default value.
|
# request, or the default value.
|
||||||
#
|
#
|
||||||
# b4_percent_define_default([[api.location.type]], [[location]])
|
# b4_percent_define_default([[location_type]], [[location]])
|
||||||
|
|
||||||
b4_percent_define_default([[filename_type]], [[std::string]])
|
b4_percent_define_default([[filename_type]], [[std::string]])
|
||||||
# Make it a warning for those who used betas of Bison 3.0.
|
|
||||||
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
||||||
|
|
||||||
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
||||||
@@ -61,8 +47,8 @@ b4_percent_define_default([[define_location_comparison]],
|
|||||||
m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
||||||
|
|
||||||
|
|
||||||
# Don't permit an empty b4_namespace_ref. Any '::parser::foo' appended to it
|
# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it
|
||||||
# would compile as an absolute reference with 'parser' in the global namespace.
|
# would compile as an absolute reference with `parser' in the global namespace.
|
||||||
# b4_namespace_open would open an anonymous namespace and thus establish
|
# b4_namespace_open would open an anonymous namespace and thus establish
|
||||||
# internal linkage. This would compile. However, it's cryptic, and internal
|
# internal linkage. This would compile. However, it's cryptic, and internal
|
||||||
# linkage for the parser would be specified in all translation units that
|
# linkage for the parser would be specified in all translation units that
|
||||||
@@ -104,13 +90,13 @@ m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
|||||||
# --------------
|
# --------------
|
||||||
# Output the definition of the tokens as enums.
|
# Output the definition of the tokens as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[[enum yytokentype
|
[[/* Tokens. */
|
||||||
{
|
enum yytokentype {
|
||||||
]m4_join([,
|
]m4_join([,
|
||||||
],
|
],
|
||||||
b4_symbol_map([b4_token_enum]))[
|
b4_symbol_map([b4_token_enum]))[
|
||||||
};]dnl
|
};
|
||||||
])
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -119,24 +105,18 @@ m4_define([b4_token_enums],
|
|||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
|
# b4_semantic_type_declare
|
||||||
|
# ------------------------
|
||||||
# b4_value_type_declare
|
|
||||||
# ---------------------
|
|
||||||
# Declare semantic_type.
|
# Declare semantic_type.
|
||||||
m4_define([b4_value_type_declare],
|
m4_define([b4_semantic_type_declare],
|
||||||
[b4_value_type_setup[]dnl
|
|
||||||
[ /// Symbol semantic values.
|
[ /// Symbol semantic values.
|
||||||
]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
m4_ifdef([b4_stype],
|
||||||
[code],
|
[ union semantic_type
|
||||||
[[ typedef ]b4_percent_define_get([[api.value.type]])[ semantic_type;]],
|
{b4_user_stype
|
||||||
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
};],
|
||||||
[union\|union-directive],
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[ union semantic_type
|
[[ typedef int semantic_type;]],
|
||||||
{
|
[[ typedef ]b4_api_PREFIX[STYPE semantic_type;]])])])
|
||||||
]b4_user_union_members[
|
|
||||||
};]])])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_declare
|
# b4_public_types_declare
|
||||||
@@ -145,12 +125,12 @@ m4_define([b4_value_type_declare],
|
|||||||
# Depending on %define token_lex, may be output in the header or source file.
|
# Depending on %define token_lex, may be output in the header or source file.
|
||||||
m4_define([b4_public_types_declare],
|
m4_define([b4_public_types_declare],
|
||||||
[[#ifndef ]b4_api_PREFIX[STYPE
|
[[#ifndef ]b4_api_PREFIX[STYPE
|
||||||
]b4_value_type_declare[
|
]b4_semantic_type_declare[
|
||||||
#else
|
#else
|
||||||
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
||||||
#endif]b4_locations_if([
|
#endif]b4_locations_if([
|
||||||
/// Symbol locations.
|
/// Symbol locations.
|
||||||
typedef b4_percent_define_get([[api.location.type]],
|
typedef b4_percent_define_get([[location_type]],
|
||||||
[[location]]) location_type;])[
|
[[location]]) location_type;])[
|
||||||
|
|
||||||
/// Syntax errors thrown from user actions.
|
/// Syntax errors thrown from user actions.
|
||||||
@@ -166,95 +146,63 @@ m4_define([b4_public_types_declare],
|
|||||||
]b4_token_enums[
|
]b4_token_enums[
|
||||||
};
|
};
|
||||||
|
|
||||||
/// (External) token type, as returned by yylex.
|
/// Token type.
|
||||||
typedef token::yytokentype token_type;
|
typedef token::yytokentype token_type;
|
||||||
|
|
||||||
/// Internal symbol number.
|
/// A complete symbol, with its type.
|
||||||
typedef int symbol_number_type;
|
template <typename Exact>
|
||||||
|
struct symbol_base_type
|
||||||
/// Internal symbol number for tokens (subsumed by symbol_number_type).
|
|
||||||
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
|
||||||
|
|
||||||
/// A complete symbol.
|
|
||||||
///
|
|
||||||
/// Expects its Base type to provide access to the symbol type
|
|
||||||
/// via type_get().
|
|
||||||
///
|
|
||||||
/// Provide access to semantic value]b4_locations_if([ and location])[.
|
|
||||||
template <typename Base>
|
|
||||||
struct basic_symbol : Base
|
|
||||||
{
|
{
|
||||||
/// Alias to Base.
|
|
||||||
typedef Base super_type;
|
|
||||||
|
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
basic_symbol ();
|
inline symbol_base_type ();
|
||||||
|
|
||||||
/// Copy constructor.
|
/// Constructor.]b4_locations_if([
|
||||||
basic_symbol (const basic_symbol& other);
|
inline symbol_base_type (const location_type& l)])[;
|
||||||
]b4_variant_if([[
|
inline symbol_base_type (]b4_args(
|
||||||
/// Constructor for valueless symbols, and symbols from each type.
|
[const semantic_type& v],
|
||||||
]b4_type_foreach([b4_basic_symbol_constructor_declare])], [[
|
b4_locations_if([const location_type& l]))[);
|
||||||
/// Constructor for valueless symbols.
|
|
||||||
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
|
||||||
const location_type& l])[);]])[
|
|
||||||
|
|
||||||
/// Constructor for symbols with semantic value.
|
/// Return this with its exact type.
|
||||||
basic_symbol (typename Base::kind_type t,
|
const Exact& self () const;
|
||||||
const semantic_type& v]b4_locations_if([,
|
Exact& self ();
|
||||||
const location_type& l])[);
|
|
||||||
|
|
||||||
~basic_symbol ();
|
/// Return the type of this symbol.
|
||||||
|
int type_get () const;
|
||||||
/// Destructive move, \a s is emptied into this.
|
|
||||||
void move (basic_symbol& s);
|
|
||||||
|
|
||||||
/// The semantic value.
|
/// The semantic value.
|
||||||
semantic_type value;]b4_locations_if([
|
semantic_type value;]b4_locations_if([
|
||||||
|
|
||||||
/// The location.
|
/// The location.
|
||||||
location_type location;])[
|
location_type location;])[
|
||||||
|
|
||||||
private:
|
|
||||||
/// Assignment operator.
|
|
||||||
basic_symbol& operator= (const basic_symbol& other);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Type access provider for token (enum) based symbols.
|
/// External form of a symbol: its type and attributes.
|
||||||
struct by_type
|
struct symbol_type : symbol_base_type<symbol_type>
|
||||||
{
|
{
|
||||||
|
/// The parent class.
|
||||||
|
typedef symbol_base_type<symbol_type> super_type;
|
||||||
|
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
by_type ();
|
inline symbol_type ();
|
||||||
|
|
||||||
/// Copy constructor.
|
/// Constructor for tokens with semantic value.
|
||||||
by_type (const by_type& other);
|
inline symbol_type (]b4_args([token_type t],
|
||||||
|
[const semantic_type& v],
|
||||||
|
b4_locations_if([const location_type& l]))[);
|
||||||
|
|
||||||
/// The symbol type as needed by the constructor.
|
/// Constructor for valueless tokens.
|
||||||
typedef token_type kind_type;
|
inline symbol_type (]b4_args([token_type t],
|
||||||
|
b4_locations_if([const location_type& l]))[);
|
||||||
/// Constructor from (external) token numbers.
|
|
||||||
by_type (kind_type t);
|
|
||||||
|
|
||||||
/// Steal the symbol type from \a that.
|
|
||||||
void move (by_type& that);
|
|
||||||
|
|
||||||
/// The (internal) type number (corresponding to \a type).
|
|
||||||
/// -1 when this symbol is empty.
|
|
||||||
symbol_number_type type_get () const;
|
|
||||||
|
|
||||||
/// The token.
|
|
||||||
token_type token () const;
|
|
||||||
|
|
||||||
enum { empty = 0 };
|
|
||||||
|
|
||||||
/// The symbol type.
|
/// The symbol type.
|
||||||
/// -1 when this symbol is empty.
|
int type;
|
||||||
token_number_type type;
|
|
||||||
|
/// The symbol type.
|
||||||
|
inline int type_get_ () const;
|
||||||
|
|
||||||
|
/// The token.
|
||||||
|
inline token_type token () const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// "External" symbols: returned by the scanner.
|
|
||||||
typedef basic_symbol<by_type> symbol_type;
|
|
||||||
|
|
||||||
]b4_symbol_constructor_declare])
|
]b4_symbol_constructor_declare])
|
||||||
|
|
||||||
|
|
||||||
@@ -268,116 +216,94 @@ m4_define([b4_public_types_define],
|
|||||||
, location (l)])[
|
, location (l)])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// basic_symbol.
|
// symbol_base_type.
|
||||||
template <typename Base>
|
template <typename Exact>
|
||||||
inline
|
inline
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
|
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type ()
|
||||||
: value ()
|
: value()]b4_locations_if([
|
||||||
{}
|
, location()])[
|
||||||
|
|
||||||
template <typename Base>
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
|
|
||||||
: Base (other)
|
|
||||||
, value ()]b4_locations_if([
|
|
||||||
, location (other.location)])[
|
|
||||||
{
|
{
|
||||||
]b4_variant_if([b4_symbol_variant([other.type_get ()], [value], [copy],
|
}]b4_locations_if([[
|
||||||
[other.value])],
|
|
||||||
[value = other.value;])[
|
|
||||||
}
|
|
||||||
|
|
||||||
|
template <typename Exact>
|
||||||
template <typename Base>
|
|
||||||
inline
|
inline
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (const location_type& l)
|
||||||
[typename Base::kind_type t],
|
: value()
|
||||||
|
, location(l)
|
||||||
|
{
|
||||||
|
}]])[
|
||||||
|
|
||||||
|
template <typename Exact>
|
||||||
|
inline
|
||||||
|
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (]b4_args(
|
||||||
[const semantic_type& v],
|
[const semantic_type& v],
|
||||||
b4_locations_if([const location_type& l]))[)
|
b4_locations_if([const location_type& l]))[)
|
||||||
: Base (t)
|
: value(v)]b4_locations_if([
|
||||||
, value (]b4_variant_if([], [v])[)]b4_locations_if([
|
, location(l)])[
|
||||||
, location (l)])[
|
{
|
||||||
{]b4_variant_if([[
|
|
||||||
(void) v;
|
|
||||||
]b4_symbol_variant([this->type_get ()], [value], [copy], [v])])[}
|
|
||||||
|
|
||||||
]b4_variant_if([[
|
|
||||||
// Implementation of basic_symbol constructor for each type.
|
|
||||||
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
|
|
||||||
/// Constructor for valueless symbols.
|
|
||||||
template <typename Base>
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
|
||||||
[typename Base::kind_type t],
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: Base (t)
|
|
||||||
, value ()]b4_locations_if([
|
|
||||||
, location (l)])[
|
|
||||||
{}]])[
|
|
||||||
|
|
||||||
template <typename Base>
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
|
|
||||||
{]b4_variant_if([[
|
|
||||||
// User destructor.
|
|
||||||
symbol_number_type yytype = this->type_get ();
|
|
||||||
switch (yytype)
|
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Type destructor.
|
|
||||||
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Exact>
|
||||||
inline
|
inline
|
||||||
void
|
const Exact&
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
|
]b4_parser_class_name[::symbol_base_type<Exact>::self () const
|
||||||
{
|
{
|
||||||
super_type::move(s);
|
return static_cast<const Exact&>(*this);
|
||||||
]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
|
|
||||||
[s.value])],
|
|
||||||
[value = s.value;])[]b4_locations_if([
|
|
||||||
location = s.location;])[
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// by_type.
|
template <typename Exact>
|
||||||
inline
|
inline
|
||||||
]b4_parser_class_name[::by_type::by_type ()
|
Exact&
|
||||||
: type (empty)
|
]b4_parser_class_name[::symbol_base_type<Exact>::self ()
|
||||||
{}
|
{
|
||||||
|
return static_cast<Exact&>(*this);
|
||||||
inline
|
}
|
||||||
]b4_parser_class_name[::by_type::by_type (const by_type& other)
|
|
||||||
: type (other.type)
|
template <typename Exact>
|
||||||
{}
|
inline
|
||||||
|
int
|
||||||
inline
|
]b4_parser_class_name[::symbol_base_type<Exact>::type_get () const
|
||||||
]b4_parser_class_name[::by_type::by_type (token_type t)
|
{
|
||||||
: type (yytranslate_ (t))
|
return self ().type_get_ ();
|
||||||
{}
|
}
|
||||||
|
|
||||||
inline
|
// symbol_type.
|
||||||
void
|
inline
|
||||||
]b4_parser_class_name[::by_type::move (by_type& that)
|
]b4_parser_class_name[::symbol_type::symbol_type ()
|
||||||
|
: super_type ()
|
||||||
|
, type ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
|
||||||
|
[token_type t],
|
||||||
|
b4_locations_if([const location_type& l]))[)
|
||||||
|
: super_type (]b4_locations_if([l])[)
|
||||||
|
, type (yytranslate_ (t))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
|
||||||
|
[token_type t],
|
||||||
|
[const semantic_type& v],
|
||||||
|
b4_locations_if([const location_type& l]))[)
|
||||||
|
: super_type (v]b4_locations_if([, l])[)
|
||||||
|
, type (yytranslate_ (t))
|
||||||
{
|
{
|
||||||
type = that.type;
|
|
||||||
that.type = empty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
int
|
int
|
||||||
]b4_parser_class_name[::by_type::type_get () const
|
]b4_parser_class_name[::symbol_type::type_get_ () const
|
||||||
{
|
{
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
]b4_token_ctor_if([[
|
]b4_lex_symbol_if([[
|
||||||
inline
|
inline
|
||||||
]b4_parser_class_name[::token_type
|
]b4_parser_class_name[::token_type
|
||||||
]b4_parser_class_name[::by_type::token () const
|
]b4_parser_class_name[::symbol_type::token () const
|
||||||
{
|
{
|
||||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
||||||
// (internal) symbol number NUM (which must be that of a token). */
|
// (internal) symbol number NUM (which must be that of a token). */
|
||||||
@@ -408,9 +334,8 @@ m4_define([b4_symbol_constructor_define], [])
|
|||||||
# sometimes in the cc file.
|
# sometimes in the cc file.
|
||||||
m4_define([b4_yytranslate_define],
|
m4_define([b4_yytranslate_define],
|
||||||
[[ // Symbol number corresponding to token number t.
|
[[ // Symbol number corresponding to token number t.
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::token_number_type
|
]b4_parser_class_name[::token_number_type
|
||||||
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
|
]b4_parser_class_name[::yytranslate_ (]b4_lex_symbol_if([token_type],
|
||||||
[int])[ t)
|
[int])[ t)
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
@@ -496,7 +421,7 @@ m4_define([b4_cc_constructor_call],
|
|||||||
m4_define([b4_parse_param_vars],
|
m4_define([b4_parse_param_vars],
|
||||||
[m4_ifset([b4_parse_param],
|
[m4_ifset([b4_parse_param],
|
||||||
[
|
[
|
||||||
// User arguments.
|
/* User arguments. */
|
||||||
b4_cc_var_decls(b4_parse_param)])])
|
b4_cc_var_decls(b4_parse_param)])])
|
||||||
m4_define([b4_cc_var_decls],
|
m4_define([b4_cc_var_decls],
|
||||||
[m4_map_sep([b4_cc_var_decl], [
|
[m4_map_sep([b4_cc_var_decl], [
|
||||||
@@ -532,13 +457,3 @@ m4_define([b4_yylloc_default_define],
|
|||||||
while (/*CONSTCOND*/ false)
|
while (/*CONSTCOND*/ false)
|
||||||
# endif
|
# endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
## -------- ##
|
|
||||||
## Checks. ##
|
|
||||||
## -------- ##
|
|
||||||
|
|
||||||
b4_token_ctor_if([b4_variant_if([],
|
|
||||||
[b4_fatal_at(b4_percent_define_get_loc(api.token.constructor),
|
|
||||||
[cannot use '%s' without '%s'],
|
|
||||||
[%define api.token.constructor],
|
|
||||||
[%define api.value.type variant]))])])
|
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
-*- Autoconf -*-
|
|
||||||
|
|
||||||
# Common code for C-like languages (C, C++, Java, etc.)
|
|
||||||
|
|
||||||
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# b4_comment_(TEXT, OPEN, CONTINUE, END)
|
|
||||||
# --------------------------------------
|
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
|
||||||
# Avoid adding indentation to the first line, as the indentation comes
|
|
||||||
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
|
||||||
#
|
|
||||||
# Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_comment_],
|
|
||||||
[$2[]m4_bpatsubst(m4_expand([[$1]]), [
|
|
||||||
\(.\)], [
|
|
||||||
$3\1])$4])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_comment(TEXT, [PREFIX])
|
|
||||||
# --------------------------
|
|
||||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_comment],
|
|
||||||
[b4_comment_([$1], [$2/* ], [$2 ], [ */])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
|
|
||||||
# ----------------------------------------------
|
|
||||||
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
|
|
||||||
# otherwise just VALUE. Be sure to pass "(VALUE)" is VALUE is a
|
|
||||||
# pointer.
|
|
||||||
m4_define([b4_dollar_dollar_],
|
|
||||||
[b4_symbol_value([$1],
|
|
||||||
m4_if([$2], [[]],
|
|
||||||
[[$3]], [[$2]]))])
|
|
||||||
|
|
||||||
# b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION)
|
|
||||||
# b4_dollar_popdef
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
# Define b4_dollar_dollar for VALUE and DEFAULT-FIELD,
|
|
||||||
# and b4_at_dollar for LOCATION.
|
|
||||||
m4_define([b4_dollar_pushdef],
|
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
|
||||||
[b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl
|
|
||||||
m4_pushdef([b4_at_dollar], [$3])dnl
|
|
||||||
])
|
|
||||||
m4_define([b4_dollar_popdef],
|
|
||||||
[m4_popdef([b4_at_dollar])dnl
|
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
])
|
|
||||||
+1
-1
@@ -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-2012 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
|
||||||
|
|||||||
@@ -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-2012 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,7 +17,6 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c-like.m4])
|
|
||||||
|
|
||||||
# b4_tocpp(STRING)
|
# b4_tocpp(STRING)
|
||||||
# ----------------
|
# ----------------
|
||||||
@@ -30,27 +29,54 @@ m4_define([b4_tocpp],
|
|||||||
# ------------------
|
# ------------------
|
||||||
# A valid C macro name to use as a CPP header guard for FILE.
|
# A valid C macro name to use as a CPP header guard for FILE.
|
||||||
m4_define([b4_cpp_guard],
|
m4_define([b4_cpp_guard],
|
||||||
[[YY_]b4_tocpp(m4_defn([b4_prefix])/[$1])[_INCLUDED]])
|
[b4_tocpp(m4_defn([b4_prefix])/[$1])])
|
||||||
|
|
||||||
|
|
||||||
# b4_cpp_guard_open(FILE)
|
# b4_cpp_guard_open(FILE)
|
||||||
# b4_cpp_guard_close(FILE)
|
# b4_cpp_guard_close(FILE)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# If FILE does not expand to nothing, open/close CPP inclusion guards for FILE.
|
# Open/close CPP inclusion guards for FILE.
|
||||||
m4_define([b4_cpp_guard_open],
|
m4_define([b4_cpp_guard_open],
|
||||||
[m4_ifval(m4_quote($1),
|
|
||||||
[#ifndef b4_cpp_guard([$1])
|
[#ifndef b4_cpp_guard([$1])
|
||||||
# define b4_cpp_guard([$1])])])
|
# define b4_cpp_guard([$1])])
|
||||||
|
|
||||||
m4_define([b4_cpp_guard_close],
|
m4_define([b4_cpp_guard_close],
|
||||||
[m4_ifval(m4_quote($1),
|
[#endif b4_comment([!b4_cpp_guard([$1])])])
|
||||||
[#endif b4_comment([!b4_cpp_guard([$1])])])])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Identification. ##
|
## Identification. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
|
# b4_comment_(TEXT, OPEN, CONTINUE, END)
|
||||||
|
# -------------------------------------
|
||||||
|
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
||||||
|
# Avoid adding indentation to the first line, as the indentation comes
|
||||||
|
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
||||||
|
#
|
||||||
|
# Prefix all the output lines with PREFIX.
|
||||||
|
m4_define([b4_comment_], [$2[]m4_bpatsubst([$1], [
|
||||||
|
\(.\)], [
|
||||||
|
$3\1])$4])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_comment(TEXT, [PREFIX])
|
||||||
|
# ----------------------------
|
||||||
|
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
||||||
|
# Avoid adding indentation to the first line, as the indentation comes
|
||||||
|
# from "/*". That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
||||||
|
#
|
||||||
|
# Prefix all the output lines with PREFIX.
|
||||||
|
m4_define([b4_c_comment],
|
||||||
|
[b4_comment_([$1], [$2/* ], [$2 ], [$2 */])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_comment(TEXT, [PREFIX])
|
||||||
|
# --------------------------
|
||||||
|
# By default, C comments.
|
||||||
|
m4_define([b4_comment], [b4_c_comment($@)])
|
||||||
|
|
||||||
|
|
||||||
# b4_identification
|
# b4_identification
|
||||||
# -----------------
|
# -----------------
|
||||||
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
|
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
|
||||||
@@ -104,27 +130,10 @@ m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
|
|||||||
## Pure/impure interfaces. ##
|
## Pure/impure interfaces. ##
|
||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
|
|
||||||
# b4_lex_formals
|
|
||||||
# --------------
|
|
||||||
# All the yylex formal arguments.
|
|
||||||
# b4_lex_param arrives quoted twice, but we want to keep only one level.
|
|
||||||
m4_define([b4_lex_formals],
|
|
||||||
[b4_pure_if([[[[YYSTYPE *yylvalp]], [[&yylval]]][]dnl
|
|
||||||
b4_locations_if([, [[YYLTYPE *yyllocp], [&yylloc]]])])dnl
|
|
||||||
m4_ifdef([b4_lex_param], [, ]b4_lex_param)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lex
|
|
||||||
# ------
|
|
||||||
# Call yylex.
|
|
||||||
m4_define([b4_lex],
|
|
||||||
[b4_function_call([yylex], [int], b4_lex_formals)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_user_args
|
# b4_user_args
|
||||||
# ------------
|
# ------------
|
||||||
m4_define([b4_user_args],
|
m4_define([b4_user_args],
|
||||||
[m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])])
|
[m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])])
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param
|
# b4_parse_param
|
||||||
@@ -150,9 +159,9 @@ m4_popdef([$1])dnl
|
|||||||
|
|
||||||
# b4_parse_param_use([VAL], [LOC])
|
# b4_parse_param_use([VAL], [LOC])
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# 'YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
|
# `YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
|
||||||
m4_define([b4_parse_param_use],
|
m4_define([b4_parse_param_use],
|
||||||
[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl
|
[m4_ifvaln([$1], [ YYUSE([$1]);])dnl
|
||||||
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
|
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
|
||||||
b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
||||||
])dnl
|
])dnl
|
||||||
@@ -182,7 +191,7 @@ m4_define([b4_int_type],
|
|||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
# Return the smallest int type able to handle numbers ranging from
|
||||||
# 'NAME_min' to 'NAME_max' (included).
|
# `NAME_min' to `NAME_max' (included).
|
||||||
m4_define([b4_int_type_for],
|
m4_define([b4_int_type_for],
|
||||||
[b4_int_type($1_min, $1_max)])
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
@@ -191,56 +200,13 @@ m4_define([b4_int_type_for],
|
|||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# Without inducing a comparison warning from the compiler, check if the
|
# Without inducing a comparison warning from the compiler, check if the
|
||||||
# literal value LITERAL equals VALUE from table TABLE, which must have
|
# literal value LITERAL equals VALUE from table TABLE, which must have
|
||||||
# TABLE_min and TABLE_max defined.
|
# TABLE_min and TABLE_max defined. YYID must be defined as an identity
|
||||||
|
# function that suppresses warnings about constant conditions.
|
||||||
m4_define([b4_table_value_equals],
|
m4_define([b4_table_value_equals],
|
||||||
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
||||||
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
||||||
[[0]],
|
[[YYID (0)]],
|
||||||
[(!!(($2) == ($3)))])])
|
[[((]$2[) == (]$3[))]])])
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
|
||||||
## Compiler issues. ##
|
|
||||||
## ----------------- ##
|
|
||||||
|
|
||||||
# b4_attribute_define
|
|
||||||
# -------------------
|
|
||||||
# Provide portability for __attribute__.
|
|
||||||
m4_define([b4_attribute_define],
|
|
||||||
[#ifndef __attribute__
|
|
||||||
/* This feature is available in gcc versions 2.5 and later. */
|
|
||||||
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
|
||||||
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
|
||||||
# define __attribute__(Spec) /* empty */
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Suppress unused-variable warnings by "using" E. */
|
|
||||||
#if ! defined lint || defined __GNUC__
|
|
||||||
# define YYUSE(E) ((void) (E))
|
|
||||||
#else
|
|
||||||
# define YYUSE(E) /* empty */
|
|
||||||
#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
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------##
|
## ---------##
|
||||||
@@ -270,9 +236,9 @@ m4_define([b4_null], [YY_NULL])
|
|||||||
|
|
||||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
# Define "yy<TABLE-NAME>" whose contents is CONTENT.
|
# Define "yy<TABLE-NAME>" which contents is CONTENT.
|
||||||
m4_define([b4_integral_parser_table_define],
|
m4_define([b4_integral_parser_table_define],
|
||||||
[m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl
|
[m4_ifvaln([$3], [b4_c_comment([$3], [ ])])dnl
|
||||||
static const b4_int_type_for([$2]) yy$1[[]] =
|
static const b4_int_type_for([$2]) yy$1[[]] =
|
||||||
{
|
{
|
||||||
$2
|
$2
|
||||||
@@ -296,29 +262,29 @@ m4_define([b4_token_define],
|
|||||||
m4_define([b4_token_defines],
|
m4_define([b4_token_defines],
|
||||||
[b4_any_token_visible_if([/* Tokens. */
|
[b4_any_token_visible_if([/* Tokens. */
|
||||||
m4_join([
|
m4_join([
|
||||||
], b4_symbol_map([b4_token_define]))
|
], b4_symbol_map([b4_token_define]))])])
|
||||||
])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NUM)
|
# b4_token_enum(TOKEN-NUM)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
m4_define([b4_token_enum],
|
m4_define([b4_token_enum],
|
||||||
[b4_token_format([%s = %s], [$1])])
|
[b4_token_format([ %s = %s], [$1])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
# b4_token_enums
|
||||||
# --------------
|
# --------------
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[b4_any_token_visible_if([[/* Token type. */
|
[b4_any_token_visible_if([[/* Tokens. */
|
||||||
#ifndef ]b4_api_PREFIX[TOKENTYPE
|
#ifndef ]b4_api_PREFIX[TOKENTYPE
|
||||||
# define ]b4_api_PREFIX[TOKENTYPE
|
# define ]b4_api_PREFIX[TOKENTYPE
|
||||||
enum ]b4_api_prefix[tokentype
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
{
|
know about them. */
|
||||||
]m4_join([,
|
enum ]b4_api_prefix[tokentype {
|
||||||
],
|
]m4_join([,
|
||||||
b4_symbol_map([b4_token_enum]))[
|
],
|
||||||
|
b4_symbol_map([b4_token_enum]))[
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
]])])
|
]])])
|
||||||
@@ -348,43 +314,106 @@ m4_define([b4_symbol_value],
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------------- ##
|
## --------------------------------------------- ##
|
||||||
## Defining C functions. ##
|
## Defining C functions in both K&R and ANSI-C. ##
|
||||||
## ---------------------- ##
|
## --------------------------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_function_define(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
# b4_modern_c
|
||||||
# -----------------------------------------------------------
|
# -----------
|
||||||
# Declare the function NAME in C.
|
# A predicate useful in #if to determine whether C is ancient or modern.
|
||||||
m4_define([b4_function_define],
|
#
|
||||||
[$2
|
# If __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run
|
||||||
$1 (b4_formals(m4_shift2($@)))[]dnl
|
# as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
|
||||||
|
# reasons, but it defines __C99__FUNC__ so check that as well.
|
||||||
|
# Microsoft C normally doesn't define these macros, but it defines _MSC_VER.
|
||||||
|
# Consider a C++ compiler to be modern if it defines __cplusplus.
|
||||||
|
#
|
||||||
|
m4_define([b4_c_modern],
|
||||||
|
[[(defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|
|| defined __cplusplus || defined _MSC_VER)]])
|
||||||
|
|
||||||
|
# b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# ----------------------------------------------------------
|
||||||
|
# Declare the function NAME.
|
||||||
|
m4_define([b4_c_function_def],
|
||||||
|
[#if b4_c_modern
|
||||||
|
b4_c_ansi_function_def($@)
|
||||||
|
#else
|
||||||
|
$2
|
||||||
|
$1 (b4_c_knr_formal_names(m4_shift2($@)))
|
||||||
|
b4_c_knr_formal_decls(m4_shift2($@))
|
||||||
|
#endif[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_formals([DECL1, NAME1], ...)
|
# b4_c_ansi_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
# -------------------------------
|
# ---------------------------------------------------------------
|
||||||
# The formal arguments of a C function definition.
|
# Declare the function NAME in ANSI.
|
||||||
m4_define([b4_formals],
|
m4_define([b4_c_ansi_function_def],
|
||||||
|
[$2
|
||||||
|
$1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_ansi_formals([DECL1, NAME1], ...)
|
||||||
|
# --------------------------------------
|
||||||
|
# Output the arguments ANSI-C definition.
|
||||||
|
m4_define([b4_c_ansi_formals],
|
||||||
[m4_if([$#], [0], [void],
|
[m4_if([$#], [0], [void],
|
||||||
[$#$1], [1], [void],
|
[$#$1], [1], [void],
|
||||||
[m4_map_sep([b4_formal], [, ], [$@])])])
|
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
||||||
|
|
||||||
m4_define([b4_formal],
|
m4_define([b4_c_ansi_formal],
|
||||||
[$1])
|
[$1])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_knr_formal_names([DECL1, NAME1], ...)
|
||||||
|
# ------------------------------------------
|
||||||
|
# Output the argument names.
|
||||||
|
m4_define([b4_c_knr_formal_names],
|
||||||
|
[m4_map_sep([b4_c_knr_formal_name], [, ], [$@])])
|
||||||
|
|
||||||
## ----------------------- ##
|
m4_define([b4_c_knr_formal_name],
|
||||||
## Declaring C functions. ##
|
[$2])
|
||||||
## ----------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_function_declare(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
# b4_c_knr_formal_decls([DECL1, NAME1], ...)
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------
|
||||||
|
# Output the K&R argument declarations.
|
||||||
|
m4_define([b4_c_knr_formal_decls],
|
||||||
|
[m4_map_sep([b4_c_knr_formal_decl],
|
||||||
|
[
|
||||||
|
],
|
||||||
|
[$@])])
|
||||||
|
|
||||||
|
m4_define([b4_c_knr_formal_decl],
|
||||||
|
[ $1;])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------------------------------------------------ ##
|
||||||
|
## Declaring (prototyping) C functions in both K&R and ANSI-C. ##
|
||||||
|
## ------------------------------------------------------------ ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# -----------------------------------------------------------
|
||||||
# Declare the function NAME.
|
# Declare the function NAME.
|
||||||
m4_define([b4_function_declare],
|
m4_define([b4_c_function_decl],
|
||||||
[$2 $1 (b4_formals(m4_shift2($@)));[]dnl
|
[#if b4_c_modern
|
||||||
|
b4_c_ansi_function_decl($@)
|
||||||
|
#else
|
||||||
|
$2 $1 ();
|
||||||
|
#endif[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# Declare the function NAME.
|
||||||
|
m4_define([b4_c_ansi_function_decl],
|
||||||
|
[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -395,21 +424,21 @@ m4_define([b4_function_declare],
|
|||||||
## --------------------- ##
|
## --------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
# b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
# -----------------------------------------------------------
|
# -----------------------------------------------------------
|
||||||
# Call the function NAME with arguments NAME1, NAME2 etc.
|
# Call the function NAME with arguments NAME1, NAME2 etc.
|
||||||
m4_define([b4_function_call],
|
m4_define([b4_c_function_call],
|
||||||
[$1 (b4_args(m4_shift2($@)))[]dnl
|
[$1 (b4_c_args(m4_shift2($@)))[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_args([DECL1, NAME1], ...)
|
# b4_c_args([DECL1, NAME1], ...)
|
||||||
# ----------------------------
|
# ------------------------------
|
||||||
# Output the arguments NAME1, NAME2...
|
# Output the arguments NAME1, NAME2...
|
||||||
m4_define([b4_args],
|
m4_define([b4_c_args],
|
||||||
[m4_map_sep([b4_arg], [, ], [$@])])
|
[m4_map_sep([b4_c_arg], [, ], [$@])])
|
||||||
|
|
||||||
m4_define([b4_arg],
|
m4_define([b4_c_arg],
|
||||||
[$2])
|
[$2])
|
||||||
|
|
||||||
|
|
||||||
@@ -418,7 +447,7 @@ m4_define([b4_arg],
|
|||||||
## ----------- ##
|
## ----------- ##
|
||||||
|
|
||||||
# b4_sync_start(LINE, FILE)
|
# b4_sync_start(LINE, FILE)
|
||||||
# -------------------------
|
# -----------------------
|
||||||
m4_define([b4_sync_start], [[#]line $1 $2])
|
m4_define([b4_sync_start], [[#]line $1 $2])
|
||||||
|
|
||||||
|
|
||||||
@@ -444,15 +473,18 @@ b4_syncline([@oline@], [@ofile@])
|
|||||||
break;])
|
break;])
|
||||||
|
|
||||||
|
|
||||||
# b4_yydestruct_define
|
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
||||||
# --------------------
|
# -------------------------------------------
|
||||||
# Define the "yydestruct" function.
|
# Generate the "yydestruct" function, which declaration is issued using
|
||||||
m4_define_default([b4_yydestruct_define],
|
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
|
||||||
|
# or "b4_c_function_def" for K&R.
|
||||||
|
m4_define_default([b4_yydestruct_generate],
|
||||||
[[/*-----------------------------------------------.
|
[[/*-----------------------------------------------.
|
||||||
| Release the memory associated to this symbol. |
|
| Release the memory associated to this symbol. |
|
||||||
`-----------------------------------------------*/
|
`-----------------------------------------------*/
|
||||||
|
|
||||||
]b4_function_define([yydestruct],
|
/*ARGSUSED*/
|
||||||
|
]$1([yydestruct],
|
||||||
[static void],
|
[static void],
|
||||||
[[const char *yymsg], [yymsg]],
|
[[const char *yymsg], [yymsg]],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
@@ -465,23 +497,29 @@ 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
|
switch (yytype)
|
||||||
]b4_symbol_actions([destructor])[
|
{
|
||||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}]dnl
|
}]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_yy_symbol_print_define
|
# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
|
||||||
# -------------------------
|
# ------------------------------------------------
|
||||||
# Define the "yy_symbol_print" function.
|
# Generate the "yy_symbol_print" function, which declaration is issued using
|
||||||
m4_define_default([b4_yy_symbol_print_define],
|
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
|
||||||
|
# or "b4_c_function_def" for K&R.
|
||||||
|
m4_define_default([b4_yy_symbol_print_generate],
|
||||||
[[
|
[[
|
||||||
/*----------------------------------------.
|
/*--------------------------------.
|
||||||
| Print this symbol's value on YYOUTPUT. |
|
| Print this symbol on YYOUTPUT. |
|
||||||
`----------------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
]b4_function_define([yy_symbol_value_print],
|
/*ARGSUSED*/
|
||||||
|
]$1([yy_symbol_value_print],
|
||||||
[static void],
|
[static void],
|
||||||
[[FILE *yyoutput], [yyoutput]],
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
@@ -500,7 +538,12 @@ m4_if(b4_skeleton, ["yacc.c"],
|
|||||||
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||||||
# endif
|
# endif
|
||||||
]])dnl
|
]])dnl
|
||||||
b4_symbol_actions([printer])[
|
[ switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_printer])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -508,7 +551,7 @@ m4_if(b4_skeleton, ["yacc.c"],
|
|||||||
| Print this symbol on YYOUTPUT. |
|
| Print this symbol on YYOUTPUT. |
|
||||||
`--------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
]b4_function_define([yy_symbol_print],
|
]$1([yy_symbol_print],
|
||||||
[static void],
|
[static void],
|
||||||
[[FILE *yyoutput], [yyoutput]],
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
@@ -516,8 +559,10 @@ m4_if(b4_skeleton, ["yacc.c"],
|
|||||||
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
||||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
{
|
{
|
||||||
YYFPRINTF (yyoutput, "%s %s (",
|
if (yytype < YYNTOKENS)
|
||||||
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
|
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
|
||||||
|
else
|
||||||
|
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
||||||
|
|
||||||
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
||||||
YYFPRINTF (yyoutput, ": ");
|
YYFPRINTF (yyoutput, ": ");
|
||||||
@@ -528,192 +573,50 @@ b4_locations_if([, yylocationp])[]b4_user_args[);
|
|||||||
}]dnl
|
}]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## api.value.type. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------- #
|
|
||||||
# api.value.type=union. #
|
|
||||||
# ---------------------- #
|
|
||||||
|
|
||||||
# b4_symbol_type_register(SYMBOL-NUM)
|
|
||||||
# -----------------------------------
|
|
||||||
# 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,
|
|
||||||
# and extend the symbol's "type" field to point to the field name,
|
|
||||||
# instead of the type name.
|
|
||||||
m4_define([b4_symbol_type_register],
|
|
||||||
[m4_define([b4_symbol($1, type_tag)],
|
|
||||||
[b4_symbol_if([$1], [has_id],
|
|
||||||
[b4_symbol([$1], [id])],
|
|
||||||
[yytype_[]b4_symbol([$1], [number])])])dnl
|
|
||||||
m4_append([b4_user_union_members],
|
|
||||||
m4_expand([
|
|
||||||
b4_symbol_tag_comment([$1])dnl
|
|
||||||
b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]))
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_type_define_tag(SYMBOL1-NUM, ...)
|
|
||||||
# ------------------------------------
|
|
||||||
# For the batch of symbols SYMBOL1-NUM... (which all have the same
|
|
||||||
# type), enhance the %union definition for each of them, and set
|
|
||||||
# there "type" field to the field tag name, instead of the type name.
|
|
||||||
m4_define([b4_type_define_tag],
|
|
||||||
[b4_symbol_if([$1], [has_type],
|
|
||||||
[m4_map([b4_symbol_type_register], [$@])])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value_union(VAL, [TYPE])
|
|
||||||
# ----------------------------------
|
|
||||||
# Same of b4_symbol_value, but when api.value.type=union.
|
|
||||||
m4_define([b4_symbol_value_union],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[(*($2*)(&$1))],
|
|
||||||
[$1])])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_setup_union
|
|
||||||
# -------------------------
|
|
||||||
# Setup support for api.value.type=union. Symbols are defined with a
|
|
||||||
# type instead of a union member name: build the corresponding union,
|
|
||||||
# and give the symbols their tag.
|
|
||||||
m4_define([b4_value_type_setup_union],
|
|
||||||
[m4_define([b4_union_members])
|
|
||||||
b4_type_foreach([b4_type_define_tag])
|
|
||||||
m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------- #
|
|
||||||
# api.value.type. #
|
|
||||||
# ---------------- #
|
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_setup_variant
|
|
||||||
# ---------------------------
|
|
||||||
# Setup support for api.value.type=variant. By default, fail, specialized
|
|
||||||
# by other skeletons.
|
|
||||||
m4_define([b4_value_type_setup_variant],
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.value.type]]),
|
|
||||||
[['%s' does not support '%s']],
|
|
||||||
[b4_skeleton],
|
|
||||||
[%define api.value.type variant])])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_value_type_setup_keyword
|
|
||||||
# ----------------------------
|
|
||||||
# api.value.type is defined with a keyword/string syntax. Check if
|
|
||||||
# that is properly defined, and prepare its use.
|
|
||||||
m4_define([_b4_value_type_setup_keyword],
|
|
||||||
[b4_percent_define_check_values([[[[api.value.type]],
|
|
||||||
[[none]],
|
|
||||||
[[union]],
|
|
||||||
[[union-directive]],
|
|
||||||
[[variant]],
|
|
||||||
[[yystype]]]])dnl
|
|
||||||
m4_case(b4_percent_define_get([[api.value.type]]),
|
|
||||||
[union], [b4_value_type_setup_union],
|
|
||||||
[variant], [b4_value_type_setup_variant])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_setup
|
|
||||||
# -------------------
|
|
||||||
# Check if api.value.type is properly defined, and possibly prepare
|
|
||||||
# its use.
|
|
||||||
b4_define_silent([b4_value_type_setup],
|
|
||||||
[# Define default value.
|
|
||||||
b4_percent_define_ifdef([[api.value.type]], [],
|
|
||||||
[# %union => api.value.type=union-directive
|
|
||||||
m4_ifdef([b4_union_members],
|
|
||||||
[m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
|
||||||
m4_define([b4_percent_define(api.value.type)], [union-directive])],
|
|
||||||
[# no tag seen => api.value.type={int}
|
|
||||||
m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[m4_define([b4_percent_define_kind(api.value.type)], [code])
|
|
||||||
m4_define([b4_percent_define(api.value.type)], [int])],
|
|
||||||
[# otherwise api.value.type=yystype
|
|
||||||
m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
|
||||||
m4_define([b4_percent_define(api.value.type)], [yystype])])])])
|
|
||||||
|
|
||||||
# Set up.
|
|
||||||
m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
|
||||||
[keyword\|string], [_b4_value_type_setup_keyword])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Declarations. ##
|
## Declarations. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_define
|
|
||||||
# --------------------
|
|
||||||
m4_define([b4_value_type_define],
|
|
||||||
[b4_value_type_setup[]dnl
|
|
||||||
/* Value type. */
|
|
||||||
m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
|
||||||
[code],
|
|
||||||
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
|
|
||||||
typedef ]b4_percent_define_get([[api.value.type]])[ ]b4_api_PREFIX[STYPE;
|
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
|
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
|
|
||||||
#endif
|
|
||||||
]],
|
|
||||||
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
|
||||||
[union\|union-directive],
|
|
||||||
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
|
|
||||||
typedef union ]b4_union_name[ ]b4_api_PREFIX[STYPE;
|
|
||||||
union ]b4_union_name[
|
|
||||||
{
|
|
||||||
]b4_user_union_members[
|
|
||||||
};
|
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
|
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
|
|
||||||
#endif
|
|
||||||
]])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_location_type_define
|
|
||||||
# -----------------------
|
|
||||||
m4_define([b4_location_type_define],
|
|
||||||
[[/* Location type. */
|
|
||||||
#if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
|
|
||||||
typedef struct ]b4_api_PREFIX[LTYPE ]b4_api_PREFIX[LTYPE;
|
|
||||||
struct ]b4_api_PREFIX[LTYPE
|
|
||||||
{
|
|
||||||
int first_line;
|
|
||||||
int first_column;
|
|
||||||
int last_line;
|
|
||||||
int last_column;
|
|
||||||
};
|
|
||||||
# define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
|
|
||||||
# define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
|
|
||||||
#endif
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_yylstype
|
# b4_declare_yylstype
|
||||||
# -------------------
|
# -------------------
|
||||||
# Declarations that might either go into the header (if --defines) or
|
# Declarations that might either go into the header (if --defines) or
|
||||||
# in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
|
# in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
|
||||||
m4_define([b4_declare_yylstype],
|
m4_define([b4_declare_yylstype],
|
||||||
[b4_value_type_define[]b4_locations_if([
|
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
|
||||||
b4_location_type_define])
|
]m4_ifdef([b4_stype],
|
||||||
|
[[typedef union ]b4_union_name[
|
||||||
|
{
|
||||||
|
]b4_user_stype[
|
||||||
|
} ]b4_api_PREFIX[STYPE;
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]],
|
||||||
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
|
[[typedef int ]b4_api_PREFIX[STYPE;
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]])])[
|
||||||
|
# define ]b4_api_prefix[stype ]b4_api_PREFIX[STYPE /* obsolescent; will be withdrawn */
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
|
||||||
|
#endif]b4_locations_if([[
|
||||||
|
|
||||||
|
#if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
|
||||||
|
typedef struct ]b4_api_PREFIX[LTYPE
|
||||||
|
{
|
||||||
|
int first_line;
|
||||||
|
int first_column;
|
||||||
|
int last_line;
|
||||||
|
int last_column;
|
||||||
|
} ]b4_api_PREFIX[LTYPE;
|
||||||
|
# define ]b4_api_prefix[ltype ]b4_api_PREFIX[LTYPE /* obsolescent; will be withdrawn */
|
||||||
|
# define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
|
||||||
|
# define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
|
||||||
|
#endif]])
|
||||||
|
|
||||||
b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
|
b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
|
||||||
]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
|
]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_YYDEBUG_define
|
# b4_YYDEBUG_define
|
||||||
# -----------------
|
# ------------------
|
||||||
m4_define([b4_YYDEBUG_define],
|
m4_define([b4_YYDEBUG_define],
|
||||||
[[/* Debug traces. */
|
[[/* Enabling traces. */
|
||||||
]m4_if(b4_api_prefix, [yy],
|
]m4_if(b4_api_prefix, [yy],
|
||||||
[[#ifndef YYDEBUG
|
[[#ifndef YYDEBUG
|
||||||
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
|
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
|
||||||
@@ -727,7 +630,7 @@ m4_define([b4_YYDEBUG_define],
|
|||||||
# endif
|
# endif
|
||||||
# else /* ! defined YYDEBUG */
|
# else /* ! defined YYDEBUG */
|
||||||
# define ]b4_api_PREFIX[DEBUG ]b4_parse_trace_if([1], [0])[
|
# define ]b4_api_PREFIX[DEBUG ]b4_parse_trace_if([1], [0])[
|
||||||
# endif /* ! defined YYDEBUG */
|
# endif /* ! defined ]b4_api_PREFIX[DEBUG */
|
||||||
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -751,7 +654,7 @@ m4_define([b4_yylloc_default_define],
|
|||||||
#ifndef YYLLOC_DEFAULT
|
#ifndef YYLLOC_DEFAULT
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
do \
|
do \
|
||||||
if (N) \
|
if (YYID (N)) \
|
||||||
{ \
|
{ \
|
||||||
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
|
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
|
||||||
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
|
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
|
||||||
@@ -765,75 +668,6 @@ m4_define([b4_yylloc_default_define],
|
|||||||
(Current).first_column = (Current).last_column = \
|
(Current).first_column = (Current).last_column = \
|
||||||
YYRHSLOC (Rhs, 0).last_column; \
|
YYRHSLOC (Rhs, 0).last_column; \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (YYID (0))
|
||||||
#endif
|
#endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
# b4_yy_location_print_define
|
|
||||||
# ---------------------------
|
|
||||||
# Define YY_LOCATION_PRINT.
|
|
||||||
m4_define([b4_yy_location_print_define],
|
|
||||||
[b4_locations_if([[
|
|
||||||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
|
||||||
This macro was not mandated originally: define only if we know
|
|
||||||
we won't break user code: when these are the locations we know. */
|
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
|
||||||
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
|
|
||||||
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
|
||||||
|
|
||||||
__attribute__((__unused__))
|
|
||||||
]b4_function_define([yy_location_print_],
|
|
||||||
[static unsigned],
|
|
||||||
[[FILE *yyo], [yyo]],
|
|
||||||
[[YYLTYPE const * const yylocp], [yylocp]])[
|
|
||||||
{
|
|
||||||
unsigned res = 0;
|
|
||||||
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
|
|
||||||
if (0 <= yylocp->first_line)
|
|
||||||
{
|
|
||||||
res += YYFPRINTF (yyo, "%d", yylocp->first_line);
|
|
||||||
if (0 <= yylocp->first_column)
|
|
||||||
res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
|
|
||||||
}
|
|
||||||
if (0 <= yylocp->last_line)
|
|
||||||
{
|
|
||||||
if (yylocp->first_line < yylocp->last_line)
|
|
||||||
{
|
|
||||||
res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
|
|
||||||
if (0 <= end_col)
|
|
||||||
res += YYFPRINTF (yyo, ".%d", end_col);
|
|
||||||
}
|
|
||||||
else if (0 <= end_col && yylocp->first_column < end_col)
|
|
||||||
res += YYFPRINTF (yyo, "-%d", end_col);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) \
|
|
||||||
yy_location_print_ (File, &(Loc))
|
|
||||||
|
|
||||||
# else
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
# endif
|
|
||||||
#endif]],
|
|
||||||
[[/* This macro is provided for backward compatibility. */
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
#endif]])
|
|
||||||
])
|
|
||||||
|
|
||||||
# b4_yyloc_default
|
|
||||||
# ----------------
|
|
||||||
# Expand to a possible default value for yylloc.
|
|
||||||
m4_define([b4_yyloc_default],
|
|
||||||
[[
|
|
||||||
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
= { ]m4_join([, ],
|
|
||||||
m4_defn([b4_location_initial_line]),
|
|
||||||
m4_defn([b4_location_initial_column]),
|
|
||||||
m4_defn([b4_location_initial_line]),
|
|
||||||
m4_defn([b4_location_initial_column]))[ }
|
|
||||||
# endif
|
|
||||||
]])
|
|
||||||
|
|||||||
+162
-115
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# GLR skeleton for Bison
|
# GLR skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2012 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
|
||||||
@@ -52,7 +52,17 @@ m4_ifndef([b4_pure_flag],
|
|||||||
# This is not shared with yacc.c in c.m4 because GLR relies on ISO C
|
# This is not shared with yacc.c in c.m4 because GLR relies on ISO C
|
||||||
# formal argument declarations.
|
# formal argument declarations.
|
||||||
m4_define([b4_user_formals],
|
m4_define([b4_user_formals],
|
||||||
[m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])])
|
[m4_ifset([b4_parse_param], [, b4_c_ansi_formals(b4_parse_param)])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_lex_param
|
||||||
|
# ------------
|
||||||
|
# Accumule in b4_lex_param all the yylex arguments.
|
||||||
|
# Yes, this is quite ugly...
|
||||||
|
m4_define([b4_lex_param],
|
||||||
|
m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl
|
||||||
|
b4_locations_if([, [[YYLTYPE *], [&yylloc]]])])dnl
|
||||||
|
m4_ifdef([b4_lex_param], [, ]b4_lex_param)))
|
||||||
|
|
||||||
|
|
||||||
# b4_yyerror_args
|
# b4_yyerror_args
|
||||||
@@ -61,7 +71,7 @@ m4_define([b4_user_formals],
|
|||||||
# a trailing comma.
|
# a trailing comma.
|
||||||
m4_define([b4_yyerror_args],
|
m4_define([b4_yyerror_args],
|
||||||
[b4_pure_if([b4_locations_if([yylocp, ])])dnl
|
[b4_pure_if([b4_locations_if([yylocp, ])])dnl
|
||||||
m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
|
m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
|
||||||
|
|
||||||
|
|
||||||
# b4_lyyerror_args
|
# b4_lyyerror_args
|
||||||
@@ -69,7 +79,7 @@ m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
|
|||||||
# Same as above, but on the lookahead, hence &yylloc instead of yylocp.
|
# Same as above, but on the lookahead, hence &yylloc instead of yylocp.
|
||||||
m4_define([b4_lyyerror_args],
|
m4_define([b4_lyyerror_args],
|
||||||
[b4_pure_if([b4_locations_if([&yylloc, ])])dnl
|
[b4_pure_if([b4_locations_if([&yylloc, ])])dnl
|
||||||
m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
|
m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
|
||||||
|
|
||||||
|
|
||||||
# b4_pure_args
|
# b4_pure_args
|
||||||
@@ -162,26 +172,28 @@ m4_define([b4_rhs_location],
|
|||||||
# b4_shared_declarations
|
# b4_shared_declarations
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Declaration that might either go into the header (if --defines)
|
# Declaration that might either go into the header (if --defines)
|
||||||
# or open coded in the parser body. glr.cc has its own definition.
|
# or open coded in the parser body.
|
||||||
m4_if(b4_skeleton, ["glr.c"],
|
m4_define([b4_shared_declarations],
|
||||||
[m4_define([b4_shared_declarations],
|
|
||||||
[b4_declare_yydebug[
|
[b4_declare_yydebug[
|
||||||
]b4_percent_code_get([[requires]])[
|
]b4_percent_code_get([[requires]])[
|
||||||
]b4_token_enums[
|
]b4_token_enums[
|
||||||
]b4_declare_yylstype[
|
]b4_declare_yylstype[
|
||||||
]b4_function_declare(b4_prefix[parse], [int], b4_parse_param)[
|
]b4_c_ansi_function_decl(b4_prefix[parse], [int], b4_parse_param)[
|
||||||
]b4_percent_code_get([[provides]])[]dnl
|
]b4_percent_code_get([[provides]])[]dnl
|
||||||
])
|
])
|
||||||
])
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Output files. ##
|
## Output files. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
b4_output_begin([b4_parser_file_name])
|
# We do want M4 expansion after # for CPP macros.
|
||||||
|
m4_changecom()
|
||||||
|
m4_divert_push(0)dnl
|
||||||
|
@output(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-2012])
|
||||||
|
[
|
||||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||||
|
|
||||||
]b4_identification
|
]b4_identification
|
||||||
@@ -196,20 +208,19 @@ b4_percent_code_get([[top]])[
|
|||||||
#define yyparse ]b4_prefix[parse
|
#define yyparse ]b4_prefix[parse
|
||||||
#define yylex ]b4_prefix[lex
|
#define yylex ]b4_prefix[lex
|
||||||
#define yyerror ]b4_prefix[error
|
#define yyerror ]b4_prefix[error
|
||||||
#define yydebug ]b4_prefix[debug
|
|
||||||
]]b4_pure_if([], [[
|
|
||||||
#define yylval ]b4_prefix[lval
|
#define yylval ]b4_prefix[lval
|
||||||
#define yychar ]b4_prefix[char
|
#define yychar ]b4_prefix[char
|
||||||
|
#define yydebug ]b4_prefix[debug
|
||||||
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
||||||
#define yylloc ]b4_prefix[lloc]])]))[
|
#define yylloc ]b4_prefix[lloc]])])[
|
||||||
|
|
||||||
/* First part of user declarations. */
|
/* Copy the first part of user declarations. */
|
||||||
]b4_user_pre_prologue[
|
]b4_user_pre_prologue[
|
||||||
|
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
|
|
||||||
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
||||||
[b4_shared_declarations])[
|
[b4_shared_declarations])[
|
||||||
|
|
||||||
/* Enabling verbose error messages. */
|
/* Enabling verbose error messages. */
|
||||||
#ifdef YYERROR_VERBOSE
|
#ifdef YYERROR_VERBOSE
|
||||||
@@ -220,11 +231,11 @@ b4_percent_code_get([[top]])[
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Default (constant) value used for initialization for null
|
/* Default (constant) value used for initialization for null
|
||||||
right-hand sides. Unlike the standard yacc.c template, here we set
|
right-hand sides. Unlike the standard yacc.c template,
|
||||||
the default value of $$ to a zeroed-out value. Since the default
|
here we set the default value of $$ to a zeroed-out value.
|
||||||
value is undefined, this behavior is technically correct. */
|
Since the default value is undefined, this behavior is
|
||||||
static YYSTYPE yyval_default;]b4_locations_if([[
|
technically correct. */
|
||||||
static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
static YYSTYPE yyval_default;
|
||||||
|
|
||||||
/* Copy the second part of user declarations. */
|
/* Copy the second part of user declarations. */
|
||||||
]b4_user_post_prologue
|
]b4_user_post_prologue
|
||||||
@@ -238,14 +249,31 @@ b4_percent_code_get[]dnl
|
|||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||||
# if ENABLE_NLS
|
# if ENABLE_NLS
|
||||||
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
|
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifndef YY_
|
# ifndef YY_
|
||||||
# define YY_(Msgid) Msgid
|
# define YY_(msgid) msgid
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
|
#if ! defined lint || defined __GNUC__
|
||||||
|
# define YYUSE(e) ((void) (e))
|
||||||
|
#else
|
||||||
|
# define YYUSE(e) /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Identity function, used to suppress warnings about constant conditions. */
|
||||||
|
#ifndef lint
|
||||||
|
# define YYID(n) (n)
|
||||||
|
#else
|
||||||
|
]b4_c_function_def([YYID], [static int], [[int i], [i]])[
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef YYFREE
|
#ifndef YYFREE
|
||||||
# define YYFREE free
|
# define YYFREE free
|
||||||
#endif
|
#endif
|
||||||
@@ -269,15 +297,31 @@ b4_percent_code_get[]dnl
|
|||||||
#ifndef YYSETJMP
|
#ifndef YYSETJMP
|
||||||
# include <setjmp.h>
|
# include <setjmp.h>
|
||||||
# define YYJMP_BUF jmp_buf
|
# define YYJMP_BUF jmp_buf
|
||||||
# define YYSETJMP(Env) setjmp (Env)
|
# define YYSETJMP(env) setjmp (env)
|
||||||
/* Pacify clang. */
|
# define YYLONGJMP(env, val) longjmp (env, val)
|
||||||
# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_attribute_define[
|
/*-----------------.
|
||||||
|
| GCC extensions. |
|
||||||
|
`-----------------*/
|
||||||
|
|
||||||
|
#ifndef __attribute__
|
||||||
|
/* This feature is available in gcc versions 2.5 and later. */
|
||||||
|
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
||||||
|
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
||||||
|
# define __attribute__(Spec) /* empty */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
]b4_locations_if([#define YYOPTIONAL_LOC(Name) Name],[
|
||||||
|
#ifdef __cplusplus
|
||||||
|
# define YYOPTIONAL_LOC(Name) /* empty */
|
||||||
|
#else
|
||||||
|
# define YYOPTIONAL_LOC(Name) Name __attribute__ ((__unused__))
|
||||||
|
#endif])[
|
||||||
|
|
||||||
#ifndef YYASSERT
|
#ifndef YYASSERT
|
||||||
# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0)))
|
# define YYASSERT(condition) ((void) ((condition) || (abort (), 0)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* YYFINAL -- State number of the termination state. */
|
/* YYFINAL -- State number of the termination state. */
|
||||||
@@ -365,20 +409,42 @@ static const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] =
|
|||||||
/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
|
/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
|
||||||
0, pointed into by YYCONFLP. */
|
0, pointed into by YYCONFLP. */
|
||||||
]dnl Do not use b4_int_type_for here, since there are places where
|
]dnl Do not use b4_int_type_for here, since there are places where
|
||||||
dnl pointers onto yyconfl are taken, whose type is "short int *".
|
dnl pointers onto yyconfl are taken, which type is "short int *".
|
||||||
dnl We probably ought to introduce a type for confl.
|
dnl We probably ought to introduce a type for confl.
|
||||||
[static const short int yyconfl[] =
|
[static const short int yyconfl[] =
|
||||||
{
|
{
|
||||||
]b4_conflicting_rules[
|
]b4_conflicting_rules[
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Error token number */
|
/* Error token number */
|
||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
|
#ifndef YYLLOC_DEFAULT
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
# define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
# define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
||||||
]])[
|
|
||||||
|
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
||||||
|
This macro was not mandated originally: define only if we know
|
||||||
|
we won't break user code: when these are the locations we know. */
|
||||||
|
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) \
|
||||||
|
fprintf (File, "%d.%d-%d.%d", \
|
||||||
|
(Loc).first_line, (Loc).first_column, \
|
||||||
|
(Loc).last_line, (Loc).last_column)
|
||||||
|
#endif
|
||||||
|
]],[
|
||||||
|
#ifndef YYLLOC_DEFAULT
|
||||||
|
# define YYLLOC_DEFAULT(Current, Rhs, N) ((void) 0)
|
||||||
|
#endif
|
||||||
|
])[
|
||||||
|
|
||||||
|
#ifndef YY_LOCATION_PRINT
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* YYLEX -- calling `yylex' with the right arguments. */
|
||||||
|
#define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
|
||||||
|
|
||||||
]b4_pure_if(
|
]b4_pure_if(
|
||||||
[
|
[
|
||||||
@@ -411,7 +477,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
|
|||||||
YYRESULTTAG yychk_flag = YYE; \
|
YYRESULTTAG yychk_flag = YYE; \
|
||||||
if (yychk_flag != yyok) \
|
if (yychk_flag != yyok) \
|
||||||
return yychk_flag; \
|
return yychk_flag; \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
@@ -419,15 +485,13 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
|
|||||||
# define YYFPRINTF fprintf
|
# define YYFPRINTF fprintf
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
]b4_yy_location_print_define[
|
|
||||||
|
|
||||||
# define YYDPRINTF(Args) \
|
# define YYDPRINTF(Args) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
YYFPRINTF Args; \
|
YYFPRINTF Args; \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
|
|
||||||
]b4_yy_symbol_print_define[
|
]b4_yy_symbol_print_generate([b4_c_ansi_function_def])[
|
||||||
|
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
||||||
do { \
|
do { \
|
||||||
@@ -437,18 +501,12 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
|
|||||||
yy_symbol_print (stderr, Type, Value]b4_locuser_args([Location])[); \
|
yy_symbol_print (stderr, Type, Value]b4_locuser_args([Location])[); \
|
||||||
YYFPRINTF (stderr, "\n"); \
|
YYFPRINTF (stderr, "\n"); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
|
|
||||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||||
multiple parsers can coexist. */
|
multiple parsers can coexist. */
|
||||||
int yydebug;
|
int yydebug;
|
||||||
|
|
||||||
struct yyGLRStack;
|
|
||||||
static void yypstack (struct yyGLRStack* yystackp, size_t yyk)
|
|
||||||
__attribute__ ((__unused__));
|
|
||||||
static void yypdumpstack (struct yyGLRStack* yystackp)
|
|
||||||
__attribute__ ((__unused__));
|
|
||||||
|
|
||||||
#else /* !]b4_api_PREFIX[DEBUG */
|
#else /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
# define YYDPRINTF(Args)
|
# define YYDPRINTF(Args)
|
||||||
@@ -488,13 +546,13 @@ static void yypdumpstack (struct yyGLRStack* yystackp)
|
|||||||
do { \
|
do { \
|
||||||
if (Yystack->yyspaceLeft < YYHEADROOM) \
|
if (Yystack->yyspaceLeft < YYHEADROOM) \
|
||||||
yyexpandGLRStack (Yystack); \
|
yyexpandGLRStack (Yystack); \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
#else
|
#else
|
||||||
# define YY_RESERVE_GLRSTACK(Yystack) \
|
# define YY_RESERVE_GLRSTACK(Yystack) \
|
||||||
do { \
|
do { \
|
||||||
if (Yystack->yyspaceLeft < YYHEADROOM) \
|
if (Yystack->yyspaceLeft < YYHEADROOM) \
|
||||||
yyMemoryExhausted (Yystack); \
|
yyMemoryExhausted (Yystack); \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -746,8 +804,8 @@ yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
|
|||||||
* value ($$), and yylocp points to place for location information
|
* value ($$), and yylocp points to place for location information
|
||||||
* (@@$). Returns yyok for normal return, yyaccept for YYACCEPT,
|
* (@@$). Returns yyok for normal return, yyaccept for YYACCEPT,
|
||||||
* yyerr for YYERROR, yyabort for YYABORT. */
|
* yyerr for YYERROR, yyabort for YYABORT. */
|
||||||
static YYRESULTTAG
|
/*ARGSUSED*/ static YYRESULTTAG
|
||||||
yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
|
yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
||||||
yyGLRStack* yystackp,
|
yyGLRStack* yystackp,
|
||||||
YYSTYPE* yyvalp]b4_locuser_formals[)
|
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||||
{
|
{
|
||||||
@@ -755,8 +813,7 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
(yystackp->yysplitPoint == YY_NULL);
|
(yystackp->yysplitPoint == YY_NULL);
|
||||||
int yylow;
|
int yylow;
|
||||||
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
||||||
[ YYUSE (yyrhslen);
|
[# undef yyerrok
|
||||||
# undef yyerrok
|
|
||||||
# define yyerrok (yystackp->yyerrState = 0)
|
# define yyerrok (yystackp->yyerrState = 0)
|
||||||
# undef YYACCEPT
|
# undef YYACCEPT
|
||||||
# define YYACCEPT return yyaccept
|
# define YYACCEPT return yyaccept
|
||||||
@@ -798,9 +855,9 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
# undef yyclearin
|
# undef yyclearin
|
||||||
# undef YYRECOVERING
|
# undef YYRECOVERING
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*ARGSUSED*/ static void
|
||||||
static void
|
|
||||||
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
|
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
|
||||||
{
|
{
|
||||||
YYUSE (yy0);
|
YYUSE (yy0);
|
||||||
@@ -808,14 +865,14 @@ yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
|
|||||||
|
|
||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
]b4_mergers[
|
]b4_mergers[
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bison grammar-table manipulation. */
|
/* Bison grammar-table manipulation. */
|
||||||
|
|
||||||
]b4_yydestruct_define[
|
]b4_yydestruct_generate([b4_c_ansi_function_def])[
|
||||||
|
|
||||||
/** Number of symbols composing the right hand side of rule #RULE. */
|
/** Number of symbols composing the right hand side of rule #RULE. */
|
||||||
static inline int
|
static inline int
|
||||||
@@ -865,8 +922,8 @@ yylhsNonterm (yyRuleNum yyrule)
|
|||||||
return yyr1[yyrule];
|
return yyr1[yyrule];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yypact_value_is_default(Yystate) \
|
#define yypact_value_is_default(yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[
|
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
||||||
|
|
||||||
/** True iff LR state YYSTATE has only a default reduction (regardless
|
/** True iff LR state YYSTATE has only a default reduction (regardless
|
||||||
* of token). */
|
* of token). */
|
||||||
@@ -883,8 +940,8 @@ yydefaultAction (yyStateNum yystate)
|
|||||||
return yydefact[yystate];
|
return yydefact[yystate];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yytable_value_is_error(Yytable_value) \
|
#define yytable_value_is_error(yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
||||||
|
|
||||||
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
||||||
* Result R means
|
* Result R means
|
||||||
@@ -1220,13 +1277,13 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
|||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_reduce_print Args; \
|
yy_reduce_print Args; \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
|
|
||||||
/*----------------------------------------------------------------------.
|
/*----------------------------------------------------------------------.
|
||||||
| Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
|
| Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
|
||||||
`----------------------------------------------------------------------*/
|
`----------------------------------------------------------------------*/
|
||||||
|
|
||||||
static inline void
|
/*ARGSUSED*/ static inline void
|
||||||
yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk,
|
yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk,
|
||||||
yyRuleNum yyrule]b4_user_formals[)
|
yyRuleNum yyrule]b4_user_formals[)
|
||||||
{
|
{
|
||||||
@@ -1476,7 +1533,7 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
|
|||||||
{
|
{
|
||||||
yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal;
|
yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal;
|
||||||
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
|
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
|
||||||
while (yytrue)
|
while (YYID (yytrue))
|
||||||
{
|
{
|
||||||
if (yyz1 == *yyz0p || yyz1 == YY_NULL)
|
if (yyz1 == *yyz0p || yyz1 == YY_NULL)
|
||||||
break;
|
break;
|
||||||
@@ -1637,7 +1694,7 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static YYRESULTTAG
|
/*ARGSUSED*/ static YYRESULTTAG
|
||||||
yyreportAmbiguity (yySemanticOption* yyx0,
|
yyreportAmbiguity (yySemanticOption* yyx0,
|
||||||
yySemanticOption* yyx1]b4_pure_formals[)
|
yySemanticOption* yyx1]b4_pure_formals[)
|
||||||
{
|
{
|
||||||
@@ -1898,7 +1955,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
if (yychar == YYEMPTY)
|
if (yychar == YYEMPTY)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Reading a token: "));
|
YYDPRINTF ((stderr, "Reading a token: "));
|
||||||
yychar = ]b4_lex[;
|
yychar = YYLEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yychar <= YYEOF)
|
if (yychar <= YYEOF)
|
||||||
@@ -1968,7 +2025,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
return yyok;
|
return yyok;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/*ARGSUSED*/ static void
|
||||||
yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
if (yystackp->yyerrState != 0)
|
if (yystackp->yyerrState != 0)
|
||||||
@@ -1976,10 +2033,10 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
#if ! YYERROR_VERBOSE
|
#if ! YYERROR_VERBOSE
|
||||||
yyerror (]b4_lyyerror_args[YY_("syntax error"));
|
yyerror (]b4_lyyerror_args[YY_("syntax error"));
|
||||||
#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_NULL, yytokenName (yytoken));
|
||||||
size_t yysize = yysize0;
|
size_t yysize = yysize0;
|
||||||
|
size_t yysize1;
|
||||||
yybool yysize_overflow = yyfalse;
|
yybool yysize_overflow = yyfalse;
|
||||||
char* yymsg = YY_NULL;
|
char* yymsg = YY_NULL;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
@@ -2039,11 +2096,9 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyarg[yycount++] = yytokenName (yyx);
|
yyarg[yycount++] = yytokenName (yyx);
|
||||||
{
|
yysize1 = yysize + yytnamerr (YY_NULL, yytokenName (yyx));
|
||||||
size_t yysz = yysize + yytnamerr (YY_NULL, yytokenName (yyx));
|
yysize_overflow |= yysize1 < yysize;
|
||||||
yysize_overflow |= yysz < yysize;
|
yysize = yysize1;
|
||||||
yysize = yysz;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2063,11 +2118,9 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
#undef YYCASE_
|
#undef YYCASE_
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
yysize1 = yysize + strlen (yyformat);
|
||||||
size_t yysz = yysize + strlen (yyformat);
|
yysize_overflow |= yysize1 < yysize;
|
||||||
yysize_overflow |= yysz < yysize;
|
yysize = yysize1;
|
||||||
yysize = yysz;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!yysize_overflow)
|
if (!yysize_overflow)
|
||||||
yymsg = (char *) YYMALLOC (yysize);
|
yymsg = (char *) YYMALLOC (yysize);
|
||||||
@@ -2097,7 +2150,6 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yyerror (]b4_lyyerror_args[YY_("syntax error"));
|
yyerror (]b4_lyyerror_args[YY_("syntax error"));
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif /* YYERROR_VERBOSE */
|
#endif /* YYERROR_VERBOSE */
|
||||||
yynerrs += 1;
|
yynerrs += 1;
|
||||||
}
|
}
|
||||||
@@ -2105,7 +2157,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
/* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP,
|
/* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP,
|
||||||
yylval, and yylloc are the syntactic category, semantic value, and location
|
yylval, and yylloc are the syntactic category, semantic value, and location
|
||||||
of the lookahead. */
|
of the lookahead. */
|
||||||
static void
|
/*ARGSUSED*/ static void
|
||||||
yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
size_t yyk;
|
size_t yyk;
|
||||||
@@ -2114,7 +2166,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
if (yystackp->yyerrState == 3)
|
if (yystackp->yyerrState == 3)
|
||||||
/* We just shifted the error token and (perhaps) took some
|
/* We just shifted the error token and (perhaps) took some
|
||||||
reductions. Skip tokens until we can proceed. */
|
reductions. Skip tokens until we can proceed. */
|
||||||
while (yytrue)
|
while (YYID (yytrue))
|
||||||
{
|
{
|
||||||
yySymbol yytoken;
|
yySymbol yytoken;
|
||||||
if (yychar == YYEOF)
|
if (yychar == YYEOF)
|
||||||
@@ -2133,7 +2185,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yytoken, &yylval]b4_locuser_args([&yylloc])[);
|
yytoken, &yylval]b4_locuser_args([&yylloc])[);
|
||||||
}
|
}
|
||||||
YYDPRINTF ((stderr, "Reading a token: "));
|
YYDPRINTF ((stderr, "Reading a token: "));
|
||||||
yychar = ]b4_lex[;
|
yychar = YYLEX;
|
||||||
if (yychar <= YYEOF)
|
if (yychar <= YYEOF)
|
||||||
{
|
{
|
||||||
yychar = yytoken = YYEOF;
|
yychar = yytoken = YYEOF;
|
||||||
@@ -2218,13 +2270,13 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
default: \
|
default: \
|
||||||
goto yybuglab; \
|
goto yybuglab; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
|
|
||||||
/*----------.
|
/*----------.
|
||||||
| yyparse. |
|
| yyparse. |
|
||||||
`----------*/
|
`----------*/
|
||||||
|
|
||||||
]b4_function_define([yyparse], [int], b4_parse_param)[
|
]b4_c_ansi_function_def([yyparse], [int], b4_parse_param)[
|
||||||
{
|
{
|
||||||
int yyresult;
|
int yyresult;
|
||||||
yyGLRStack yystack;
|
yyGLRStack yystack;
|
||||||
@@ -2234,13 +2286,20 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
YYDPRINTF ((stderr, "Starting parse\n"));
|
YYDPRINTF ((stderr, "Starting parse\n"));
|
||||||
|
|
||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
yylval = yyval_default;]b4_locations_if([
|
yylval = yyval_default;
|
||||||
yylloc = yyloc_default;])[
|
]b4_locations_if([
|
||||||
]m4_ifdef([b4_initial_action], [
|
#if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
||||||
|
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
||||||
|
#endif
|
||||||
|
])
|
||||||
|
m4_ifdef([b4_initial_action], [
|
||||||
|
m4_pushdef([b4_at_dollar], [yylloc])dnl
|
||||||
|
m4_pushdef([b4_dollar_dollar], [yylval])dnl
|
||||||
/* User initialization code. */
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef])[]dnl
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
|
m4_popdef([b4_at_dollar])])dnl
|
||||||
[
|
[
|
||||||
if (! yyinitGLRStack (yystackp, YYINITDEPTH))
|
if (! yyinitGLRStack (yystackp, YYINITDEPTH))
|
||||||
goto yyexhaustedlab;
|
goto yyexhaustedlab;
|
||||||
@@ -2254,13 +2313,13 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyglrShift (&yystack, 0, 0, 0, &yylval]b4_locations_if([, &yylloc])[);
|
yyglrShift (&yystack, 0, 0, 0, &yylval]b4_locations_if([, &yylloc])[);
|
||||||
yyposn = 0;
|
yyposn = 0;
|
||||||
|
|
||||||
while (yytrue)
|
while (YYID (yytrue))
|
||||||
{
|
{
|
||||||
/* For efficiency, we have two loops, the first of which is
|
/* For efficiency, we have two loops, the first of which is
|
||||||
specialized to deterministic operation (single stack, no
|
specialized to deterministic operation (single stack, no
|
||||||
potential ambiguity). */
|
potential ambiguity). */
|
||||||
/* Standard mode */
|
/* Standard mode */
|
||||||
while (yytrue)
|
while (YYID (yytrue))
|
||||||
{
|
{
|
||||||
yyRuleNum yyrule;
|
yyRuleNum yyrule;
|
||||||
int yyaction;
|
int yyaction;
|
||||||
@@ -2287,7 +2346,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
if (yychar == YYEMPTY)
|
if (yychar == YYEMPTY)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Reading a token: "));
|
YYDPRINTF ((stderr, "Reading a token: "));
|
||||||
yychar = ]b4_lex[;
|
yychar = YYLEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yychar <= YYEOF)
|
if (yychar <= YYEOF)
|
||||||
@@ -2324,7 +2383,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (yytrue)
|
while (YYID (yytrue))
|
||||||
{
|
{
|
||||||
yySymbol yytoken_to_shift;
|
yySymbol yytoken_to_shift;
|
||||||
size_t yys;
|
size_t yys;
|
||||||
@@ -2456,11 +2515,16 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyfreeGLRStack (&yystack);
|
yyfreeGLRStack (&yystack);
|
||||||
}
|
}
|
||||||
|
|
||||||
return yyresult;
|
/* Make sure YYID is used. */
|
||||||
|
return YYID (yyresult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DEBUGGING ONLY */
|
/* DEBUGGING ONLY */
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
|
static void yypstack (yyGLRStack* yystackp, size_t yyk)
|
||||||
|
__attribute__ ((__unused__));
|
||||||
|
static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
yy_yypstack (yyGLRState* yys)
|
yy_yypstack (yyGLRState* yys)
|
||||||
{
|
{
|
||||||
@@ -2529,35 +2593,18 @@ yypdumpstack (yyGLRStack* yystackp)
|
|||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef yylval
|
|
||||||
#undef yychar
|
|
||||||
#undef yynerrs]b4_locations_if([
|
|
||||||
#undef yylloc])
|
|
||||||
|
|
||||||
m4_if(b4_prefix, [yy], [],
|
|
||||||
[[/* Substitute the variable and function names. */
|
|
||||||
#define yyparse ]b4_prefix[parse
|
|
||||||
#define yylex ]b4_prefix[lex
|
|
||||||
#define yyerror ]b4_prefix[error
|
|
||||||
#define yylval ]b4_prefix[lval
|
|
||||||
#define yychar ]b4_prefix[char
|
|
||||||
#define yydebug ]b4_prefix[debug
|
|
||||||
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
|
||||||
#define yylloc ]b4_prefix[lloc]])])[
|
|
||||||
|
|
||||||
]b4_epilogue[]dnl
|
]b4_epilogue[]dnl
|
||||||
b4_output_end()
|
dnl
|
||||||
|
dnl glr.cc produces its own header.
|
||||||
# glr.cc produces its own header.
|
dnl
|
||||||
m4_if(b4_skeleton, ["glr.c"],
|
m4_if(b4_skeleton, ["glr.c"],
|
||||||
[b4_defines_if(
|
[b4_defines_if(
|
||||||
[b4_output_begin([b4_spec_defines_file])
|
[@output(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-2012])[
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
]b4_shared_declarations[
|
]b4_shared_declarations[
|
||||||
]b4_cpp_guard_close([b4_spec_defines_file])[
|
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||||
]b4_output_end()
|
]])])
|
||||||
])])
|
m4_divert_pop(0)
|
||||||
|
|||||||
+82
-112
@@ -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-2012 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
|
||||||
@@ -43,11 +43,17 @@
|
|||||||
# user must initialize the first positions (in particular the
|
# user must initialize the first positions (in particular the
|
||||||
# filename member).
|
# filename member).
|
||||||
|
|
||||||
# We require a pure interface.
|
# We require a pure interface using locations.
|
||||||
|
m4_define([b4_percent_define(locations)], [])
|
||||||
m4_define([b4_pure_flag], [1])
|
m4_define([b4_pure_flag], [1])
|
||||||
|
|
||||||
|
# The header is mandatory.
|
||||||
|
b4_defines_if([],
|
||||||
|
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c++.m4])
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
b4_bison_locations_if([m4_include(b4_pkgdatadir/[location.cc])])
|
b4_percent_define_ifdef([[location_type]], [],
|
||||||
|
[m4_include(b4_pkgdatadir/[location.cc])])
|
||||||
|
|
||||||
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]])])
|
||||||
@@ -55,103 +61,69 @@ m4_define([b4_parser_class_name],
|
|||||||
# Save the parse parameters.
|
# Save the parse parameters.
|
||||||
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
||||||
|
|
||||||
# b4_parse_param_wrap
|
|
||||||
# -------------------
|
|
||||||
# New ones.
|
|
||||||
m4_ifset([b4_parse_param],
|
|
||||||
[m4_define([b4_parse_param_wrap],
|
|
||||||
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]],]
|
|
||||||
m4_defn([b4_parse_param]))],
|
|
||||||
[m4_define([b4_parse_param_wrap],
|
|
||||||
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]]])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
# b4_yy_symbol_print_generate
|
||||||
# b4_yy_symbol_print_define
|
# ---------------------------
|
||||||
# -------------------------
|
|
||||||
# Bypass the default implementation to generate the "yy_symbol_print"
|
# Bypass the default implementation to generate the "yy_symbol_print"
|
||||||
# and "yy_symbol_value_print" functions.
|
# and "yy_symbol_value_print" functions.
|
||||||
m4_define([b4_yy_symbol_print_define],
|
m4_define([b4_yy_symbol_print_generate],
|
||||||
[[
|
[[
|
||||||
/*--------------------.
|
/*--------------------.
|
||||||
| Print this symbol. |
|
| Print this symbol. |
|
||||||
`--------------------*/
|
`--------------------*/
|
||||||
|
|
||||||
]b4_function_define([yy_symbol_print],
|
]b4_c_ansi_function_def([yy_symbol_print],
|
||||||
[static void],
|
[static void],
|
||||||
[[FILE *], []],
|
[[FILE *], []],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
[[const ]b4_namespace_ref::b4_parser_class_name[::semantic_type *yyvaluep],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::semantic_type *yyvaluep],
|
||||||
[yyvaluep]][]dnl
|
[yyvaluep]],
|
||||||
b4_locations_if([,
|
|
||||||
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]]]),
|
[yylocationp]],
|
||||||
b4_parse_param)[
|
b4_parse_param)[
|
||||||
{
|
{
|
||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
||||||
}
|
}
|
||||||
]])[
|
]])
|
||||||
|
|
||||||
# Hijack the initial action to initialize the locations.
|
|
||||||
]b4_bison_locations_if([m4_define([b4_initial_action],
|
|
||||||
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
|
||||||
m4_defn([b4_initial_action])]))])[
|
|
||||||
|
|
||||||
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
||||||
# and declaration of yyerror.
|
# and declaration of yyerror.
|
||||||
]m4_append([b4_post_prologue],
|
m4_append([b4_post_prologue],
|
||||||
[b4_syncline([@oline@], [@ofile@])[
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
||||||
]b4_function_declare([yyerror],
|
]b4_c_ansi_function_decl([yyerror],
|
||||||
[static void],b4_locations_if([
|
[static void],
|
||||||
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]],])
|
[yylocationp]],
|
||||||
b4_parse_param,
|
b4_parse_param,
|
||||||
[[const char* msg], [msg]])])
|
[[const char* msg], [msg]])])
|
||||||
|
|
||||||
|
|
||||||
#undef yynerrs
|
|
||||||
#undef yychar
|
|
||||||
#undef yylval]b4_locations_if([
|
|
||||||
#undef yylloc])
|
|
||||||
|
|
||||||
m4_if(b4_prefix, [yy], [],
|
|
||||||
[[/* Substitute the variable and function names. */
|
|
||||||
#define yyparse ]b4_prefix[parse
|
|
||||||
#define yylex ]b4_prefix[lex
|
|
||||||
#define yyerror ]b4_prefix[error
|
|
||||||
#define yydebug ]b4_prefix[debug
|
|
||||||
]]b4_pure_if([], [[
|
|
||||||
#define yylval ]b4_prefix[lval
|
|
||||||
#define yychar ]b4_prefix[char
|
|
||||||
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
|
||||||
#define yylloc ]b4_prefix[lloc]])]))
|
|
||||||
|
|
||||||
# Hijack the epilogue to define implementations (yyerror, parser member
|
# Hijack the epilogue to define implementations (yyerror, parser member
|
||||||
# functions etc.).
|
# functions etc.).
|
||||||
m4_append([b4_epilogue],
|
m4_append([b4_epilogue],
|
||||||
[b4_syncline([@oline@], [@ofile@])[
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
|
|
||||||
/*------------------.
|
/*------------------.
|
||||||
| Report an error. |
|
| Report an error. |
|
||||||
`------------------*/
|
`------------------*/
|
||||||
|
|
||||||
]b4_function_define([yyerror],
|
]b4_c_ansi_function_def([yyerror],
|
||||||
[static void],b4_locations_if([
|
[static void],
|
||||||
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]],])
|
[yylocationp]],
|
||||||
b4_parse_param,
|
b4_parse_param,
|
||||||
[[const char* msg], [msg]])[
|
[[const char* msg], [msg]])[
|
||||||
{
|
{
|
||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
[ yyparser.error (]b4_locations_if([[*yylocationp, ]])[msg);
|
[ yyparser.error (*yylocationp, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
]dnl In this section, the parse params are the original parse_params.
|
]dnl In this section, the parse param are the original parse_params.
|
||||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||||
[ /// Build a parser object.
|
[ /// Build a parser object.
|
||||||
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||||
@@ -179,27 +151,32 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
|
|
||||||
inline void
|
inline void
|
||||||
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep,
|
||||||
const location_type* yylocationp]])[)
|
const location_type* yylocationp)
|
||||||
{]b4_locations_if([[
|
{
|
||||||
YYUSE (yylocationp);]])[
|
YYUSE (yylocationp);
|
||||||
YYUSE (yyvaluep);
|
YYUSE (yyvaluep);
|
||||||
std::ostream& yyoutput = debug_stream ();
|
std::ostream& yyoutput = debug_stream ();
|
||||||
std::ostream& yyo = yyoutput;
|
std::ostream& yyo = yyoutput;
|
||||||
YYUSE (yyo);
|
YYUSE (yyo);
|
||||||
]b4_symbol_actions([printer])[
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_printer])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yy_symbol_print_ (int yytype,
|
]b4_parser_class_name[::yy_symbol_print_ (int yytype,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep,
|
||||||
const location_type* yylocationp]])[)
|
const location_type* yylocationp)
|
||||||
{
|
{
|
||||||
*yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm")
|
*yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm")
|
||||||
<< ' ' << yytname[yytype] << " ("]b4_locations_if([[
|
<< ' ' << yytname[yytype] << " ("
|
||||||
<< *yylocationp << ": "]])[;
|
<< *yylocationp << ": ";
|
||||||
yy_symbol_value_print_ (yytype, yyvaluep]b4_locations_if([[, yylocationp]])[);
|
yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
|
||||||
*yycdebug_ << ')';
|
*yycdebug_ << ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,35 +202,46 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
void
|
void
|
||||||
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||||
{
|
{
|
||||||
// Actually, it is yydebug which is really used.
|
|
||||||
yydebug = l;
|
yydebug = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
]m4_popdef([b4_parse_param])dnl
|
]m4_popdef([b4_parse_param])dnl
|
||||||
b4_namespace_close
|
b4_namespace_close[
|
||||||
])
|
]])
|
||||||
|
|
||||||
# b4_shared_declarations
|
|
||||||
# ----------------------
|
# Let glr.c believe that the user arguments include the parser itself.
|
||||||
# Declaration that might either go into the header (if --defines)
|
m4_ifset([b4_parse_param],
|
||||||
# or open coded in the parser body.
|
[m4_pushdef([b4_parse_param],
|
||||||
m4_define([b4_shared_declarations],
|
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]],]
|
||||||
[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
m4_defn([b4_parse_param]))],
|
||||||
b4_percent_code_get([[requires]])[
|
[m4_pushdef([b4_parse_param],
|
||||||
|
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]]])
|
||||||
|
])
|
||||||
|
m4_include(b4_pkgdatadir/[glr.c])
|
||||||
|
m4_popdef([b4_parse_param])
|
||||||
|
|
||||||
|
m4_divert_push(0)
|
||||||
|
@output(b4_spec_defines_file@)@
|
||||||
|
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||||
|
[2002-2012])[
|
||||||
|
|
||||||
|
/* C++ GLR parser skeleton written by Akim Demaille. */
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
|
|
||||||
|
]b4_percent_code_get([[requires]])[
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>]b4_defines_if([
|
#include <iostream>
|
||||||
b4_bison_locations_if([[#include "location.hh"]])])[
|
]b4_percent_define_ifdef([[location_type]], [],
|
||||||
|
[[#include "location.hh"]])[
|
||||||
|
|
||||||
]b4_YYDEBUG_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
]b4_defines_if([],
|
|
||||||
[b4_bison_locations_if([b4_position_define
|
|
||||||
b4_location_define])])[
|
|
||||||
|
|
||||||
/// A Bison parser.
|
/// A Bison parser.
|
||||||
class ]b4_parser_class_name[
|
class ]b4_parser_class_name[
|
||||||
{
|
{
|
||||||
@@ -281,29 +269,29 @@ b4_location_define])])[
|
|||||||
void set_debug_level (debug_level_type l);
|
void set_debug_level (debug_level_type l);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Report a syntax error.]b4_locations_if([[
|
/// Report a syntax error.
|
||||||
/// \param loc where the syntax error is found.]])[
|
/// \param loc where the syntax error is found.
|
||||||
/// \param msg a description of the syntax error.
|
/// \param msg a description of the syntax error.
|
||||||
virtual void error (]b4_locations_if([[const location_type& loc, ]])[const std::string& msg);
|
virtual void error (const location_type& loc, const std::string& msg);
|
||||||
|
|
||||||
# if ]b4_api_PREFIX[DEBUG
|
# if ]b4_api_PREFIX[DEBUG
|
||||||
public:
|
public:
|
||||||
/// \brief Report a symbol value on the debug stream.
|
/// \brief Report a symbol value on the debug stream.
|
||||||
/// \param yytype The token type.
|
/// \param yytype The token type.
|
||||||
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
/// \param yyvaluep Its semantic value.
|
||||||
/// \param yylocationp Its location.]])[
|
/// \param yylocationp Its location.
|
||||||
virtual void yy_symbol_value_print_ (int yytype,
|
virtual void yy_symbol_value_print_ (int yytype,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep,
|
||||||
const location_type* yylocationp]])[);
|
const location_type* yylocationp);
|
||||||
/// \brief Report a symbol on the debug stream.
|
/// \brief Report a symbol on the debug stream.
|
||||||
/// \param yytype The token type.
|
/// \param yytype The token type.
|
||||||
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
/// \param yyvaluep Its semantic value.
|
||||||
/// \param yylocationp Its location.]])[
|
/// \param yylocationp Its location.
|
||||||
virtual void yy_symbol_print_ (int yytype,
|
virtual void yy_symbol_print_ (int yytype,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep,
|
||||||
const location_type* yylocationp]])[);
|
const location_type* yylocationp);
|
||||||
private:
|
private:
|
||||||
// Debugging.
|
/* Debugging. */
|
||||||
std::ostream* yycdebug_;
|
std::ostream* yycdebug_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -323,23 +311,5 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|||||||
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]m4_popdef([b4_parse_param])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
b4_defines_if(
|
|
||||||
[b4_output_begin([b4_spec_defines_file])
|
|
||||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|
||||||
[2002-2013])[
|
|
||||||
|
|
||||||
// C++ GLR parser skeleton written by Akim Demaille.
|
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
|
||||||
]b4_shared_declarations[
|
|
||||||
]b4_cpp_guard_close([b4_spec_defines_file])[
|
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||||
]b4_output_end()])
|
]m4_divert_pop(0)
|
||||||
|
|
||||||
# Let glr.c (and b4_shared_declarations) believe that the user
|
|
||||||
# arguments include the parser itself.
|
|
||||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_wrap]))
|
|
||||||
m4_include(b4_pkgdatadir/[glr.c])
|
|
||||||
m4_popdef([b4_parse_param])
|
|
||||||
|
|||||||
+1
-1
@@ -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-2012 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
-29
@@ -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-2012 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,11 +17,16 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c-like.m4])
|
|
||||||
|
# b4_comment(TEXT)
|
||||||
|
# ----------------
|
||||||
|
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
|
||||||
|
], [
|
||||||
|
]) */])
|
||||||
|
|
||||||
|
|
||||||
# b4_list2(LIST1, LIST2)
|
# b4_list2(LIST1, LIST2)
|
||||||
# ----------------------
|
# --------------------------
|
||||||
# Join two lists with a comma if necessary.
|
# Join two lists with a comma if necessary.
|
||||||
m4_define([b4_list2],
|
m4_define([b4_list2],
|
||||||
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
||||||
@@ -103,7 +108,7 @@ m4_define([b4_int_type],
|
|||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
# Return the smallest int type able to handle numbers ranging from
|
||||||
# 'NAME_min' to 'NAME_max' (included).
|
# `NAME_min' to `NAME_max' (included).
|
||||||
m4_define([b4_int_type_for],
|
m4_define([b4_int_type_for],
|
||||||
[b4_int_type($1_min, $1_max)])
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
@@ -169,28 +174,12 @@ m4_define([b4_predicate_case], [ case $1:
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
## -------- ##
|
|
||||||
## Checks. ##
|
|
||||||
## -------- ##
|
|
||||||
|
|
||||||
b4_percent_define_check_kind([[api.value.type]], [code], [deprecated])
|
|
||||||
|
|
||||||
b4_percent_define_check_kind([[annotations]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[extends]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[implements]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[init_throws]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[lex_throws]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[parser_class_name]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
m4_define([b4_yystype], [b4_percent_define_get([[api.value.type]])])
|
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
||||||
b4_percent_define_default([[api.value.type]], [[Object]])
|
b4_percent_define_default([[stype]], [[Object]])
|
||||||
|
|
||||||
# %name-prefix
|
# %name-prefix
|
||||||
m4_define_default([b4_prefix], [[YY]])
|
m4_define_default([b4_prefix], [[YY]])
|
||||||
@@ -207,11 +196,11 @@ m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
|||||||
b4_percent_define_default([[init_throws]], [])
|
b4_percent_define_default([[init_throws]], [])
|
||||||
m4_define([b4_init_throws], [b4_percent_define_get([[init_throws]])])
|
m4_define([b4_init_throws], [b4_percent_define_get([[init_throws]])])
|
||||||
|
|
||||||
b4_percent_define_default([[api.location.type]], [Location])
|
b4_percent_define_default([[location_type]], [Location])
|
||||||
m4_define([b4_location_type], [b4_percent_define_get([[api.location.type]])])
|
m4_define([b4_location_type], [b4_percent_define_get([[location_type]])])
|
||||||
|
|
||||||
b4_percent_define_default([[api.position.type]], [Position])
|
b4_percent_define_default([[position_type]], [Position])
|
||||||
m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
|
m4_define([b4_position_type], [b4_percent_define_get([[position_type]])])
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
@@ -271,7 +260,7 @@ m4_define([b4_lex_param_decl],
|
|||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
m4_define([b4_param_decls],
|
m4_define([b4_param_decls],
|
||||||
[m4_map([b4_param_decl], [$@])])
|
[m4_map_args([b4_param_decl], $@)])
|
||||||
m4_define([b4_param_decl], [, $1])
|
m4_define([b4_param_decl], [, $1])
|
||||||
|
|
||||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
||||||
@@ -298,7 +287,7 @@ m4_define([b4_lex_param_call],
|
|||||||
b4_param_calls(b4_lex_param))],
|
b4_param_calls(b4_lex_param))],
|
||||||
[$1])])
|
[$1])])
|
||||||
m4_define([b4_param_calls],
|
m4_define([b4_param_calls],
|
||||||
[m4_map([b4_param_call], [$@])])
|
[m4_map_args([b4_param_call], $@)])
|
||||||
m4_define([b4_param_call], [, $2])
|
m4_define([b4_param_call], [, $2])
|
||||||
|
|
||||||
|
|
||||||
@@ -311,7 +300,7 @@ m4_define([b4_parse_param_cons],
|
|||||||
[b4_constructor_calls(b4_parse_param)])])
|
[b4_constructor_calls(b4_parse_param)])])
|
||||||
|
|
||||||
m4_define([b4_constructor_calls],
|
m4_define([b4_constructor_calls],
|
||||||
[m4_map([b4_constructor_call], [$@])])
|
[m4_map_args([b4_constructor_call], $@)])
|
||||||
m4_define([b4_constructor_call],
|
m4_define([b4_constructor_call],
|
||||||
[this.$2 = $2;
|
[this.$2 = $2;
|
||||||
])
|
])
|
||||||
|
|||||||
+244
-295
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2012 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,21 +17,19 @@
|
|||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c++.m4])
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
|
|
||||||
# api.value.type=variant is valid.
|
|
||||||
m4_define([b4_value_type_setup_variant])
|
|
||||||
|
|
||||||
# b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
|
# b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Declare "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
|
# Declare "parser::yy<TABLE-NAME>_" which contents is CONTENT.
|
||||||
m4_define([b4_integral_parser_table_declare],
|
m4_define([b4_integral_parser_table_declare],
|
||||||
[m4_ifval([$3], [b4_comment([$3], [ ])
|
[m4_ifval([$3], [b4_c_comment([$3], [ ])
|
||||||
])dnl
|
])dnl
|
||||||
static const b4_int_type_for([$2]) yy$1_[[]];dnl
|
static const b4_int_type_for([$2]) yy$1_[[]];dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
# Define "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
|
# Define "parser::yy<TABLE-NAME>_" which contents is CONTENT.
|
||||||
m4_define([b4_integral_parser_table_define],
|
m4_define([b4_integral_parser_table_define],
|
||||||
[ const b4_int_type_for([$2])
|
[ const b4_int_type_for([$2])
|
||||||
b4_parser_class_name::yy$1_[[]] =
|
b4_parser_class_name::yy$1_[[]] =
|
||||||
@@ -40,14 +38,13 @@ m4_define([b4_integral_parser_table_define],
|
|||||||
};dnl
|
};dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, [TYPE])
|
# b4_symbol_value_template(VAL, [TYPE])
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Same as b4_symbol_value, but used in a template method. It makes
|
# Same as b4_symbol_value, but used in a template method. It makes
|
||||||
# a difference when using variants. Note that b4_value_type_setup_union
|
# a difference when using variants.
|
||||||
# overrides b4_symbol_value, so we must override it again.
|
|
||||||
m4_copy([b4_symbol_value], [b4_symbol_value_template])
|
m4_copy([b4_symbol_value], [b4_symbol_value_template])
|
||||||
m4_append([b4_value_type_setup_union],
|
|
||||||
[m4_copy_force([b4_symbol_value_union], [b4_symbol_value_template])])
|
|
||||||
|
|
||||||
# b4_lhs_value([TYPE])
|
# b4_lhs_value([TYPE])
|
||||||
# --------------------
|
# --------------------
|
||||||
@@ -101,73 +98,70 @@ m4_define([b4_rhs_location],
|
|||||||
# Same as in C, but using references instead of pointers.
|
# Same as in C, but using references instead of pointers.
|
||||||
m4_define([b4_symbol_action],
|
m4_define([b4_symbol_action],
|
||||||
[b4_symbol_if([$1], [has_$2],
|
[b4_symbol_if([$1], [has_$2],
|
||||||
[m4_pushdef([b4_symbol_value], m4_defn([b4_symbol_value_template]))[]dnl
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
b4_dollar_pushdef([yysym.value],
|
[b4_symbol_value_template([yysym.value],
|
||||||
b4_symbol_if([$1], [has_type],
|
b4_symbol_if([$1], [has_type],
|
||||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
[b4_symbol([$1], [type])]))])dnl
|
||||||
[yysym.location])dnl
|
m4_pushdef([b4_at_dollar], [yysym.location])dnl
|
||||||
b4_symbol_case_([$1])
|
b4_symbol_case_([$1])
|
||||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
||||||
b4_symbol([$1], [$2])
|
b4_symbol([$1], [$2])
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
m4_popdef([b4_symbol_value])[]dnl
|
m4_popdef([b4_at_dollar])dnl
|
||||||
b4_dollar_popdef[]dnl
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
# b4_lex
|
|
||||||
# ------
|
|
||||||
# Call yylex.
|
|
||||||
m4_define([b4_lex],
|
|
||||||
[b4_token_ctor_if(
|
|
||||||
[b4_function_call([yylex],
|
|
||||||
[symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))],
|
|
||||||
[b4_function_call([yylex], [int],
|
|
||||||
[b4_api_PREFIX[STYPE*], [&yyla.value]][]dnl
|
|
||||||
b4_locations_if([, [[location*], [&yyla.location]]])dnl
|
|
||||||
m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
|
|
||||||
|
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-2013])
|
[2002-2012])
|
||||||
|
|
||||||
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]])])
|
||||||
|
|
||||||
b4_bison_locations_if([# Backward compatibility.
|
# The header is mandatory.
|
||||||
|
b4_defines_if([],
|
||||||
|
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
||||||
|
|
||||||
|
b4_locations_if([b4_percent_define_ifdef([[location_type]], [],
|
||||||
|
[# Backward compatibility.
|
||||||
m4_define([b4_location_constructors])
|
m4_define([b4_location_constructors])
|
||||||
m4_include(b4_pkgdatadir/[location.cc])])
|
m4_include(b4_pkgdatadir/[location.cc])])])
|
||||||
m4_include(b4_pkgdatadir/[stack.hh])
|
m4_include(b4_pkgdatadir/[stack.hh])
|
||||||
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
|
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
|
||||||
|
|
||||||
# b4_shared_declarations
|
# We do want M4 expansion after # for CPP macros.
|
||||||
# ----------------------
|
m4_changecom()
|
||||||
# Declaration that might either go into the header (if --defines)
|
m4_divert_push(0)dnl
|
||||||
# or open coded in the parser body.
|
@output(b4_spec_defines_file@)@
|
||||||
m4_define([b4_shared_declarations],
|
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
|
||||||
[b4_percent_code_get([[requires]])[
|
[
|
||||||
|
/**
|
||||||
|
** \file ]b4_spec_defines_file[
|
||||||
|
** Define the ]b4_namespace_ref[::parser class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* C++ LALR(1) parser skeleton written by Akim Demaille. */
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
|
]b4_percent_code_get([[requires]])[
|
||||||
]b4_parse_assert_if([# include <cassert>])[
|
]b4_parse_assert_if([# include <cassert>])[
|
||||||
# include <vector>
|
|
||||||
# include <iostream>
|
|
||||||
# include <stdexcept>
|
# include <stdexcept>
|
||||||
# include <string>]b4_defines_if([[
|
# include <string>
|
||||||
|
# include <iostream>
|
||||||
# include "stack.hh"
|
# include "stack.hh"
|
||||||
]b4_bison_locations_if([[# include "location.hh"]])])[
|
]b4_locations_if([b4_percent_define_ifdef([[location_type]], [],
|
||||||
]b4_variant_if([b4_variant_includes])[
|
[[# include "location.hh"]])])[
|
||||||
|
|
||||||
|
]b4_variant_if([b4_namespace_open
|
||||||
|
b4_variant_define
|
||||||
|
b4_namespace_close])[
|
||||||
|
|
||||||
]b4_YYDEBUG_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
|
|
||||||
]b4_defines_if([],
|
|
||||||
[b4_stack_define
|
|
||||||
b4_bison_locations_if([b4_position_define
|
|
||||||
b4_location_define])])[
|
|
||||||
|
|
||||||
]b4_variant_if([b4_variant_define])[
|
|
||||||
|
|
||||||
/// A Bison parser.
|
/// A Bison parser.
|
||||||
class ]b4_parser_class_name[
|
class ]b4_parser_class_name[
|
||||||
{
|
{
|
||||||
@@ -195,27 +189,22 @@ b4_location_define])])[
|
|||||||
void set_debug_level (debug_level_type l);
|
void set_debug_level (debug_level_type l);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Report a syntax error.]b4_locations_if([[
|
/// Report a syntax error.]b4_locations_if([
|
||||||
/// \param loc where the syntax error is found.]])[
|
/// \param loc where the syntax error is found.])[
|
||||||
/// \param msg a description of the syntax error.
|
/// \param msg a description of the syntax error.
|
||||||
virtual void error (]b4_locations_if([[const location_type& loc, ]])[const std::string& msg);
|
virtual void error (]b4_locations_if([const location_type& loc, ])[const std::string& msg);
|
||||||
|
|
||||||
/// Report a syntax error.
|
/// Report a syntax error.
|
||||||
void error (const syntax_error& err);
|
void error (const syntax_error& err);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// This class is not copyable.
|
|
||||||
]b4_parser_class_name[ (const ]b4_parser_class_name[&);
|
|
||||||
]b4_parser_class_name[& operator= (const ]b4_parser_class_name[&);
|
|
||||||
|
|
||||||
/// State numbers.
|
/// State numbers.
|
||||||
typedef int state_type;
|
typedef int state_type;
|
||||||
|
|
||||||
/// 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 yytoken the lookahead token.
|
||||||
virtual std::string yysyntax_error_ (state_type yystate,
|
virtual std::string yysyntax_error_ (state_type yystate, int yytoken);
|
||||||
symbol_number_type yytoken) const;
|
|
||||||
|
|
||||||
/// Compute post-reduction state.
|
/// Compute post-reduction state.
|
||||||
/// \param yystate the current state
|
/// \param yystate the current state
|
||||||
@@ -230,12 +219,11 @@ b4_location_define])])[
|
|||||||
/// \param yyvalue the value to check
|
/// \param yyvalue the value to check
|
||||||
static bool yy_table_value_is_error_ (int yyvalue);
|
static bool yy_table_value_is_error_ (int yyvalue);
|
||||||
|
|
||||||
|
/// Internal symbol numbers.
|
||||||
|
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
||||||
static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
|
static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
|
||||||
static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
|
static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
|
||||||
|
|
||||||
/// Convert a scanner token number \a t to a symbol number.
|
|
||||||
static token_number_type yytranslate_ (]b4_token_ctor_if([token_type], [int])[ t);
|
|
||||||
|
|
||||||
// Tables.
|
// Tables.
|
||||||
]b4_parser_tables_declare[]b4_error_verbose_if([
|
]b4_parser_tables_declare[]b4_error_verbose_if([
|
||||||
|
|
||||||
@@ -247,7 +235,7 @@ b4_location_define])])[
|
|||||||
static const char* const yytname_[];
|
static const char* const yytname_[];
|
||||||
]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[
|
]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[
|
||||||
]b4_integral_parser_table_declare([rline], [b4_rline],
|
]b4_integral_parser_table_declare([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 \a r is going to be reduced.
|
/// Report on the debug stream that the rule \a r is going to be reduced.
|
||||||
virtual void yy_reduce_print_ (int r);
|
virtual void yy_reduce_print_ (int r);
|
||||||
/// Print the state stack on the debug stream.
|
/// Print the state stack on the debug stream.
|
||||||
@@ -256,61 +244,48 @@ b4_location_define])])[
|
|||||||
// Debugging.
|
// Debugging.
|
||||||
int yydebug_;
|
int yydebug_;
|
||||||
std::ostream* yycdebug_;
|
std::ostream* yycdebug_;
|
||||||
|
#endif // ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
|
/// Convert a scanner token number \a t to a symbol number.
|
||||||
|
static inline token_number_type yytranslate_ (]b4_lex_symbol_if([token_type], [int])[ t);
|
||||||
|
|
||||||
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/// \brief Display a symbol type, value and location.
|
/// \brief Display a symbol type, value and location.
|
||||||
/// \param yyo The output stream.
|
/// \param yyo The output stream.
|
||||||
/// \param yysym The symbol.
|
/// \param yysym The symbol.
|
||||||
template <typename Base>
|
template <typename Exact>
|
||||||
void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
|
void yy_print_ (std::ostream& yyo,
|
||||||
|
const symbol_base_type<Exact>& yysym) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// \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 s The symbol.
|
||||||
template <typename Base>
|
template <typename Exact>
|
||||||
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
|
inline void yy_destroy_ (const char* yymsg,
|
||||||
|
symbol_base_type<Exact>& yysym) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Type access provider for state based symbols.
|
/// Element of the stack: a state and its attributes.
|
||||||
struct by_state
|
struct stack_symbol_type : symbol_base_type<stack_symbol_type>
|
||||||
{
|
{
|
||||||
/// Default constructor.
|
/// The parent class.
|
||||||
by_state ();
|
typedef symbol_base_type<stack_symbol_type> super_type;
|
||||||
|
|
||||||
/// The symbol type as needed by the constructor.
|
/// Default constructor.
|
||||||
typedef state_type kind_type;
|
inline stack_symbol_type ();
|
||||||
|
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
by_state (kind_type s);
|
inline stack_symbol_type (]b4_args([state_type s],
|
||||||
|
[const semantic_type& v],
|
||||||
/// Copy constructor.
|
b4_locations_if([const location_type& l]))[);
|
||||||
by_state (const by_state& other);
|
|
||||||
|
|
||||||
/// Steal the symbol type from \a that.
|
|
||||||
void move (by_state& that);
|
|
||||||
|
|
||||||
/// The (internal) type number (corresponding to \a state).
|
|
||||||
/// "empty" when empty.
|
|
||||||
symbol_number_type type_get () const;
|
|
||||||
|
|
||||||
enum { empty = 0 };
|
|
||||||
|
|
||||||
/// The state.
|
/// The state.
|
||||||
state_type state;
|
state_type state;
|
||||||
};
|
|
||||||
|
|
||||||
/// "Internal" symbol: element of the stack.
|
/// The type (corresponding to \a state).
|
||||||
struct stack_symbol_type : basic_symbol<by_state>
|
inline int type_get_ () const;
|
||||||
{
|
|
||||||
/// Superclass.
|
|
||||||
typedef basic_symbol<by_state> super_type;
|
|
||||||
/// Construct an empty symbol.
|
|
||||||
stack_symbol_type ();
|
|
||||||
/// Steal the contents from \a sym to build this.
|
|
||||||
stack_symbol_type (state_type s, symbol_type& sym);
|
|
||||||
/// Assignment, needed by push_back.
|
|
||||||
stack_symbol_type& operator= (const stack_symbol_type& that);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Stack type.
|
/// Stack type.
|
||||||
@@ -324,7 +299,7 @@ b4_location_define])])[
|
|||||||
/// if null, no trace is output.
|
/// if null, no trace is output.
|
||||||
/// \param s the symbol
|
/// \param s the symbol
|
||||||
/// \warning the contents of \a s.value is stolen.
|
/// \warning the contents of \a s.value is stolen.
|
||||||
void yypush_ (const char* m, stack_symbol_type& s);
|
inline void yypush_ (const char* m, stack_symbol_type& s);
|
||||||
|
|
||||||
/// Push a new look ahead token on the state on the stack.
|
/// Push a new look ahead token on the state on the stack.
|
||||||
/// \param m a debug message to display
|
/// \param m a debug message to display
|
||||||
@@ -332,12 +307,12 @@ b4_location_define])])[
|
|||||||
/// \param s the state
|
/// \param s the state
|
||||||
/// \param sym the symbol (for its value and location).
|
/// \param sym the symbol (for its value and location).
|
||||||
/// \warning the contents of \a s.value is stolen.
|
/// \warning the contents of \a s.value is stolen.
|
||||||
void yypush_ (const char* m, state_type s, symbol_type& sym);
|
inline void yypush_ (const char* m, state_type s, symbol_type& sym);
|
||||||
|
|
||||||
/// Pop \a n symbols the three stacks.
|
/// Pop \a n symbols the three stacks.
|
||||||
void yypop_ (unsigned int n = 1);
|
inline void yypop_ (unsigned int n = 1);
|
||||||
|
|
||||||
// Constants.
|
/* Constants. */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
yyeof_ = 0,
|
yyeof_ = 0,
|
||||||
@@ -353,7 +328,7 @@ b4_location_define])])[
|
|||||||
]b4_parse_param_vars[
|
]b4_parse_param_vars[
|
||||||
};
|
};
|
||||||
|
|
||||||
]b4_token_ctor_if([b4_yytranslate_define
|
]b4_lex_symbol_if([b4_yytranslate_define
|
||||||
b4_public_types_define])[
|
b4_public_types_define])[
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
@@ -361,32 +336,13 @@ b4_public_types_define])[
|
|||||||
[b4_token_defines
|
[b4_token_defines
|
||||||
|
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
#ifndef ]b4_api_PREFIX[STYPE
|
||||||
// Redirection for backward compatibility.
|
/* Redirection for backward compatibility. */
|
||||||
# define ]b4_api_PREFIX[STYPE b4_namespace_ref::b4_parser_class_name::semantic_type
|
# define ]b4_api_PREFIX[STYPE b4_namespace_ref::b4_parser_class_name::semantic_type
|
||||||
#endif
|
#endif
|
||||||
])[
|
])[
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]])
|
|
||||||
|
|
||||||
b4_defines_if(
|
|
||||||
[b4_output_begin([b4_spec_defines_file])
|
|
||||||
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
|
|
||||||
[
|
|
||||||
/**
|
|
||||||
** \file ]b4_spec_defines_file[
|
|
||||||
** Define the ]b4_namespace_ref[::parser class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// C++ LALR(1) parser skeleton written by Akim Demaille.
|
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
|
||||||
]b4_shared_declarations[
|
|
||||||
]b4_cpp_guard_close([b4_spec_defines_file])
|
]b4_cpp_guard_close([b4_spec_defines_file])
|
||||||
b4_output_end()
|
@output(b4_parser_file_name@)@
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
b4_output_begin([b4_parser_file_name])
|
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])
|
||||||
b4_percent_code_get([[top]])[]dnl
|
b4_percent_code_get([[top]])[]dnl
|
||||||
m4_if(b4_prefix, [yy], [],
|
m4_if(b4_prefix, [yy], [],
|
||||||
@@ -394,22 +350,21 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
// Take the name prefix into account.
|
// Take the name prefix into account.
|
||||||
#define yylex b4_prefix[]lex])[
|
#define yylex b4_prefix[]lex])[
|
||||||
|
|
||||||
// First part of user declarations.
|
/* First part of user declarations. */
|
||||||
]b4_user_pre_prologue[
|
]b4_user_pre_prologue[
|
||||||
|
|
||||||
]b4_null_define[
|
#include "@basename(]b4_spec_defines_file[@)"
|
||||||
|
|
||||||
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
/* User implementation prologue. */
|
||||||
[b4_shared_declarations])[
|
|
||||||
|
|
||||||
// User implementation prologue.
|
|
||||||
]b4_user_post_prologue[
|
]b4_user_post_prologue[
|
||||||
]b4_percent_code_get[
|
]b4_percent_code_get[
|
||||||
|
|
||||||
|
]b4_null_define[
|
||||||
|
|
||||||
#ifndef YY_
|
#ifndef YY_
|
||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||||
# if ENABLE_NLS
|
# if ENABLE_NLS
|
||||||
# include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE.
|
# include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
|
||||||
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@@ -422,13 +377,13 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
[#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
|
[#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
|
||||||
]b4_yylloc_default_define])[
|
]b4_yylloc_default_define])[
|
||||||
|
|
||||||
// Suppress unused-variable warnings by "using" E.
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
#define YYUSE(E) ((void) (E))
|
#define YYUSE(e) ((void) (e))
|
||||||
|
|
||||||
// Enable debugging if requested.
|
/* Enable debugging if requested. */
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
// A pseudo ostream that takes yydebug_ into account.
|
/* A pseudo ostream that takes yydebug_ into account. */
|
||||||
# define YYCDEBUG if (yydebug_) (*yycdebug_)
|
# define YYCDEBUG if (yydebug_) (*yycdebug_)
|
||||||
|
|
||||||
# define YY_SYMBOL_PRINT(Title, Symbol) \
|
# define YY_SYMBOL_PRINT(Title, Symbol) \
|
||||||
@@ -453,14 +408,14 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
yystack_print_ (); \
|
yystack_print_ (); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
#else // !]b4_api_PREFIX[DEBUG
|
#else /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
# define YYCDEBUG if (false) std::cerr
|
# define YYCDEBUG if (false) std::cerr
|
||||||
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol)
|
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol)
|
||||||
# define YY_REDUCE_PRINT(Rule) static_cast<void>(0)
|
# define YY_REDUCE_PRINT(Rule) static_cast<void>(0)
|
||||||
# define YY_STACK_PRINT() static_cast<void>(0)
|
# define YY_STACK_PRINT() static_cast<void>(0)
|
||||||
|
|
||||||
#endif // !]b4_api_PREFIX[DEBUG
|
#endif /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
#define yyerrok (yyerrstatus_ = 0)
|
#define yyerrok (yyerrstatus_ = 0)
|
||||||
#define yyclearin (yyempty = true)
|
#define yyclearin (yyempty = true)
|
||||||
@@ -495,7 +450,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
case '\\':
|
case '\\':
|
||||||
if (*++yyp != '\\')
|
if (*++yyp != '\\')
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
// Fall through.
|
/* Fall through. */
|
||||||
default:
|
default:
|
||||||
yyr += *yyp;
|
yyr += *yyp;
|
||||||
break;
|
break;
|
||||||
@@ -517,125 +472,120 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
||||||
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||||
#endif]b4_parse_param_cons[
|
#endif]b4_parse_param_cons[
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
]b4_parser_class_name::~b4_parser_class_name[ ()
|
]b4_parser_class_name::~b4_parser_class_name[ ()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*---------------.
|
/*---------------.
|
||||||
| Symbol types. |
|
| Symbol types. |
|
||||||
`---------------*/
|
`---------------*/
|
||||||
|
|
||||||
]b4_token_ctor_if([], [b4_public_types_define])[
|
]b4_lex_symbol_if([], [b4_public_types_define])[
|
||||||
|
|
||||||
// by_state.
|
// stack_symbol_type.
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::by_state::by_state ()
|
|
||||||
: state (empty)
|
|
||||||
{}
|
|
||||||
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::by_state::by_state (const by_state& other)
|
|
||||||
: state (other.state)
|
|
||||||
{}
|
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
]b4_parser_class_name[::by_state::move (by_state& that)
|
|
||||||
{
|
|
||||||
state = that.state;
|
|
||||||
that.state = empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::by_state::by_state (state_type s)
|
|
||||||
: state (s)
|
|
||||||
{}
|
|
||||||
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::symbol_number_type
|
|
||||||
]b4_parser_class_name[::by_state::type_get () const
|
|
||||||
{
|
|
||||||
return state == empty ? 0 : yystos_[state];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
|
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
|
||||||
{}
|
: super_type ()
|
||||||
|
, state ()
|
||||||
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
|
|
||||||
: super_type (s]b4_locations_if([, that.location])[)
|
|
||||||
{
|
{
|
||||||
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
|
||||||
[value], [move], [that.value])],
|
|
||||||
[[value = that.value;]])[
|
|
||||||
// that is emptied.
|
|
||||||
that.type = empty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (]b4_args(
|
||||||
]b4_parser_class_name[::stack_symbol_type&
|
[state_type s],
|
||||||
]b4_parser_class_name[::stack_symbol_type::operator= (const stack_symbol_type& that)
|
[const semantic_type& v],
|
||||||
|
b4_locations_if([const location_type& l]))[)
|
||||||
|
: super_type (v]b4_locations_if([, l])[)
|
||||||
|
, state (s)
|
||||||
{
|
{
|
||||||
state = that.state;
|
}
|
||||||
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
|
||||||
[value], [copy], [that.value])],
|
int
|
||||||
[[value = that.value;]])[]b4_locations_if([
|
]b4_parser_class_name[::stack_symbol_type::type_get_ () const
|
||||||
location = that.location;])[
|
{
|
||||||
return *this;
|
return yystos_[state];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Exact>
|
||||||
inline
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
|
]b4_parser_class_name[::yy_destroy_ (const char* yymsg,
|
||||||
|
symbol_base_type<Exact>& yysym) const
|
||||||
{
|
{
|
||||||
if (yymsg)
|
if (yymsg)
|
||||||
YY_SYMBOL_PRINT (yymsg, yysym);]b4_variant_if([], [
|
YY_SYMBOL_PRINT (yymsg, yysym);
|
||||||
|
|
||||||
// User destructor.
|
// User destructor.
|
||||||
b4_symbol_actions([destructor], [yysym.type_get ()])])[
|
int yytype = yysym.type_get ();
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}]b4_variant_if([
|
||||||
|
|
||||||
|
// Type destructor.
|
||||||
|
b4_symbol_variant([[yytype]], [[yysym.value]], [[template destroy]])])[
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
template <typename Base>
|
template <typename Exact>
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yy_print_ (std::ostream& yyo,
|
]b4_parser_class_name[::yy_print_ (std::ostream& yyo,
|
||||||
const basic_symbol<Base>& yysym) const
|
const symbol_base_type<Exact>& yysym) const
|
||||||
{
|
{
|
||||||
std::ostream& yyoutput = yyo;
|
std::ostream& yyoutput = yyo;
|
||||||
YYUSE (yyoutput);
|
YYUSE (yyoutput);
|
||||||
symbol_number_type yytype = yysym.type_get ();
|
int yytype = yysym.type_get ();
|
||||||
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
||||||
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
||||||
<< yysym.location << ": "])[;
|
<< yysym.location << ": "])[;
|
||||||
]b4_symbol_actions([printer])[
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_printer])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
yyo << ')';
|
yyo << ')';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym)
|
]b4_parser_class_name[::yypush_ (const char* m, state_type s,
|
||||||
|
symbol_type& sym)
|
||||||
{
|
{
|
||||||
stack_symbol_type t (s, sym);
|
if (m)
|
||||||
yypush_ (m, t);
|
YY_SYMBOL_PRINT (m, sym);
|
||||||
|
]b4_variant_if(
|
||||||
|
[[ yystack_.push (stack_symbol_type (]b4_args(
|
||||||
|
[s],
|
||||||
|
[semantic_type()],
|
||||||
|
b4_locations_if([sym.location]))[));
|
||||||
|
]b4_symbol_variant([[yystos_[s]]], [[yystack_[0].value]],
|
||||||
|
[build], [sym.value])],
|
||||||
|
[[ yystack_.push (stack_symbol_type (]b4_args(
|
||||||
|
[s],
|
||||||
|
[sym.value],
|
||||||
|
b4_locations_if([sym.location]))[));]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s)
|
]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s)
|
||||||
{
|
{
|
||||||
if (m)
|
if (m)
|
||||||
YY_SYMBOL_PRINT (m, s);
|
YY_SYMBOL_PRINT (m, s);
|
||||||
yystack_.push (s);
|
]b4_variant_if(
|
||||||
|
[[ yystack_.push (stack_symbol_type (]b4_args(
|
||||||
|
[s.state],
|
||||||
|
[semantic_type()],
|
||||||
|
b4_locations_if([s.location]))[));
|
||||||
|
]b4_symbol_variant([[yystos_[s.state]]], [[yystack_[0].value]],
|
||||||
|
[build], [s.value])],
|
||||||
|
[ yystack_.push (s);])[
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yypop_ (unsigned int n)
|
]b4_parser_class_name[::yypop_ (unsigned int n)
|
||||||
{
|
{
|
||||||
@@ -697,11 +647,11 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
/// Whether yyla contains a lookahead.
|
/// Whether yyla contains a lookahead.
|
||||||
bool yyempty = true;
|
bool yyempty = true;
|
||||||
|
|
||||||
// State.
|
/* State. */
|
||||||
int yyn;
|
int yyn;
|
||||||
int yylen = 0;
|
int yylen = 0;
|
||||||
|
|
||||||
// Error handling.
|
/* Error handling. */
|
||||||
int yynerrs_ = 0;
|
int yynerrs_ = 0;
|
||||||
int yyerrstatus_ = 0;
|
int yyerrstatus_ = 0;
|
||||||
|
|
||||||
@@ -717,69 +667,71 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
/// The return value of parse ().
|
/// The return value of parse ().
|
||||||
int yyresult;
|
int yyresult;
|
||||||
|
|
||||||
// FIXME: This shoud be completely indented. It is not yet to
|
|
||||||
// avoid gratuitous conflicts when merging into the master branch.
|
|
||||||
try
|
|
||||||
{
|
|
||||||
YYCDEBUG << "Starting parse" << std::endl;
|
YYCDEBUG << "Starting parse" << std::endl;
|
||||||
|
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl
|
m4_pushdef([b4_at_dollar], [yyla.location])dnl
|
||||||
// User initialization code.
|
m4_pushdef([b4_dollar_dollar], [yyla.value])dnl
|
||||||
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef])[]dnl
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
|
m4_popdef([b4_at_dollar])])dnl
|
||||||
|
|
||||||
[ /* Initialize the stack. The initial state will be set in
|
[ /* Initialize the stack. The initial state will be set in
|
||||||
yynewstate, since the latter expects the semantical and the
|
yynewstate, since the latter expects the semantical and the
|
||||||
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_ = stack_type (0);
|
||||||
yypush_ (YY_NULL, 0, yyla);
|
yypush_ (YY_NULL, 0, yyla);
|
||||||
|
|
||||||
// A new symbol was pushed on the stack.
|
// A new symbol was pushed on the stack.
|
||||||
yynewstate:
|
yynewstate:
|
||||||
YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;
|
YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;
|
||||||
|
|
||||||
// Accept?
|
/* Accept? */
|
||||||
if (yystack_[0].state == yyfinal_)
|
if (yystack_[0].state == yyfinal_)
|
||||||
goto yyacceptlab;
|
goto yyacceptlab;
|
||||||
|
|
||||||
goto yybackup;
|
goto yybackup;
|
||||||
|
|
||||||
// Backup.
|
/* Backup. */
|
||||||
yybackup:
|
yybackup:
|
||||||
|
|
||||||
// Try to take a decision without lookahead.
|
/* Try to take a decision without lookahead. */
|
||||||
yyn = yypact_[yystack_[0].state];
|
yyn = yypact_[yystack_[0].state];
|
||||||
if (yy_pact_value_is_default_ (yyn))
|
if (yy_pact_value_is_default_ (yyn))
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
|
|
||||||
// Read a lookahead token.
|
/* Read a lookahead token. */
|
||||||
if (yyempty)
|
if (yyempty)
|
||||||
{
|
{
|
||||||
YYCDEBUG << "Reading a token: ";
|
YYCDEBUG << "Reading a token: ";
|
||||||
try
|
try
|
||||||
{]b4_token_ctor_if([[
|
{
|
||||||
symbol_type yylookahead (]b4_lex[);
|
]b4_lex_symbol_if(
|
||||||
yyla.move (yylookahead);]], [[
|
[ yyla = b4_c_function_call([yylex], [symbol_type],
|
||||||
yyla.type = yytranslate_ (]b4_lex[);]])[
|
m4_ifdef([b4_lex_param], b4_lex_param));],
|
||||||
}
|
[ yyla.type = yytranslate_ (b4_c_function_call([yylex], [int],
|
||||||
|
[b4_api_PREFIX[STYPE*], [&yyla.value]][]dnl
|
||||||
|
b4_locations_if([, [[location*], [&yyla.location]]])dnl
|
||||||
|
m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
|
||||||
|
}
|
||||||
catch (const syntax_error& yyexc)
|
catch (const syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
error (yyexc);
|
error (yyexc);
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
}
|
}
|
||||||
yyempty = false;
|
yyempty = false;
|
||||||
}
|
}
|
||||||
YY_SYMBOL_PRINT ("Next token is", yyla);
|
YY_SYMBOL_PRINT ("Next token is", yyla);
|
||||||
|
|
||||||
/* If the proper action on seeing token YYLA.TYPE is to reduce or
|
/* If the proper action on seeing token YYLA.TYPE is to reduce or
|
||||||
to detect an error, take that action. */
|
to detect an error, take that action. */
|
||||||
yyn += yyla.type_get ();
|
yyn += yyla.type;
|
||||||
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ())
|
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type)
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
|
|
||||||
// Reduce or error.
|
/* Reduce or error. */
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (yyn <= 0)
|
if (yyn <= 0)
|
||||||
{
|
{
|
||||||
@@ -789,14 +741,15 @@ b4_dollar_popdef])[]dnl
|
|||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discard the token being shifted.
|
/* Discard the token being shifted. */
|
||||||
yyempty = true;
|
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_;
|
||||||
|
|
||||||
// Shift the lookahead token.
|
/* Shift the lookahead token. */
|
||||||
yypush_ ("Shifting", yyn, yyla);
|
yypush_ ("Shifting", yyn, yyla);
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
@@ -820,7 +773,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
variants. */
|
variants. */
|
||||||
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])],[
|
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])],[
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
'$$ = $1'. Otherwise, use the top of the stack.
|
`$$ = $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
|
||||||
@@ -840,25 +793,40 @@ b4_dollar_popdef])[]dnl
|
|||||||
// Perform the reduction.
|
// Perform the reduction.
|
||||||
YY_REDUCE_PRINT (yyn);
|
YY_REDUCE_PRINT (yyn);
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
switch (yyn)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
]b4_variant_if([[
|
||||||
|
// Destroy the rhs symbols.
|
||||||
|
for (int i = 0; i < yylen; ++i)
|
||||||
|
// Destroy a variant which value may have been swapped with
|
||||||
|
// yylhs.value (for instance if the action was "std::swap($$,
|
||||||
|
// $1)"). The value of yylhs.value (hence possibly one of these
|
||||||
|
// rhs symbols) depends on the default construction for this
|
||||||
|
// type. In the case of pointers for instance, no
|
||||||
|
// initialization is done, so the value is junk. Therefore do
|
||||||
|
// not try to report the value of symbols about to be destroyed
|
||||||
|
// in the debug trace, it's possibly junk. Hence yymsg = 0.
|
||||||
|
// Besides, that keeps exactly the same traces as with the other
|
||||||
|
// Bison skeletons.
|
||||||
|
yy_destroy_ (YY_NULL, yystack_[i]);]])[
|
||||||
|
|
||||||
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_NULL, yylhs);
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
@@ -866,13 +834,13 @@ b4_dollar_popdef])[]dnl
|
|||||||
| yyerrlab -- here on detecting error. |
|
| yyerrlab -- here on detecting error. |
|
||||||
`--------------------------------------*/
|
`--------------------------------------*/
|
||||||
yyerrlab:
|
yyerrlab:
|
||||||
// If not already recovering from an error, report this error.
|
/* If not already recovering from an error, report this error. */
|
||||||
if (!yyerrstatus_)
|
if (!yyerrstatus_)
|
||||||
{
|
{
|
||||||
++yynerrs_;
|
++yynerrs_;
|
||||||
error (]b4_join(b4_locations_if([yyla.location]),
|
error (]b4_args(b4_locations_if([yyla.location]),
|
||||||
[[yysyntax_error_ (yystack_[0].state,
|
[[yysyntax_error_ (yystack_[0].state,
|
||||||
yyempty ? yyempty_ : yyla.type_get ())]])[);
|
yyempty ? yyempty_ : yyla.type)]])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
@@ -882,8 +850,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
/* If just tried and failed to reuse lookahead token after an
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
error, discard it. */
|
error, discard it. */
|
||||||
|
|
||||||
// Return failure if at end of input.
|
/* Return failure if at end of input. */
|
||||||
if (yyla.type_get () == yyeof_)
|
if (yyla.type == yyeof_)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
else if (!yyempty)
|
else if (!yyempty)
|
||||||
{
|
{
|
||||||
@@ -892,7 +860,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Else will try to reuse lookahead token after shifting the error token.
|
/* Else will try to reuse lookahead token after shifting the error
|
||||||
|
token. */
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
|
|
||||||
|
|
||||||
@@ -908,9 +877,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
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;]])b4_variant_if([[
|
||||||
/* $$ was initialized before running the user action. */
|
/* $$ was initialized before running the user action. */
|
||||||
YY_SYMBOL_PRINT ("Error: discarding", yylhs);
|
yy_destroy_ ("Error: discarding", yylhs);]])[
|
||||||
yylhs.~stack_symbol_type();]])[
|
/* Do not reclaim the symbols of the rule which action triggered
|
||||||
/* Do not reclaim the symbols of the rule whose action triggered
|
|
||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
@@ -920,7 +888,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
||||||
`-------------------------------------------------------------*/
|
`-------------------------------------------------------------*/
|
||||||
yyerrlab1:
|
yyerrlab1:
|
||||||
yyerrstatus_ = 3; // Each real token shifted decrements this.
|
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
||||||
{
|
{
|
||||||
stack_symbol_type error_token;
|
stack_symbol_type error_token;
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -950,18 +918,18 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyerror_range[2].location = yyla.location;
|
yyerror_range[2].location = yyla.location;
|
||||||
YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);]])[
|
YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);]])[
|
||||||
|
|
||||||
// Shift the error token.
|
/* Shift the error token. */
|
||||||
error_token.state = yyn;
|
error_token.state = yyn;
|
||||||
yypush_ ("Shifting", error_token);
|
yypush_ ("Shifting", error_token);
|
||||||
}
|
}
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
// Accept.
|
/* Accept. */
|
||||||
yyacceptlab:
|
yyacceptlab:
|
||||||
yyresult = 0;
|
yyresult = 0;
|
||||||
goto yyreturn;
|
goto yyreturn;
|
||||||
|
|
||||||
// Abort.
|
/* Abort. */
|
||||||
yyabortlab:
|
yyabortlab:
|
||||||
yyresult = 1;
|
yyresult = 1;
|
||||||
goto yyreturn;
|
goto yyreturn;
|
||||||
@@ -970,10 +938,10 @@ b4_dollar_popdef])[]dnl
|
|||||||
if (!yyempty)
|
if (!yyempty)
|
||||||
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 which action triggered
|
||||||
this YYABORT or YYACCEPT. */
|
this YYABORT or YYACCEPT. */
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
while (1 < yystack_.size ())
|
while (yystack_.size () != 1)
|
||||||
{
|
{
|
||||||
yy_destroy_ ("Cleanup: popping", yystack_[0]);
|
yy_destroy_ ("Cleanup: popping", yystack_[0]);
|
||||||
yypop_ ();
|
yypop_ ();
|
||||||
@@ -981,36 +949,19 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
return yyresult;
|
return yyresult;
|
||||||
}
|
}
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
YYCDEBUG << "Exception caught: cleaning lookahead and stack"
|
|
||||||
<< std::endl;
|
|
||||||
// Do not try to display the values of the reclaimed symbols,
|
|
||||||
// as their printer might throw an exception.
|
|
||||||
if (!yyempty)
|
|
||||||
yy_destroy_ (YY_NULL, yyla);
|
|
||||||
|
|
||||||
while (1 < yystack_.size ())
|
|
||||||
{
|
|
||||||
yy_destroy_ (YY_NULL, yystack_[0]);
|
|
||||||
yypop_ ();
|
|
||||||
}
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::error (const syntax_error& yyexc)
|
]b4_parser_class_name[::error (const syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
error (]b4_join(b4_locations_if([yyexc.location]),
|
error (]b4_args(b4_locations_if([yyexc.location]),
|
||||||
[[yyexc.what()]])[);
|
[[yyexc.what()]])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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, int yytoken],
|
||||||
[state_type, symbol_number_type])[) const
|
[int, int])[)
|
||||||
{]b4_error_verbose_if([[
|
{]b4_error_verbose_if([[
|
||||||
std::string yyres;
|
std::string yyres;
|
||||||
// Number of reported tokens (one for the "unexpected", one per
|
// Number of reported tokens (one for the "unexpected", one per
|
||||||
@@ -1056,7 +1007,7 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
|
|||||||
YYCHECK. In other words, skip the first -YYN actions for
|
YYCHECK. In other words, skip the first -YYN actions for
|
||||||
this state because they are default actions. */
|
this state because they are default actions. */
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
// Stay within bounds of both yycheck and yytname.
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
int yychecklim = yylast_ - yyn + 1;
|
int yychecklim = yylast_ - yyn + 1;
|
||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
@@ -1112,8 +1063,8 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
|
|||||||
]b4_parser_tables_define[
|
]b4_parser_tables_define[
|
||||||
|
|
||||||
]b4_token_table_if([], [[#if ]b4_api_PREFIX[DEBUG]])[
|
]b4_token_table_if([], [[#if ]b4_api_PREFIX[DEBUG]])[
|
||||||
// YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
// First, the terminals, then, starting at \a yyntokens_, nonterminals.
|
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
||||||
const char*
|
const char*
|
||||||
const ]b4_parser_class_name[::yytname_[] =
|
const ]b4_parser_class_name[::yytname_[] =
|
||||||
{
|
{
|
||||||
@@ -1142,20 +1093,18 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
|
|||||||
{
|
{
|
||||||
unsigned int yylno = yyrline_[yyrule];
|
unsigned int yylno = yyrline_[yyrule];
|
||||||
int yynrhs = yyr2_[yyrule];
|
int yynrhs = yyr2_[yyrule];
|
||||||
// Print the symbols being reduced, and their result.
|
/* Print the symbols being reduced, and their result. */
|
||||||
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
||||||
<< " (line " << yylno << "):" << std::endl;
|
<< " (line " << yylno << "):" << std::endl;
|
||||||
// The symbols being reduced.
|
/* The symbols being reduced. */
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
|
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
|
||||||
]b4_rhs_data(yynrhs, yyi + 1)[);
|
]b4_rhs_data(yynrhs, yyi + 1)[);
|
||||||
}
|
}
|
||||||
#endif // ]b4_api_PREFIX[DEBUG
|
#endif // ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
]b4_token_ctor_if([], [b4_yytranslate_define])[
|
]b4_lex_symbol_if([], [b4_yytranslate_define])[
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
]b4_epilogue[]dnl
|
]b4_epilogue[]dnl
|
||||||
b4_output_end()
|
m4_divert_pop(0)
|
||||||
|
|
||||||
|
|
||||||
m4_popdef([b4_copyright_years])dnl
|
m4_popdef([b4_copyright_years])dnl
|
||||||
|
|||||||
+87
-268
@@ -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-2012 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,8 +20,7 @@ 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 do not depend on %debug in Java, but pacify warnings about
|
# We don't depend on %debug in Java, but pacify warnings about non-used flags.
|
||||||
# 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],
|
||||||
@@ -31,60 +30,10 @@ 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.
|
m4_divert_push(0)dnl
|
||||||
b4_percent_define_default([[api.push-pull]], [[pull]])
|
@output(b4_parser_file_name@)@
|
||||||
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_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||||
[2007-2013])
|
[2007-2012])
|
||||||
|
|
||||||
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. */
|
||||||
@@ -107,9 +56,7 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,24 +77,18 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -155,8 +96,7 @@ 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;
|
||||||
@@ -165,8 +105,7 @@ 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 ();
|
||||||
@@ -198,28 +137,24 @@ 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])[;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -228,8 +163,7 @@ 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);]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,9 +171,7 @@ 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
|
||||||
@@ -405,49 +337,34 @@ 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
|
||||||
* Internal return codes that are not supported for user semantic
|
// actions.
|
||||||
* 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;
|
||||||
@@ -459,7 +376,7 @@ b4_define_state])[
|
|||||||
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
||||||
|
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
'$$ = $1'. Otherwise, use the top of the stack.
|
`$$ = $1'. Otherwise, use the top of the stack.
|
||||||
|
|
||||||
Otherwise, the following line sets YYVAL to garbage.
|
Otherwise, the following line sets YYVAL to garbage.
|
||||||
This behavior is undocumented and Bison
|
This behavior is undocumented and Bison
|
||||||
@@ -547,7 +464,6 @@ b4_define_state])[
|
|||||||
+ (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.
|
||||||
@@ -555,53 +471,48 @@ b4_define_state])[
|
|||||||
* @@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])])])[
|
|
||||||
{
|
{
|
||||||
]b4_locations_if([/* @@$. */
|
/// Lookahead and lookahead in internal form.
|
||||||
b4_location_type yyloc;])[
|
int yychar = yyempty_;
|
||||||
]b4_push_if([],[[
|
int yytoken = 0;
|
||||||
]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
|
m4_pushdef([b4_at_dollar], [yylloc])dnl
|
||||||
|
m4_pushdef([b4_dollar_dollar], [yylval])dnl
|
||||||
/* User initialization code. */
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef[]dnl
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
])[
|
m4_popdef([b4_at_dollar])])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;
|
|
||||||
|
|
||||||
boolean push_token_consumed = true;
|
[ /* Initialize the stack. */
|
||||||
]])[
|
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
||||||
|
|
||||||
|
int label = YYNEWSTATE;
|
||||||
for (;;)
|
for (;;)
|
||||||
switch (label)
|
switch (label)
|
||||||
{
|
{
|
||||||
@@ -614,8 +525,7 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
/* Accept? */
|
/* Accept? */
|
||||||
if (yystate == yyfinal_)
|
if (yystate == yyfinal_)
|
||||||
]b4_push_if([{label = YYACCEPT; break;}],
|
return true;
|
||||||
[return true;])[
|
|
||||||
|
|
||||||
/* Take a decision. First try without lookahead. */
|
/* Take a decision. First try without lookahead. */
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
@@ -624,27 +534,16 @@ 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 = yylextoken;
|
yychar = yylexer.yylex ();]
|
||||||
yylval = yylexval;]b4_locations_if([
|
b4_locations_if([[
|
||||||
yylloc = yylexloc;])[
|
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
||||||
push_token_consumed = false;]])[
|
yylexer.getEndPos ());]])
|
||||||
]b4_push_if([],[[
|
yylval = yylexer.getLVal ();[
|
||||||
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. */
|
||||||
@@ -741,10 +640,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)
|
||||||
]b4_push_if([{label = YYABORT; break;}],[return false;])[
|
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
|
||||||
@@ -752,9 +651,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);])[
|
||||||
@@ -786,10 +685,9 @@ b4_dollar_popdef[]dnl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pop the current state because it cannot handle the
|
/* Pop the current state because it cannot handle the error token. */
|
||||||
* error token. */
|
|
||||||
if (yystack.height == 0)
|
if (yystack.height == 0)
|
||||||
]b4_push_if([{label = YYABORT; break;}],[return false;])[
|
return false;
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
||||||
yystack.pop ();
|
yystack.pop ();
|
||||||
@@ -798,11 +696,7 @@ b4_dollar_popdef[]dnl
|
|||||||
yystack.print (yyDebugStream);
|
yystack.print (yyDebugStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (label == YYABORT)
|
]b4_locations_if([
|
||||||
/* 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);
|
||||||
@@ -820,91 +714,13 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
/* Accept. */
|
/* Accept. */
|
||||||
case YYACCEPT:
|
case YYACCEPT:
|
||||||
]b4_push_if([this.push_parse_initialized = false; return YYACCEPT;],
|
return true;
|
||||||
[return true;])[
|
|
||||||
|
|
||||||
/* Abort. */
|
/* Abort. */
|
||||||
case YYABORT:
|
case YYABORT:
|
||||||
]b4_push_if([this.push_parse_initialized = false; return YYABORT;],
|
return false;
|
||||||
[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)
|
||||||
@@ -912,6 +728,11 @@ b4_both_if([[
|
|||||||
if (yyErrorVerbose)
|
if (yyErrorVerbose)
|
||||||
{
|
{
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
|
- Assume YYFAIL is not used. It's too flawed to consider.
|
||||||
|
See
|
||||||
|
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
||||||
|
for details. YYERROR is fine as it does not invoke this
|
||||||
|
function.
|
||||||
- If this state is a consistent state with a default action,
|
- If this state is a consistent state with a default action,
|
||||||
then the only way this function was invoked is if the
|
then the only way this function was invoked is if the
|
||||||
default action is an error action. In that case, don't
|
default action is an error action. In that case, don't
|
||||||
@@ -939,8 +760,8 @@ b4_both_if([[
|
|||||||
*/
|
*/
|
||||||
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]));
|
||||||
@@ -989,9 +810,8 @@ b4_both_if([[
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the given <code>yytable_</code>
|
* Whether the given <code>yytable_</code> value indicates a syntax error.
|
||||||
* value indicates a syntax error.
|
* @@param yyvalue the value to check
|
||||||
* @@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)
|
||||||
{
|
{
|
||||||
@@ -1003,16 +823,15 @@ b4_both_if([[
|
|||||||
|
|
||||||
]b4_parser_tables_define[
|
]b4_parser_tables_define[
|
||||||
]b4_integral_parser_table_define([token_number], [b4_toknum],
|
]b4_integral_parser_table_define([token_number], [b4_toknum],
|
||||||
[[YYTOKEN_NUMBER[YYLEX-NUM] -- Internal symbol number corresponding
|
[TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
||||||
to YYLEX-NUM.]])[
|
to YYLEX-NUM.])[
|
||||||
|
|
||||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
||||||
]b4_typed_parser_table_define([String], [tname], [b4_tname])[
|
]b4_typed_parser_table_define([String], [tname], [b4_tname])[
|
||||||
|
|
||||||
]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)
|
||||||
@@ -1062,4 +881,4 @@ b4_percent_code_get[]dnl
|
|||||||
}
|
}
|
||||||
|
|
||||||
b4_epilogue[]dnl
|
b4_epilogue[]dnl
|
||||||
b4_output_end()
|
m4_divert_pop(0)dnl
|
||||||
|
|||||||
+1
-2
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2002, 2005-2013 Free Software Foundation, Inc.
|
## Copyright (C) 2002, 2005-2012 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,7 +18,6 @@ dist_pkgdata_DATA = \
|
|||||||
data/bison.m4 \
|
data/bison.m4 \
|
||||||
data/c++-skel.m4 \
|
data/c++-skel.m4 \
|
||||||
data/c++.m4 \
|
data/c++.m4 \
|
||||||
data/c-like.m4 \
|
|
||||||
data/c-skel.m4 \
|
data/c-skel.m4 \
|
||||||
data/c.m4 \
|
data/c.m4 \
|
||||||
data/glr.c \
|
data/glr.c \
|
||||||
|
|||||||
+82
-117
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2012 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,16 +16,33 @@
|
|||||||
# 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-2012])
|
||||||
|
|
||||||
# b4_position_define
|
# We do want M4 expansion after # for CPP macros.
|
||||||
# ------------------
|
m4_changecom()
|
||||||
# Define class position.
|
m4_divert_push(0)dnl
|
||||||
m4_define([b4_position_define],
|
@output(b4_dir_prefix[]position.hh@)@
|
||||||
[[ /// Abstract a position.
|
b4_copyright([Positions for Bison parsers in C++])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
** \file ]b4_dir_prefix[position.hh
|
||||||
|
** Define the ]b4_namespace_ref[::position class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
||||||
|
|
||||||
|
# include <algorithm> // std::max
|
||||||
|
# include <iosfwd>
|
||||||
|
# include <string>
|
||||||
|
|
||||||
|
]b4_null_define[
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
/// Abstract a position.
|
||||||
class position
|
class position
|
||||||
{
|
{
|
||||||
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_NULL,
|
||||||
unsigned int l = ]b4_location_initial_line[u,
|
unsigned int l = ]b4_location_initial_line[u,
|
||||||
@@ -52,17 +69,14 @@ m4_define([b4_position_define],
|
|||||||
/// (line related) Advance to the COUNT next lines.
|
/// (line related) Advance to the COUNT next lines.
|
||||||
void lines (int count = 1)
|
void lines (int count = 1)
|
||||||
{
|
{
|
||||||
if (count)
|
column = ]b4_location_initial_column[u;
|
||||||
{
|
line += count;
|
||||||
column = ]b4_location_initial_column[u;
|
|
||||||
line = add_ (line, count, ]b4_location_initial_line[);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// (column related) Advance to the COUNT next columns.
|
/// (column related) Advance to the COUNT next columns.
|
||||||
void columns (int count = 1)
|
void columns (int count = 1)
|
||||||
{
|
{
|
||||||
column = add_ (column, count, ]b4_location_initial_column[);
|
column = std::max (]b4_location_initial_column[u, column + count);
|
||||||
}
|
}
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
@@ -72,44 +86,36 @@ m4_define([b4_position_define],
|
|||||||
unsigned int line;
|
unsigned int line;
|
||||||
/// Current column number.
|
/// Current column number.
|
||||||
unsigned int column;
|
unsigned int column;
|
||||||
|
|
||||||
private:
|
|
||||||
/// Compute max(min, lhs+rhs) (provided min <= lhs).
|
|
||||||
static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min)
|
|
||||||
{
|
|
||||||
return (0 < rhs || -static_cast<unsigned int>(rhs) < lhs
|
|
||||||
? rhs + lhs
|
|
||||||
: min);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Add and assign a position.
|
/// Add and assign a position.
|
||||||
inline position&
|
inline const position&
|
||||||
operator+= (position& res, int width)
|
operator+= (position& res, const int width)
|
||||||
{
|
{
|
||||||
res.columns (width);
|
res.columns (width);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add two position objects.
|
/// Add two position objects.
|
||||||
inline position
|
inline const position
|
||||||
operator+ (position res, int width)
|
operator+ (const position& begin, const int width)
|
||||||
{
|
{
|
||||||
|
position res = begin;
|
||||||
return res += width;
|
return res += width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add and assign a position.
|
/// Add and assign a position.
|
||||||
inline position&
|
inline const position&
|
||||||
operator-= (position& res, int width)
|
operator-= (position& res, const int width)
|
||||||
{
|
{
|
||||||
return res += -width;
|
return res += -width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add two position objects.
|
/// Add two position objects.
|
||||||
inline position
|
inline const position
|
||||||
operator- (position res, int width)
|
operator- (const position& begin, const int width)
|
||||||
{
|
{
|
||||||
return res -= width;
|
return begin + -width;
|
||||||
}
|
}
|
||||||
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
||||||
/// Compare two position objects.
|
/// Compare two position objects.
|
||||||
@@ -134,21 +140,33 @@ m4_define([b4_position_define],
|
|||||||
** \param ostr the destination output stream
|
** \param ostr the destination output stream
|
||||||
** \param pos a reference to the position to redirect
|
** \param pos a reference to the position to redirect
|
||||||
*/
|
*/
|
||||||
template <typename YYChar>
|
inline std::ostream&
|
||||||
inline std::basic_ostream<YYChar>&
|
operator<< (std::ostream& ostr, const position& pos)
|
||||||
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
|
|
||||||
{
|
{
|
||||||
if (pos.filename)
|
if (pos.filename)
|
||||||
ostr << *pos.filename << ':';
|
ostr << *pos.filename << ':';
|
||||||
return ostr << pos.line << '.' << pos.column;
|
return ostr << pos.line << '.' << pos.column;
|
||||||
}
|
}
|
||||||
]])
|
|
||||||
|
|
||||||
|
]b4_namespace_close[
|
||||||
|
]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
|
||||||
|
@output(b4_dir_prefix[]location.hh@)@
|
||||||
|
b4_copyright([Locations for Bison parsers in C++])[
|
||||||
|
|
||||||
# b4_location_define
|
/**
|
||||||
# ------------------
|
** \file ]b4_dir_prefix[location.hh
|
||||||
m4_define([b4_location_define],
|
** Define the ]b4_namespace_ref[::location class.
|
||||||
[[ /// Abstract a location.
|
*/
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
|
||||||
|
|
||||||
|
# include <iostream>
|
||||||
|
# include <string>
|
||||||
|
# include "position.hh"
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
|
||||||
|
/// Abstract a location.
|
||||||
class location
|
class location
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -196,13 +214,13 @@ m4_define([b4_location_define],
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Extend the current location to the COUNT next columns.
|
/// Extend the current location to the COUNT next columns.
|
||||||
void columns (int count = 1)
|
void columns (unsigned int count = 1)
|
||||||
{
|
{
|
||||||
end += count;
|
end += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extend the current location to the COUNT next lines.
|
/// Extend the current location to the COUNT next lines.
|
||||||
void lines (int count = 1)
|
void lines (unsigned int count = 1)
|
||||||
{
|
{
|
||||||
end.lines (count);
|
end.lines (count);
|
||||||
}
|
}
|
||||||
@@ -217,35 +235,26 @@ m4_define([b4_location_define],
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Join two location objects to create a location.
|
/// Join two location objects to create a location.
|
||||||
inline location operator+ (location res, const location& end)
|
inline const location operator+ (const location& begin, const location& end)
|
||||||
{
|
{
|
||||||
|
location res = begin;
|
||||||
res.end = end.end;
|
res.end = end.end;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Change end position in place.
|
/// Add two location objects.
|
||||||
inline location& operator+= (location& res, int width)
|
inline const location operator+ (const location& begin, unsigned int width)
|
||||||
{
|
{
|
||||||
|
location res = begin;
|
||||||
res.columns (width);
|
res.columns (width);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Change end position.
|
/// Add and assign a location.
|
||||||
inline location operator+ (location res, int width)
|
inline location& operator+= (location& res, unsigned int width)
|
||||||
{
|
{
|
||||||
return res += width;
|
res.columns (width);
|
||||||
}
|
return res;
|
||||||
|
|
||||||
/// Change end position in place.
|
|
||||||
inline location& operator-= (location& res, int width)
|
|
||||||
{
|
|
||||||
return res += -width;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Change end position.
|
|
||||||
inline location operator- (const location& begin, int width)
|
|
||||||
{
|
|
||||||
return begin + -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.
|
||||||
@@ -268,68 +277,24 @@ m4_define([b4_location_define],
|
|||||||
**
|
**
|
||||||
** Avoid duplicate information.
|
** Avoid duplicate information.
|
||||||
*/
|
*/
|
||||||
template <typename YYChar>
|
inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
|
||||||
inline std::basic_ostream<YYChar>&
|
|
||||||
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
|
||||||
{
|
{
|
||||||
unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
position last = loc.end - 1;
|
||||||
ostr << loc.begin// << "(" << loc.end << ") "
|
ostr << loc.begin;
|
||||||
;
|
if (last.filename
|
||||||
if (loc.end.filename
|
|
||||||
&& (!loc.begin.filename
|
&& (!loc.begin.filename
|
||||||
|| *loc.begin.filename != *loc.end.filename))
|
|| *loc.begin.filename != *last.filename))
|
||||||
ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col;
|
ostr << '-' << last;
|
||||||
else if (loc.begin.line < loc.end.line)
|
else if (loc.begin.line != last.line)
|
||||||
ostr << '-' << loc.end.line << '.' << end_col;
|
ostr << '-' << last.line << '.' << last.column;
|
||||||
else if (loc.begin.column < end_col)
|
else if (loc.begin.column != last.column)
|
||||||
ostr << '-' << end_col;
|
ostr << '-' << last.column;
|
||||||
return ostr;
|
return ostr;
|
||||||
}
|
}
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
b4_defines_if([
|
|
||||||
b4_output_begin([b4_dir_prefix[]position.hh])
|
|
||||||
b4_copyright([Positions for Bison parsers in C++])[
|
|
||||||
|
|
||||||
/**
|
|
||||||
** \file ]b4_dir_prefix[position.hh
|
|
||||||
** Define the ]b4_namespace_ref[::position class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
|
||||||
|
|
||||||
# include <algorithm> // std::max
|
|
||||||
# include <iostream>
|
|
||||||
# include <string>
|
|
||||||
|
|
||||||
]b4_null_define[
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
|
||||||
]b4_position_define[
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
|
|
||||||
b4_output_end()
|
|
||||||
|
|
||||||
|
|
||||||
b4_output_begin([b4_dir_prefix[]location.hh])
|
|
||||||
b4_copyright([Locations for Bison parsers in C++])[
|
|
||||||
|
|
||||||
/**
|
|
||||||
** \file ]b4_dir_prefix[location.hh
|
|
||||||
** Define the ]b4_namespace_ref[::location class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
|
|
||||||
|
|
||||||
# include "position.hh"
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
|
||||||
]b4_location_define[
|
|
||||||
]b4_namespace_close[
|
|
||||||
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
|
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
|
||||||
b4_output_end()
|
m4_divert_pop(0)
|
||||||
])
|
m4_popdef([b4_copyright_years])dnl
|
||||||
|
m4_changecom([#])
|
||||||
|
|
||||||
m4_popdef([b4_copyright_years])
|
|
||||||
|
|||||||
+29
-46
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2012 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,12 +16,25 @@
|
|||||||
# 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-2012])
|
||||||
|
|
||||||
# b4_stack_define
|
# We do want M4 expansion after # for CPP macros.
|
||||||
# ---------------
|
m4_changecom()
|
||||||
m4_define([b4_stack_define],
|
m4_divert_push(0)dnl
|
||||||
[[ template <class T, class S = std::vector<T> >
|
@output(b4_dir_prefix[]stack.hh@)@
|
||||||
|
b4_copyright([Stack handling for Bison parsers in C++])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
** \file ]b4_dir_prefix[stack.hh
|
||||||
|
** Define the ]b4_namespace_ref[::stack class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
|
||||||
|
|
||||||
|
# include <deque>
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
template <class T, class S = std::deque<T> >
|
||||||
class stack
|
class stack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -41,27 +54,23 @@ m4_define([b4_stack_define],
|
|||||||
|
|
||||||
inline
|
inline
|
||||||
T&
|
T&
|
||||||
operator[] (unsigned int i)
|
operator [] (unsigned int i)
|
||||||
{
|
{
|
||||||
return seq_[seq_.size () - 1 - i];
|
return seq_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const T&
|
const T&
|
||||||
operator[] (unsigned int i) const
|
operator [] (unsigned int i) const
|
||||||
{
|
{
|
||||||
return seq_[seq_.size () - 1 - i];
|
return seq_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Steal the contents of \a t.
|
|
||||||
///
|
|
||||||
/// Close to move-semantics.
|
|
||||||
inline
|
inline
|
||||||
void
|
void
|
||||||
push (T& t)
|
push (const T& t)
|
||||||
{
|
{
|
||||||
seq_.push_back (T());
|
seq_.push_front (t);
|
||||||
operator[](0).move (t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@@ -69,13 +78,7 @@ m4_define([b4_stack_define],
|
|||||||
pop (unsigned int n = 1)
|
pop (unsigned int n = 1)
|
||||||
{
|
{
|
||||||
for (; n; --n)
|
for (; n; --n)
|
||||||
seq_.pop_back ();
|
seq_.pop_front ();
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
clear ()
|
|
||||||
{
|
|
||||||
seq_.clear ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@@ -100,8 +103,6 @@ m4_define([b4_stack_define],
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
stack (const stack&);
|
|
||||||
stack& operator= (const stack&);
|
|
||||||
/// The wrapped container.
|
/// The wrapped container.
|
||||||
S seq_;
|
S seq_;
|
||||||
};
|
};
|
||||||
@@ -128,27 +129,9 @@ m4_define([b4_stack_define],
|
|||||||
const S& stack_;
|
const S& stack_;
|
||||||
unsigned int range_;
|
unsigned int range_;
|
||||||
};
|
};
|
||||||
]])
|
|
||||||
|
|
||||||
b4_defines_if(
|
|
||||||
[b4_output_begin([b4_dir_prefix[]stack.hh])
|
|
||||||
b4_copyright([Stack handling for Bison parsers in C++])[
|
|
||||||
|
|
||||||
/**
|
|
||||||
** \file ]b4_dir_prefix[stack.hh
|
|
||||||
** Define the ]b4_namespace_ref[::stack class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
|
|
||||||
|
|
||||||
# include <vector>
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
|
||||||
]b4_stack_define[
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
|
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
|
||||||
b4_output_end()
|
m4_divert_pop(0)
|
||||||
])
|
m4_popdef([b4_copyright_years])dnl
|
||||||
|
m4_changecom([#])
|
||||||
m4_popdef([b4_copyright_years])
|
|
||||||
|
|||||||
+73
-158
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2012 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,7 +26,7 @@
|
|||||||
# YYTYPE.
|
# YYTYPE.
|
||||||
m4_define([b4_symbol_variant],
|
m4_define([b4_symbol_variant],
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
[$2.$3< $][3 > (m4_shift3($@))])dnl
|
[$2.$3< $][3 >(m4_shift3($@))])dnl
|
||||||
switch ($1)
|
switch ($1)
|
||||||
{
|
{
|
||||||
b4_type_foreach([b4_type_action_])[]dnl
|
b4_type_foreach([b4_type_action_])[]dnl
|
||||||
@@ -51,6 +51,13 @@ m4_define([_b4_char_sizeof_dummy],
|
|||||||
dummy[]_b4_char_sizeof_counter])
|
dummy[]_b4_char_sizeof_counter])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_char_sizeof_(SYMBOL-NUM)
|
||||||
|
# ---------------------------
|
||||||
|
# A comment describing this symbol.
|
||||||
|
m4_define([b4_char_sizeof_],
|
||||||
|
[ // b4_symbol([$1], [tag])
|
||||||
|
])
|
||||||
|
|
||||||
# b4_char_sizeof(SYMBOL-NUMS)
|
# b4_char_sizeof(SYMBOL-NUMS)
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# To be mapped on the list of type names to produce:
|
# To be mapped on the list of type names to produce:
|
||||||
@@ -62,179 +69,116 @@ dummy[]_b4_char_sizeof_counter])
|
|||||||
m4_define([b4_char_sizeof],
|
m4_define([b4_char_sizeof],
|
||||||
[b4_symbol_if([$1], [has_type],
|
[b4_symbol_if([$1], [has_type],
|
||||||
[
|
[
|
||||||
m4_map([ b4_symbol_tag_comment], [$@])dnl
|
m4_map_args([b4_char_sizeof_], $@)dnl
|
||||||
char _b4_char_sizeof_dummy@{sizeof(b4_symbol([$1], [type]))@};
|
char _b4_char_sizeof_dummy@{sizeof([b4_symbol([$1], [type])])@};
|
||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
# b4_variant_includes
|
|
||||||
# -------------------
|
|
||||||
# The needed includes for variants support.
|
|
||||||
m4_define([b4_variant_includes],
|
|
||||||
[b4_parse_assert_if([[#include <typeinfo>]])[
|
|
||||||
#ifndef YYASSERT
|
|
||||||
# include <cassert>
|
|
||||||
# define YYASSERT assert
|
|
||||||
#endif
|
|
||||||
]])
|
|
||||||
|
|
||||||
# b4_variant_define
|
# b4_variant_define
|
||||||
# -----------------
|
# -----------------
|
||||||
# Define "variant".
|
# Define "variant".
|
||||||
m4_define([b4_variant_define],
|
m4_define([b4_variant_define],
|
||||||
[[ /// A char[S] buffer to store and retrieve objects.
|
[[
|
||||||
|
/// A char[S] buffer to store and retrieve objects.
|
||||||
///
|
///
|
||||||
/// Sort of a variant, but does not keep track of the nature
|
/// Sort of a variant, but does not keep track of the nature
|
||||||
/// of the stored data, since that knowledge is available
|
/// of the stored data, since that knowledge is available
|
||||||
/// via the current state.
|
/// via the current state.
|
||||||
template <size_t S>
|
template <size_t S>
|
||||||
struct variant
|
struct variant
|
||||||
{
|
{]b4_parse_assert_if([
|
||||||
/// Type of *this.
|
/// Whether something is contained.
|
||||||
typedef variant<S> self_type;
|
bool built;
|
||||||
|
])[
|
||||||
/// Empty construction.
|
/// Empty construction.
|
||||||
|
inline
|
||||||
variant ()]b4_parse_assert_if([
|
variant ()]b4_parse_assert_if([
|
||||||
: yytname_ (YY_NULL)])[
|
: built (false)])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/// Construct and fill.
|
/// Instantiate a \a T in here.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
variant (const T& t)]b4_parse_assert_if([
|
inline T&
|
||||||
: yytname_ (typeid (T).name ())])[
|
|
||||||
{
|
|
||||||
YYASSERT (sizeof (T) <= S);
|
|
||||||
new (yyas_<T> ()) T (t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Destruction, allowed only if empty.
|
|
||||||
~variant ()
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
YYASSERT (!yytname_);
|
|
||||||
])[}
|
|
||||||
|
|
||||||
/// Instantiate an empty \a T in here.
|
|
||||||
template <typename T>
|
|
||||||
T&
|
|
||||||
build ()
|
build ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytname_);
|
assert (!built);
|
||||||
YYASSERT (sizeof (T) <= S);
|
built = true;])[
|
||||||
yytname_ = typeid (T).name ();])[
|
return *new (buffer.raw) T;
|
||||||
return *new (yyas_<T> ()) T;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Instantiate a \a T in here from \a t.
|
/// Instantiate a \a T in here from \a t.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
inline T&
|
||||||
build (const T& t)
|
build (const T& t)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytname_);
|
assert(!built);
|
||||||
YYASSERT (sizeof (T) <= S);
|
built = true;])[
|
||||||
yytname_ = typeid (T).name ();])[
|
return *new (buffer.raw) T(t);
|
||||||
return *new (yyas_<T> ()) T (t);
|
}
|
||||||
|
|
||||||
|
/// Construct and fill.
|
||||||
|
template <typename T>
|
||||||
|
inline
|
||||||
|
variant (const T& t)]b4_parse_assert_if([
|
||||||
|
: built (true)])[
|
||||||
|
{
|
||||||
|
new (buffer.raw) T(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Accessor to a built \a T.
|
/// Accessor to a built \a T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
inline T&
|
||||||
as ()
|
as ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytname_ == typeid (T).name ());
|
assert (built);])[
|
||||||
YYASSERT (sizeof (T) <= S);])[
|
return reinterpret_cast<T&>(buffer.raw);
|
||||||
return *yyas_<T> ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Const accessor to a built \a T (for %printer).
|
/// Const accessor to a built \a T (for %printer).
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const T&
|
inline const T&
|
||||||
as () const
|
as () const
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytname_ == typeid (T).name ());
|
assert(built);])[
|
||||||
YYASSERT (sizeof (T) <= S);])[
|
return reinterpret_cast<const T&>(buffer.raw);
|
||||||
return *yyas_<T> ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Swap the content with \a other, of same type.
|
/// Swap the content with \a other.
|
||||||
///
|
|
||||||
/// Both variants must be built beforehand, because swapping the actual
|
|
||||||
/// data requires reading it (with as()), and this is not possible on
|
|
||||||
/// unconstructed variants: it would require some dynamic testing, which
|
|
||||||
/// should not be the variant's responsability.
|
|
||||||
/// Swapping between built and (possibly) non-built is done with
|
|
||||||
/// variant::move ().
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
inline void
|
||||||
swap (self_type& other)
|
swap (variant<S>& other)
|
||||||
{]b4_parse_assert_if([
|
{
|
||||||
YYASSERT (yytname_);
|
std::swap (as<T>(), other.as<T>());
|
||||||
YYASSERT (yytname_ == other.yytname_);])[
|
|
||||||
std::swap (as<T> (), other.as<T> ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Move the content of \a other to this.
|
/// Assign the content of \a other to this.
|
||||||
///
|
|
||||||
/// Destroys \a other.
|
/// Destroys \a other.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
inline void
|
||||||
move (self_type& other)
|
build (variant<S>& other)
|
||||||
{]b4_parse_assert_if([
|
|
||||||
YYASSERT (!yytname_);])[
|
|
||||||
build<T> ();
|
|
||||||
swap<T> (other);
|
|
||||||
other.destroy<T> ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Copy the content of \a other to this.
|
|
||||||
template <typename T>
|
|
||||||
void
|
|
||||||
copy (const self_type& other)
|
|
||||||
{
|
{
|
||||||
build<T> (other.as<T> ());
|
build<T>();
|
||||||
|
swap<T>(other);
|
||||||
|
other.destroy<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destroy the stored \a T.
|
/// Destroy the stored \a T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
inline void
|
||||||
destroy ()
|
destroy ()
|
||||||
{
|
{
|
||||||
as<T> ().~T ();]b4_parse_assert_if([
|
as<T>().~T();]b4_parse_assert_if([
|
||||||
yytname_ = YY_NULL;])[
|
built = false;])[
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
/// A buffer large enough to store any of the semantic values.
|
||||||
/// Prohibit blind copies.
|
/// Long double is chosen as it has the strongest alignment
|
||||||
self_type& operator=(const self_type&);
|
/// constraints.
|
||||||
variant (const self_type&);
|
|
||||||
|
|
||||||
/// Accessor to raw memory as \a T.
|
|
||||||
template <typename T>
|
|
||||||
T*
|
|
||||||
yyas_ ()
|
|
||||||
{
|
|
||||||
void *yyp = yybuffer_.yyraw;
|
|
||||||
return static_cast<T*> (yyp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Const accessor to raw memory as \a T.
|
|
||||||
template <typename T>
|
|
||||||
const T*
|
|
||||||
yyas_ () const
|
|
||||||
{
|
|
||||||
const void *yyp = yybuffer_.yyraw;
|
|
||||||
return static_cast<const T*> (yyp);
|
|
||||||
}
|
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
/// Strongest alignment constraints.
|
long double align_me;
|
||||||
long double yyalign_me;
|
char raw[S];
|
||||||
/// A buffer large enough to store any of the semantic values.
|
} buffer;
|
||||||
char yyraw[S];
|
|
||||||
} yybuffer_;]b4_parse_assert_if([
|
|
||||||
|
|
||||||
/// Whether the content is built: if defined, the name of the stored type.
|
|
||||||
const char *yytname_;])[
|
|
||||||
};
|
};
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -244,17 +188,16 @@ m4_define([b4_variant_define],
|
|||||||
## -------------------------- ##
|
## -------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_declare
|
# b4_semantic_type_declare
|
||||||
# ---------------------
|
# ------------------------
|
||||||
# Declare semantic_type.
|
# Declare semantic_type.
|
||||||
m4_define([b4_value_type_declare],
|
m4_define([b4_semantic_type_declare],
|
||||||
[[ /// An auxiliary type to compute the largest semantic type.
|
[ /// An auxiliary type to compute the largest semantic type.
|
||||||
union union_type
|
union union_type
|
||||||
{]b4_type_foreach([b4_char_sizeof])[};
|
{]b4_type_foreach([b4_char_sizeof])[};
|
||||||
|
|
||||||
/// Symbol semantic values.
|
/// Symbol semantic values.
|
||||||
typedef variant<sizeof(union_type)> semantic_type;][]dnl
|
typedef variant<sizeof(union_type)> semantic_type;])
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# How the semantic value is extracted when using variants.
|
# How the semantic value is extracted when using variants.
|
||||||
@@ -263,7 +206,7 @@ m4_define([b4_value_type_declare],
|
|||||||
# ----------------------------
|
# ----------------------------
|
||||||
m4_define([b4_symbol_value],
|
m4_define([b4_symbol_value],
|
||||||
[m4_ifval([$2],
|
[m4_ifval([$2],
|
||||||
[$1.as< $2 > ()],
|
[$1.as< $2 >()],
|
||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, [TYPE])
|
# b4_symbol_value_template(VAL, [TYPE])
|
||||||
@@ -271,7 +214,7 @@ m4_define([b4_symbol_value],
|
|||||||
# Same as b4_symbol_value, but used in a template method.
|
# Same as b4_symbol_value, but used in a template method.
|
||||||
m4_define([b4_symbol_value_template],
|
m4_define([b4_symbol_value_template],
|
||||||
[m4_ifval([$2],
|
[m4_ifval([$2],
|
||||||
[$1.template as< $2 > ()],
|
[$1.template as< $2 >()],
|
||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
|
|
||||||
@@ -290,7 +233,7 @@ m4_define([b4_symbol_constructor_declare_],
|
|||||||
[ static inline
|
[ static inline
|
||||||
symbol_type
|
symbol_type
|
||||||
make_[]b4_symbol_([$1], [id]) (dnl
|
make_[]b4_symbol_([$1], [id]) (dnl
|
||||||
b4_join(b4_symbol_if([$1], [has_type],
|
b4_args(b4_symbol_if([$1], [has_type],
|
||||||
[const b4_symbol([$1], [type])& v]),
|
[const b4_symbol([$1], [type])& v]),
|
||||||
b4_locations_if([const location_type& l])));
|
b4_locations_if([const location_type& l])));
|
||||||
|
|
||||||
@@ -314,46 +257,18 @@ m4_define([b4_symbol_constructor_define_],
|
|||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||||
[ b4_parser_class_name::symbol_type
|
[ b4_parser_class_name::symbol_type
|
||||||
b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl
|
b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl
|
||||||
b4_join(b4_symbol_if([$1], [has_type],
|
b4_args(b4_symbol_if([$1], [has_type],
|
||||||
[const b4_symbol([$1], [type])& v]),
|
[const b4_symbol([$1], [type])& v]),
|
||||||
b4_locations_if([const location_type& l])))
|
b4_locations_if([const location_type& l])))
|
||||||
{
|
{
|
||||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
return symbol_type (b4_args([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])));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
])])])
|
])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_basic_symbol_constructor_declare
|
|
||||||
# -----------------------------------
|
|
||||||
# Generate a constructor declaration for basic_symbol from given type.
|
|
||||||
m4_define([b4_basic_symbol_constructor_declare],
|
|
||||||
[[
|
|
||||||
basic_symbol (]b4_join(
|
|
||||||
[typename Base::kind_type t],
|
|
||||||
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[ v]),
|
|
||||||
b4_locations_if([const location_type& l]))[);
|
|
||||||
]])
|
|
||||||
|
|
||||||
# b4_basic_symbol_constructor_define
|
|
||||||
# ----------------------------------
|
|
||||||
# Generate a constructor implementation for basic_symbol from given type.
|
|
||||||
m4_define([b4_basic_symbol_constructor_define],
|
|
||||||
[[
|
|
||||||
template <typename Base>
|
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
|
||||||
[typename Base::kind_type t],
|
|
||||||
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[ v]),
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: Base (t)
|
|
||||||
, value (]b4_symbol_if([$1], [has_type], [v])[)]b4_locations_if([
|
|
||||||
, location (l)])[
|
|
||||||
{}
|
|
||||||
]])
|
|
||||||
|
|
||||||
# b4_symbol_constructor_define
|
# b4_symbol_constructor_define
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
# Define the overloaded versions of make_symbol for all the value types.
|
# Define the overloaded versions of make_symbol for all the value types.
|
||||||
|
|||||||
+1
-13
@@ -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-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -90,16 +90,4 @@
|
|||||||
<xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
|
<xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="space">
|
|
||||||
<xsl:param name="repeat">0</xsl:param>
|
|
||||||
<xsl:param name="fill" select="' '"/>
|
|
||||||
<xsl:if test="number($repeat) >= 1">
|
|
||||||
<xsl:call-template name="space">
|
|
||||||
<xsl:with-param name="repeat" select="$repeat - 1"/>
|
|
||||||
<xsl:with-param name="fill" select="$fill"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:value-of select="$fill"/>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
+8
-183
@@ -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-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -55,11 +55,7 @@
|
|||||||
<xsl:call-template name="escape">
|
<xsl:call-template name="escape">
|
||||||
<xsl:with-param name="subject" select="$filename"/>
|
<xsl:with-param name="subject" select="$filename"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:text>" {
|
<xsl:text>" { </xsl:text>
|
||||||
node [fontname = courier, shape = box, colorscheme = paired6]
|
|
||||||
edge [fontname = courier]
|
|
||||||
|
|
||||||
</xsl:text>
|
|
||||||
<xsl:apply-templates select="state"/>
|
<xsl:apply-templates select="state"/>
|
||||||
<xsl:text>} </xsl:text>
|
<xsl:text>} </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
@@ -68,87 +64,11 @@
|
|||||||
<xsl:call-template name="output-node">
|
<xsl:call-template name="output-node">
|
||||||
<xsl:with-param name="number" select="@number"/>
|
<xsl:with-param name="number" select="@number"/>
|
||||||
<xsl:with-param name="label">
|
<xsl:with-param name="label">
|
||||||
|
<xsl:value-of select="@number"/>
|
||||||
<xsl:apply-templates select="itemset/item"/>
|
<xsl:apply-templates select="itemset/item"/>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:apply-templates select="actions/transitions"/>
|
<xsl:apply-templates select="actions/transitions"/>
|
||||||
<xsl:apply-templates select="actions/reductions">
|
|
||||||
<xsl:with-param name="staten">
|
|
||||||
<xsl:value-of select="@number"/>
|
|
||||||
</xsl:with-param>
|
|
||||||
</xsl:apply-templates>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="actions/reductions">
|
|
||||||
<xsl:param name="staten"/>
|
|
||||||
<xsl:for-each select='reduction'>
|
|
||||||
<!-- These variables are needed because the current context can't be
|
|
||||||
refered to directly in XPath expressions. -->
|
|
||||||
<xsl:variable name="rul">
|
|
||||||
<xsl:value-of select="@rule"/>
|
|
||||||
</xsl:variable>
|
|
||||||
<xsl:variable name="ena">
|
|
||||||
<xsl:value-of select="@enabled"/>
|
|
||||||
</xsl:variable>
|
|
||||||
<!-- The foreach's body is protected by this, so that we are actually
|
|
||||||
going to iterate once per reduction rule, and not per lookahead. -->
|
|
||||||
<xsl:if test='not(preceding-sibling::*[@rule=$rul and @enabled=$ena])'>
|
|
||||||
<xsl:variable name="rule">
|
|
||||||
<xsl:choose>
|
|
||||||
<!-- The acceptation state is refered to as 'accept' in the XML, but
|
|
||||||
just as '0' in the DOT. -->
|
|
||||||
<xsl:when test="@rule='accept'">
|
|
||||||
<xsl:text>0</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="@rule"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
|
|
||||||
<!-- The edge's beginning -->
|
|
||||||
<xsl:call-template name="reduction-edge-start">
|
|
||||||
<xsl:with-param name="state" select="$staten"/>
|
|
||||||
<xsl:with-param name="rule" select="$rule"/>
|
|
||||||
<xsl:with-param name="enabled" select="@enabled"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
|
|
||||||
<!-- The edge's tokens -->
|
|
||||||
<!-- Don't show labels for the default action. In other cases, there will
|
|
||||||
always be at least one token, so 'label="[]"' will not occur. -->
|
|
||||||
<xsl:if test='$rule!=0 and not(../reduction[@enabled=$ena and @rule=$rule and @symbol="$default"])'>
|
|
||||||
<xsl:text>label="[</xsl:text>
|
|
||||||
<xsl:for-each select='../reduction[@enabled=$ena and @rule=$rule]'>
|
|
||||||
<xsl:call-template name="escape">
|
|
||||||
<xsl:with-param name="subject" select="@symbol"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:if test="position() != last ()">
|
|
||||||
<xsl:text>, </xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:for-each>
|
|
||||||
<xsl:text>]", </xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
|
|
||||||
<!-- The edge's end -->
|
|
||||||
<xsl:text>style=solid] </xsl:text>
|
|
||||||
|
|
||||||
<!-- The diamond representing the reduction -->
|
|
||||||
<xsl:call-template name="reduction-node">
|
|
||||||
<xsl:with-param name="state" select="$staten"/>
|
|
||||||
<xsl:with-param name="rule" select="$rule"/>
|
|
||||||
<xsl:with-param name="color">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test='@enabled="true"'>
|
|
||||||
<xsl:text>3</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:text>5</xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:with-param>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:for-each>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="actions/transitions">
|
<xsl:template match="actions/transitions">
|
||||||
@@ -156,48 +76,17 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="item">
|
<xsl:template match="item">
|
||||||
<xsl:param name="prev-rule-number"
|
|
||||||
select="preceding-sibling::item[1]/@rule-number"/>
|
|
||||||
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
||||||
<xsl:with-param name="point" select="@point"/>
|
<xsl:with-param name="point" select="@point"/>
|
||||||
<xsl:with-param name="num" select="@rule-number"/>
|
|
||||||
<xsl:with-param name="prev-lhs"
|
|
||||||
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
|
||||||
/>
|
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
<xsl:apply-templates select="lookaheads"/>
|
<xsl:apply-templates select="lookaheads"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="rule">
|
<xsl:template match="rule">
|
||||||
<xsl:param name="point"/>
|
<xsl:param name="point"/>
|
||||||
<xsl:param name="num"/>
|
|
||||||
<xsl:param name="prev-lhs"/>
|
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:choose>
|
<xsl:value-of select="lhs"/>
|
||||||
<xsl:when test="$num < 10">
|
<xsl:text> -></xsl:text>
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$num < 100">
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:text></xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
<xsl:value-of select="$num"/>
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$prev-lhs = lhs[text()]">
|
|
||||||
<xsl:call-template name="lpad">
|
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="lhs"/>
|
|
||||||
<xsl:text>:</xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
<xsl:if test="$point = 0">
|
<xsl:if test="$point = 0">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -217,7 +106,7 @@
|
|||||||
<xsl:template match="empty"/>
|
<xsl:template match="empty"/>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
<xsl:text> [</xsl:text>
|
<xsl:text>[</xsl:text>
|
||||||
<xsl:apply-templates select="symbol"/>
|
<xsl:apply-templates select="symbol"/>
|
||||||
<xsl:text>]</xsl:text>
|
<xsl:text>]</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
@@ -229,50 +118,6 @@
|
|||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="reduction-edge-start">
|
|
||||||
<xsl:param name="state"/>
|
|
||||||
<xsl:param name="rule"/>
|
|
||||||
<xsl:param name="enabled"/>
|
|
||||||
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<xsl:value-of select="$state"/>
|
|
||||||
<xsl:text> -> "</xsl:text>
|
|
||||||
<xsl:value-of select="$state"/>
|
|
||||||
<xsl:text>R</xsl:text>
|
|
||||||
<xsl:value-of select="$rule"/>
|
|
||||||
<xsl:if test='$enabled = "false"'>
|
|
||||||
<xsl:text>d</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:text>" [</xsl:text>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="reduction-node">
|
|
||||||
<xsl:param name="state"/>
|
|
||||||
<xsl:param name="rule"/>
|
|
||||||
<xsl:param name="color"/>
|
|
||||||
|
|
||||||
<xsl:text> "</xsl:text>
|
|
||||||
<xsl:value-of select="$state"/>
|
|
||||||
<xsl:text>R</xsl:text>
|
|
||||||
<xsl:value-of select="$rule"/>
|
|
||||||
<xsl:if test="$color = 5">
|
|
||||||
<xsl:text>d</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:text>" [label="</xsl:text>
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$rule = 0">
|
|
||||||
<xsl:text>Acc", fillcolor=1</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:text>R</xsl:text>
|
|
||||||
<xsl:value-of select="$rule"/>
|
|
||||||
<xsl:text>", fillcolor=</xsl:text>
|
|
||||||
<xsl:value-of select="$color"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
<xsl:text>, shape=diamond, style=filled] </xsl:text>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="transition">
|
<xsl:template match="transition">
|
||||||
<xsl:call-template name="output-edge">
|
<xsl:call-template name="output-edge">
|
||||||
<xsl:with-param name="src" select="../../../@number"/>
|
<xsl:with-param name="src" select="../../../@number"/>
|
||||||
@@ -304,13 +149,10 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="$number"/>
|
<xsl:value-of select="$number"/>
|
||||||
<xsl:text> [label="</xsl:text>
|
<xsl:text> [label="</xsl:text>
|
||||||
<xsl:text>State </xsl:text>
|
|
||||||
<xsl:value-of select="$number"/>
|
|
||||||
<xsl:text>\n</xsl:text>
|
|
||||||
<xsl:call-template name="escape">
|
<xsl:call-template name="escape">
|
||||||
<xsl:with-param name="subject" select="$label"/>
|
<xsl:with-param name="subject" select="$label"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:text>\l"] </xsl:text>
|
<xsl:text>"] </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="output-edge">
|
<xsl:template name="output-edge">
|
||||||
@@ -351,7 +193,7 @@
|
|||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
<xsl:with-param name="search" select="' '"/>
|
<xsl:with-param name="search" select="' '"/>
|
||||||
<xsl:with-param name="replace" select="'\l'"/>
|
<xsl:with-param name="replace" select="'\n'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
@@ -377,21 +219,4 @@
|
|||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="lpad">
|
|
||||||
<xsl:param name="str" select="''"/>
|
|
||||||
<xsl:param name="pad" select="0"/>
|
|
||||||
<xsl:variable name="diff" select="$pad - string-length($str)" />
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$diff < 0">
|
|
||||||
<xsl:value-of select="$str"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:call-template name="space">
|
|
||||||
<xsl:with-param name="repeat" select="$diff"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:value-of select="$str"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
+15
-3
@@ -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-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@
|
|||||||
<xsl:template match="automaton/state">
|
<xsl:template match="automaton/state">
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:text>State </xsl:text>
|
<xsl:text>state </xsl:text>
|
||||||
<xsl:value-of select="@number"/>
|
<xsl:value-of select="@number"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="itemset/item">
|
<xsl:apply-templates select="itemset/item">
|
||||||
@@ -373,7 +373,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty">
|
<xsl:template match="empty">
|
||||||
<xsl:text> %empty</xsl:text>
|
<xsl:text> /* empty */</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
@@ -522,6 +522,18 @@
|
|||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="space">
|
||||||
|
<xsl:param name="repeat">0</xsl:param>
|
||||||
|
<xsl:param name="fill" select="' '"/>
|
||||||
|
<xsl:if test="number($repeat) >= 1">
|
||||||
|
<xsl:call-template name="space">
|
||||||
|
<xsl:with-param name="repeat" select="$repeat - 1"/>
|
||||||
|
<xsl:with-param name="fill" select="$fill"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:value-of select="$fill"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="line-wrap">
|
<xsl:template name="line-wrap">
|
||||||
<xsl:param name="line-length"/> <!-- required -->
|
<xsl:param name="line-length"/> <!-- required -->
|
||||||
<xsl:param name="first-line-length" select="$line-length"/>
|
<xsl:param name="first-line-length" select="$line-length"/>
|
||||||
|
|||||||
@@ -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-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+220
-146
@@ -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-2012 Free Software Foundation,
|
||||||
# Inc.
|
# Inc.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[1984, 1989-1990, 2000-2013])
|
[1984, 1989-1990, 2000-2012])
|
||||||
|
|
||||||
# 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
|
||||||
@@ -67,39 +67,36 @@ m4_define_default([b4_stack_depth_init], [200])
|
|||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
|
|
||||||
b4_percent_define_default([[api.pure]], [[false]])
|
b4_percent_define_default([[api.pure]], [[false]])
|
||||||
b4_percent_define_check_values([[[[api.pure]],
|
b4_define_flag_if([pure])
|
||||||
[[false]], [[true]], [[]], [[full]]]])
|
m4_define([b4_pure_flag],
|
||||||
|
[b4_percent_define_flag_if([[api.pure]], [[1]], [[0]])])
|
||||||
|
|
||||||
m4_define([b4_pure_flag], [[0]])
|
# b4_yacc_pure_if(IF-TRUE, IF-FALSE)
|
||||||
m4_case(b4_percent_define_get([[api.pure]]),
|
# ----------------------------------
|
||||||
[false], [m4_define([b4_pure_flag], [[0]])],
|
# Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
|
||||||
[true], [m4_define([b4_pure_flag], [[1]])],
|
m4_define([b4_yacc_pure_if],
|
||||||
[], [m4_define([b4_pure_flag], [[1]])],
|
[b4_pure_if([m4_ifset([b4_parse_param],
|
||||||
[full], [m4_define([b4_pure_flag], [[2]])])
|
[$1], [$2])],
|
||||||
|
[$2])])
|
||||||
|
|
||||||
m4_define([b4_pure_if],
|
|
||||||
[m4_case(b4_pure_flag,
|
|
||||||
[0], [$2],
|
|
||||||
[1], [$1],
|
|
||||||
[2], [$1])])
|
|
||||||
[m4_fatal([invalid api.pure value: ]$1)])])
|
|
||||||
|
|
||||||
# b4_yyerror_arg_loc_if(ARG)
|
|
||||||
# --------------------------
|
|
||||||
# Expand ARG iff yyerror is to be given a location as argument.
|
|
||||||
m4_define([b4_yyerror_arg_loc_if],
|
|
||||||
[b4_locations_if([m4_case(b4_pure_flag,
|
|
||||||
[1], [m4_ifset([b4_parse_param], [$1])],
|
|
||||||
[2], [$1])])])
|
|
||||||
|
|
||||||
# b4_yyerror_args
|
# b4_yyerror_args
|
||||||
# ---------------
|
# ---------------
|
||||||
# Arguments passed to yyerror: user args plus yylloc.
|
# Arguments passed to yyerror: user args plus yylloc.
|
||||||
m4_define([b4_yyerror_args],
|
m4_define([b4_yyerror_args],
|
||||||
[b4_yyerror_arg_loc_if([&yylloc, ])dnl
|
[b4_yacc_pure_if([b4_locations_if([&yylloc, ])])dnl
|
||||||
m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
|
m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_lex_param
|
||||||
|
# ------------
|
||||||
|
# Accumulate in b4_lex_param all the yylex arguments.
|
||||||
|
# b4_lex_param arrives quoted twice, but we want to keep only one level.
|
||||||
|
m4_define([b4_lex_param],
|
||||||
|
m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl
|
||||||
|
b4_locations_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl
|
||||||
|
m4_ifdef([b4_lex_param], b4_lex_param)))
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## Data Types. ##
|
## Data Types. ##
|
||||||
@@ -143,6 +140,7 @@ m4_define([b4_rhs_value],
|
|||||||
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
## Locations. ##
|
## Locations. ##
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
@@ -174,20 +172,12 @@ m4_define([b4_declare_scanner_communication_variables], [[
|
|||||||
/* The lookahead symbol. */
|
/* The lookahead symbol. */
|
||||||
int yychar;
|
int yychar;
|
||||||
|
|
||||||
]b4_pure_if([[
|
|
||||||
/* The semantic value of the lookahead symbol. */
|
/* The semantic value of the lookahead symbol. */
|
||||||
/* Default value used for initialization, for pacifying older GCCs
|
YYSTYPE yylval;]b4_locations_if([[
|
||||||
or non-GCC compilers. */
|
|
||||||
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
|
|
||||||
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);]b4_locations_if([[
|
|
||||||
|
|
||||||
/* Location data for the lookahead symbol. */
|
/* Location data for the lookahead symbol. */
|
||||||
static YYLTYPE yyloc_default]b4_yyloc_default[;
|
YYLTYPE yylloc;]])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;]])])
|
||||||
|
|
||||||
@@ -205,9 +195,9 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
|||||||
int yyerrstatus;
|
int yyerrstatus;
|
||||||
|
|
||||||
/* The stacks and their tools:
|
/* The stacks and their tools:
|
||||||
'yyss': related to states.
|
`yyss': related to states.
|
||||||
'yyvs': related to semantic values.]b4_locations_if([[
|
`yyvs': related to semantic values.]b4_locations_if([[
|
||||||
'yyls': related to locations.]])[
|
`yyls': related to locations.]])[
|
||||||
|
|
||||||
Refer to the stacks through separate pointers, to allow yyoverflow
|
Refer to the stacks through separate pointers, to allow yyoverflow
|
||||||
to reallocate them elsewhere. */
|
to reallocate them elsewhere. */
|
||||||
@@ -249,19 +239,19 @@ enum { YYPUSH_MORE = 4 };
|
|||||||
|
|
||||||
typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
|
typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
|
||||||
|
|
||||||
]b4_pull_if([b4_function_declare([b4_prefix[parse]], [[int]], b4_parse_param)
|
]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param)
|
||||||
])b4_function_declare([b4_prefix[push_parse]], [[int]],
|
])b4_c_function_decl([b4_prefix[push_parse]], [[int]],
|
||||||
[[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
|
[[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
|
||||||
[[[int pushed_char]], [[pushed_char]]],
|
[[[int pushed_char]], [[pushed_char]]],
|
||||||
[[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
|
[[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
|
||||||
[[b4_api_PREFIX[LTYPE *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
[[b4_api_PREFIX[LTYPE const *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))
|
b4_parse_param]))
|
||||||
b4_pull_if([b4_function_declare([b4_prefix[pull_parse]], [[int]],
|
b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]],
|
||||||
[[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
|
[[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))])
|
b4_parse_param]))])
|
||||||
b4_function_declare([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
|
b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
|
||||||
[[[void]], []])
|
[[[void]], []])
|
||||||
b4_function_declare([b4_prefix[pstate_delete]], [[void]],
|
b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
|
||||||
[[b4_prefix[pstate *ps]], [[ps]]])dnl
|
[[b4_prefix[pstate *ps]], [[ps]]])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -269,7 +259,13 @@ b4_function_declare([b4_prefix[pstate_delete]], [[void]],
|
|||||||
# -------------------
|
# -------------------
|
||||||
# When not the push parser.
|
# When not the push parser.
|
||||||
m4_define([b4_declare_yyparse_],
|
m4_define([b4_declare_yyparse_],
|
||||||
[b4_function_declare(b4_prefix[parse], [int], b4_parse_param)])
|
[[#ifdef YYPARSE_PARAM
|
||||||
|
]b4_c_function_decl(b4_prefix[parse], [int],
|
||||||
|
[[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[
|
||||||
|
#else /* ! YYPARSE_PARAM */
|
||||||
|
]b4_c_function_decl(b4_prefix[parse], [int], b4_parse_param)[
|
||||||
|
#endif /* ! YYPARSE_PARAM */]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_yyparse
|
# b4_declare_yyparse
|
||||||
@@ -299,7 +295,10 @@ m4_define([b4_shared_declarations],
|
|||||||
## Output files. ##
|
## Output files. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
b4_output_begin([b4_parser_file_name])
|
# We do want M4 expansion after # for CPP macros.
|
||||||
|
m4_changecom()
|
||||||
|
m4_divert_push(0)dnl
|
||||||
|
@output(b4_parser_file_name@)@
|
||||||
b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
||||||
|
|
||||||
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
||||||
@@ -328,12 +327,11 @@ m4_if(b4_api_prefix, [yy], [],
|
|||||||
#define yypstate ]b4_prefix[pstate]])[
|
#define yypstate ]b4_prefix[pstate]])[
|
||||||
#define yylex ]b4_prefix[lex
|
#define yylex ]b4_prefix[lex
|
||||||
#define yyerror ]b4_prefix[error
|
#define yyerror ]b4_prefix[error
|
||||||
#define yydebug ]b4_prefix[debug
|
|
||||||
#define yynerrs ]b4_prefix[nerrs
|
|
||||||
]]b4_pure_if([], [[
|
|
||||||
#define yylval ]b4_prefix[lval
|
#define yylval ]b4_prefix[lval
|
||||||
#define yychar ]b4_prefix[char]b4_locations_if([[
|
#define yychar ]b4_prefix[char
|
||||||
#define yylloc ]b4_prefix[lloc]])]))[
|
#define yydebug ]b4_prefix[debug
|
||||||
|
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
||||||
|
#define yylloc ]b4_prefix[lloc]])])[
|
||||||
|
|
||||||
/* Copy the first part of user declarations. */
|
/* Copy the first part of user declarations. */
|
||||||
]b4_user_pre_prologue[
|
]b4_user_pre_prologue[
|
||||||
@@ -348,11 +346,9 @@ m4_if(b4_api_prefix, [yy], [],
|
|||||||
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]m4_ifval(m4_quote(b4_spec_defines_file),
|
/* In a future release of Bison, this section will be replaced
|
||||||
[[/* In a future release of Bison, this section will be replaced
|
|
||||||
by #include "@basename(]b4_spec_defines_file[@)". */
|
by #include "@basename(]b4_spec_defines_file[@)". */
|
||||||
]])dnl
|
]b4_shared_declarations[
|
||||||
b4_shared_declarations[
|
|
||||||
|
|
||||||
/* Copy the second part of user declarations. */
|
/* Copy the second part of user declarations. */
|
||||||
]b4_user_post_prologue
|
]b4_user_post_prologue
|
||||||
@@ -370,8 +366,10 @@ typedef unsigned char yytype_uint8;
|
|||||||
|
|
||||||
#ifdef YYTYPE_INT8
|
#ifdef YYTYPE_INT8
|
||||||
typedef YYTYPE_INT8 yytype_int8;
|
typedef YYTYPE_INT8 yytype_int8;
|
||||||
#else
|
#elif ]b4_c_modern[
|
||||||
typedef signed char yytype_int8;
|
typedef signed char yytype_int8;
|
||||||
|
#else
|
||||||
|
typedef short int yytype_int8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef YYTYPE_UINT16
|
#ifdef YYTYPE_UINT16
|
||||||
@@ -391,7 +389,7 @@ typedef short int yytype_int16;
|
|||||||
# define YYSIZE_T __SIZE_TYPE__
|
# define YYSIZE_T __SIZE_TYPE__
|
||||||
# elif defined size_t
|
# elif defined size_t
|
||||||
# define YYSIZE_T size_t
|
# define YYSIZE_T size_t
|
||||||
# elif ! defined YYSIZE_T
|
# elif ! defined YYSIZE_T && ]b4_c_modern[
|
||||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YYSIZE_T size_t
|
# define YYSIZE_T size_t
|
||||||
# else
|
# else
|
||||||
@@ -405,15 +403,30 @@ typedef short int yytype_int16;
|
|||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||||
# if ENABLE_NLS
|
# if ENABLE_NLS
|
||||||
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
|
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifndef YY_
|
# ifndef YY_
|
||||||
# define YY_(Msgid) Msgid
|
# define YY_(msgid) msgid
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_attribute_define[
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
|
#if ! defined lint || defined __GNUC__
|
||||||
|
# define YYUSE(e) ((void) (e))
|
||||||
|
#else
|
||||||
|
# define YYUSE(e) /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Identity function, used to suppress warnings about constant conditions. */
|
||||||
|
#ifndef lint
|
||||||
|
# define YYID(n) (n)
|
||||||
|
#else
|
||||||
|
]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
|
||||||
|
{
|
||||||
|
return yyi;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[
|
#if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[
|
||||||
|
|
||||||
@@ -433,7 +446,7 @@ b4_push_if([], [b4_lac_if([], [[
|
|||||||
# define alloca _alloca
|
# define alloca _alloca
|
||||||
# else
|
# else
|
||||||
# define YYSTACK_ALLOC alloca
|
# define YYSTACK_ALLOC alloca
|
||||||
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
|
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && ]b4_c_modern[
|
||||||
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
|
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
|
||||||
# ifndef EXIT_SUCCESS
|
# ifndef EXIT_SUCCESS
|
||||||
@@ -445,8 +458,8 @@ b4_push_if([], [b4_lac_if([], [[
|
|||||||
# endif]])])[
|
# endif]])])[
|
||||||
|
|
||||||
# ifdef YYSTACK_ALLOC
|
# ifdef YYSTACK_ALLOC
|
||||||
/* Pacify GCC's 'empty if-body' warning. */
|
/* Pacify GCC's `empty if-body' warning. */
|
||||||
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
|
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
|
||||||
# ifndef YYSTACK_ALLOC_MAXIMUM
|
# ifndef YYSTACK_ALLOC_MAXIMUM
|
||||||
/* The OS might guarantee only one guard page at the bottom of the stack,
|
/* The OS might guarantee only one guard page at the bottom of the stack,
|
||||||
and a page size can be as small as 4096 bytes. So we cannot safely
|
and a page size can be as small as 4096 bytes. So we cannot safely
|
||||||
@@ -470,13 +483,13 @@ b4_push_if([], [b4_lac_if([], [[
|
|||||||
# endif
|
# endif
|
||||||
# ifndef YYMALLOC
|
# ifndef YYMALLOC
|
||||||
# define YYMALLOC malloc
|
# define YYMALLOC malloc
|
||||||
# if ! defined malloc && ! defined EXIT_SUCCESS
|
# if ! defined malloc && ! defined EXIT_SUCCESS && ]b4_c_modern[
|
||||||
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
|
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifndef YYFREE
|
# ifndef YYFREE
|
||||||
# define YYFREE free
|
# define YYFREE free
|
||||||
# if ! defined free && ! defined EXIT_SUCCESS
|
# if ! defined free && ! defined EXIT_SUCCESS && ]b4_c_modern[
|
||||||
void free (void *); /* INFRINGES ON USER NAME SPACE */
|
void free (void *); /* INFRINGES ON USER NAME SPACE */
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@@ -527,7 +540,7 @@ union yyalloc
|
|||||||
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
||||||
yyptr += yynewbytes / sizeof (*yyptr); \
|
yyptr += yynewbytes / sizeof (*yyptr); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (YYID (0))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -546,7 +559,7 @@ union yyalloc
|
|||||||
for (yyi = 0; yyi < (Count); yyi++) \
|
for (yyi = 0; yyi < (Count); yyi++) \
|
||||||
(Dst)[yyi] = (Src)[yyi]; \
|
(Dst)[yyi] = (Src)[yyi]; \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (YYID (0))
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif /* !YYCOPY_NEEDED */
|
#endif /* !YYCOPY_NEEDED */
|
||||||
@@ -582,7 +595,7 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
|||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
]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.])[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
|
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
|
||||||
@@ -605,13 +618,13 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
|||||||
|
|
||||||
#define YYPACT_NINF ]b4_pact_ninf[
|
#define YYPACT_NINF ]b4_pact_ninf[
|
||||||
|
|
||||||
#define yypact_value_is_default(Yystate) \
|
#define yypact_value_is_default(yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[
|
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
||||||
|
|
||||||
#define YYTABLE_NINF ]b4_table_ninf[
|
#define YYTABLE_NINF ]b4_table_ninf[
|
||||||
|
|
||||||
#define yytable_value_is_error(Yytable_value) \
|
#define yytable_value_is_error(yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
]b4_parser_tables_define[
|
||||||
|
|
||||||
@@ -625,6 +638,21 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
|||||||
#define YYERROR goto yyerrorlab
|
#define YYERROR goto yyerrorlab
|
||||||
|
|
||||||
|
|
||||||
|
/* Like YYERROR except do call yyerror. This remains here temporarily
|
||||||
|
to ease the transition to the new meaning of YYERROR, for GCC.
|
||||||
|
Once GCC version 2 has supplanted version 1, this can go. However,
|
||||||
|
YYFAIL appears to be in use. Nevertheless, it is formally deprecated
|
||||||
|
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
|
||||||
|
discussed. */
|
||||||
|
|
||||||
|
#define YYFAIL goto yyerrlab
|
||||||
|
#if defined YYFAIL
|
||||||
|
/* This is here to suppress warnings from the GCC cpp's
|
||||||
|
-Wunused-macros. Normally we don't worry about that warning, but
|
||||||
|
some users do, and we want to make it easy for users to remove
|
||||||
|
YYFAIL uses, which will produce warnings from Bison 2.5. */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define YYRECOVERING() (!!yyerrstatus)
|
#define YYRECOVERING() (!!yyerrstatus)
|
||||||
|
|
||||||
#define YYBACKUP(Token, Value) \
|
#define YYBACKUP(Token, Value) \
|
||||||
@@ -643,16 +671,46 @@ do \
|
|||||||
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
|
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
|
||||||
YYERROR; \
|
YYERROR; \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (YYID (0))
|
||||||
|
|
||||||
|
|
||||||
/* Error token number */
|
|
||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
#define YYERRCODE 256
|
#define YYERRCODE 256
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
||||||
]])[
|
|
||||||
|
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
||||||
|
This macro was not mandated originally: define only if we know
|
||||||
|
we won't break user code: when these are the locations we know. */
|
||||||
|
|
||||||
|
#ifndef YY_LOCATION_PRINT
|
||||||
|
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) \
|
||||||
|
fprintf (File, "%d.%d-%d.%d", \
|
||||||
|
(Loc).first_line, (Loc).first_column, \
|
||||||
|
(Loc).last_line, (Loc).last_column)
|
||||||
|
# else
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
# endif
|
||||||
|
#endif]], [[
|
||||||
|
|
||||||
|
|
||||||
|
/* This macro is provided for backward compatibility. */
|
||||||
|
|
||||||
|
#ifndef YY_LOCATION_PRINT
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
#endif]])[
|
||||||
|
|
||||||
|
|
||||||
|
/* YYLEX -- calling `yylex' with the right arguments. */
|
||||||
|
|
||||||
|
#ifdef YYLEX_PARAM
|
||||||
|
# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
|
||||||
|
#else
|
||||||
|
# define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Enable debugging if requested. */
|
/* Enable debugging if requested. */
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -666,9 +724,7 @@ while (0)
|
|||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
YYFPRINTF Args; \
|
YYFPRINTF Args; \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
|
|
||||||
]b4_yy_location_print_define[
|
|
||||||
|
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
||||||
do { \
|
do { \
|
||||||
@@ -679,16 +735,16 @@ do { \
|
|||||||
Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
|
Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
|
||||||
YYFPRINTF (stderr, "\n"); \
|
YYFPRINTF (stderr, "\n"); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
|
|
||||||
]b4_yy_symbol_print_define[
|
]b4_yy_symbol_print_generate([b4_c_function_def])[
|
||||||
|
|
||||||
/*------------------------------------------------------------------.
|
/*------------------------------------------------------------------.
|
||||||
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
|
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
|
||||||
| TOP (included). |
|
| TOP (included). |
|
||||||
`------------------------------------------------------------------*/
|
`------------------------------------------------------------------*/
|
||||||
|
|
||||||
]b4_function_define([yy_stack_print], [static void],
|
]b4_c_function_def([yy_stack_print], [static void],
|
||||||
[[yytype_int16 *yybottom], [yybottom]],
|
[[yytype_int16 *yybottom], [yybottom]],
|
||||||
[[yytype_int16 *yytop], [yytop]])[
|
[[yytype_int16 *yytop], [yytop]])[
|
||||||
{
|
{
|
||||||
@@ -705,14 +761,14 @@ do { \
|
|||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_stack_print ((Bottom), (Top)); \
|
yy_stack_print ((Bottom), (Top)); \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------.
|
/*------------------------------------------------.
|
||||||
| Report that the YYRULE is going to be reduced. |
|
| Report that the YYRULE is going to be reduced. |
|
||||||
`------------------------------------------------*/
|
`------------------------------------------------*/
|
||||||
|
|
||||||
]b4_function_define([yy_reduce_print], [static void],
|
]b4_c_function_def([yy_reduce_print], [static void],
|
||||||
[[yytype_int16 *yyssp], [yyssp]],
|
[[yytype_int16 *yyssp], [yyssp]],
|
||||||
[[YYSTYPE *yyvsp], [yyvsp]],
|
[[YYSTYPE *yyvsp], [yyvsp]],
|
||||||
b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
|
b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
|
||||||
@@ -741,7 +797,7 @@ do { \
|
|||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_reduce_print (yyssp, yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
|
yy_reduce_print (yyssp, yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
|
|
||||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||||
multiple parsers can coexist. */
|
multiple parsers can coexist. */
|
||||||
@@ -875,7 +931,7 @@ do { \
|
|||||||
goto yyerrlab; \
|
goto yyerrlab; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
|
|
||||||
/* Discard any previous initial lookahead context because of Event,
|
/* Discard any previous initial lookahead context because of Event,
|
||||||
which may be a lookahead change or an invalidation of the currently
|
which may be a lookahead change or an invalidation of the currently
|
||||||
@@ -898,7 +954,7 @@ do { \
|
|||||||
Event "\n"); \
|
Event "\n"); \
|
||||||
yy_lac_established = 0; \
|
yy_lac_established = 0; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (YYID (0))
|
||||||
#else
|
#else
|
||||||
# define YY_LAC_DISCARD(Event) yy_lac_established = 0
|
# define YY_LAC_DISCARD(Event) yy_lac_established = 0
|
||||||
#endif
|
#endif
|
||||||
@@ -1014,7 +1070,7 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
|||||||
# define yystrlen strlen
|
# define yystrlen strlen
|
||||||
# else
|
# else
|
||||||
/* Return the length of YYSTR. */
|
/* Return the length of YYSTR. */
|
||||||
]b4_function_define([yystrlen], [static YYSIZE_T],
|
]b4_c_function_def([yystrlen], [static YYSIZE_T],
|
||||||
[[const char *yystr], [yystr]])[
|
[[const char *yystr], [yystr]])[
|
||||||
{
|
{
|
||||||
YYSIZE_T yylen;
|
YYSIZE_T yylen;
|
||||||
@@ -1031,7 +1087,7 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
|||||||
# else
|
# else
|
||||||
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
|
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
|
||||||
YYDEST. */
|
YYDEST. */
|
||||||
]b4_function_define([yystpcpy], [static char *],
|
]b4_c_function_def([yystpcpy], [static char *],
|
||||||
[[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[
|
[[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[
|
||||||
{
|
{
|
||||||
char *yyd = yydest;
|
char *yyd = yydest;
|
||||||
@@ -1110,6 +1166,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
{
|
{
|
||||||
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
||||||
YYSIZE_T yysize = yysize0;
|
YYSIZE_T yysize = yysize0;
|
||||||
|
YYSIZE_T yysize1;
|
||||||
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_NULL;
|
||||||
@@ -1120,6 +1177,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
|
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
|
- Assume YYFAIL is not used. It's too flawed to consider. See
|
||||||
|
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
||||||
|
for details. YYERROR is fine as it does not invoke this
|
||||||
|
function.
|
||||||
- If this state is a consistent state with a default action, then
|
- If this state is a consistent state with a default action, then
|
||||||
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
|
||||||
@@ -1186,13 +1247,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyarg[yycount++] = yytname[yyx];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
{
|
yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
||||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
if (! (yysize <= yysize1
|
||||||
if (! (yysize <= yysize1
|
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
return 2;
|
||||||
return 2;
|
yysize = yysize1;
|
||||||
yysize = yysize1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}]b4_lac_if([[
|
}]b4_lac_if([[
|
||||||
# if ]b4_api_PREFIX[DEBUG
|
# if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -1216,12 +1275,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
# undef YYCASE_
|
# undef YYCASE_
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
yysize1 = yysize + yystrlen (yyformat);
|
||||||
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
|
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
return 2;
|
||||||
return 2;
|
yysize = yysize1;
|
||||||
yysize = yysize1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*yymsg_alloc < yysize)
|
if (*yymsg_alloc < yysize)
|
||||||
{
|
{
|
||||||
@@ -1254,7 +1311,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
#endif /* YYERROR_VERBOSE */
|
#endif /* YYERROR_VERBOSE */
|
||||||
|
|
||||||
]b4_yydestruct_define[
|
]b4_yydestruct_generate([b4_c_function_def])[
|
||||||
|
|
||||||
]b4_pure_if([], [
|
]b4_pure_if([], [
|
||||||
|
|
||||||
@@ -1269,13 +1326,13 @@ struct yypstate
|
|||||||
|
|
||||||
static char yypstate_allocated = 0;]])b4_pull_if([
|
static char yypstate_allocated = 0;]])b4_pull_if([
|
||||||
|
|
||||||
b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
||||||
{
|
{
|
||||||
return yypull_parse (YY_NULL]m4_ifset([b4_parse_param],
|
return yypull_parse (YY_NULL]m4_ifset([b4_parse_param],
|
||||||
[[, ]b4_args(b4_parse_param)])[);
|
[[, ]b4_c_args(b4_parse_param)])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_function_define([[yypull_parse]], [[int]],
|
]b4_c_function_def([[yypull_parse]], [[int]],
|
||||||
[[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
|
[[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))[
|
b4_parse_param]))[
|
||||||
{
|
{
|
||||||
@@ -1283,8 +1340,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
yypstate *yyps_local;]b4_pure_if([[
|
yypstate *yyps_local;]b4_pure_if([[
|
||||||
int yychar;
|
int yychar;
|
||||||
YYSTYPE yylval;]b4_locations_if([[
|
YYSTYPE yylval;]b4_locations_if([[
|
||||||
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
YYLTYPE yylloc;]])])[
|
||||||
YYLTYPE yylloc = yyloc_default;]])])[
|
|
||||||
if (yyps)
|
if (yyps)
|
||||||
yyps_local = yyps;
|
yyps_local = yyps;
|
||||||
else
|
else
|
||||||
@@ -1299,9 +1355,9 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
yychar = ]b4_lex[;
|
yychar = YYLEX;
|
||||||
yystatus =
|
yystatus =
|
||||||
yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
|
yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])[);
|
||||||
} while (yystatus == YYPUSH_MORE);
|
} while (yystatus == YYPUSH_MORE);
|
||||||
if (!yyps)
|
if (!yyps)
|
||||||
yypstate_delete (yyps_local);
|
yypstate_delete (yyps_local);
|
||||||
@@ -1309,7 +1365,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
/* Initialize the parser data structure. */
|
/* Initialize the parser data structure. */
|
||||||
]b4_function_define([[yypstate_new]], [[yypstate *]])[
|
]b4_c_function_def([[yypstate_new]], [[yypstate *]])[
|
||||||
{
|
{
|
||||||
yypstate *yyps;]b4_pure_if([], [[
|
yypstate *yyps;]b4_pure_if([], [[
|
||||||
if (yypstate_allocated)
|
if (yypstate_allocated)
|
||||||
@@ -1322,7 +1378,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
return yyps;
|
return yyps;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_function_define([[yypstate_delete]], [[void]],
|
]b4_c_function_def([[yypstate_delete]], [[void]],
|
||||||
[[[yypstate *yyps]], [[yyps]]])[
|
[[[yypstate *yyps]], [[yyps]]])[
|
||||||
{
|
{
|
||||||
#ifndef yyoverflow
|
#ifndef yyoverflow
|
||||||
@@ -1360,11 +1416,11 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
| yypush_parse. |
|
| yypush_parse. |
|
||||||
`---------------*/
|
`---------------*/
|
||||||
|
|
||||||
]b4_function_define([[yypush_parse]], [[int]],
|
]b4_c_function_def([[yypush_parse]], [[int]],
|
||||||
[[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
|
[[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
|
||||||
[[[int yypushed_char]], [[yypushed_char]]],
|
[[[int yypushed_char]], [[yypushed_char]]],
|
||||||
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
|
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
|
||||||
[[[YYLTYPE *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
[[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))], [[
|
b4_parse_param]))], [[
|
||||||
|
|
||||||
|
|
||||||
@@ -1372,7 +1428,12 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
| yyparse. |
|
| yyparse. |
|
||||||
`----------*/
|
`----------*/
|
||||||
|
|
||||||
]b4_function_define([yyparse], [int], b4_parse_param)])[
|
#ifdef YYPARSE_PARAM
|
||||||
|
]b4_c_function_def([yyparse], [int],
|
||||||
|
[[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[
|
||||||
|
#else /* ! YYPARSE_PARAM */
|
||||||
|
]b4_c_function_def([yyparse], [int], b4_parse_param)[
|
||||||
|
#endif]])[
|
||||||
{]b4_pure_if([b4_declare_scanner_communication_variables
|
{]b4_pure_if([b4_declare_scanner_communication_variables
|
||||||
])b4_push_if([b4_pure_if([], [[
|
])b4_push_if([b4_pure_if([], [[
|
||||||
int yypushed_char = yychar;
|
int yypushed_char = yychar;
|
||||||
@@ -1385,7 +1446,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
int yyn;
|
int yyn;
|
||||||
int yyresult;
|
int yyresult;
|
||||||
/* Lookahead token as an internal (translated) token number. */
|
/* Lookahead token as an internal (translated) token number. */
|
||||||
int yytoken = 0;
|
int yytoken;
|
||||||
/* The variables used to return semantic value and location from the
|
/* The variables used to return semantic value and location from the
|
||||||
action routines. */
|
action routines. */
|
||||||
YYSTYPE yyval;]b4_locations_if([[
|
YYSTYPE yyval;]b4_locations_if([[
|
||||||
@@ -1410,9 +1471,10 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
goto yyread_pushed_token;
|
goto yyread_pushed_token;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
yyssp = yyss = yyssa;
|
yytoken = 0;
|
||||||
yyvsp = yyvs = yyvsa;]b4_locations_if([[
|
yyss = yyssa;
|
||||||
yylsp = yyls = yylsa;]])[
|
yyvs = yyvsa;]b4_locations_if([[
|
||||||
|
yyls = yylsa;]])[
|
||||||
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
||||||
|
|
||||||
yyes = yyesa;
|
yyes = yyesa;
|
||||||
@@ -1426,17 +1488,32 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
yyerrstatus = 0;
|
yyerrstatus = 0;
|
||||||
yynerrs = 0;
|
yynerrs = 0;
|
||||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||||
]m4_ifdef([b4_initial_action], [
|
|
||||||
b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [],
|
/* Initialize stack pointers.
|
||||||
[b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl
|
Waste one element of value and location stack
|
||||||
|
so that they stay on the same level as the state stack.
|
||||||
|
The wasted elements are never initialized. */
|
||||||
|
yyssp = yyss;
|
||||||
|
yyvsp = yyvs;]b4_locations_if([[
|
||||||
|
yylsp = yyls;
|
||||||
|
|
||||||
|
#if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
|
/* Initialize the default location before parsing starts. */
|
||||||
|
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
||||||
|
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
||||||
|
#endif]])
|
||||||
|
m4_ifdef([b4_initial_action],[
|
||||||
|
m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl
|
||||||
|
m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl
|
||||||
/* User initialization code. */
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef[]dnl
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
|
m4_popdef([b4_at_dollar])])dnl
|
||||||
m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
|
m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
|
||||||
]])])dnl
|
|
||||||
b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])[;
|
|
||||||
]])dnl
|
]])dnl
|
||||||
[ goto yysetstate;
|
m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
||||||
|
]])[
|
||||||
|
goto yysetstate;
|
||||||
|
|
||||||
/*------------------------------------------------------------.
|
/*------------------------------------------------------------.
|
||||||
| yynewstate -- Push a new state, which is found in yystate. |
|
| yynewstate -- Push a new state, which is found in yystate. |
|
||||||
@@ -1560,7 +1637,7 @@ yyread_pushed_token:]])[
|
|||||||
yylval = *yypushed_val;]b4_locations_if([[
|
yylval = *yypushed_val;]b4_locations_if([[
|
||||||
if (yypushed_loc)
|
if (yypushed_loc)
|
||||||
yylloc = *yypushed_loc;]])])], [[
|
yylloc = *yypushed_loc;]])])], [[
|
||||||
yychar = ]b4_lex[;]])[
|
yychar = YYLEX;]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yychar <= YYEOF)
|
if (yychar <= YYEOF)
|
||||||
@@ -1606,9 +1683,7 @@ yyread_pushed_token:]])[
|
|||||||
YY_LAC_DISCARD ("shift");]])[
|
YY_LAC_DISCARD ("shift");]])[
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
|
||||||
*++yyvsp = yylval;
|
*++yyvsp = yylval;
|
||||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
|
||||||
]b4_locations_if([ *++yylsp = yylloc;])[
|
]b4_locations_if([ *++yylsp = yylloc;])[
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
@@ -1631,7 +1706,7 @@ yyreduce:
|
|||||||
yylen = yyr2[yyn];
|
yylen = yyr2[yyn];
|
||||||
|
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
'$$ = $1'.
|
`$$ = $1'.
|
||||||
|
|
||||||
Otherwise, the following line sets YYVAL to garbage.
|
Otherwise, the following line sets YYVAL to garbage.
|
||||||
This behavior is undocumented and Bison
|
This behavior is undocumented and Bison
|
||||||
@@ -1679,7 +1754,7 @@ yyreduce:
|
|||||||
*++yyvsp = yyval;]b4_locations_if([
|
*++yyvsp = yyval;]b4_locations_if([
|
||||||
*++yylsp = yyloc;])[
|
*++yylsp = yyloc;])[
|
||||||
|
|
||||||
/* Now 'shift' the result of the reduction. Determine what state
|
/* Now `shift' the result of the reduction. Determine what state
|
||||||
that goes to, based on the state we popped back to and the rule
|
that goes to, based on the state we popped back to and the rule
|
||||||
number reduced by. */
|
number reduced by. */
|
||||||
|
|
||||||
@@ -1694,9 +1769,9 @@ yyreduce:
|
|||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------.
|
/*------------------------------------.
|
||||||
| yyerrlab -- here on detecting error. |
|
| yyerrlab -- here on detecting error |
|
||||||
`--------------------------------------*/
|
`------------------------------------*/
|
||||||
yyerrlab:
|
yyerrlab:
|
||||||
/* Make sure we have latest lookahead translation. See comments at
|
/* Make sure we have latest lookahead translation. See comments at
|
||||||
user semantic actions for why this is necessary. */
|
user semantic actions for why this is necessary. */
|
||||||
@@ -1783,7 +1858,7 @@ yyerrorlab:
|
|||||||
goto yyerrorlab;
|
goto yyerrorlab;
|
||||||
|
|
||||||
]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen];
|
]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen];
|
||||||
]])[ /* Do not reclaim the symbols of the rule whose action triggered
|
]])[ /* Do not reclaim the symbols of the rule which action triggered
|
||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
YYPOPSTACK (yylen);
|
YYPOPSTACK (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
@@ -1828,9 +1903,7 @@ yyerrlab1:
|
|||||||
current lookahead token, the shift below will for sure. */
|
current lookahead token, the shift below will for sure. */
|
||||||
YY_LAC_DISCARD ("error recovery");]])[
|
YY_LAC_DISCARD ("error recovery");]])[
|
||||||
|
|
||||||
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
|
||||||
*++yyvsp = yylval;
|
*++yyvsp = yylval;
|
||||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
yyerror_range[2] = yylloc;
|
yyerror_range[2] = yylloc;
|
||||||
/* Using YYLLOC is tempting, but would change the location of
|
/* Using YYLLOC is tempting, but would change the location of
|
||||||
@@ -1878,7 +1951,7 @@ yyreturn:
|
|||||||
yydestruct ("Cleanup: discarding lookahead",
|
yydestruct ("Cleanup: discarding lookahead",
|
||||||
yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
|
yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
|
||||||
}
|
}
|
||||||
/* Do not reclaim the symbols of the rule whose action triggered
|
/* Do not reclaim the symbols of the rule which action triggered
|
||||||
this YYABORT or YYACCEPT. */
|
this YYABORT or YYACCEPT. */
|
||||||
YYPOPSTACK (yylen);
|
YYPOPSTACK (yylen);
|
||||||
YY_STACK_PRINT (yyss, yyssp);
|
YY_STACK_PRINT (yyss, yyssp);
|
||||||
@@ -1901,15 +1974,16 @@ yypushreturn:]])[
|
|||||||
if (yymsg != yymsgbuf)
|
if (yymsg != yymsgbuf)
|
||||||
YYSTACK_FREE (yymsg);
|
YYSTACK_FREE (yymsg);
|
||||||
#endif
|
#endif
|
||||||
return yyresult;
|
/* Make sure YYID is used. */
|
||||||
|
return YYID (yyresult);
|
||||||
}
|
}
|
||||||
]b4_epilogue[]dnl
|
|
||||||
b4_output_end()
|
|
||||||
|
|
||||||
|
]b4_epilogue[]dnl
|
||||||
b4_defines_if(
|
b4_defines_if(
|
||||||
[b4_output_begin([b4_spec_defines_file])[
|
[@output(b4_spec_defines_file@)@
|
||||||
]b4_copyright([Bison interface for Yacc-like parsers in C])[
|
b4_copyright([Bison interface for Yacc-like parsers in C])[
|
||||||
|
|
||||||
]b4_shared_declarations[
|
]b4_shared_declarations[
|
||||||
]b4_output_end()
|
]])dnl b4_defines_if
|
||||||
])# b4_defines_if
|
m4_divert_pop(0)
|
||||||
|
m4_popdef([b4_copyright_years])
|
||||||
|
|||||||
@@ -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-2012 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
@@ -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-2012 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
@@ -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-2012 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
@@ -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-2012 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
@@ -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-2012 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
@@ -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-2012 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
@@ -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-2012 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
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
## Copyright (C) 2008-2012 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
@@ -1,6 +1,6 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
Copyright (C) 2005-2012 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
@@ -1,6 +1,6 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
Copyright (C) 2005-2012 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
@@ -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-2012 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
@@ -1,3 +1,4 @@
|
|||||||
|
/*.info*
|
||||||
/*~
|
/*~
|
||||||
/.dirstamp
|
/.dirstamp
|
||||||
/bison.1
|
/bison.1
|
||||||
@@ -8,7 +9,6 @@
|
|||||||
/bison.fn
|
/bison.fn
|
||||||
/bison.help
|
/bison.help
|
||||||
/bison.html
|
/bison.html
|
||||||
/bison.info
|
|
||||||
/bison.ky
|
/bison.ky
|
||||||
/bison.log
|
/bison.log
|
||||||
/bison.pdf
|
/bison.pdf
|
||||||
|
|||||||
+58
-125
@@ -1,4 +1,4 @@
|
|||||||
# Doxyfile 1.8.3
|
# Doxyfile 1.8.0
|
||||||
|
|
||||||
# This file describes the settings to be used by the documentation system
|
# This file describes the settings to be used by the documentation system
|
||||||
# doxygen (www.doxygen.org) for a project.
|
# doxygen (www.doxygen.org) for a project.
|
||||||
@@ -38,8 +38,7 @@ PROJECT_NUMBER = "@PACKAGE_VERSION@"
|
|||||||
# for a project that appears at the top of each page and should give viewer
|
# for a project that appears at the top of each page and should give viewer
|
||||||
# a quick idea about the purpose of the project. Keep the description short.
|
# a quick idea about the purpose of the project. Keep the description short.
|
||||||
|
|
||||||
PROJECT_BRIEF = "Generate a deterministic LR or generalized LR (GLR) \
|
PROJECT_BRIEF =
|
||||||
parser employing LALR(1), IELR(1), or canonical LR(1) parser tables."
|
|
||||||
|
|
||||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is
|
# With the PROJECT_LOGO tag one can specify an logo or icon that is
|
||||||
# included in the documentation. The maximum height of the logo should not
|
# included in the documentation. The maximum height of the logo should not
|
||||||
@@ -127,9 +126,7 @@ FULL_PATH_NAMES = NO
|
|||||||
# only done if one of the specified strings matches the left-hand part of
|
# only done if one of the specified strings matches the left-hand part of
|
||||||
# the path. The tag can be used to show relative paths in the file list.
|
# the path. The tag can be used to show relative paths in the file list.
|
||||||
# If left blank the directory from which doxygen is run is used as the
|
# If left blank the directory from which doxygen is run is used as the
|
||||||
# path to strip. Note that you specify absolute paths here, but also
|
# path to strip.
|
||||||
# relative paths, which will be relative from the directory where doxygen is
|
|
||||||
# started.
|
|
||||||
|
|
||||||
STRIP_FROM_PATH =
|
STRIP_FROM_PATH =
|
||||||
|
|
||||||
@@ -232,15 +229,14 @@ OPTIMIZE_FOR_FORTRAN = NO
|
|||||||
OPTIMIZE_OUTPUT_VHDL = NO
|
OPTIMIZE_OUTPUT_VHDL = NO
|
||||||
|
|
||||||
# Doxygen selects the parser to use depending on the extension of the files it
|
# Doxygen selects the parser to use depending on the extension of the files it
|
||||||
# parses. With this tag you can assign which parser to use for a given
|
# parses. With this tag you can assign which parser to use for a given extension.
|
||||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
# Doxygen has a built-in mapping, but you can override or extend it using this
|
||||||
# using this tag. The format is ext=language, where ext is a file extension,
|
# tag. The format is ext=language, where ext is a file extension, and language
|
||||||
# and language is one of the parsers supported by doxygen: IDL, Java,
|
# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
|
||||||
# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
|
# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
|
||||||
# C++. For instance to make doxygen treat .inc files as Fortran files (default
|
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
|
||||||
# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
|
# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
|
||||||
# that for custom extensions you also need to set FILE_PATTERNS otherwise the
|
# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
|
||||||
# files are not read by doxygen.
|
|
||||||
|
|
||||||
EXTENSION_MAPPING =
|
EXTENSION_MAPPING =
|
||||||
|
|
||||||
@@ -253,13 +249,6 @@ EXTENSION_MAPPING =
|
|||||||
|
|
||||||
MARKDOWN_SUPPORT = YES
|
MARKDOWN_SUPPORT = YES
|
||||||
|
|
||||||
# When enabled doxygen tries to link words that correspond to documented classes,
|
|
||||||
# or namespaces to their corresponding documentation. Such a link can be
|
|
||||||
# prevented in individual cases by by putting a % sign in front of the word or
|
|
||||||
# globally by setting AUTOLINK_SUPPORT to NO.
|
|
||||||
|
|
||||||
AUTOLINK_SUPPORT = YES
|
|
||||||
|
|
||||||
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
|
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
|
||||||
# to include (a tag file for) the STL sources as input, then you should
|
# to include (a tag file for) the STL sources as input, then you should
|
||||||
# set this tag to YES in order to let doxygen match functions declarations and
|
# set this tag to YES in order to let doxygen match functions declarations and
|
||||||
@@ -280,10 +269,10 @@ CPP_CLI_SUPPORT = NO
|
|||||||
|
|
||||||
SIP_SUPPORT = NO
|
SIP_SUPPORT = NO
|
||||||
|
|
||||||
# For Microsoft's IDL there are propget and propput attributes to indicate
|
# For Microsoft's IDL there are propget and propput attributes to indicate getter
|
||||||
# getter and setter methods for a property. Setting this option to YES (the
|
# and setter methods for a property. Setting this option to YES (the default)
|
||||||
# default) will make doxygen replace the get and set methods by a property in
|
# will make doxygen replace the get and set methods by a property in the
|
||||||
# the documentation. This will only work if the methods are indeed getting or
|
# documentation. This will only work if the methods are indeed getting or
|
||||||
# setting a simple type. If this is not the case, or you want to show the
|
# setting a simple type. If this is not the case, or you want to show the
|
||||||
# methods anyway, you should set this option to NO.
|
# methods anyway, you should set this option to NO.
|
||||||
|
|
||||||
@@ -373,8 +362,7 @@ EXTRACT_ALL = YES
|
|||||||
|
|
||||||
EXTRACT_PRIVATE = YES
|
EXTRACT_PRIVATE = YES
|
||||||
|
|
||||||
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
|
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation.
|
||||||
# scope will be included in the documentation.
|
|
||||||
|
|
||||||
EXTRACT_PACKAGE = NO
|
EXTRACT_PACKAGE = NO
|
||||||
|
|
||||||
@@ -545,8 +533,7 @@ GENERATE_BUGLIST = YES
|
|||||||
GENERATE_DEPRECATEDLIST= YES
|
GENERATE_DEPRECATEDLIST= YES
|
||||||
|
|
||||||
# The ENABLED_SECTIONS tag can be used to enable conditional
|
# The ENABLED_SECTIONS tag can be used to enable conditional
|
||||||
# documentation sections, marked by \if section-label ... \endif
|
# documentation sections, marked by \if sectionname ... \endif.
|
||||||
# and \cond section-label ... \endcond blocks.
|
|
||||||
|
|
||||||
ENABLED_SECTIONS =
|
ENABLED_SECTIONS =
|
||||||
|
|
||||||
@@ -566,6 +553,12 @@ MAX_INITIALIZER_LINES = 30
|
|||||||
|
|
||||||
SHOW_USED_FILES = YES
|
SHOW_USED_FILES = YES
|
||||||
|
|
||||||
|
# If the sources in your project are distributed over multiple directories
|
||||||
|
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
|
||||||
|
# in the documentation. The default is NO.
|
||||||
|
|
||||||
|
SHOW_DIRECTORIES = NO
|
||||||
|
|
||||||
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
|
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
|
||||||
# This will remove the Files entry from the Quick Index and from the
|
# This will remove the Files entry from the Quick Index and from the
|
||||||
# Folder Tree View (if specified). The default is YES.
|
# Folder Tree View (if specified). The default is YES.
|
||||||
@@ -591,7 +584,7 @@ FILE_VERSION_FILTER =
|
|||||||
|
|
||||||
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
|
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
|
||||||
# by doxygen. The layout file controls the global structure of the generated
|
# by doxygen. The layout file controls the global structure of the generated
|
||||||
# output files in an output format independent way. To create the layout file
|
# output files in an output format independent way. The create the layout file
|
||||||
# that represents doxygen's defaults, run doxygen with the -l option.
|
# that represents doxygen's defaults, run doxygen with the -l option.
|
||||||
# You can optionally specify a file name after the option, if omitted
|
# You can optionally specify a file name after the option, if omitted
|
||||||
# DoxygenLayout.xml will be used as the name of the layout file.
|
# DoxygenLayout.xml will be used as the name of the layout file.
|
||||||
@@ -604,8 +597,7 @@ LAYOUT_FILE =
|
|||||||
# requires the bibtex tool to be installed. See also
|
# requires the bibtex tool to be installed. See also
|
||||||
# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
|
# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
|
||||||
# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
|
# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
|
||||||
# feature you need bibtex and perl available in the search path. Do not use
|
# feature you need bibtex and perl available in the search path.
|
||||||
# file names with spaces, bibtex cannot handle them.
|
|
||||||
|
|
||||||
CITE_BIB_FILES =
|
CITE_BIB_FILES =
|
||||||
|
|
||||||
@@ -705,9 +697,9 @@ RECURSIVE = YES
|
|||||||
# Note that relative paths are relative to the directory from which doxygen is
|
# Note that relative paths are relative to the directory from which doxygen is
|
||||||
# run.
|
# run.
|
||||||
|
|
||||||
EXCLUDE = @top_builddir@/src/scan-gram.c \
|
EXCLUDE = @top_srcdir@/src/scan-gram.c \
|
||||||
@top_builddir@/src/scan-skel.c \
|
@top_srcdir@/src/scan-skel.c \
|
||||||
@top_srcdir@/src/parse-*.[ch]
|
@top_builddir@/src/parse-*.[ch]
|
||||||
|
|
||||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||||
@@ -793,13 +785,6 @@ FILTER_SOURCE_FILES = NO
|
|||||||
|
|
||||||
FILTER_SOURCE_PATTERNS =
|
FILTER_SOURCE_PATTERNS =
|
||||||
|
|
||||||
# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
|
|
||||||
# is part of the input, its contents will be placed on the main page (index.html).
|
|
||||||
# This can be useful if you have a project on for instance GitHub and want reuse
|
|
||||||
# the introduction page also for the doxygen output.
|
|
||||||
|
|
||||||
USE_MDFILE_AS_MAINPAGE =
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to source browsing
|
# configuration options related to source browsing
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -818,7 +803,7 @@ INLINE_SOURCES = NO
|
|||||||
|
|
||||||
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
|
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
|
||||||
# doxygen to hide any special comment blocks from generated source code
|
# doxygen to hide any special comment blocks from generated source code
|
||||||
# fragments. Normal C, C++ and Fortran comments will always remain visible.
|
# fragments. Normal C and C++ comments will always remain visible.
|
||||||
|
|
||||||
STRIP_CODE_COMMENTS = YES
|
STRIP_CODE_COMMENTS = YES
|
||||||
|
|
||||||
@@ -921,23 +906,13 @@ HTML_FOOTER =
|
|||||||
|
|
||||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
||||||
# style sheet that is used by each HTML page. It can be used to
|
# style sheet that is used by each HTML page. It can be used to
|
||||||
# fine-tune the look of the HTML output. If left blank doxygen will
|
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
||||||
# generate a default style sheet. Note that it is recommended to use
|
# will generate a default style sheet. Note that doxygen will try to copy
|
||||||
# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
|
# the style sheet file to the HTML output directory, so don't put your own
|
||||||
# tag will in the future become obsolete.
|
# style sheet in the HTML output directory as well, or it will be erased!
|
||||||
|
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
|
|
||||||
# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
|
|
||||||
# user-defined cascading style sheet that is included after the standard
|
|
||||||
# style sheets created by doxygen. Using this option one can overrule
|
|
||||||
# certain style aspects. This is preferred over using HTML_STYLESHEET
|
|
||||||
# since it does not replace the standard style sheet and is therefor more
|
|
||||||
# robust against future updates. Doxygen will copy the style sheet file to
|
|
||||||
# the output directory.
|
|
||||||
|
|
||||||
HTML_EXTRA_STYLESHEET =
|
|
||||||
|
|
||||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||||
# other source files which should be copied to the HTML output directory. Note
|
# other source files which should be copied to the HTML output directory. Note
|
||||||
# that these files will be copied to the base HTML output directory. Use the
|
# that these files will be copied to the base HTML output directory. Use the
|
||||||
@@ -978,23 +953,20 @@ HTML_COLORSTYLE_GAMMA = 80
|
|||||||
|
|
||||||
HTML_TIMESTAMP = YES
|
HTML_TIMESTAMP = YES
|
||||||
|
|
||||||
|
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
|
||||||
|
# files or namespaces will be aligned in HTML using tables. If set to
|
||||||
|
# NO a bullet list will be used.
|
||||||
|
|
||||||
|
HTML_ALIGN_MEMBERS = YES
|
||||||
|
|
||||||
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
|
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
|
||||||
# documentation will contain sections that can be hidden and shown after the
|
# documentation will contain sections that can be hidden and shown after the
|
||||||
# page has loaded.
|
# page has loaded. For this to work a browser that supports
|
||||||
|
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
|
||||||
|
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
|
||||||
|
|
||||||
HTML_DYNAMIC_SECTIONS = NO
|
HTML_DYNAMIC_SECTIONS = NO
|
||||||
|
|
||||||
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
|
|
||||||
# entries shown in the various tree structured indices initially; the user
|
|
||||||
# can expand and collapse entries dynamically later on. Doxygen will expand
|
|
||||||
# the tree to such a level that at most the specified number of entries are
|
|
||||||
# visible (unless a fully collapsed tree already exceeds this amount).
|
|
||||||
# So setting the number of entries 1 will produce a full collapsed tree by
|
|
||||||
# default. 0 is a special value representing an infinite number of entries
|
|
||||||
# and will result in a full expanded tree by default.
|
|
||||||
|
|
||||||
HTML_INDEX_NUM_ENTRIES = 100
|
|
||||||
|
|
||||||
# If the GENERATE_DOCSET tag is set to YES, additional index files
|
# If the GENERATE_DOCSET tag is set to YES, additional index files
|
||||||
# will be generated that can be used as input for Apple's Xcode 3
|
# will be generated that can be used as input for Apple's Xcode 3
|
||||||
# integrated development environment, introduced with OSX 10.5 (Leopard).
|
# integrated development environment, introduced with OSX 10.5 (Leopard).
|
||||||
@@ -1022,9 +994,9 @@ DOCSET_FEEDNAME = "Doxygen generated docs"
|
|||||||
|
|
||||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||||
|
|
||||||
# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
|
# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
|
||||||
# identify the documentation publisher. This should be a reverse domain-name
|
# the documentation publisher. This should be a reverse domain-name style
|
||||||
# style string, e.g. com.mycompany.MyDocSet.documentation.
|
# string, e.g. com.mycompany.MyDocSet.documentation.
|
||||||
|
|
||||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||||
|
|
||||||
@@ -1173,6 +1145,11 @@ GENERATE_TREEVIEW = YES
|
|||||||
|
|
||||||
ENUM_VALUES_PER_LINE = 4
|
ENUM_VALUES_PER_LINE = 4
|
||||||
|
|
||||||
|
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
|
||||||
|
# and Class Hierarchy pages using a tree view instead of an ordered list.
|
||||||
|
|
||||||
|
USE_INLINE_TREES = NO
|
||||||
|
|
||||||
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
|
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
|
||||||
# used to set the initial width (in pixels) of the frame in which the tree
|
# used to set the initial width (in pixels) of the frame in which the tree
|
||||||
# is shown.
|
# is shown.
|
||||||
@@ -1209,13 +1186,6 @@ FORMULA_TRANSPARENT = YES
|
|||||||
|
|
||||||
USE_MATHJAX = NO
|
USE_MATHJAX = NO
|
||||||
|
|
||||||
# When MathJax is enabled you can set the default output format to be used for
|
|
||||||
# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
|
|
||||||
# SVG. The default value is HTML-CSS, which is slower, but has the best
|
|
||||||
# compatibility.
|
|
||||||
|
|
||||||
MATHJAX_FORMAT = HTML-CSS
|
|
||||||
|
|
||||||
# When MathJax is enabled you need to specify the location relative to the
|
# When MathJax is enabled you need to specify the location relative to the
|
||||||
# HTML output directory using the MATHJAX_RELPATH option. The destination
|
# HTML output directory using the MATHJAX_RELPATH option. The destination
|
||||||
# directory should contain the MathJax.js script. For instance, if the mathjax
|
# directory should contain the MathJax.js script. For instance, if the mathjax
|
||||||
@@ -1244,50 +1214,15 @@ MATHJAX_EXTENSIONS =
|
|||||||
SEARCHENGINE = NO
|
SEARCHENGINE = NO
|
||||||
|
|
||||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||||
# implemented using a web server instead of a web client using Javascript.
|
# implemented using a PHP enabled web server instead of at the web client
|
||||||
# There are two flavours of web server based search depending on the
|
# using Javascript. Doxygen will generate the search PHP script and index
|
||||||
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
|
# file to put on the web server. The advantage of the server
|
||||||
# searching and an index file used by the script. When EXTERNAL_SEARCH is
|
# based approach is that it scales better to large projects and allows
|
||||||
# enabled the indexing and searching needs to be provided by external tools.
|
# full text search. The disadvantages are that it is more difficult to setup
|
||||||
# See the manual for details.
|
# and does not have live searching capabilities.
|
||||||
|
|
||||||
SERVER_BASED_SEARCH = NO
|
SERVER_BASED_SEARCH = NO
|
||||||
|
|
||||||
# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
|
|
||||||
# script for searching. Instead the search results are written to an XML file
|
|
||||||
# which needs to be processed by an external indexer. Doxygen will invoke an
|
|
||||||
# external search engine pointed to by the SEARCHENGINE_URL option to obtain
|
|
||||||
# the search results. Doxygen ships with an example indexer (doxyindexer) and
|
|
||||||
# search engine (doxysearch.cgi) which are based on the open source search engine
|
|
||||||
# library Xapian. See the manual for configuration details.
|
|
||||||
|
|
||||||
EXTERNAL_SEARCH = NO
|
|
||||||
|
|
||||||
# The SEARCHENGINE_URL should point to a search engine hosted by a web server
|
|
||||||
# which will returned the search results when EXTERNAL_SEARCH is enabled.
|
|
||||||
# Doxygen ships with an example search engine (doxysearch) which is based on
|
|
||||||
# the open source search engine library Xapian. See the manual for configuration
|
|
||||||
# details.
|
|
||||||
|
|
||||||
SEARCHENGINE_URL =
|
|
||||||
|
|
||||||
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
|
|
||||||
# search data is written to a file for indexing by an external tool. With the
|
|
||||||
# SEARCHDATA_FILE tag the name of this file can be specified.
|
|
||||||
|
|
||||||
SEARCHDATA_FILE = searchdata.xml
|
|
||||||
|
|
||||||
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through other
|
|
||||||
# doxygen projects that are not otherwise connected via tags files, but are
|
|
||||||
# all added to the same search index. Each project needs to have a tag file set
|
|
||||||
# via GENERATE_TAGFILE. The search mapping then maps the name of the tag file
|
|
||||||
# to a relative location where the documentation can be found,
|
|
||||||
# similar to the
|
|
||||||
# TAGFILES option but without actually processing the tag file.
|
|
||||||
# The format is: EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
|
|
||||||
|
|
||||||
EXTRA_SEARCH_MAPPINGS =
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the LaTeX output
|
# configuration options related to the LaTeX output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -1571,9 +1506,7 @@ SEARCH_INCLUDES = YES
|
|||||||
# contain include files that are not input files but should be processed by
|
# contain include files that are not input files but should be processed by
|
||||||
# the preprocessor.
|
# the preprocessor.
|
||||||
|
|
||||||
INCLUDE_PATH = @top_srcdir@ \
|
INCLUDE_PATH = @top_srcdir@
|
||||||
@top_srcdir@/lib \
|
|
||||||
@top_builddir@/lib
|
|
||||||
|
|
||||||
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
||||||
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
||||||
@@ -1784,7 +1717,7 @@ CALLER_GRAPH = NO
|
|||||||
|
|
||||||
GRAPHICAL_HIERARCHY = YES
|
GRAPHICAL_HIERARCHY = YES
|
||||||
|
|
||||||
# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
|
# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
|
||||||
# then doxygen will show the dependencies a directory has on other directories
|
# then doxygen will show the dependencies a directory has on other directories
|
||||||
# in a graphical way. The dependency relations are determined by the #include
|
# in a graphical way. The dependency relations are determined by the #include
|
||||||
# relations between the files in the directories.
|
# relations between the files in the directories.
|
||||||
|
|||||||
+616
-1639
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
|||||||
digraph "reduce.y"
|
|
||||||
{
|
|
||||||
node [fontname=courier shape=box]
|
|
||||||
edge [fontname=courier]
|
|
||||||
|
|
||||||
1 [label="State 1\n 3 a: \"0\" . [\".\"]\l 4 b: \"0\" . [\";\"]\l"]
|
|
||||||
1 -> "1R3" [label="" style=solid]
|
|
||||||
"1R3" [style=filled shape=diamond fillcolor=yellowgreen label="R3"]
|
|
||||||
1 -> "1R4" [label="[\";\"]" style=solid]
|
|
||||||
"1R4" [style=filled shape=diamond fillcolor=yellowgreen label="R4"]
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
.------------------.
|
|
||||||
| State 1 |
|
|
||||||
| 3 a: "0" . [";"] |
|
|
||||||
| 4 b: "0" . ["."] |
|
|
||||||
`------------------'
|
|
||||||
/ \
|
|
||||||
/ \ ["."]
|
|
||||||
/ \
|
|
||||||
v v
|
|
||||||
/ \ / \
|
|
||||||
/ R \ / R \
|
|
||||||
(green) \ 3 / \ 4 / (green)
|
|
||||||
\ / \ /
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
digraph "shift.y"
|
|
||||||
{
|
|
||||||
node [fontname=courier shape=box]
|
|
||||||
edge [fontname=courier]
|
|
||||||
|
|
||||||
3 [label="State 3\n 1 exp: a . \".\"\l"]
|
|
||||||
3 -> 6 [style=solid label="\".\""]
|
|
||||||
6 [label="State 6\n 1 exp: a \".\" .\l"]
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
.----------------.
|
|
||||||
| State 3 |
|
|
||||||
| 1 exp: a . ";" |
|
|
||||||
`----------------'
|
|
||||||
|
|
|
||||||
| ";"
|
|
||||||
|
|
|
||||||
v
|
|
||||||
.----------------.
|
|
||||||
| State 6 |
|
|
||||||
| 1 exp: a ";" . |
|
|
||||||
`----------------'
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
// Generated by GNU Bison 2.6.90.
|
|
||||||
// Report bugs to <[email protected]>.
|
|
||||||
// Home page: <http://www.gnu.org/software/bison/>.
|
|
||||||
|
|
||||||
digraph "/tmp/fo.y"
|
|
||||||
{
|
|
||||||
node [fontname = courier, shape = box, colorscheme = paired6]
|
|
||||||
edge [fontname = courier]
|
|
||||||
|
|
||||||
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a \";\"\l 2 | . b \".\"\l 3 a: . \"0\"\l 4 b: . \"0\"\l"]
|
|
||||||
0 -> 1 [style=solid label="\"0\""]
|
|
||||||
0 -> 2 [style=dashed label="exp"]
|
|
||||||
0 -> 3 [style=dashed label="a"]
|
|
||||||
0 -> 4 [style=dashed label="b"]
|
|
||||||
1 [label="State 1\n\l 3 a: \"0\" . [\";\"]\l 4 b: \"0\" . [\".\"]\l"]
|
|
||||||
1 -> "1R3" [style=solid]
|
|
||||||
"1R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
|
|
||||||
1 -> "1R4" [label="[\".\"]", style=solid]
|
|
||||||
"1R4" [label="R4", fillcolor=3, shape=diamond, style=filled]
|
|
||||||
2 [label="State 2\n\l 0 $accept: exp . $end\l"]
|
|
||||||
2 -> 5 [style=solid label="$end"]
|
|
||||||
3 [label="State 3\n\l 1 exp: a . \";\"\l"]
|
|
||||||
3 -> 6 [style=solid label="\";\""]
|
|
||||||
4 [label="State 4\n\l 2 exp: b . \".\"\l"]
|
|
||||||
4 -> 7 [style=solid label="\".\""]
|
|
||||||
5 [label="State 5\n\l 0 $accept: exp $end .\l"]
|
|
||||||
5 -> "5R0" [style=solid]
|
|
||||||
"5R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
|
|
||||||
6 [label="State 6\n\l 1 exp: a \";\" .\l"]
|
|
||||||
6 -> "6R1" [style=solid]
|
|
||||||
"6R1" [label="R1", fillcolor=3, shape=diamond, style=filled]
|
|
||||||
7 [label="State 7\n\l 2 exp: b \".\" .\l"]
|
|
||||||
7 -> "7R2" [style=solid]
|
|
||||||
"7R2" [label="R2", fillcolor=3, shape=diamond, style=filled]
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
%%
|
|
||||||
exp: a ";" | b ".";
|
|
||||||
a: "0";
|
|
||||||
b: "0";
|
|
||||||
+3
-38
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc.
|
## Copyright (C) 2001-2003, 2005-2012 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,14 +20,7 @@ doc_bison_TEXINFOS = \
|
|||||||
doc/fdl.texi \
|
doc/fdl.texi \
|
||||||
doc/gpl-3.0.texi
|
doc/gpl-3.0.texi
|
||||||
|
|
||||||
# Cannot express dependencies directly on file names because of Automake.
|
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d
|
||||||
# Obfuscate with a variable.
|
|
||||||
doc_bison = doc/bison
|
|
||||||
$(doc_bison).dvi: $(FIGS_DOT:.dot=.eps)
|
|
||||||
$(doc_bison).pdf: $(FIGS_DOT:.dot=.pdf)
|
|
||||||
$(doc_bison).html: $(FIGS_DOT:.dot=.png)
|
|
||||||
|
|
||||||
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
|
|
||||||
CLEANDIRS = doc/bison.t2d
|
CLEANDIRS = doc/bison.t2d
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -rf $(CLEANDIRS)
|
rm -rf $(CLEANDIRS)
|
||||||
@@ -37,7 +30,7 @@ MOSTLYCLEANFILES += $(top_srcdir)/doc/*.t
|
|||||||
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
||||||
CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
|
CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
|
||||||
$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
||||||
# Create $@~ which is the previous contents. Don't use 'mv' here so
|
# Create $@~ which is the previous contents. Don't use `mv' here so
|
||||||
# that even if we are interrupted, the file is still available for
|
# that even if we are interrupted, the file is still available for
|
||||||
# diff in the next run. Note that $@ might not exist yet.
|
# diff in the next run. Note that $@ might not exist yet.
|
||||||
$(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
|
$(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
|
||||||
@@ -119,34 +112,6 @@ $(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
|
|||||||
|
|
||||||
nodist_man_MANS = doc/yacc.1
|
nodist_man_MANS = doc/yacc.1
|
||||||
|
|
||||||
## ----------------------------- ##
|
|
||||||
## Graphviz examples generation. ##
|
|
||||||
## ----------------------------- ##
|
|
||||||
|
|
||||||
CLEANDIRS += doc/figs
|
|
||||||
FIGS_DOT = \
|
|
||||||
doc/figs/example.dot \
|
|
||||||
doc/figs/example-reduce.dot doc/figs/example-shift.dot
|
|
||||||
EXTRA_DIST += \
|
|
||||||
$(FIGS_DOT) \
|
|
||||||
$(FIGS_DOT:.dot=.eps) $(FIGS_DOT:.dot=.pdf) $(FIGS_DOT:.dot=.png)
|
|
||||||
SUFFIXES += .dot .eps .pdf .png
|
|
||||||
|
|
||||||
.dot.eps:
|
|
||||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
|
||||||
$(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp
|
|
||||||
$(AM_V_at) mv $@.tmp $@
|
|
||||||
|
|
||||||
.dot.pdf:
|
|
||||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
|
||||||
$(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
|
|
||||||
$(AM_V_at) mv $@.tmp $@
|
|
||||||
|
|
||||||
.dot.png:
|
|
||||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
|
||||||
$(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp
|
|
||||||
$(AM_V_at) mv $@.tmp $@
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Doxygenation. ##
|
## Doxygenation. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|||||||
+1
-1
@@ -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-2012 Free Software Foundation, Inc.
|
||||||
%
|
%
|
||||||
% This file is part of Bison.
|
% This file is part of Bison.
|
||||||
%
|
%
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ straightforward use of _build/src/bison would.)
|
|||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
|
Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+25
-33
@@ -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-2012 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of Bison, the GNU Compiler Compiler.
|
# This file is part of Bison, the GNU Compiler Compiler.
|
||||||
#
|
#
|
||||||
@@ -35,7 +35,6 @@ I<directives>:
|
|||||||
| directives & directives -- Concatenation
|
| directives & directives -- Concatenation
|
||||||
| [ directives> ] -- Optional
|
| [ directives> ] -- Optional
|
||||||
| ( directives> ) -- Parentheses
|
| ( directives> ) -- Parentheses
|
||||||
| %b PATH -- Use bison at PATH for this bench
|
|
||||||
| #d NAME[=VALUE] -- %code { #define NAME [VALUE] }
|
| #d NAME[=VALUE] -- %code { #define NAME [VALUE] }
|
||||||
| %d NAME[=VALUE] -- %define NAME ["VALUE"]
|
| %d NAME[=VALUE] -- %define NAME ["VALUE"]
|
||||||
| %s skeleton -- %skeleton "skeleton"
|
| %s skeleton -- %skeleton "skeleton"
|
||||||
@@ -204,9 +203,9 @@ Format the list of directives for Bison for bench named C<$bench>.
|
|||||||
sub directives($@)
|
sub directives($@)
|
||||||
{
|
{
|
||||||
my ($bench, @directive) = @_;
|
my ($bench, @directive) = @_;
|
||||||
my $res = "/* Directives for bench '$bench'. */\n";
|
my $res = "/* Directives for bench `$bench'. */\n";
|
||||||
$res .= join ("\n", @directive) . "\n";
|
$res .= join ("\n", @directive) . "\n";
|
||||||
$res .= "/* End of directives for bench '$bench'. */\n";
|
$res .= "/* End of directives for bench `$bench'. */\n";
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,7 +579,7 @@ sub generate_grammar_list ($$@)
|
|||||||
my ($base, $max, @directive) = @_;
|
my ($base, $max, @directive) = @_;
|
||||||
my $directives = directives ($base, @directive);
|
my $directives = directives ($base, @directive);
|
||||||
my $variant = grep { /%define "?variant"?/ } @directive;
|
my $variant = grep { /%define "?variant"?/ } @directive;
|
||||||
my $token_ctor = grep { /%define "?api.token.constructor"?/ } @directive;
|
my $lex_symbol = grep { /%define "?lex_symbol"?/ } @directive;
|
||||||
my $out = new IO::File ">$base.y"
|
my $out = new IO::File ">$base.y"
|
||||||
or die;
|
or die;
|
||||||
print $out <<EOF;
|
print $out <<EOF;
|
||||||
@@ -602,16 +601,16 @@ $directives
|
|||||||
|
|
||||||
#define STAGE_MAX ($max * 10) // max = $max
|
#define STAGE_MAX ($max * 10) // max = $max
|
||||||
|
|
||||||
#define USE_TOKEN_CTOR $token_ctor
|
#define USE_LEX_SYMBOL $lex_symbol
|
||||||
#define USE_VARIANTS $variant
|
#define USE_VARIANTS $variant
|
||||||
|
|
||||||
// Prototype of the yylex function providing subsequent tokens.
|
// Prototype of the yylex function providing subsequent tokens.
|
||||||
static
|
static
|
||||||
#if USE_TOKEN_CTOR
|
#if USE_LEX_SYMBOL
|
||||||
yy::parser::symbol_type yylex();
|
yy::parser::symbol_type yylex();
|
||||||
#else
|
#else
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
||||||
yy::parser::location_type* yyllocp);
|
yy::parser::location_type* yylloc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Conversion to string.
|
// Conversion to string.
|
||||||
@@ -679,11 +678,11 @@ EOF
|
|||||||
#
|
#
|
||||||
|
|
||||||
static
|
static
|
||||||
#if USE_TOKEN_CTOR
|
#if USE_LEX_SYMBOL
|
||||||
yy::parser::symbol_type yylex()
|
yy::parser::symbol_type yylex()
|
||||||
#else
|
#else
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
||||||
yy::parser::location_type* yyllocp)
|
yy::parser::location_type* yylloc)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef yy::parser::location_type location_type;
|
typedef yy::parser::location_type location_type;
|
||||||
@@ -692,42 +691,42 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
|||||||
++stage;
|
++stage;
|
||||||
if (stage == STAGE_MAX)
|
if (stage == STAGE_MAX)
|
||||||
{
|
{
|
||||||
#if USE_TOKEN_CTOR
|
#if USE_LEX_SYMBOL
|
||||||
return yy::parser::make_END_OF_FILE (location_type ());
|
return yy::parser::make_END_OF_FILE (location_type ());
|
||||||
#else
|
#else
|
||||||
*yyllocp = location_type ();
|
*yylloc = location_type ();
|
||||||
return token::END_OF_FILE;
|
return token::END_OF_FILE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (stage % 2)
|
else if (stage % 2)
|
||||||
{
|
{
|
||||||
#if USE_TOKEN_CTOR
|
#if USE_LEX_SYMBOL
|
||||||
return yy::parser::make_NUMBER (stage, location_type ());
|
return yy::parser::make_NUMBER (stage, location_type ());
|
||||||
#else
|
#else
|
||||||
# if defined ONE_STAGE_BUILD
|
# if defined ONE_STAGE_BUILD
|
||||||
yylvalp->build(stage);
|
yylval->build(stage);
|
||||||
# elif USE_VARIANTS
|
# elif USE_VARIANTS
|
||||||
yylvalp->build<int>() = stage;
|
yylval->build<int>() = stage;
|
||||||
# else
|
# else
|
||||||
yylvalp->ival = stage;
|
yylval->ival = stage;
|
||||||
# endif
|
# endif
|
||||||
*yyllocp = location_type ();
|
*yylloc = location_type ();
|
||||||
return token::NUMBER;
|
return token::NUMBER;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if USE_TOKEN_CTOR
|
#if USE_LEX_SYMBOL
|
||||||
return yy::parser::make_TEXT ("A string.", location_type ());
|
return yy::parser::make_TEXT ("A string.", location_type ());
|
||||||
#else
|
#else
|
||||||
# if defined ONE_STAGE_BUILD
|
# if defined ONE_STAGE_BUILD
|
||||||
yylvalp->build(std::string("A string."));
|
yylval->build(std::string("A string."));
|
||||||
# elif USE_VARIANTS
|
# elif USE_VARIANTS
|
||||||
yylvalp->build<std::string>() = std::string("A string.");
|
yylval->build<std::string>() = std::string("A string.");
|
||||||
# else
|
# else
|
||||||
yylvalp->sval = new std::string("A string.");
|
yylval->sval = new std::string("A string.");
|
||||||
# endif
|
# endif
|
||||||
*yyllocp = location_type ();
|
*yylloc = location_type ();
|
||||||
return token::TEXT;
|
return token::TEXT;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -807,8 +806,7 @@ sub compile ($)
|
|||||||
|
|
||||||
my $compiler = $language eq 'C++' ? $cxx : $cc;
|
my $compiler = $language eq 'C++' ? $cxx : $cc;
|
||||||
|
|
||||||
my $my_bison = `sed -ne '/%bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
run "$bison $base.y -o $base.c";
|
||||||
run ((length $my_bison ? $my_bison : $bison) . " $base.y -o $base.c");
|
|
||||||
run "$compiler -o $base $cflags $base.c";
|
run "$compiler -o $base $cflags $base.c";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -916,7 +914,7 @@ sub bench_variant_parser ()
|
|||||||
[
|
[
|
||||||
%d variant
|
%d variant
|
||||||
&
|
&
|
||||||
[ #d ONE_STAGE_BUILD | %d api.token.constructor ]
|
[ #d ONE_STAGE_BUILD | %d lex_symbol ]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -1050,12 +1048,6 @@ sub parse_dirs ()
|
|||||||
@res = ("%skeleton \"$token[0]\"");
|
@res = ("%skeleton \"$token[0]\"");
|
||||||
shift @token;
|
shift @token;
|
||||||
}
|
}
|
||||||
elsif ($token[0] eq '%b')
|
|
||||||
{
|
|
||||||
shift @token;
|
|
||||||
@res = ("/*\n%bison \"$token[0]\"\\\n*/");
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@res = $token[0];
|
@res = $token[0];
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
|
## Copyright (C) 2006, 2008-2012 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
|
||||||
|
|||||||
Executable
+220
@@ -0,0 +1,220 @@
|
|||||||
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use IO::File;
|
||||||
|
use Getopt::Long;
|
||||||
|
use File::Basename; # for dirname
|
||||||
|
|
||||||
|
my $VERSION = '2012-01-21 17:13'; # UTC
|
||||||
|
(my $ME = $0) =~ s|.*/||;
|
||||||
|
|
||||||
|
my $prefix;
|
||||||
|
my $lib_name;
|
||||||
|
|
||||||
|
sub usage ($)
|
||||||
|
{
|
||||||
|
my ($exit_code) = @_;
|
||||||
|
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||||
|
if ($exit_code != 0)
|
||||||
|
{
|
||||||
|
print $STREAM "Try '$ME --help' for more information.\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $STREAM <<EOF;
|
||||||
|
Usage: $ME --lib-name=NAME FILE
|
||||||
|
or: $ME [--help|--version]
|
||||||
|
Rewrite a gnulib-tool-generated FILE like lib/gnulib.mk to work with
|
||||||
|
automake's subdir-objects.
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
|
||||||
|
This option must be specified:
|
||||||
|
|
||||||
|
--lib-name=NAME library name, often "lib\$project"
|
||||||
|
|
||||||
|
The following are optional:
|
||||||
|
|
||||||
|
--help display this help and exit
|
||||||
|
--version output version information and exit
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
exit $exit_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
# contents ($FILE_NAME)
|
||||||
|
# ---------------------
|
||||||
|
sub contents ($)
|
||||||
|
{
|
||||||
|
my ($file) = @_;
|
||||||
|
local $/; # Turn on slurp-mode.
|
||||||
|
my $f = new IO::File "< $file" or die "$file";
|
||||||
|
my $contents = $f->getline or die "$file";
|
||||||
|
$f->close;
|
||||||
|
return $contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
# prefix_word ($WORD)
|
||||||
|
# -------------------
|
||||||
|
# Do not prefix special words such as variable dereferences. Also,
|
||||||
|
# "Makefile" is really "Makefile", since precisely there is no
|
||||||
|
# lib/Makefile.
|
||||||
|
sub prefix_word ($)
|
||||||
|
{
|
||||||
|
local ($_) = @_;
|
||||||
|
$_ = $prefix . $_
|
||||||
|
unless /^-/ || m{^\$\(\w+\)} || $_ eq "Makefile" || $_ eq '\\';
|
||||||
|
return $_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# prefix_words ($TEXT)
|
||||||
|
# --------------------
|
||||||
|
sub prefix_words ($)
|
||||||
|
{
|
||||||
|
local ($_) = @_;
|
||||||
|
s{(\S+)}{prefix_word($1)}gem;
|
||||||
|
return $_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# prefix_assignment ($LHS-AND-ASSIGN-OP, $RHS)
|
||||||
|
# --------------------------------------------
|
||||||
|
sub prefix_assignment ($$)
|
||||||
|
{
|
||||||
|
my ($lhs_and_assign_op, $rhs) = @_;
|
||||||
|
my $res;
|
||||||
|
|
||||||
|
# Some variables are initialized by gnulib.mk, and we don't want
|
||||||
|
# that. Change '=' to '+='.
|
||||||
|
if ($lhs_and_assign_op =~ /^(SUBDIRS|EXTRA_DIST|BUILT_SOURCES|SUFFIXES|MOSTLYCLEANFILES|CLEANFILES|DISTCLEANFILES|MAINTAINERCLEANFILES|AM_CFLAGS|AM_CPPFLAGS|AM_GNU_GETTEXT) =/)
|
||||||
|
{
|
||||||
|
$lhs_and_assign_op =~ s/=/+=/;
|
||||||
|
}
|
||||||
|
# We don't want to inherit gnulib's AUTOMAKE_OPTIONS, comment them.
|
||||||
|
elsif ($lhs_and_assign_op =~ /^AUTOMAKE_OPTIONS =/)
|
||||||
|
{
|
||||||
|
$lhs_and_assign_op =~ s/^/# /;
|
||||||
|
}
|
||||||
|
# Don't touch suffixes.
|
||||||
|
elsif ($lhs_and_assign_op =~ /^SUFFIXES /)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
# The words are (probably) paths to files in lib/: prefix them.
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$rhs = prefix_words($rhs)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Variables which name depend on the location: libbison_a_SOURCES =>
|
||||||
|
# lib_libbison_a_SOURCES.
|
||||||
|
$lhs_and_assign_op =~ s/($lib_name)/lib_$1/g;
|
||||||
|
|
||||||
|
return $lhs_and_assign_op . $rhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
# prefix $CONTENTS
|
||||||
|
# ----------------
|
||||||
|
# $CONTENTS is a Makefile content. Post-process it so that each file-name
|
||||||
|
# is prefixed with $prefix (e.g., "lib/").
|
||||||
|
#
|
||||||
|
# Relies heavily on the regularity of the file generated by gnulib-tool.
|
||||||
|
sub prefix ($)
|
||||||
|
{
|
||||||
|
# Work on $_.
|
||||||
|
local ($_) = @_;
|
||||||
|
|
||||||
|
# Prefix all the occurrence of files in rules. If there is nothing
|
||||||
|
# after in the :, it's probably a phony target, or a suffix rule.
|
||||||
|
# Don't touch it.
|
||||||
|
s{^([-\w+/]+\.[-\w.]+ *: *\S.*)$}
|
||||||
|
{prefix_words($1)}gem;
|
||||||
|
|
||||||
|
# Prefix files in variables.
|
||||||
|
s{^([\w.]+\s*\+?=)(.*)$}
|
||||||
|
{prefix_assignment($1, $2)}gem;
|
||||||
|
|
||||||
|
# These three guys escape all the other regular rules.
|
||||||
|
s{(charset\.alias|ref-add\.sed|ref-del\.sed)}{$prefix$1}g;
|
||||||
|
# Unfortunately, as a result we sometimes have lib/lib.
|
||||||
|
s{($prefix){2}}{$1}g;
|
||||||
|
|
||||||
|
# $(srcdir) is actually $(top_srcdir)/lib.
|
||||||
|
s{\$\(srcdir\)}{\$(top_srcdir)/lib}g;
|
||||||
|
|
||||||
|
# Sometimes, t-$@ is used instead of $@-t, which, of course, does
|
||||||
|
# not work when we have a $@ with a directory in it.
|
||||||
|
s{t-\$\@}{\$\@-t}g;
|
||||||
|
|
||||||
|
# Some AC_SUBST patterns remain and would better be Make macros.
|
||||||
|
s{\@(MKDIR_P)\@}{\$($1)}g;
|
||||||
|
|
||||||
|
# Adjust paths in mkdir.
|
||||||
|
s{(\$\(MKDIR_P\))\s*(\w+)}{$1 $prefix$2}g;
|
||||||
|
|
||||||
|
return $_;
|
||||||
|
}
|
||||||
|
|
||||||
|
# process ($IN)
|
||||||
|
# -------------
|
||||||
|
sub process ($)
|
||||||
|
{
|
||||||
|
my ($file) = @_;
|
||||||
|
my ($bak) = "$file.bak";
|
||||||
|
rename ($file, $bak) or die;
|
||||||
|
my $contents = contents ($bak);
|
||||||
|
$contents = prefix ($contents);
|
||||||
|
my $out = new IO::File(">$file") or die;
|
||||||
|
print $out $contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
GetOptions
|
||||||
|
(
|
||||||
|
'lib-name=s' => \$lib_name,
|
||||||
|
help => sub { usage 0 },
|
||||||
|
version => sub { print "$ME version $VERSION\n"; exit },
|
||||||
|
) or usage 1;
|
||||||
|
|
||||||
|
my $fail = 0;
|
||||||
|
defined $lib_name
|
||||||
|
or (warn "$ME: no library name; use --lib-name=NAME\n"), $fail = 1;
|
||||||
|
|
||||||
|
# There must be exactly one argument.
|
||||||
|
@ARGV == 0
|
||||||
|
and (warn "$ME: missing FILE argument\n"), $fail = 1;
|
||||||
|
1 < @ARGV
|
||||||
|
and (warn "$ME: too many arguments:\n", join ("\n", @ARGV), "\n"),
|
||||||
|
$fail = 1;
|
||||||
|
$fail
|
||||||
|
and usage 1;
|
||||||
|
|
||||||
|
my $file = $ARGV[0];
|
||||||
|
$prefix = (dirname $file) . '/';
|
||||||
|
warn "prefix=$prefix\n";
|
||||||
|
|
||||||
|
process $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
### Setup "GNU" style for perl-mode and cperl-mode.
|
||||||
|
## Local Variables:
|
||||||
|
## perl-indent-level: 2
|
||||||
|
## perl-continued-statement-offset: 2
|
||||||
|
## perl-continued-brace-offset: 0
|
||||||
|
## perl-brace-offset: 0
|
||||||
|
## perl-brace-imaginary-offset: 0
|
||||||
|
## perl-label-offset: -2
|
||||||
|
## cperl-indent-level: 2
|
||||||
|
## cperl-brace-offset: 0
|
||||||
|
## cperl-continued-brace-offset: 0
|
||||||
|
## cperl-label-offset: -2
|
||||||
|
## cperl-extra-newline-before-brace: t
|
||||||
|
## cperl-merge-trailing-else: nil
|
||||||
|
## cperl-continued-statement-offset: 2
|
||||||
|
## eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
|
## time-stamp-start: "my $VERSION = '"
|
||||||
|
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||||
|
## time-stamp-time-zone: "UTC"
|
||||||
|
## time-stamp-end: "'; # UTC"
|
||||||
|
## End:
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2012 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
|
||||||
|
|||||||
+15
-18
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2006, 2008-2012 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
|
||||||
@@ -44,33 +44,30 @@ CLEANFILES += \
|
|||||||
# Avoid using BUILT_SOURCES which is too global.
|
# Avoid using BUILT_SOURCES which is too global.
|
||||||
$(examples_calc___calc___OBJECTS): $(calc_sources_generated)
|
$(examples_calc___calc___OBJECTS): $(calc_sources_generated)
|
||||||
|
|
||||||
calc_sources_extracted = \
|
calc_sources_extracted = \
|
||||||
examples/calc++/calc++-driver.cc \
|
examples/calc++/calc++-driver.cc \
|
||||||
examples/calc++/calc++-driver.hh \
|
examples/calc++/calc++-driver.hh \
|
||||||
examples/calc++/calc++-scanner.ll \
|
examples/calc++/calc++-scanner.ll \
|
||||||
examples/calc++/calc++.cc
|
examples/calc++/calc++.cc
|
||||||
calc_extracted = \
|
calc_extracted = \
|
||||||
$(calc_sources_extracted) \
|
$(calc_sources_extracted) \
|
||||||
examples/calc++/calc++-parser.yy
|
examples/calc++/calc++-parser.yy
|
||||||
extracted += $(calc_extracted)
|
extracted += $(calc_extracted)
|
||||||
calc_sources_generated = \
|
calc_sources_generated = \
|
||||||
examples/calc++/calc++-parser.cc \
|
examples/calc++/calc++-parser.cc \
|
||||||
examples/calc++/calc++-parser.hh \
|
examples/calc++/calc++-parser.hh \
|
||||||
examples/calc++/location.hh \
|
examples/calc++/location.hh \
|
||||||
examples/calc++/position.hh \
|
examples/calc++/position.hh \
|
||||||
examples/calc++/stack.hh
|
examples/calc++/stack.hh
|
||||||
calc_sources = \
|
calc_sources = \
|
||||||
$(calc_sources_extracted) \
|
$(calc_sources_extracted) \
|
||||||
$(calc_sources_generated)
|
$(calc_sources_generated)
|
||||||
|
|
||||||
if BISON_CXX_WORKS
|
if BISON_CXX_WORKS
|
||||||
check_PROGRAMS += examples/calc++/calc++
|
check_PROGRAMS += examples/calc++/calc++
|
||||||
nodist_examples_calc___calc___SOURCES = \
|
nodist_examples_calc___calc___SOURCES = \
|
||||||
$(calc_sources)
|
$(calc_sources)
|
||||||
|
|
||||||
examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
|
examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
|
||||||
examples_calc___calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
|
|
||||||
dist_TESTS += examples/calc++/calc++.test
|
dist_TESTS += examples/calc++/calc++.test
|
||||||
else
|
|
||||||
EXTRA_DIST += examples/calc++/calc++.test
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
+1
-1
@@ -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-2012 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
-4
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2005, 2008-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2005, 2008-2012 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,9 +16,6 @@
|
|||||||
dist_noinst_SCRIPTS = examples/extexi examples/test
|
dist_noinst_SCRIPTS = examples/extexi examples/test
|
||||||
TEST_LOG_COMPILER = $(top_srcdir)/examples/test
|
TEST_LOG_COMPILER = $(top_srcdir)/examples/test
|
||||||
|
|
||||||
AM_CXXFLAGS = \
|
|
||||||
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## Extracting. ##
|
## Extracting. ##
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2006, 2008-2012 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,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2012 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,4 +1,4 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2006, 2008-2012 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,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2012 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
-3
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2012 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
|
||||||
@@ -54,9 +54,9 @@ run ()
|
|||||||
# Expected output.
|
# Expected output.
|
||||||
local out_exp=$1
|
local out_exp=$1
|
||||||
shift
|
shift
|
||||||
|
$prog "$@" - <input >out_eff
|
||||||
# Effective exit status.
|
# Effective exit status.
|
||||||
local sta_eff=0
|
local sta_eff=$?
|
||||||
$prog "$@" - <input >out_eff || sta_eff=$?
|
|
||||||
# Effective output.
|
# Effective output.
|
||||||
local out_eff=`cat out_eff`
|
local out_eff=`cat out_eff`
|
||||||
if test $sta_eff -eq $sta_exp; then
|
if test $sta_eff -eq $sta_exp; then
|
||||||
|
|||||||
+37
-42
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
Copyright (C) 2008-2012 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,9 +18,9 @@
|
|||||||
%debug
|
%debug
|
||||||
%skeleton "lalr1.cc"
|
%skeleton "lalr1.cc"
|
||||||
%defines
|
%defines
|
||||||
%define api.token.constructor
|
|
||||||
%define api.value.type variant
|
|
||||||
%define parse.assert
|
%define parse.assert
|
||||||
|
%define variant
|
||||||
|
%define lex_symbol
|
||||||
%locations
|
%locations
|
||||||
|
|
||||||
%code requires // *.hh
|
%code requires // *.hh
|
||||||
@@ -38,10 +38,7 @@ typedef std::list<std::string> strings_type;
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
// Prototype of the yylex function providing subsequent tokens.
|
// Prototype of the yylex function providing subsequent tokens.
|
||||||
namespace yy
|
static yy::parser::symbol_type yylex ();
|
||||||
{
|
|
||||||
static parser::symbol_type yylex ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Printing a list of strings.
|
// Printing a list of strings.
|
||||||
// Koening look up will look into std, since that's an std::list.
|
// Koening look up will look into std, since that's an std::list.
|
||||||
@@ -70,7 +67,8 @@ typedef std::list<std::string> strings_type;
|
|||||||
|
|
||||||
%token <::std::string> TEXT;
|
%token <::std::string> TEXT;
|
||||||
%token <int> NUMBER;
|
%token <int> NUMBER;
|
||||||
%printer { yyoutput << $$; } <*>;
|
%printer { debug_stream () << $$; }
|
||||||
|
<int> <::std::string> <::std::list<std::string>>;
|
||||||
%token END_OF_FILE 0;
|
%token END_OF_FILE 0;
|
||||||
|
|
||||||
%type <::std::string> item;
|
%type <::std::string> item;
|
||||||
@@ -93,44 +91,41 @@ item:
|
|||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
||||||
namespace yy
|
// The yylex function providing subsequent tokens:
|
||||||
|
// TEXT "I have three numbers for you:"
|
||||||
|
// NUMBER 1
|
||||||
|
// NUMBER 2
|
||||||
|
// NUMBER 3
|
||||||
|
// TEXT " and that's all!"
|
||||||
|
// END_OF_FILE
|
||||||
|
|
||||||
|
static
|
||||||
|
yy::parser::symbol_type
|
||||||
|
yylex ()
|
||||||
{
|
{
|
||||||
// The yylex function providing subsequent tokens:
|
static int stage = -1;
|
||||||
// TEXT "I have three numbers for you."
|
++stage;
|
||||||
// NUMBER 1
|
yy::parser::location_type loc(0, stage + 1, stage + 1);
|
||||||
// NUMBER 2
|
switch (stage)
|
||||||
// NUMBER 3
|
|
||||||
// TEXT "And that's all!"
|
|
||||||
// END_OF_FILE
|
|
||||||
|
|
||||||
static
|
|
||||||
parser::symbol_type
|
|
||||||
yylex ()
|
|
||||||
{
|
{
|
||||||
static int stage = -1;
|
case 0:
|
||||||
++stage;
|
return yy::parser::make_TEXT ("I have three numbers for you.", loc);
|
||||||
parser::location_type loc(0, stage + 1, stage + 1);
|
case 1:
|
||||||
switch (stage)
|
case 2:
|
||||||
{
|
case 3:
|
||||||
case 0:
|
return yy::parser::make_NUMBER (stage, loc);
|
||||||
return parser::make_TEXT ("I have three numbers for you.", loc);
|
case 4:
|
||||||
case 1:
|
return yy::parser::make_TEXT ("And that's all!", loc);
|
||||||
case 2:
|
default:
|
||||||
case 3:
|
return yy::parser::make_END_OF_FILE (loc);
|
||||||
return parser::make_NUMBER (stage, loc);
|
|
||||||
case 4:
|
|
||||||
return parser::make_TEXT ("And that's all!", loc);
|
|
||||||
default:
|
|
||||||
return parser::make_END_OF_FILE (loc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Mandatory error function
|
// Mandatory error function
|
||||||
void
|
void
|
||||||
parser::error (const parser::location_type& loc, const std::string& msg)
|
yy::parser::error (const yy::parser::location_type& loc, const std::string& msg)
|
||||||
{
|
{
|
||||||
std::cerr << loc << ": " << msg << std::endl;
|
std::cerr << loc << ": " << msg << std::endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
external: gnulib
|
||||||
+1
-1
Submodule gnulib updated: 03e96cc338...2f67aa79c6
+13
-15
@@ -35,8 +35,6 @@
|
|||||||
/close.c
|
/close.c
|
||||||
/closeout.c
|
/closeout.c
|
||||||
/closeout.h
|
/closeout.h
|
||||||
/concat-filename.c
|
|
||||||
/concat-filename.h
|
|
||||||
/config.charset
|
/config.charset
|
||||||
/config.h
|
/config.h
|
||||||
/config.in.h
|
/config.in.h
|
||||||
@@ -64,7 +62,6 @@
|
|||||||
/fd-hook.h
|
/fd-hook.h
|
||||||
/fd-safer-flag.c
|
/fd-safer-flag.c
|
||||||
/fd-safer.c
|
/fd-safer.c
|
||||||
/filename.h
|
|
||||||
/float+.h
|
/float+.h
|
||||||
/float.c
|
/float.c
|
||||||
/float.h
|
/float.h
|
||||||
@@ -101,6 +98,7 @@
|
|||||||
/isnanf.c
|
/isnanf.c
|
||||||
/isnanl-nolibm.h
|
/isnanl-nolibm.h
|
||||||
/isnanl.c
|
/isnanl.c
|
||||||
|
/iswblank.c
|
||||||
/itold.c
|
/itold.c
|
||||||
/ldexpl.c
|
/ldexpl.c
|
||||||
/localcharset.c
|
/localcharset.c
|
||||||
@@ -108,10 +106,13 @@
|
|||||||
/malloc.c
|
/malloc.c
|
||||||
/math.h
|
/math.h
|
||||||
/math.in.h
|
/math.in.h
|
||||||
|
/mbchar.c
|
||||||
|
/mbchar.h
|
||||||
/mbrtowc.c
|
/mbrtowc.c
|
||||||
/mbsinit.c
|
/mbsinit.c
|
||||||
/mbswidth.c
|
/mbswidth.c
|
||||||
/mbswidth.h
|
/mbswidth.h
|
||||||
|
/mbuiter.h
|
||||||
/memchr.c
|
/memchr.c
|
||||||
/memchr.valgrind
|
/memchr.valgrind
|
||||||
/msvc-inval.c
|
/msvc-inval.c
|
||||||
@@ -122,7 +123,6 @@
|
|||||||
/nonblocking.h
|
/nonblocking.h
|
||||||
/obstack.c
|
/obstack.c
|
||||||
/obstack.h
|
/obstack.h
|
||||||
/obstack_printf.c
|
|
||||||
/open.c
|
/open.c
|
||||||
/pathmax.h
|
/pathmax.h
|
||||||
/perror.c
|
/perror.c
|
||||||
@@ -211,6 +211,8 @@
|
|||||||
/stripslash.c
|
/stripslash.c
|
||||||
/strndup.c
|
/strndup.c
|
||||||
/strnlen.c
|
/strnlen.c
|
||||||
|
/strnlen1.c
|
||||||
|
/strnlen1.h
|
||||||
/strtol.c
|
/strtol.c
|
||||||
/strtoul.c
|
/strtoul.c
|
||||||
/strverscmp.c
|
/strverscmp.c
|
||||||
@@ -221,7 +223,6 @@
|
|||||||
/sys_socket.in.h
|
/sys_socket.in.h
|
||||||
/sys_stat.h
|
/sys_stat.h
|
||||||
/sys_stat.in.h
|
/sys_stat.in.h
|
||||||
/sys_types.in.h
|
|
||||||
/sys_wait.h
|
/sys_wait.h
|
||||||
/sys_wait.in.h
|
/sys_wait.in.h
|
||||||
/sysexits.in.h
|
/sysexits.in.h
|
||||||
@@ -258,17 +259,14 @@
|
|||||||
/xalloc-die.c
|
/xalloc-die.c
|
||||||
/xalloc-oversized.h
|
/xalloc-oversized.h
|
||||||
/xalloc.h
|
/xalloc.h
|
||||||
/xconcat-filename.c
|
|
||||||
/xmalloc.c
|
/xmalloc.c
|
||||||
/xmemdup0.c
|
|
||||||
/xmemdup0.h
|
|
||||||
/xsize.h
|
/xsize.h
|
||||||
/xstrndup.c
|
/xstrndup.c
|
||||||
/xstrndup.h
|
/xstrndup.h
|
||||||
/binary-io.c
|
/xmemdup0.c
|
||||||
/xsize.c
|
/xmemdup0.h
|
||||||
/bitrotate.c
|
/sys_types.in.h
|
||||||
/math.c
|
/concat-filename.c
|
||||||
/sig-handler.c
|
/concat-filename.h
|
||||||
/unistd.c
|
/filename.h
|
||||||
/wctype-h.c
|
/xconcat-filename.c
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Array bitsets.
|
/* Array bitsets.
|
||||||
|
|
||||||
Copyright (C) 2002-2003, 2006, 2009-2013 Free Software Foundation,
|
Copyright (C) 2002-2003, 2006, 2009-2012 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
@@ -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-2012 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
@@ -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-2012 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
@@ -1,6 +1,6 @@
|
|||||||
/* General bitsets.
|
/* General bitsets.
|
||||||
|
|
||||||
Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
|
Copyright (C) 2002-2006, 2009-2012 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
@@ -1,6 +1,6 @@
|
|||||||
/* Generic bitsets.
|
/* Generic bitsets.
|
||||||
|
|
||||||
Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc.
|
Copyright (C) 2002-2004, 2009-2012 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
@@ -1,6 +1,6 @@
|
|||||||
/* Bitset statistics.
|
/* Bitset statistics.
|
||||||
|
|
||||||
Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
|
Copyright (C) 2002-2006, 2009-2012 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
@@ -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-2012 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
@@ -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-2012 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
@@ -1,6 +1,6 @@
|
|||||||
/* Bitset vectors.
|
/* Bitset vectors.
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004, 2009-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Contributed by Akim Demaille (akim@freefriends.org).
|
Contributed by Akim Demaille (akim@freefriends.org).
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -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-2012 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
@@ -1,6 +1,6 @@
|
|||||||
/* Bitset vectors.
|
/* Bitset vectors.
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004, 2009-2012 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
@@ -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-2012 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
@@ -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-2012 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
@@ -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-2012 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
@@ -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-2012 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
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user