mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-11 11:45:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5163803a63 | ||
|
|
fee7c78a83 | ||
|
|
8fc544b03c | ||
|
|
d62d5c4b33 | ||
|
|
ab3eaff7c4 | ||
|
|
85e83ea968 | ||
|
|
0269c6fb03 | ||
|
|
23e536af49 | ||
|
|
cd56929097 | ||
|
|
7aa38561f7 | ||
|
|
22a00cfbf2 | ||
|
|
8c06cb9130 | ||
|
|
b5233ba323 | ||
|
|
013720f0e7 | ||
|
|
365b4d95a4 | ||
|
|
5bb44cca81 | ||
|
|
15f9f8c853 | ||
|
|
04676a5085 | ||
|
|
cf44351dd7 | ||
|
|
614e0bbe23 |
+1
-1
@@ -1 +1 @@
|
||||
3.3.2
|
||||
3.3.90
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
GNU Bison NEWS
|
||||
|
||||
* Noteworthy changes in release 3.3.91 (2019-05-12) [beta]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
Portability issues were fixed.
|
||||
|
||||
* Noteworthy changes in release 3.3.90 (2019-04-28) [beta]
|
||||
|
||||
** New features
|
||||
|
||||
@@ -66,6 +66,7 @@ Frank Heckenbach [email protected]
|
||||
Frans Englich [email protected]
|
||||
Gabriel Rassoul [email protected]
|
||||
Gary L Peskin [email protected]
|
||||
Gavin Smith [email protected]
|
||||
Georg Sauthoff [email protected]
|
||||
George Neuner [email protected]
|
||||
Gilles Espinasse [email protected]
|
||||
@@ -128,6 +129,7 @@ Oliver Mangold [email protected]
|
||||
Paolo Bonzini [email protected]
|
||||
Paolo Simone Gasparello [email protected]
|
||||
Pascal Bart [email protected]
|
||||
Patrice Dumas [email protected]
|
||||
Paul Eggert [email protected]
|
||||
Paul Hilfinger [email protected]
|
||||
Per Allansson [email protected]
|
||||
|
||||
+111
-66
@@ -7,6 +7,51 @@
|
||||
@settitle Bison @value{VERSION}
|
||||
@setchapternewpage odd
|
||||
|
||||
@tex
|
||||
\gdef\rgbWarning{0.50 0 0.50}
|
||||
\gdef\colorWarning{%
|
||||
\setcolor{\rgbWarning}%
|
||||
}
|
||||
\gdef\rgbError{0.80 0 0}
|
||||
\gdef\colorError{%
|
||||
\setcolor{\rgbError}%
|
||||
}
|
||||
\gdef\rgbNotice{0 0 0.80}
|
||||
\gdef\colorNotice{%
|
||||
\setcolor{\rgbNotice}%
|
||||
}
|
||||
\gdef\colorOff{%
|
||||
\setcolor{\maincolor}%
|
||||
}
|
||||
@end tex
|
||||
|
||||
@ifnottex
|
||||
@macro colorWarning
|
||||
@inlineraw{html, <b style="color:darkviolet">}
|
||||
@end macro
|
||||
@macro colorError
|
||||
@inlineraw{html, <b style="color:red">}
|
||||
@end macro
|
||||
@macro colorNotice
|
||||
@inlineraw{html, <b style="color:darkcyan">}
|
||||
@end macro
|
||||
@macro colorOff
|
||||
@inlineraw{html, </b>}
|
||||
@end macro
|
||||
@end ifnottex
|
||||
|
||||
@macro dwarning{text}
|
||||
@colorWarning{}\text\@colorOff{}
|
||||
@end macro
|
||||
|
||||
@macro derror{text}
|
||||
@colorError{}\text\@colorOff{}
|
||||
@end macro
|
||||
|
||||
@macro dnotice{text}
|
||||
@colorNotice{}\text\@colorOff{}
|
||||
@end macro
|
||||
|
||||
@finalout
|
||||
|
||||
@c SMALL BOOK version
|
||||
@@ -4280,24 +4325,24 @@ $@@3: %empty @{ d(); @};
|
||||
exp: @@1 "b" @@2 $@@3 "e" @{ f = $1; @}
|
||||
@end example
|
||||
|
||||
There are probably two errors in the above example: the first midrule
|
||||
action does not generate a value (it does not use @code{$$} although the
|
||||
final action uses it), and the value of the second one is not used (the
|
||||
final action does not use @code{$3}). Bison reports these errors when the
|
||||
There are probably two errors in the above example: the first midrule action
|
||||
does not generate a value (it does not use @code{$$} although the final
|
||||
action uses it), and the value of the second one is not used (the final
|
||||
action does not use @code{$3}). Bison reports these errors when the
|
||||
@code{midrule-value} warnings are enabled (@pxref{Invocation, ,Invoking
|
||||
Bison}):
|
||||
|
||||
@example
|
||||
$ @kbd{bison -Wmidrule-value mid.y}
|
||||
@group
|
||||
mid.y:2.6-13: warning: unset value: $$
|
||||
2 | exp: @{ a(); @} "b" @{ $$ = c(); @} @{ d(); @} "e" @{ f = $1; @};
|
||||
| ^~~~~~~~
|
||||
mid.y:2.6-13: @dwarning{warning}: unset value: $$
|
||||
2 | exp: @dwarning{@{ a(); @}} "b" @{ $$ = c(); @} @{ d(); @} "e" @{ f = $1; @};
|
||||
| @dwarning{^~~~~~~~}
|
||||
@end group
|
||||
@group
|
||||
mid.y:2.19-31: warning: unused value: $3
|
||||
2 | exp: @{ a(); @} "b" @{ $$ = c(); @} @{ d(); @} "e" @{ f = $1; @};
|
||||
| ^~~~~~~~~~~~~
|
||||
mid.y:2.19-31: @dwarning{warning}: unused value: $3
|
||||
2 | exp: @{ a(); @} "b" @dwarning{@{ $$ = c(); @}} @{ d(); @} "e" @{ f = $1; @};
|
||||
| @dwarning{^~~~~~~~~~~~~}
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@@ -4305,9 +4350,9 @@ mid.y:2.19-31: warning: unused value: $3
|
||||
|
||||
It is sometimes useful to turn midrule actions into regular actions, e.g.,
|
||||
to factor them, or to escape from their limitations. For instance, as an
|
||||
alternative to @emph{typed} midrule action, you may bury the midrule
|
||||
action inside a nonterminal symbol and to declare a printer and a destructor
|
||||
for that symbol:
|
||||
alternative to @emph{typed} midrule action, you may bury the midrule action
|
||||
inside a nonterminal symbol and to declare a printer and a destructor for
|
||||
that symbol:
|
||||
|
||||
@example
|
||||
@group
|
||||
@@ -9342,12 +9387,12 @@ useless: STR;
|
||||
@command{bison} reports:
|
||||
|
||||
@example
|
||||
calc.y: warning: 1 nonterminal useless in grammar [-Wother]
|
||||
calc.y: warning: 1 rule useless in grammar [-Wother]
|
||||
calc.y:19.1-7: warning: nonterminal useless in grammar: useless [-Wother]
|
||||
19 | useless: STR;
|
||||
| ^~~~~~~
|
||||
calc.y: warning: 7 shift/reduce conflicts [-Wconflicts-sr]
|
||||
calc.y: @dwarning{warning}: 1 nonterminal useless in grammar [@dwarning{-Wother}]
|
||||
calc.y: @dwarning{warning}: 1 rule useless in grammar [@dwarning{-Wother}]
|
||||
calc.y:19.1-7: @dwarning{warning}: nonterminal useless in grammar: useless [@dwarning{-Wother}]
|
||||
19 | @dwarning{useless: STR;}
|
||||
| @dwarning{^~~~~~~}
|
||||
calc.y: @dwarning{warning}: 7 shift/reduce conflicts [@dwarning{-Wconflicts-sr}]
|
||||
@end example
|
||||
|
||||
When given @option{--report=state}, in addition to @file{calc.tab.c}, it
|
||||
@@ -9764,7 +9809,7 @@ Parser}, for a detailed analysis of the textual report.
|
||||
|
||||
@ifnotinfo
|
||||
@float Figure,fig:graph
|
||||
@image{figs/example, 430pt}
|
||||
@center @image{figs/example, 430pt,,,.svg}
|
||||
@caption{A graphical rendering of the parser.}
|
||||
@end float
|
||||
@end ifnotinfo
|
||||
@@ -9802,7 +9847,7 @@ State 3
|
||||
|
||||
A Graphviz rendering of this portion of the graph could be:
|
||||
|
||||
@center @image{figs/example-shift, 100pt}
|
||||
@center @image{figs/example-shift, 100pt,,,.svg}
|
||||
|
||||
@subheading Graphical Representation of Reductions
|
||||
|
||||
@@ -9824,7 +9869,7 @@ State 1
|
||||
|
||||
A Graphviz rendering of this portion of the graph could be:
|
||||
|
||||
@center @image{figs/example-reduce, 120pt}
|
||||
@center @image{figs/example-reduce, 120pt,,,.svg}
|
||||
|
||||
When unresolved conflicts are present, because in deterministic parsing
|
||||
a single decision can be made, Bison can arbitrarily choose to disable a
|
||||
@@ -10299,15 +10344,15 @@ exp:;
|
||||
@end group
|
||||
@group
|
||||
$ @kbd{bison -u foo.y}
|
||||
foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
|
||||
1 | %error-verbose
|
||||
| ^~~~~~~~~~~~~~
|
||||
foo.y:2.1-27: error: %define variable 'parse.error' redefined
|
||||
2 | %define parse.error verbose
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
foo.y:1.1-14: @dwarning{warning}: deprecated directive, use '%define parse.error verbose' [@dwarning{-Wdeprecated}]
|
||||
1 | @dwarning{%error-verbose}
|
||||
| @dwarning{^~~~~~~~~~~~~~}
|
||||
foo.y:2.1-27: @dwarning{warning}: %define variable 'parse.error' redefined [@dwarning{-Wother}]
|
||||
2 | @dwarning{%define parse.error verbose}
|
||||
| @dwarning{^~~~~~~~~~~~~~~~~~~~~~~~~~~}
|
||||
foo.y:1.1-14: previous definition
|
||||
1 | %error-verbose
|
||||
| ^~~~~~~~~~~~~~
|
||||
1 | @dnotice{%error-verbose}
|
||||
| @dnotice{^~~~~~~~~~~~~~}
|
||||
bison: file 'foo.y' was updated (backup: 'foo.y~')
|
||||
@end group
|
||||
@group
|
||||
@@ -10421,19 +10466,19 @@ Bison reports:
|
||||
@c width in PDF.
|
||||
@example
|
||||
@group
|
||||
warning: useless precedence and associativity for "="
|
||||
| %nonassoc "="
|
||||
| ^~~
|
||||
@dwarning{warning}: useless precedence and associativity for "="
|
||||
| %nonassoc @dwarning{"="}
|
||||
| @dwarning{^~~}
|
||||
@end group
|
||||
@group
|
||||
warning: useless associativity for "*", use %precedence
|
||||
| %left "*"
|
||||
| ^~~
|
||||
@dwarning{warning}: useless associativity for "*", use %precedence
|
||||
| %left @dwarning{"*"}
|
||||
| @dwarning{^~~}
|
||||
@end group
|
||||
@group
|
||||
warning: useless precedence for "("
|
||||
| %precedence "("
|
||||
| ^~~
|
||||
@dwarning{warning}: useless precedence for "("
|
||||
| %precedence @dwarning{"("}
|
||||
| @dwarning{^~~}
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@@ -10520,29 +10565,29 @@ When invoked with @option{-fcaret} (or nothing), Bison will report:
|
||||
|
||||
@example
|
||||
@group
|
||||
in.y:3.20-23: error: ambiguous reference: '$exp'
|
||||
3 | exp: exp '+' exp @{ $exp = $1 + $2; @};
|
||||
| ^~~~
|
||||
in.y:3.20-23: @derror{error}: ambiguous reference: '$exp'
|
||||
3 | exp: exp '+' exp @{ @derror{$exp} = $1 + $2; @};
|
||||
| @derror{^~~~}
|
||||
@end group
|
||||
@group
|
||||
in.y:3.1-3: refers to: $exp at $$
|
||||
3 | exp: exp '+' exp @{ $exp = $1 + $2; @};
|
||||
| ^~~
|
||||
3 | @dnotice{exp}: exp '+' exp @{ $exp = $1 + $2; @};
|
||||
| @dnotice{^~~}
|
||||
@end group
|
||||
@group
|
||||
in.y:3.6-8: refers to: $exp at $1
|
||||
3 | exp: exp '+' exp @{ $exp = $1 + $2; @};
|
||||
| ^~~
|
||||
3 | exp: @dnotice{exp} '+' exp @{ $exp = $1 + $2; @};
|
||||
| @dnotice{^~~}
|
||||
@end group
|
||||
@group
|
||||
in.y:3.14-16: refers to: $exp at $3
|
||||
3 | exp: exp '+' exp @{ $exp = $1 + $2; @};
|
||||
| ^~~
|
||||
3 | exp: exp '+' @dnotice{exp} @{ $exp = $1 + $2; @};
|
||||
| @dnotice{^~~}
|
||||
@end group
|
||||
@group
|
||||
in.y:3.32-33: error: $2 of 'exp' has no declared type
|
||||
3 | exp: exp '+' exp @{ $exp = $1 + $2; @};
|
||||
| ^~
|
||||
in.y:3.32-33: @derror{error}: $2 of 'exp' has no declared type
|
||||
3 | exp: exp '+' exp @{ $exp = $1 + @derror{$2}; @};
|
||||
| @derror{^~}
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@@ -10550,11 +10595,11 @@ Whereas, when invoked with @option{-fno-caret}, Bison will only report:
|
||||
|
||||
@example
|
||||
@group
|
||||
in.y:3.20-23: error: ambiguous reference: ‘$exp’
|
||||
in.y:3.20-23: @derror{error}: ambiguous reference: ‘$exp’
|
||||
in.y:3.1-3: refers to: $exp at $$
|
||||
in.y:3.6-8: refers to: $exp at $1
|
||||
in.y:3.14-16: refers to: $exp at $3
|
||||
in.y:3.32-33: error: $2 of ‘exp’ has no declared type
|
||||
in.y:3.32-33: @derror{error}: $2 of ‘exp’ has no declared type
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@@ -10578,14 +10623,14 @@ exp:;
|
||||
|
||||
@group
|
||||
$ @kbd{bison -ffixit foo.y}
|
||||
foo.y:2.1-24: error: %define variable 'api.prefix' redefined
|
||||
2 | %define api.prefix @{bar@}
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~
|
||||
foo.y:2.1-24: @derror{error}: %define variable 'api.prefix' redefined
|
||||
2 | @derror{%define api.prefix @{bar@}}
|
||||
| @derror{^~~~~~~~~~~~~~~~~~~~~~~~}
|
||||
foo.y:1.1-24: previous definition
|
||||
1 | %define api.prefix @{foo@}
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~
|
||||
1 | @dnotice{%define api.prefix @{foo@}}
|
||||
| @dnotice{^~~~~~~~~~~~~~~~~~~~~~~~}
|
||||
fix-it:"foo.y":@{2:1-2:25@}:""
|
||||
foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
||||
foo.y: @dwarning{warning}: fix-its can be applied. Rerun with option '--update'. [@dwarning{-Wother}]
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@@ -10602,13 +10647,13 @@ exp:;
|
||||
@end group
|
||||
@group
|
||||
$ @kbd{bison foo.y}
|
||||
foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
|
||||
1 | %error-verbose
|
||||
| ^~~~~~~~~~~~~~
|
||||
foo.y:2.1-18: warning: deprecated directive, use '%define api.prefix @{foo@}' [-Wdeprecated]
|
||||
2 | %name-prefix "foo"
|
||||
| ^~~~~~~~~~~~~~~~~~
|
||||
foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
||||
foo.y:1.1-14: @dwarning{warning}: deprecated directive, use '%define parse.error verbose' [@dwarning{-Wdeprecated}]
|
||||
1 | @dwarning{%error-verbose}
|
||||
| @dwarning{^~~~~~~~~~~~~~}
|
||||
foo.y:2.1-18: @dwarning{warning}: deprecated directive, use '%define api.prefix @{foo@}' [@dwarning{-Wdeprecated}]
|
||||
2 | @dwarning{%name-prefix "foo"}
|
||||
| @dwarning{^~~~~~~~~~~~~~~~~~}
|
||||
foo.y: @dwarning{warning}: fix-its can be applied. Rerun with option '--update'. [@dwarning{-Wother}]
|
||||
@end group
|
||||
@end example
|
||||
|
||||
|
||||
+12
-7
@@ -14,7 +14,12 @@
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AM_MAKEINFOFLAGS = --no-split
|
||||
AM_MAKEINFOFLAGS = \
|
||||
--no-split \
|
||||
--set-customization-variable=SECTION_NAME_IN_TITLE=true \
|
||||
--set-customization-variable=AVOID_MENU_REDUNDANCY=true \
|
||||
--set-customization-variable=ICONS=true
|
||||
|
||||
info_TEXINFOS = doc/bison.texi
|
||||
doc_bison_TEXINFOS = \
|
||||
$(CROSS_OPTIONS_TEXI) \
|
||||
@@ -28,7 +33,7 @@ doc_bison = doc/bison
|
||||
$(doc_bison).dvi: $(FIGS_GV:.gv=.eps)
|
||||
$(doc_bison).info: $(FIGS_GV:.gv=.txt)
|
||||
$(doc_bison).pdf: $(FIGS_GV:.gv=.pdf)
|
||||
$(doc_bison).html: $(FIGS_GV:.gv=.png)
|
||||
$(doc_bison).html: $(FIGS_GV:.gv=.svg)
|
||||
|
||||
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
|
||||
CLEANDIRS += doc/bison.t2d
|
||||
@@ -137,14 +142,14 @@ endif
|
||||
## Graphviz examples generation. ##
|
||||
## ----------------------------- ##
|
||||
|
||||
CLEANFILES += $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png)
|
||||
CLEANFILES += $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.svg)
|
||||
FIGS_GV = \
|
||||
doc/figs/example.gv \
|
||||
doc/figs/example-reduce.gv doc/figs/example-shift.gv
|
||||
EXTRA_DIST += \
|
||||
$(FIGS_GV) $(FIGS_GV:.gv=.txt) \
|
||||
$(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png)
|
||||
SUFFIXES += .gv .eps .pdf .png
|
||||
$(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.svg)
|
||||
SUFFIXES += .gv .eps .pdf .svg
|
||||
|
||||
.gv.eps:
|
||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||
@@ -156,9 +161,9 @@ SUFFIXES += .gv .eps .pdf .png
|
||||
$(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
|
||||
$(AM_V_at) mv $@.tmp $@
|
||||
|
||||
.gv.png:
|
||||
.gv.svg:
|
||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||
$(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp
|
||||
$(AM_V_at) $(DOT) -Gmargin=0 -Tsvg $< >$@.tmp
|
||||
$(AM_V_at) mv $@.tmp $@
|
||||
|
||||
## -------------- ##
|
||||
|
||||
+1
-1
Submodule gnulib updated: 14a920195e...03752516b2
@@ -0,0 +1,15 @@
|
||||
/*.gmo
|
||||
/*.po
|
||||
/LINGUAS
|
||||
/Makefile.in.in
|
||||
/Makevars
|
||||
/Makevars.template
|
||||
/POTFILES.in
|
||||
/Rules-quot
|
||||
/bison-gnulib.pot
|
||||
/boldquot.sed
|
||||
/[email protected]
|
||||
/[email protected]
|
||||
/insert-header.sin
|
||||
/quot.sed
|
||||
/remove-potcdate.sin
|
||||
+22
-5
@@ -72,7 +72,7 @@ begin_use_class (const char *s, FILE *out)
|
||||
{
|
||||
if (out == stderr)
|
||||
{
|
||||
if (style_debug)
|
||||
if (color_debug)
|
||||
fprintf (out, "<%s>", s);
|
||||
else
|
||||
{
|
||||
@@ -87,7 +87,7 @@ end_use_class (const char *s, FILE *out)
|
||||
{
|
||||
if (out == stderr)
|
||||
{
|
||||
if (style_debug)
|
||||
if (color_debug)
|
||||
fprintf (out, "</%s>", s);
|
||||
else
|
||||
{
|
||||
@@ -252,6 +252,7 @@ complain_init_color (void)
|
||||
{
|
||||
#if HAVE_LIBTEXTSTYLE
|
||||
if (color_mode == color_yes
|
||||
|| color_mode == color_html
|
||||
|| (color_mode == color_tty && isatty (STDERR_FILENO)))
|
||||
{
|
||||
style_file_prepare ("BISON_DIAGNOSTICS_STYLE", NULL,
|
||||
@@ -268,9 +269,25 @@ complain_init_color (void)
|
||||
style_file_name = NULL;
|
||||
#endif
|
||||
|
||||
/* Workaround clang's warning (starting at Clang 3.5) about the stub
|
||||
code of html_styled_ostream_create:
|
||||
|
||||
| src/complain.c:274:7: error: code will never be executed [-Werror,-Wunreachable-code]
|
||||
| ? html_styled_ostream_create (file_ostream_create (stderr),
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
#if defined __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunreachable-code"
|
||||
#endif
|
||||
errstream =
|
||||
styled_ostream_create (STDERR_FILENO, "(stderr)", TTYCTL_AUTO,
|
||||
style_file_name);
|
||||
color_mode == color_html
|
||||
? html_styled_ostream_create (file_ostream_create (stderr),
|
||||
style_file_name)
|
||||
: styled_ostream_create (STDERR_FILENO, "(stderr)", TTYCTL_AUTO,
|
||||
style_file_name);
|
||||
#if defined __clang__
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -521,7 +538,7 @@ deprecated_directive (location const *loc, char const *old, char const *upd)
|
||||
_("deprecated directive: %s, use %s"),
|
||||
quote (old), quote_n (1, upd));
|
||||
/* Register updates only if -Wdeprecated is enabled. */
|
||||
if (warnings_flag[warning_deprecated] != severity_disabled)
|
||||
if (warning_is_enabled (Wdeprecated))
|
||||
fixits_register (loc, upd);
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -52,6 +52,11 @@ fixit_new (location const *loc, char const* fix)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int
|
||||
fixit_cmp (const fixit *a, const fixit *b)
|
||||
{
|
||||
return location_cmp (a->location, b->location);
|
||||
}
|
||||
|
||||
static void
|
||||
fixit_free (fixit *f)
|
||||
@@ -85,7 +90,7 @@ fixits_register (location const *loc, char const* fix)
|
||||
(gl_listelement_dispose_fn) fixit_free,
|
||||
true);
|
||||
fixit *f = fixit_new (loc, fix);
|
||||
gl_list_add_last (fixits, f);
|
||||
gl_sortedlist_add (fixits, (gl_listelement_compar_fn) fixit_cmp, f);
|
||||
if (feature_flag & feature_fixit_parsable)
|
||||
fixit_print (f, stderr);
|
||||
}
|
||||
|
||||
+9
-6
@@ -45,7 +45,7 @@ bool no_lines_flag = false;
|
||||
bool token_table_flag = false;
|
||||
location yacc_loc = EMPTY_LOCATION_INIT;
|
||||
bool update_flag = false; /* for -u */
|
||||
bool style_debug = false; /* --style=debug. */
|
||||
bool color_debug = false;
|
||||
|
||||
bool nondeterministic_parser = false;
|
||||
bool glr_parser = false;
|
||||
@@ -596,14 +596,17 @@ getargs_colors (int argc, char *argv[])
|
||||
{
|
||||
const char *arg = argv[i];
|
||||
if (STRPREFIX_LIT ("--color=", arg))
|
||||
handle_color_option (arg + strlen ("--color="));
|
||||
{
|
||||
const char *color = arg + strlen ("--color=");
|
||||
if (STREQ (color, "debug"))
|
||||
color_debug = true;
|
||||
else
|
||||
handle_color_option (color);
|
||||
}
|
||||
else if (STRPREFIX_LIT ("--style=", arg))
|
||||
{
|
||||
const char *style = arg + strlen ("--style=");
|
||||
if (STREQ (style, "debug"))
|
||||
style_debug = true;
|
||||
else
|
||||
handle_style_option (style);
|
||||
handle_style_option (style);
|
||||
}
|
||||
}
|
||||
complain_init_color ();
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ extern bool no_lines_flag; /* for -l */
|
||||
extern bool token_table_flag; /* for -k */
|
||||
extern location yacc_loc; /* for -y */
|
||||
extern bool update_flag; /* for -u */
|
||||
extern bool style_debug; /* --style=debug. */
|
||||
extern bool color_debug; /* --color=debug. */
|
||||
/* GLR_PARSER is true if the input file says to use the GLR
|
||||
(Generalized LR) parser, and to output some additional information
|
||||
used by the GLR algorithm. */
|
||||
|
||||
+1
-1
@@ -203,7 +203,7 @@ typedef struct
|
||||
int expected_rr_conflicts;
|
||||
|
||||
const char *action;
|
||||
location action_location;
|
||||
location action_loc;
|
||||
} rule;
|
||||
|
||||
/* The used rules (size NRULES). */
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
#include "getargs.h"
|
||||
#include "location.h"
|
||||
|
||||
location const empty_location = EMPTY_LOCATION_INIT;
|
||||
location const empty_loc = EMPTY_LOCATION_INIT;
|
||||
|
||||
/* If BUF is null, add BUFSIZE (which in this case must be less than
|
||||
INT_MAX) to COLUMN; otherwise, add mbsnwidth (BUF, BUFSIZE, 0) to
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ typedef struct
|
||||
# define GRAM_LTYPE location
|
||||
|
||||
# define EMPTY_LOCATION_INIT {{NULL, 0, 0, 0}, {NULL, 0, 0, 0}}
|
||||
extern location const empty_location;
|
||||
extern location const empty_loc;
|
||||
|
||||
/* Set *LOC and adjust scanner cursor to account for token TOKEN of
|
||||
size SIZE. */
|
||||
|
||||
+2
-2
@@ -372,8 +372,8 @@ user_actions_output (FILE *out)
|
||||
{
|
||||
fprintf (out, "%s(%d, [b4_syncline(%d, ",
|
||||
rules[r].is_predicate ? "b4_predicate_case" : "b4_case",
|
||||
r + 1, rules[r].action_location.start.line);
|
||||
string_output (out, rules[r].action_location.start.file);
|
||||
r + 1, rules[r].action_loc.start.line);
|
||||
string_output (out, rules[r].action_loc.start.file);
|
||||
fprintf (out, ")dnl\n[ %s]])\n\n", rules[r].action);
|
||||
}
|
||||
fputs ("])\n\n", out);
|
||||
|
||||
+3
-3
@@ -122,7 +122,7 @@
|
||||
#include "xmemdup0.h"
|
||||
|
||||
static int current_prec = 0;
|
||||
static location current_lhs_location;
|
||||
static location current_lhs_loc;
|
||||
static named_ref *current_lhs_named_ref;
|
||||
static symbol *current_lhs_symbol;
|
||||
static symbol_class current_class = unknown_sym;
|
||||
@@ -2406,7 +2406,7 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 95:
|
||||
{ grammar_current_rule_begin (current_lhs_symbol, current_lhs_location,
|
||||
{ grammar_current_rule_begin (current_lhs_symbol, current_lhs_loc,
|
||||
current_lhs_named_ref); }
|
||||
break;
|
||||
|
||||
@@ -3037,7 +3037,7 @@ void
|
||||
current_lhs (symbol *sym, location loc, named_ref *ref)
|
||||
{
|
||||
current_lhs_symbol = sym;
|
||||
current_lhs_location = loc;
|
||||
current_lhs_loc = loc;
|
||||
if (sym)
|
||||
symbol_location_as_lhs_set (sym, loc);
|
||||
/* In order to simplify memory management, named references for lhs
|
||||
|
||||
+3
-3
@@ -49,7 +49,7 @@
|
||||
#include "xmemdup0.h"
|
||||
|
||||
static int current_prec = 0;
|
||||
static location current_lhs_location;
|
||||
static location current_lhs_loc;
|
||||
static named_ref *current_lhs_named_ref;
|
||||
static symbol *current_lhs_symbol;
|
||||
static symbol_class current_class = unknown_sym;
|
||||
@@ -651,7 +651,7 @@ rhses.1:
|
||||
%token PERCENT_EMPTY "%empty";
|
||||
rhs:
|
||||
%empty
|
||||
{ grammar_current_rule_begin (current_lhs_symbol, current_lhs_location,
|
||||
{ grammar_current_rule_begin (current_lhs_symbol, current_lhs_loc,
|
||||
current_lhs_named_ref); }
|
||||
| rhs symbol named_ref.opt
|
||||
{ grammar_current_rule_symbol_append ($2, @2, $3); }
|
||||
@@ -1050,7 +1050,7 @@ void
|
||||
current_lhs (symbol *sym, location loc, named_ref *ref)
|
||||
{
|
||||
current_lhs_symbol = sym;
|
||||
current_lhs_location = loc;
|
||||
current_lhs_loc = loc;
|
||||
if (sym)
|
||||
symbol_location_as_lhs_set (sym, loc);
|
||||
/* In order to simplify memory management, named references for lhs
|
||||
|
||||
+38
-37
@@ -62,7 +62,7 @@ grammar_start_symbol_set (symbol *sym, location loc)
|
||||
{
|
||||
start_flag = true;
|
||||
startsymbol = sym;
|
||||
startsymbol_location = loc;
|
||||
startsymbol_loc = loc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,12 +131,12 @@ record_merge_function_type (int merger, uniqstr type, location declaration_loc)
|
||||
quote (merge_function->name), type,
|
||||
merge_function->type);
|
||||
indent += SUB_INDENT;
|
||||
complain_indent (&merge_function->type_declaration_location, complaint,
|
||||
complain_indent (&merge_function->type_declaration_loc, complaint,
|
||||
&indent,
|
||||
_("previous declaration"));
|
||||
}
|
||||
merge_function->type = uniqstr_new (type);
|
||||
merge_function->type_declaration_location = declaration_loc;
|
||||
merge_function->type_declaration_loc = declaration_loc;
|
||||
}
|
||||
|
||||
/*--------------------------------------.
|
||||
@@ -295,7 +295,7 @@ grammar_rule_check_and_complete (symbol_list *r)
|
||||
char const *rhs_type =
|
||||
first_rhs->content->type_name ? first_rhs->content->type_name : "";
|
||||
if (!UNIQSTR_EQ (lhs_type, rhs_type))
|
||||
complain (&r->location, Wother,
|
||||
complain (&r->rhs_loc, Wother,
|
||||
_("type clash on default action: <%s> != <%s>"),
|
||||
lhs_type, rhs_type);
|
||||
else
|
||||
@@ -308,7 +308,7 @@ grammar_rule_check_and_complete (symbol_list *r)
|
||||
if (is_cxx)
|
||||
{
|
||||
code_props_rule_action_init (&r->action_props, "{ $$ = $1; }",
|
||||
r->location, r,
|
||||
r->rhs_loc, r,
|
||||
/* name */ NULL,
|
||||
/* type */ NULL,
|
||||
/* is_predicate */ false);
|
||||
@@ -318,7 +318,7 @@ grammar_rule_check_and_complete (symbol_list *r)
|
||||
}
|
||||
/* Warn if there is no default for $$ but we need one. */
|
||||
else
|
||||
complain (&r->location, Wother,
|
||||
complain (&r->rhs_loc, Wother,
|
||||
_("empty rule for typed nonterminal, and no action"));
|
||||
}
|
||||
|
||||
@@ -335,9 +335,9 @@ grammar_rule_check_and_complete (symbol_list *r)
|
||||
{
|
||||
warnings warn_flag = midrule_warning ? Wmidrule_values : Wother;
|
||||
if (n)
|
||||
complain (&l->location, warn_flag, _("unused value: $%d"), n);
|
||||
complain (&l->sym_loc, warn_flag, _("unused value: $%d"), n);
|
||||
else
|
||||
complain (&l->location, warn_flag, _("unset value: $$"));
|
||||
complain (&l->rhs_loc, warn_flag, _("unset value: $$"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -357,9 +357,10 @@ grammar_rule_check_and_complete (symbol_list *r)
|
||||
&& !r->percent_empty_loc.start.file
|
||||
&& warning_is_enabled (Wempty_rule))
|
||||
{
|
||||
complain (&r->location, Wempty_rule,
|
||||
_("empty rule without %%empty"));
|
||||
fixits_register (&r->location, " %empty ");
|
||||
complain (&r->rhs_loc, Wempty_rule, _("empty rule without %%empty"));
|
||||
location loc = r->rhs_loc;
|
||||
loc.end = loc.start;
|
||||
fixits_register (&loc, " %empty ");
|
||||
}
|
||||
|
||||
/* See comments in grammar_current_rule_prec_set for how POSIX
|
||||
@@ -369,12 +370,12 @@ grammar_rule_check_and_complete (symbol_list *r)
|
||||
&& r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"'
|
||||
&& r->ruleprec->content->status != declared
|
||||
&& !r->ruleprec->content->prec)
|
||||
complain (&r->location, Wother,
|
||||
complain (&r->rhs_loc, Wother,
|
||||
_("token for %%prec is not defined: %s"), r->ruleprec->tag);
|
||||
|
||||
/* Check that the (main) action was not typed. */
|
||||
if (r->action_props.type)
|
||||
complain (&r->location, Wother,
|
||||
complain (&r->rhs_loc, Wother,
|
||||
_("only midrule actions can be typed: %s"), r->action_props.type);
|
||||
}
|
||||
|
||||
@@ -387,8 +388,8 @@ void
|
||||
grammar_current_rule_end (location loc)
|
||||
{
|
||||
/* Put an empty link in the list to mark the end of this rule */
|
||||
grammar_symbol_append (NULL, grammar_end->location);
|
||||
current_rule->location = loc;
|
||||
grammar_symbol_append (NULL, grammar_end->rhs_loc);
|
||||
current_rule->rhs_loc = loc;
|
||||
}
|
||||
|
||||
|
||||
@@ -408,11 +409,11 @@ grammar_midrule_action (void)
|
||||
|
||||
/* Make a DUMMY nonterminal, whose location is that of the midrule
|
||||
action. Create the MIDRULE. */
|
||||
location dummy_location = current_rule->action_props.location;
|
||||
symbol *dummy = dummy_symbol_get (dummy_location);
|
||||
location dummy_loc = current_rule->action_props.location;
|
||||
symbol *dummy = dummy_symbol_get (dummy_loc);
|
||||
symbol_type_set(dummy,
|
||||
current_rule->action_props.type, current_rule->action_props.location);
|
||||
symbol_list *midrule = symbol_list_sym_new (dummy, dummy_location);
|
||||
symbol_list *midrule = symbol_list_sym_new (dummy, dummy_loc);
|
||||
|
||||
/* Remember named_ref of previous action. */
|
||||
named_ref *action_name = current_rule->action_props.named_ref;
|
||||
@@ -422,7 +423,7 @@ grammar_midrule_action (void)
|
||||
++nrules;
|
||||
++nritems;
|
||||
/* Attach its location and actions to that of the DUMMY. */
|
||||
midrule->location = dummy_location;
|
||||
midrule->rhs_loc = dummy_loc;
|
||||
code_props_rule_action_init (&midrule->action_props,
|
||||
current_rule->action_props.code,
|
||||
current_rule->action_props.location,
|
||||
@@ -443,14 +444,14 @@ grammar_midrule_action (void)
|
||||
grammar = midrule;
|
||||
|
||||
/* End the dummy's rule. */
|
||||
midrule->next = symbol_list_sym_new (NULL, dummy_location);
|
||||
midrule->next = symbol_list_sym_new (NULL, dummy_loc);
|
||||
midrule->next->next = current_rule;
|
||||
|
||||
previous_rule_end = midrule->next;
|
||||
|
||||
/* Insert the dummy nonterminal replacing the midrule action into
|
||||
the current rule. Bind it to its dedicated rule. */
|
||||
grammar_current_rule_symbol_append (dummy, dummy_location,
|
||||
grammar_current_rule_symbol_append (dummy, dummy_loc,
|
||||
action_name);
|
||||
grammar_end->midrule = midrule;
|
||||
midrule->midrule_parent_rule = current_rule;
|
||||
@@ -509,11 +510,11 @@ grammar_current_rule_dprec_set (int dprec, location loc)
|
||||
"%dprec");
|
||||
else if (current_rule->dprec != 0)
|
||||
duplicate_rule_directive ("%dprec",
|
||||
current_rule->dprec_location, loc);
|
||||
current_rule->dprec_loc, loc);
|
||||
else
|
||||
{
|
||||
current_rule->dprec = dprec;
|
||||
current_rule->dprec_location = loc;
|
||||
current_rule->dprec_loc = loc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,11 +529,11 @@ grammar_current_rule_merge_set (uniqstr name, location loc)
|
||||
"%merge");
|
||||
if (current_rule->merger != 0)
|
||||
duplicate_rule_directive ("%merge",
|
||||
current_rule->merger_declaration_location, loc);
|
||||
current_rule->merger_declaration_loc, loc);
|
||||
else
|
||||
{
|
||||
current_rule->merger = get_merge_function (name);
|
||||
current_rule->merger_declaration_location = loc;
|
||||
current_rule->merger_declaration_loc = loc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -622,7 +623,7 @@ packgram (void)
|
||||
{
|
||||
symbol_list *lhs = p;
|
||||
record_merge_function_type (lhs->merger, lhs->content.sym->content->type_name,
|
||||
lhs->merger_declaration_location);
|
||||
lhs->merger_declaration_loc);
|
||||
/* If the midrule's $$ is set or its $n is used, remove the '$' from the
|
||||
symbol name so that it's a user-defined symbol so that the default
|
||||
%destructor and %printer apply. */
|
||||
@@ -647,10 +648,10 @@ packgram (void)
|
||||
rules[ruleno].dprec = lhs->dprec;
|
||||
rules[ruleno].merger = lhs->merger;
|
||||
rules[ruleno].precsym = NULL;
|
||||
rules[ruleno].location = lhs->location;
|
||||
rules[ruleno].location = lhs->rhs_loc;
|
||||
rules[ruleno].useful = true;
|
||||
rules[ruleno].action = lhs->action_props.code;
|
||||
rules[ruleno].action_location = lhs->action_props.location;
|
||||
rules[ruleno].action_loc = lhs->action_props.location;
|
||||
rules[ruleno].is_predicate = lhs->action_props.is_predicate;
|
||||
rules[ruleno].expected_sr_conflicts = lhs->expected_sr_conflicts;
|
||||
rules[ruleno].expected_rr_conflicts = lhs->expected_rr_conflicts;
|
||||
@@ -713,18 +714,18 @@ reader (void)
|
||||
symbols_new ();
|
||||
|
||||
/* Construct the accept symbol. */
|
||||
accept = symbol_get ("$accept", empty_location);
|
||||
accept = symbol_get ("$accept", empty_loc);
|
||||
accept->content->class = nterm_sym;
|
||||
accept->content->number = nvars++;
|
||||
|
||||
/* Construct the error token */
|
||||
errtoken = symbol_get ("error", empty_location);
|
||||
errtoken = symbol_get ("error", empty_loc);
|
||||
errtoken->content->class = token_sym;
|
||||
errtoken->content->number = ntokens++;
|
||||
|
||||
/* Construct a token that represents all undefined literal tokens.
|
||||
It is always token number 2. */
|
||||
undeftoken = symbol_get ("$undefined", empty_location);
|
||||
undeftoken = symbol_get ("$undefined", empty_loc);
|
||||
undeftoken->content->class = token_sym;
|
||||
undeftoken->content->number = ntokens++;
|
||||
|
||||
@@ -801,7 +802,7 @@ check_and_convert_grammar (void)
|
||||
/* If the user did not define her ENDTOKEN, do it now. */
|
||||
if (!endtoken)
|
||||
{
|
||||
endtoken = symbol_get ("$end", empty_location);
|
||||
endtoken = symbol_get ("$end", empty_loc);
|
||||
endtoken->content->class = token_sym;
|
||||
endtoken->content->number = 0;
|
||||
/* Value specified by POSIX. */
|
||||
@@ -823,11 +824,11 @@ check_and_convert_grammar (void)
|
||||
|
||||
$accept: %start $end. */
|
||||
{
|
||||
symbol_list *p = symbol_list_sym_new (accept, empty_location);
|
||||
p->location = grammar->location;
|
||||
p->next = symbol_list_sym_new (startsymbol, empty_location);
|
||||
p->next->next = symbol_list_sym_new (endtoken, empty_location);
|
||||
p->next->next->next = symbol_list_sym_new (NULL, empty_location);
|
||||
symbol_list *p = symbol_list_sym_new (accept, empty_loc);
|
||||
p->rhs_loc = grammar->rhs_loc;
|
||||
p->next = symbol_list_sym_new (startsymbol, empty_loc);
|
||||
p->next->next = symbol_list_sym_new (endtoken, empty_loc);
|
||||
p->next->next->next = symbol_list_sym_new (NULL, empty_loc);
|
||||
p->next->next->next->next = grammar;
|
||||
nrules += 1;
|
||||
nritems += 3;
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ typedef struct merger_list
|
||||
struct merger_list* next;
|
||||
uniqstr name;
|
||||
uniqstr type;
|
||||
location type_declaration_location;
|
||||
location type_declaration_loc;
|
||||
} merger_list;
|
||||
|
||||
/* From the parser. */
|
||||
|
||||
+1
-1
@@ -382,7 +382,7 @@ reduce_grammar (void)
|
||||
reduce_print ();
|
||||
|
||||
if (!bitset_test (N, accept->content->number - ntokens))
|
||||
complain (&startsymbol_location, fatal,
|
||||
complain (&startsymbol_loc, fatal,
|
||||
_("start symbol %s does not derive any sentence"),
|
||||
startsymbol->tag);
|
||||
|
||||
|
||||
+5
-5
@@ -57,8 +57,8 @@ static void handle_action_at (symbol_list *rule, char *cp, location at_loc);
|
||||
/* A string to be pushed to obstack after dollar/at has been handled. */
|
||||
static char *ref_tail_fields;
|
||||
|
||||
static location the_location;
|
||||
static location *loc = &the_location;
|
||||
static location current_loc;
|
||||
static location *loc = ¤t_loc;
|
||||
|
||||
/* A string representing the most recent translation. */
|
||||
static char *last_string;
|
||||
@@ -187,7 +187,7 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
|
||||
}
|
||||
"@$" {
|
||||
obstack_sgrow (&obstack_for_string, "]b4_at_dollar[");
|
||||
muscle_percent_define_ensure("locations", the_location, true);
|
||||
muscle_percent_define_ensure("locations", *loc, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,12 +507,12 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
dollar_or_at);
|
||||
}
|
||||
else if (midrule_rhs_index)
|
||||
complain_indent (&rule->location, complaint, &indent,
|
||||
complain_indent (&rule->rhs_loc, complaint, &indent,
|
||||
_("symbol not found in production before $%d: "
|
||||
"%.*s"),
|
||||
midrule_rhs_index, len, cp);
|
||||
else
|
||||
complain_indent (&rule->location, complaint, &indent,
|
||||
complain_indent (&rule->rhs_loc, complaint, &indent,
|
||||
_("symbol not found in production: %.*s"),
|
||||
len, cp);
|
||||
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ eqopt ({sp}=)?
|
||||
int context_state PACIFY_CC (= 0);
|
||||
|
||||
/* Location of most recent identifier, when applicable. */
|
||||
location id_loc PACIFY_CC (= empty_location);
|
||||
location id_loc PACIFY_CC (= empty_loc);
|
||||
|
||||
/* Where containing code started, when applicable. Its initial
|
||||
value is relevant only when yylex is invoked in the SC_EPILOGUE
|
||||
|
||||
+6
-5
@@ -34,7 +34,7 @@ symbol_list_sym_new (symbol *sym, location loc)
|
||||
|
||||
res->content_type = SYMLIST_SYMBOL;
|
||||
res->content.sym = sym;
|
||||
res->location = res->sym_loc = loc;
|
||||
res->sym_loc = loc;
|
||||
res->named_ref = NULL;
|
||||
|
||||
res->midrule = NULL;
|
||||
@@ -42,13 +42,14 @@ symbol_list_sym_new (symbol *sym, location loc)
|
||||
res->midrule_parent_rhs_index = 0;
|
||||
|
||||
/* Members used for LHS only. */
|
||||
res->rhs_loc = empty_loc;
|
||||
res->ruleprec = NULL;
|
||||
res->percent_empty_loc = empty_location;
|
||||
res->percent_empty_loc = empty_loc;
|
||||
code_props_none_init (&res->action_props);
|
||||
res->dprec = 0;
|
||||
res->dprec_location = empty_location;
|
||||
res->dprec_loc = empty_loc;
|
||||
res->merger = 0;
|
||||
res->merger_declaration_location = empty_location;
|
||||
res->merger_declaration_loc = empty_loc;
|
||||
res->expected_sr_conflicts = -1;
|
||||
res->expected_rr_conflicts = -1;
|
||||
|
||||
@@ -73,7 +74,7 @@ symbol_list_type_new (uniqstr type_name, location loc)
|
||||
res->content.sem_type->location = loc;
|
||||
res->content.sem_type->status = undeclared;
|
||||
|
||||
res->location = res->sym_loc = loc;
|
||||
res->sym_loc = loc;
|
||||
res->named_ref = NULL;
|
||||
res->next = NULL;
|
||||
|
||||
|
||||
+6
-4
@@ -50,7 +50,6 @@ typedef struct symbol_list
|
||||
*/
|
||||
semantic_type *sem_type;
|
||||
} content;
|
||||
location location;
|
||||
|
||||
/* Named reference. */
|
||||
named_ref *named_ref;
|
||||
@@ -74,6 +73,9 @@ typedef struct symbol_list
|
||||
| when several RHSs are bound to a single lhs via "|"). |
|
||||
`--------------------------------------------------------------*/
|
||||
|
||||
/* Location of the RHS. */
|
||||
location rhs_loc;
|
||||
|
||||
/* Precedence/associativity. */
|
||||
symbol *ruleprec;
|
||||
|
||||
@@ -82,13 +84,13 @@ typedef struct symbol_list
|
||||
code_props action_props;
|
||||
|
||||
/* The location of the first %empty for this rule, or \a
|
||||
empty_location. */
|
||||
empty_loc. */
|
||||
location percent_empty_loc;
|
||||
|
||||
int dprec;
|
||||
location dprec_location;
|
||||
location dprec_loc;
|
||||
int merger;
|
||||
location merger_declaration_location;
|
||||
location merger_declaration_loc;
|
||||
|
||||
/* Counts of the number of expected conflicts for this rule, or -1 if none
|
||||
given. */
|
||||
|
||||
+15
-15
@@ -46,7 +46,7 @@ symbol *undeftoken = NULL;
|
||||
symbol *endtoken = NULL;
|
||||
symbol *accept = NULL;
|
||||
symbol *startsymbol = NULL;
|
||||
location startsymbol_location;
|
||||
location startsymbol_loc;
|
||||
|
||||
/* Precedence relation graph. */
|
||||
static symgraph **prec_nodes;
|
||||
@@ -198,7 +198,7 @@ semantic_type_new (uniqstr tag, const location *loc)
|
||||
|
||||
uniqstr_assert (tag);
|
||||
res->tag = tag;
|
||||
res->location = loc ? *loc : empty_location;
|
||||
res->location = loc ? *loc : empty_loc;
|
||||
res->status = undeclared;
|
||||
for (int i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
code_props_none_init (&res->props[i]);
|
||||
@@ -339,12 +339,12 @@ symbol_type_set (symbol *sym, uniqstr type_name, location loc)
|
||||
tag_seen = true;
|
||||
if (sym->content->type_name)
|
||||
complain_symbol_redeclared (sym, "%type",
|
||||
sym->content->type_location, loc);
|
||||
sym->content->type_loc, loc);
|
||||
else
|
||||
{
|
||||
uniqstr_assert (type_name);
|
||||
sym->content->type_name = type_name;
|
||||
sym->content->type_location = loc;
|
||||
sym->content->type_loc = loc;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -426,12 +426,12 @@ symbol_precedence_set (symbol *sym, int prec, assoc a, location loc)
|
||||
sym_content *s = sym->content;
|
||||
if (s->prec)
|
||||
complain_symbol_redeclared (sym, assoc_to_string (a),
|
||||
s->prec_location, loc);
|
||||
s->prec_loc, loc);
|
||||
else
|
||||
{
|
||||
s->prec = prec;
|
||||
s->assoc = a;
|
||||
s->prec_location = loc;
|
||||
s->prec_loc = loc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,10 +587,10 @@ symbol_merge_properties (symbol *sym, symbol *str)
|
||||
{
|
||||
if (str->content->type_name)
|
||||
symbol_type_set (sym,
|
||||
str->content->type_name, str->content->type_location);
|
||||
str->content->type_name, str->content->type_loc);
|
||||
else
|
||||
symbol_type_set (str,
|
||||
sym->content->type_name, sym->content->type_location);
|
||||
sym->content->type_name, sym->content->type_loc);
|
||||
}
|
||||
|
||||
|
||||
@@ -604,10 +604,10 @@ symbol_merge_properties (symbol *sym, symbol *str)
|
||||
{
|
||||
if (str->content->prec)
|
||||
symbol_precedence_set (sym, str->content->prec, str->content->assoc,
|
||||
str->content->prec_location);
|
||||
str->content->prec_loc);
|
||||
else
|
||||
symbol_precedence_set (str, sym->content->prec, sym->content->assoc,
|
||||
sym->content->prec_location);
|
||||
sym->content->prec_loc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1034,11 +1034,11 @@ symbols_pack (void)
|
||||
symbols_token_translations_init ();
|
||||
|
||||
if (startsymbol->content->class == unknown_sym)
|
||||
complain (&startsymbol_location, fatal,
|
||||
complain (&startsymbol_loc, fatal,
|
||||
_("the start symbol %s is undefined"),
|
||||
startsymbol->tag);
|
||||
else if (startsymbol->content->class == token_sym)
|
||||
complain (&startsymbol_location, fatal,
|
||||
complain (&startsymbol_loc, fatal,
|
||||
_("the start symbol %s is a token"),
|
||||
startsymbol->tag);
|
||||
}
|
||||
@@ -1209,14 +1209,14 @@ print_precedence_warnings (void)
|
||||
&& !prec_nodes[i]->succ)
|
||||
{
|
||||
if (is_assoc_useless (s))
|
||||
complain (&s->content->prec_location, Wprecedence,
|
||||
complain (&s->content->prec_loc, Wprecedence,
|
||||
_("useless precedence and associativity for %s"), s->tag);
|
||||
else if (s->content->assoc == precedence_assoc)
|
||||
complain (&s->content->prec_location, Wprecedence,
|
||||
complain (&s->content->prec_loc, Wprecedence,
|
||||
_("useless precedence for %s"), s->tag);
|
||||
}
|
||||
else if (is_assoc_useless (s))
|
||||
complain (&s->content->prec_location, Wprecedence,
|
||||
complain (&s->content->prec_loc, Wprecedence,
|
||||
_("useless associativity for %s, use %%precedence"), s->tag);
|
||||
}
|
||||
free (used_assoc);
|
||||
|
||||
+3
-3
@@ -122,7 +122,7 @@ struct sym_content
|
||||
uniqstr type_name;
|
||||
|
||||
/** Its \c \%type's location. */
|
||||
location type_location;
|
||||
location type_loc;
|
||||
|
||||
/** Any \c \%destructor (resp. \%printer) declared specificially for this
|
||||
symbol.
|
||||
@@ -134,7 +134,7 @@ struct sym_content
|
||||
code_props props[CODE_PROPS_SIZE];
|
||||
|
||||
symbol_number number;
|
||||
location prec_location;
|
||||
location prec_loc;
|
||||
int prec;
|
||||
assoc assoc;
|
||||
|
||||
@@ -246,7 +246,7 @@ extern symbol *accept;
|
||||
/** The user start symbol. */
|
||||
extern symbol *startsymbol;
|
||||
/** The location of the \c \%start declaration. */
|
||||
extern location startsymbol_location;
|
||||
extern location startsymbol_loc;
|
||||
|
||||
/** Whether a symbol declared with a type tag. */
|
||||
extern bool tag_seen;
|
||||
|
||||
+42
-10
@@ -196,16 +196,8 @@ one.y:11.3-8: previous declaration
|
||||
bison: file 'one.y' was updated (backup: 'one.y~')
|
||||
]])
|
||||
|
||||
AT_CHECK([cat one.y], [],
|
||||
[[%code top {
|
||||
/* Load config.h, and adjust to the compiler.
|
||||
We used to do it here, but each time we add a new line,
|
||||
we have to adjust all the line numbers in error messages.
|
||||
It's simpler to use a constant include to a varying file. */
|
||||
#include <testsuite.h>
|
||||
}
|
||||
|
||||
%%
|
||||
AT_CHECK([sed -e '1,8d' one.y], [],
|
||||
[[%%
|
||||
exp:
|
||||
%empty {} @&t@
|
||||
;
|
||||
@@ -267,6 +259,46 @@ AT_BISON_OPTION_POPDEFS
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
|
||||
## -------------------- ##
|
||||
## Add missing %empty. ##
|
||||
## -------------------- ##
|
||||
|
||||
AT_SETUP([Add missing %empty])
|
||||
|
||||
AT_DATA([input.y],
|
||||
[[%%
|
||||
exp: a b c d e
|
||||
a: {}
|
||||
b:{
|
||||
};
|
||||
c:
|
||||
d
|
||||
:
|
||||
e:
|
||||
%%
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([--update -Wall input.y], [], [], [ignore])
|
||||
AT_CHECK([cat input.y], [],
|
||||
[[%%
|
||||
exp: a b c d e
|
||||
a: %empty {}
|
||||
b: %empty {
|
||||
};
|
||||
c: %empty @&t@
|
||||
d
|
||||
: %empty @&t@
|
||||
e: %empty @&t@
|
||||
%%
|
||||
]])
|
||||
|
||||
# No warnings.
|
||||
AT_BISON_CHECK([-Wall input.y])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ------------------ ##
|
||||
## Initial location. ##
|
||||
## ------------------ ##
|
||||
|
||||
@@ -118,8 +118,14 @@ fi
|
||||
## Other. ##
|
||||
## ------- ##
|
||||
|
||||
# Empty if no D compiler was found.
|
||||
: ${DC='@DC@'}
|
||||
: ${DCFLAGS='@DCFLAGS@'}
|
||||
if test x"$DC" = x; then
|
||||
BISON_DC_WORKS=false
|
||||
else
|
||||
BISON_DC_WORKS=true
|
||||
fi
|
||||
|
||||
# Empty if no javac was found
|
||||
: ${CONF_JAVAC='@CONF_JAVAC@'}
|
||||
|
||||
+1
-1
@@ -893,7 +893,7 @@ error-reduce:
|
||||
|
||||
consistent-error:
|
||||
'a'
|
||||
| /*empty*/ %prec 'a'
|
||||
| %empty %prec 'a'
|
||||
;
|
||||
|
||||
// Provide another context in which all rules are useful so that this
|
||||
|
||||
+5
-5
@@ -278,17 +278,17 @@ AT_DATA([[input.y]],
|
||||
[[%expect 1
|
||||
%%
|
||||
exp: e 'e';
|
||||
e: 'e' | /* Nothing. */;
|
||||
e: 'e' | %empty;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-o input.c input.y], 0, [],
|
||||
[[input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
|
||||
[[input.y:4.10-15: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret -o input.c input.y], 0, [],
|
||||
[[input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
|
||||
4 | e: 'e' | /* Nothing. */;
|
||||
| ^
|
||||
[[input.y:4.10-15: warning: rule useless in parser due to conflicts [-Wother]
|
||||
4 | e: 'e' | %empty;
|
||||
| ^~~~~~
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -20,6 +20,8 @@ AT_BANNER([[Diagnostics.]])
|
||||
|
||||
# AT_TEST($1: TITLE, $2: GRAMMAR, $3: EXIT-STATUS, $4: OUTPUT-WITH-STYLE)
|
||||
# -----------------------------------------------------------------------
|
||||
# Run Bison on GRAMMAR with debugging style enabled, and expect
|
||||
# OUTPUT-WITH-STYLE as diagnostics.
|
||||
m4_pushdef([AT_TEST],
|
||||
[
|
||||
AT_SETUP([$1])
|
||||
@@ -43,7 +45,7 @@ AT_CHECK([perl -p -e 's{</?\w+>}{}g' <experr.orig >experr])
|
||||
AT_CHECK([LC_ALL=en_US.UTF-8 bison -fcaret -Wall input.y], [$3], [], [experr])
|
||||
|
||||
AT_CHECK([cp experr.orig experr])
|
||||
AT_CHECK([LC_ALL=en_US.UTF-8 bison -fcaret --style=debug -Wall input.y], [$3], [], [experr])
|
||||
AT_CHECK([LC_ALL=en_US.UTF-8 bison -fcaret --color=debug -Wall input.y], [$3], [], [experr])
|
||||
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
|
||||
@@ -221,7 +223,7 @@ input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option
|
||||
|
||||
# Locations coming from m4 need the byte-column for diagnostics.
|
||||
|
||||
AT_TEST([[Locations from M4]],
|
||||
AT_TEST([[Tabulations and multibyte characters from M4]],
|
||||
[[%define api.prefix {sun}
|
||||
%define api.prefix {🌞}
|
||||
%%
|
||||
|
||||
@@ -591,7 +591,7 @@ AT_DATA_GRAMMAR([glr-regr7.y],
|
||||
start:
|
||||
stack1 start
|
||||
| stack2 start
|
||||
| /* empty */
|
||||
| %empty
|
||||
;
|
||||
stack1: 'a' ;
|
||||
stack2: 'a' ;
|
||||
@@ -680,11 +680,11 @@ InterfaceDeclaration : OptConstantWord %dprec 1
|
||||
| OptSignalWord %dprec 2
|
||||
;
|
||||
|
||||
OptConstantWord : /* empty */
|
||||
OptConstantWord : %empty
|
||||
| T_CONSTANT
|
||||
;
|
||||
|
||||
OptSignalWord : /* empty */
|
||||
OptSignalWord : %empty
|
||||
{ printf("empty: %d/%d\n", @$.first_column, @$.last_column); }
|
||||
| T_SIGNAL
|
||||
;
|
||||
|
||||
+2
-10
@@ -2590,16 +2590,8 @@ AT_CHECK([diff input.y.orig input.y~])
|
||||
AT_CHECK([test ! -f output.c])
|
||||
|
||||
# Check the update.
|
||||
AT_CHECK([cat input.y], [],
|
||||
[[%code top {
|
||||
/* Load config.h, and adjust to the compiler.
|
||||
We used to do it here, but each time we add a new line,
|
||||
we have to adjust all the line numbers in error messages.
|
||||
It's simpler to use a constant include to a varying file. */
|
||||
#include <testsuite.h>
|
||||
}
|
||||
|
||||
|
||||
AT_CHECK([sed -e '1,8d' input.y], [],
|
||||
[[
|
||||
%default-prec
|
||||
%define parse.error verbose
|
||||
%expect-rr 0
|
||||
|
||||
+4
-3
@@ -390,7 +390,7 @@ m4_define([AT_DATA_SOURCE_PROLOGUE],
|
||||
|
||||
# AT_DATA_GRAMMAR_PROLOGUE
|
||||
# ------------------------
|
||||
# The prologue that should be included in any grammar which parser is
|
||||
# The prologue that should be included in any grammar whose parser is
|
||||
# meant to be compiled.
|
||||
m4_define([AT_DATA_GRAMMAR_PROLOGUE],
|
||||
[[%code top {
|
||||
@@ -400,7 +400,7 @@ m4_define([AT_DATA_GRAMMAR_PROLOGUE],
|
||||
|
||||
# AT_DATA_SOURCE(NAME, CONTENT)
|
||||
# -----------------------------
|
||||
# Generate the file NAME, which CONTENT is preceded by
|
||||
# Generate the file NAME, whose CONTENT is preceded by
|
||||
# AT_DATA_SOURCE_PROLOGUE.
|
||||
m4_define([AT_DATA_SOURCE],
|
||||
[AT_DATA([$1],
|
||||
@@ -411,7 +411,7 @@ $2])
|
||||
|
||||
# AT_DATA_GRAMMAR(NAME, CONTENT)
|
||||
# ------------------------------
|
||||
# Generate the file NAME, which CONTENT is preceded by
|
||||
# Generate the file NAME, whose CONTENT is preceded by
|
||||
# AT_DATA_GRAMMAR_PROLOGUE.
|
||||
m4_define([AT_DATA_GRAMMAR], [AT_LANG_DISPATCH([$0], $@)])
|
||||
|
||||
@@ -977,6 +977,7 @@ AT_CHECK(m4_join([ ],
|
||||
# with trailing ".o" removed, and ".cc" appended.
|
||||
m4_define([AT_COMPILE_D],
|
||||
[AT_KEYWORDS(d)
|
||||
AT_SKIP_IF([[! $BISON_DC_WORKS]])
|
||||
AT_CHECK(m4_join([ ],
|
||||
[$DC $DCFLAGS $3],
|
||||
[m4_bmatch([$1], [[.]], [-c])],
|
||||
|
||||
Reference in New Issue
Block a user