mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-08 18:25:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6675d36e25 | ||
|
|
d0bec3175f | ||
|
|
79e68b6c4d | ||
|
|
5cb74cacd8 | ||
|
|
9c8e6e05b6 | ||
|
|
431774d1f6 | ||
|
|
7d5474e979 | ||
|
|
6b78e50cef | ||
|
|
28769d608e | ||
|
|
a22588bcb9 | ||
|
|
b8c5e5609f | ||
|
|
b81229e1f9 | ||
|
|
815a76f558 | ||
|
|
ea138cd1f1 | ||
|
|
9922f1f877 | ||
|
|
1438b79e80 | ||
|
|
01f3e2969b | ||
|
|
744da03955 | ||
|
|
b28d67b6b0 |
+1
-1
@@ -1 +1 @@
|
||||
3.6.91
|
||||
3.6.93
|
||||
|
||||
@@ -1,29 +1,6 @@
|
||||
GNU Bison NEWS
|
||||
|
||||
* Noteworthy changes in release 3.6.92 (2020-07-19) [beta]
|
||||
|
||||
Changes in the display of counterexamples.
|
||||
|
||||
** Documentation
|
||||
|
||||
*** Examples
|
||||
|
||||
The bistromathic demonstrates %param and how to quote sources in the error
|
||||
messages:
|
||||
|
||||
> 123 456
|
||||
1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
|
||||
1 | 123 456
|
||||
| ^~~
|
||||
|
||||
* Noteworthy changes in release 3.6.91 (2020-07-09) [beta]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
Portability issues.
|
||||
|
||||
|
||||
* Noteworthy changes in release 3.6.90 (2020-07-04) [beta]
|
||||
* Noteworthy changes in release 3.7 (2020-07-23) [stable]
|
||||
|
||||
** Deprecated features
|
||||
|
||||
@@ -41,52 +18,114 @@ Changes in the display of counterexamples.
|
||||
|
||||
Contributed by Vincent Imbimbo.
|
||||
|
||||
When given `--report=counterexamples` or `-Wcounterexamples`, bison will
|
||||
now output counterexamples for conflicts in the grammar. These are
|
||||
strings in the grammar which can be parsed in two ways due to the
|
||||
conflict. For example:
|
||||
When given `-Wcounterexamples`/`-Wcex`, bison will now output
|
||||
counterexamples for conflicts.
|
||||
|
||||
Shift/reduce conflict on token "/":
|
||||
Example exp "+" exp • "/" exp
|
||||
**** Unifying Counterexamples
|
||||
|
||||
Unifying counterexamples are strings which can be parsed in two ways due
|
||||
to the conflict. For example on a grammar that contains the usual
|
||||
"dangling else" ambiguity:
|
||||
|
||||
$ bison else.y
|
||||
else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
|
||||
$ bison else.y -Wcex
|
||||
else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
|
||||
Example: "if" exp "then" "if" exp "then" exp • "else" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "+" exp
|
||||
↳ exp • "/" exp
|
||||
Example exp "+" exp • "/" exp
|
||||
↳ "if" exp "then" exp
|
||||
↳ "if" exp "then" exp • "else" exp
|
||||
Example: "if" exp "then" "if" exp "then" exp • "else" exp
|
||||
Reduce derivation
|
||||
exp
|
||||
↳ exp "/" exp
|
||||
↳ exp "+" exp •
|
||||
↳ "if" exp "then" exp "else" exp
|
||||
↳ "if" exp "then" exp •
|
||||
|
||||
When Bison is installed with text styling enabled, the example is actually
|
||||
shown twice, with colors highlighting the ambiguity.
|
||||
When text styling is enabled, colors are used in the examples and the
|
||||
derivations to highlight the structure of both analyses. In this case,
|
||||
|
||||
This is a shift/reduce conflict caused by none of the operators having
|
||||
precedence, so the example can be parsed in the two ways shown. When
|
||||
bison cannot find an example that can be derived in two ways, it instead
|
||||
generates two examples that are the same up until the dot:
|
||||
"if" exp "then" [ "if" exp "then" exp • ] "else" exp
|
||||
|
||||
First example expr • ID ',' ID $end
|
||||
Shift derivation
|
||||
$accept
|
||||
↳ s $end
|
||||
↳ a ID
|
||||
↳ expr
|
||||
↳ expr • ID ','
|
||||
Second example expr • ID $end
|
||||
Reduce derivation
|
||||
$accept
|
||||
↳ s $end
|
||||
↳ a ID
|
||||
↳ expr •
|
||||
vs.
|
||||
|
||||
"if" exp "then" [ "if" exp "then" exp • "else" exp ]
|
||||
|
||||
|
||||
The counterexamples are "focused", in two different ways. First, they do
|
||||
not clutter the output with all the derivations from the start symbol,
|
||||
rather they start on the "conflicted nonterminal". They go straight to the
|
||||
point. Second, they don't "expand" nonterminal symbols uselessly.
|
||||
|
||||
**** Nonunifying Counterexamples
|
||||
|
||||
In the case of the dangling else, Bison found an example that can be
|
||||
parsed in two ways (therefore proving that the grammar is ambiguous).
|
||||
When it cannot find such an example, it instead generates two examples
|
||||
that are the same up until the dot:
|
||||
|
||||
$ bison foo.y
|
||||
foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
|
||||
4 | a: expr
|
||||
| ^~~~
|
||||
|
||||
$ bison -Wcex foo.y
|
||||
foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
|
||||
First example: expr • ID ',' ID $end
|
||||
Shift derivation
|
||||
$accept
|
||||
↳ s $end
|
||||
↳ a ID
|
||||
↳ expr
|
||||
↳ expr • ID ','
|
||||
Second example: expr • ID $end
|
||||
Reduce derivation
|
||||
$accept
|
||||
↳ s $end
|
||||
↳ a ID
|
||||
↳ expr •
|
||||
foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
|
||||
4 | a: expr
|
||||
| ^~~~
|
||||
|
||||
In these cases, the parser usually doesn't have enough lookahead to
|
||||
differentiate the two given examples.
|
||||
|
||||
The counterexamples are "focused" in two different ways. First, they do
|
||||
not clutter the output with all the derivations from the start symbol,
|
||||
rather they start on the "conflicted nonterminal". They go straight to the
|
||||
point. Second, they don't "expand" nonterminal symbols uselessly.
|
||||
**** Reports
|
||||
|
||||
Counterexamples are also included in the report when given
|
||||
`--report=counterexamples`/`-rcex` (or `--report=all`), with more
|
||||
technical details:
|
||||
|
||||
State 7
|
||||
|
||||
1 exp: "if" exp "then" exp • [$end, "then", "else"]
|
||||
2 | "if" exp "then" exp • "else" exp
|
||||
|
||||
"else" shift, and go to state 8
|
||||
|
||||
"else" [reduce using rule 1 (exp)]
|
||||
$default reduce using rule 1 (exp)
|
||||
|
||||
shift/reduce conflict on token "else":
|
||||
1 exp: "if" exp "then" exp •
|
||||
2 exp: "if" exp "then" exp • "else" exp
|
||||
Example: "if" exp "then" "if" exp "then" exp • "else" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ "if" exp "then" exp
|
||||
↳ "if" exp "then" exp • "else" exp
|
||||
Example: "if" exp "then" "if" exp "then" exp • "else" exp
|
||||
Reduce derivation
|
||||
exp
|
||||
↳ "if" exp "then" exp "else" exp
|
||||
↳ "if" exp "then" exp •
|
||||
|
||||
*** File prefix mapping
|
||||
|
||||
@@ -100,6 +139,11 @@ Changes in the display of counterexamples.
|
||||
|
||||
** Changes
|
||||
|
||||
*** Diagnostics
|
||||
|
||||
When text styling is enabled and the terminal supports it, the warnings
|
||||
now include hyperlinks to the documentation.
|
||||
|
||||
*** Relocatable installation
|
||||
|
||||
When installed to be relocatable (via `configure --enable-relocatable`),
|
||||
@@ -140,6 +184,18 @@ Changes in the display of counterexamples.
|
||||
Now the parser state can be examined when parsing is finished. The parser
|
||||
state is reset when starting a new parse.
|
||||
|
||||
** Documentation
|
||||
|
||||
*** Examples
|
||||
|
||||
The bistromathic demonstrates %param and how to quote sources in the error
|
||||
messages:
|
||||
|
||||
> 123 456
|
||||
1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
|
||||
1 | 123 456
|
||||
| ^~~
|
||||
|
||||
** Bug fixes
|
||||
|
||||
*** Include the generated header (yacc.c)
|
||||
@@ -4405,7 +4461,7 @@ LocalWords: yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
|
||||
LocalWords: symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
|
||||
LocalWords: autocompletion bistromathic submessages Cayuela lexcalc hoc
|
||||
LocalWords: yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
|
||||
LocalWords: gotos readline Imbimbo Wcounterexamples
|
||||
LocalWords: gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
|
||||
|
||||
Local Variables:
|
||||
ispell-dictionary: "american"
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ gnulib_modules='
|
||||
realloc-posix
|
||||
relocatable-prog relocatable-script
|
||||
rename
|
||||
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
||||
spawn-pipe stdbool stpcpy stpncpy strdup-posix strerror strverscmp
|
||||
timevar
|
||||
unicodeio unistd unistd-safer unlink unlocked-io
|
||||
update-copyright unsetenv verify
|
||||
|
||||
+240
-68
@@ -9889,10 +9889,11 @@ initially developed by Chinawat Isradisaikul and Andrew Myers
|
||||
As a first example, see the example grammar of @ref{Shift/Reduce}, which
|
||||
features on shift/reduce conflict:
|
||||
|
||||
@c see doc/if-then-else.y
|
||||
@example
|
||||
$ @kbd{bison if-then-else.y}
|
||||
if-then-else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
if-then-else.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
if-then-else.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
|
||||
if-then-else.y: @dnotice{note}: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@@ -9900,32 +9901,46 @@ Let's rerun @command{bison} with the option
|
||||
@option{-Wcex}/@option{-Wcounterexamples}@inlinefmt{info, (the following
|
||||
output is actually in color)}:
|
||||
|
||||
@ifhtml
|
||||
@ifnottex
|
||||
@example
|
||||
Shift/reduce conflict on token "else":
|
||||
if-then-else.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
|
||||
if-then-else.y: @dwarning{warning}: shift/reduce conflict on token "else" [@dwarning{-Wcounterexamples}]
|
||||
@group
|
||||
Example @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @blue{"else" stmt}
|
||||
Shift derivation @yellow{if_stmt @arrow{} [ "if" expr "then"} @green{stmt @arrow{} [} @blue{if_stmt @arrow{} [ "if" expr "then" stmt} @red{•} @blue{"else" stmt ]} @green{]} @yellow{]}
|
||||
Example @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
|
||||
Reduce derivation @yellow{if_stmt @arrow{} [ "if" expr "then"} @green{stmt @arrow{} [} @blue{if_stmt @arrow{} [ "if" expr "then" stmt} @red{•} @blue{]} @green{]} @yellow{"else" stmt ]}
|
||||
Example: @yellow{"if" expr "then"} "if" expr "then" stmt • "else" stmt
|
||||
Shift derivation
|
||||
@yellow{if_stmt}
|
||||
@yellow{↳ "if" expr "then"} @green{stmt}
|
||||
@green{↳} @blue{if_stmt}
|
||||
@blue{↳ "if" expr "then" stmt} @red{•} @blue{"else" stmt}
|
||||
Example: @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
|
||||
Reduce derivation
|
||||
@yellow{if_stmt}
|
||||
@yellow{↳ "if" expr "then"} @green{stmt} @yellow{"else" stmt}
|
||||
@green{↳} @blue{if_stmt}
|
||||
@blue{↳ "if" expr "then" stmt} @red{•}
|
||||
@end group
|
||||
@end example
|
||||
@end ifhtml
|
||||
@ifnothtml
|
||||
@smallexample
|
||||
Shift/reduce conflict on token "else":
|
||||
@end ifnottex
|
||||
@iftex
|
||||
@example
|
||||
if-then-else.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
|
||||
if-then-else.y: @dwarning{warning}: shift/reduce conflict on token "else" [@dwarning{-Wcounterexamples}]
|
||||
@group
|
||||
Example
|
||||
@yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @blue{"else" stmt}
|
||||
Example: @yellow{"if" expr "then"} "if" expr "then" stmt • "else" stmt
|
||||
Shift derivation
|
||||
@yellow{if_stmt @arrow{} [ "if" expr "then"} @green{stmt @arrow{} [} @blue{if_stmt @arrow{} [ "if" expr "then" stmt} @red{•} @blue{"else" stmt ]} @green{]} @yellow{]}
|
||||
Example
|
||||
@yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
|
||||
@yellow{if_stmt}
|
||||
@yellow{@arrow{} "if" expr "then"} @green{stmt}
|
||||
@green{@arrow{}} @blue{if_stmt}
|
||||
@blue{@arrow{} "if" expr "then" stmt} @red{•} @blue{"else" stmt}
|
||||
Example: @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
|
||||
Reduce derivation
|
||||
@yellow{if_stmt @arrow{} [ "if" expr "then"} @green{stmt @arrow{} [} @blue{if_stmt @arrow{} [ "if" expr "then" stmt} @red{•} @blue{]} @green{]} @yellow{"else" stmt ]}
|
||||
@yellow{if_stmt}
|
||||
@yellow{@arrow{} "if" expr "then"} @green{stmt} @yellow{"else" stmt}
|
||||
@green{@arrow{}} @blue{if_stmt}
|
||||
@blue{@arrow{} "if" expr "then" stmt} @red{•}
|
||||
@end group
|
||||
@end smallexample
|
||||
@end ifnothtml
|
||||
@end example
|
||||
@end iftex
|
||||
|
||||
This shows two different derivations for one single expression. That
|
||||
demonstrates that the grammar is ambiguous.
|
||||
@@ -9935,6 +9950,7 @@ demonstrates that the grammar is ambiguous.
|
||||
As a more delicate example, consider the example grammar of
|
||||
@ref{Reduce/Reduce}, which features a reduce/reduce conflict:
|
||||
|
||||
@c doc/sequence.y
|
||||
@example
|
||||
%%
|
||||
sequence:
|
||||
@@ -9950,32 +9966,112 @@ maybeword:
|
||||
|
||||
Bison generates the following counterexamples:
|
||||
|
||||
@ifnottex
|
||||
@example
|
||||
@group
|
||||
$ @kbd{bison -Wcex sequence.y}
|
||||
sequence.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
|
||||
sequence.y: @dwarning{warning}: 2 reduce/reduce conflicts [@dwarning{-Wconflicts-rr}]
|
||||
Shift/reduce conflict on token "word":
|
||||
Example @red{•} @green{"word"}
|
||||
Shift derivation @yellow{sequence @arrow{} [} @green{maybeword @arrow{} [} @red{•} @green{"word" ]} @yellow{]}
|
||||
Example @red{•} @yellow{"word"}
|
||||
Reduce derivation @yellow{sequence @arrow{} [} @green{sequence @arrow{} [} @red{•} @green{]} @yellow{"word" ]}
|
||||
|
||||
Reduce/reduce conflict on tokens $end, "word":
|
||||
Example @red{•}
|
||||
First derivation @yellow{sequence @arrow{} [} @red{•} @yellow{]}
|
||||
Example @red{•}
|
||||
Second derivation @yellow{sequence @arrow{} [} @green{maybeword @arrow{} [} @red{•} @green{]} @yellow{]}
|
||||
|
||||
Shift/reduce conflict on token "word":
|
||||
Example @red{•} @green{"word"}
|
||||
Shift derivation @yellow{sequence @arrow{} [} @green{maybeword @arrow{} [} @red{•} @green{"word" ]} @yellow{]}
|
||||
Example @red{•} @yellow{"word"}
|
||||
Reduce derivation @yellow{sequence @arrow{} [} @green{sequence @arrow{} [} @blue{maybeword @arrow{} [} @red{•} @blue{]} @green{]} @yellow{"word" ]}
|
||||
|
||||
@end group
|
||||
@group
|
||||
sequence.y: @dwarning{warning}: shift/reduce conflict on token "word" [@dwarning{-Wcounterexamples}]
|
||||
Example: @red{•} @green{"word"}
|
||||
Shift derivation
|
||||
@yellow{sequence}
|
||||
@yellow{↳} @green{maybeword}
|
||||
@green{↳} @red{•} @green{"word"}
|
||||
Example: @red{•} @yellow{"word"}
|
||||
Reduce derivation
|
||||
@yellow{sequence}
|
||||
@yellow{↳} @green{sequence} @yellow{"word"}
|
||||
@green{↳} @red{•}
|
||||
@end group
|
||||
@group
|
||||
sequence.y: @dwarning{warning}: reduce/reduce conflict on tokens $end, "word" [@dwarning{-Wcounterexamples}]
|
||||
Example: @red{•}
|
||||
First reduce derivation
|
||||
@yellow{sequence}
|
||||
@yellow{↳} @red{•}
|
||||
Example: @red{•}
|
||||
Second reduce derivation
|
||||
@yellow{sequence}
|
||||
@yellow{↳} @green{maybeword}
|
||||
@green{↳} @red{•}
|
||||
@end group
|
||||
@group
|
||||
sequence.y: @dwarning{warning}: shift/reduce conflict on token "word" [@dwarning{-Wcounterexamples}]
|
||||
Example: @red{•} @green{"word"}
|
||||
Shift derivation
|
||||
@yellow{sequence}
|
||||
@yellow{↳} @green{maybeword}
|
||||
@green{↳} @red{•} @green{"word"}
|
||||
Example: @red{•} @yellow{"word"}
|
||||
Reduce derivation
|
||||
@yellow{sequence}
|
||||
@yellow{↳} @green{sequence} @yellow{"word"}
|
||||
@green{↳} @blue{maybeword}
|
||||
@blue{↳} @red{•}
|
||||
@end group
|
||||
@group
|
||||
sequence.y:8.3-45: @dwarning{warning}: rule useless in parser due to conflicts [@dwarning{-Wother}]
|
||||
8 | @dwarning{%empty @{ printf ("empty maybeword\n"); @}}
|
||||
| @dwarning{^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
|
||||
@end group
|
||||
@end example
|
||||
@end ifnottex
|
||||
@iftex
|
||||
@example
|
||||
@group
|
||||
$ @kbd{bison -Wcex sequence.y}
|
||||
sequence.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
|
||||
sequence.y: @dwarning{warning}: 2 reduce/reduce conflicts [@dwarning{-Wconflicts-rr}]
|
||||
@end group
|
||||
@group
|
||||
sequence.y: @dwarning{warning}: shift/reduce conflict on token "word" [@dwarning{-Wcounterexamples}]
|
||||
Example: @red{•} @green{"word"}
|
||||
Shift derivation
|
||||
@yellow{sequence}
|
||||
@yellow{@arrow{}} @green{maybeword}
|
||||
@green{@arrow{}} @red{•} @green{"word"}
|
||||
Example: @red{•} @yellow{"word"}
|
||||
Reduce derivation
|
||||
@yellow{sequence}
|
||||
@yellow{@arrow{}} @green{sequence} @yellow{"word"}
|
||||
@green{@arrow{}} @red{•}
|
||||
@end group
|
||||
@group
|
||||
sequence.y: @dwarning{warning}: reduce/reduce conflict on tokens $end, "word" [@dwarning{-Wcounterexamples}]
|
||||
Example: @red{•}
|
||||
First reduce derivation
|
||||
@yellow{sequence}
|
||||
@yellow{@arrow{}} @red{•}
|
||||
Example: @red{•}
|
||||
Second reduce derivation
|
||||
@yellow{sequence}
|
||||
@yellow{@arrow{}} @green{maybeword}
|
||||
@green{@arrow{}} @red{•}
|
||||
@end group
|
||||
@group
|
||||
sequence.y: @dwarning{warning}: shift/reduce conflict on token "word" [@dwarning{-Wcounterexamples}]
|
||||
Example: @red{•} @green{"word"}
|
||||
Shift derivation
|
||||
@yellow{sequence}
|
||||
@yellow{@arrow{}} @green{maybeword}
|
||||
@green{@arrow{}} @red{•} @green{"word"}
|
||||
Example: @red{•} @yellow{"word"}
|
||||
Reduce derivation
|
||||
@yellow{sequence}
|
||||
@yellow{@arrow{}} @green{sequence} @yellow{"word"}
|
||||
@green{@arrow{}} @blue{maybeword}
|
||||
@blue{@arrow{}} @red{•}
|
||||
@end group
|
||||
@group
|
||||
sequence.y:8.3-45: @dwarning{warning}: rule useless in parser due to conflicts [@dwarning{-Wother}]
|
||||
8 | @dwarning{%empty @{ printf ("empty maybeword\n"); @}}
|
||||
| @dwarning{^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
|
||||
@end group
|
||||
@end example
|
||||
@end iftex
|
||||
|
||||
Each of these three conflicts, again, prove that the grammar is ambiguous.
|
||||
For instance, the second conflict (the reduce/reduce one) shows that the
|
||||
@@ -9989,6 +10085,7 @@ that are the same up until the dot. Most notably, this will happen when
|
||||
your grammar requires a stronger parser (more lookahead, LR instead of
|
||||
LALR). The following example isn't LR(1):
|
||||
|
||||
@c doc/ids.y
|
||||
@example
|
||||
%token ID
|
||||
%%
|
||||
@@ -9999,13 +10096,58 @@ expr: %empty | expr ID ','
|
||||
|
||||
@command{bison} reports:
|
||||
|
||||
@smallexample
|
||||
Shift/reduce conflict on token ID:
|
||||
First example @purple{expr} @red{•} @purple{ID ','} @green{ID} @yellow{$end}
|
||||
Shift derivation @yellow{$accept @arrow{} [} @green{s @arrow{} [} @blue{a @arrow{} [} @purple{expr @arrow{} [ expr} @red{•} @purple{ID ',' ]} @blue{]} @green{ID ]} @yellow{$end ]}
|
||||
Second example @blue{expr} @red{•} @green{ID} @yellow{$end}
|
||||
Reduce derivation @yellow{$accept @arrow{} [} @green{s @arrow{} [} @blue{a @arrow{} [ expr} @red{•} @blue{]} @green{ID ]} @yellow{$end ]}
|
||||
@end smallexample
|
||||
@ifnottex
|
||||
@example
|
||||
ids.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
|
||||
ids.y: @dwarning{warning}: shift/reduce conflict on token ID [@dwarning{-Wcounterexamples}]
|
||||
@group
|
||||
First example: @purple{expr} @red{•} @purple{ID ','} @green{ID} @yellow{$end}
|
||||
Shift derivation
|
||||
@yellow{$accept}
|
||||
@yellow{↳} @green{s} @yellow{$end}
|
||||
@green{↳} @blue{a} @green{ID}
|
||||
@blue{↳} @purple{expr}
|
||||
@purple{↳ expr} @red{•} @purple{ID ','}
|
||||
Second example: @blue{expr} @red{•} @green{ID} @yellow{$end}
|
||||
Reduce derivation
|
||||
@yellow{$accept}
|
||||
@yellow{↳} @green{s} @yellow{$end}
|
||||
@green{↳} @blue{a} @green{ID}
|
||||
@blue{↳ expr} @red{•}
|
||||
@end group
|
||||
@group
|
||||
ids.y:4.4-7: @dwarning{warning}: rule useless in parser due to conflicts [@dwarning{-Wother}]
|
||||
4 | a: expr
|
||||
| ^~~~
|
||||
@end group
|
||||
@end example
|
||||
@end ifnottex
|
||||
@iftex
|
||||
@example
|
||||
ids.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}]
|
||||
ids.y: @dwarning{warning}: shift/reduce conflict on token ID [@dwarning{-Wcounterexamples}]
|
||||
@group
|
||||
First example: @purple{expr} @red{•} @purple{ID ','} @green{ID} @yellow{$end}
|
||||
Shift derivation
|
||||
@yellow{$accept}
|
||||
@yellow{@arrow{}} @green{s} @yellow{$end}
|
||||
@green{@arrow{}} @blue{a} @green{ID}
|
||||
@blue{@arrow{}} @purple{expr}
|
||||
@purple{@arrow{} expr} @red{•} @purple{ID ','}
|
||||
Second example: @blue{expr} @red{•} @green{ID} @yellow{$end}
|
||||
Reduce derivation
|
||||
@yellow{$accept}
|
||||
@yellow{@arrow{}} @green{s} @yellow{$end}
|
||||
@green{@arrow{}} @blue{a} @green{ID}
|
||||
@blue{@arrow{} expr} @red{•}
|
||||
@end group
|
||||
@group
|
||||
ids.y:4.4-7: @dwarning{warning}: rule useless in parser due to conflicts [@dwarning{-Wother}]
|
||||
4 | a: expr
|
||||
| ^~~~
|
||||
@end group
|
||||
@end example
|
||||
@end iftex
|
||||
|
||||
This conflict is caused by the parser not having enough information to know
|
||||
the difference between these two examples. The parser would need an
|
||||
@@ -10041,6 +10183,7 @@ by default. As a consequence, the verbose output file is called
|
||||
|
||||
The following grammar file, @file{calc.y}, will be used in the sequel:
|
||||
|
||||
@c doc/calc.y
|
||||
@example
|
||||
@group
|
||||
%union
|
||||
@@ -10084,7 +10227,7 @@ calc.y:19.1-7: @dwarning{warning}: nonterminal useless in grammar: useless [@dwa
|
||||
19 | @dwarning{useless: STR;}
|
||||
| @dwarning{^~~~~~~}
|
||||
calc.y: @dwarning{warning}: 7 shift/reduce conflicts [@dwarning{-Wconflicts-sr}]
|
||||
calc.y: @dwarning{warning}: rerun with option '-Wcounterexamples' to generate conflict counterexamples [@dwarning{-Wother}]
|
||||
calc.y: @dnotice{note}: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
@end smallexample
|
||||
|
||||
Going back to the calc example, when given @option{--report=state},
|
||||
@@ -10396,15 +10539,44 @@ When given @option{--report=counterexamples}, @command{bison} will generate
|
||||
counterexamples within the report, augmented with the corresponding items
|
||||
(@pxref{Counterexamples}).
|
||||
|
||||
@ifnottex
|
||||
@example
|
||||
Shift/reduce conflict on token '/':
|
||||
shift/reduce conflict on token '/':
|
||||
1 exp: exp '+' exp •
|
||||
4 exp: exp • '/' exp
|
||||
Example @yellow{exp '+'} @green{exp} @red{•} @green{'/' exp}
|
||||
Shift derivation @yellow{exp @arrow{} [ exp '+'} @green{exp @arrow{} [ exp} @red{•} @green{'/' exp ]} @yellow{]}
|
||||
Example @green{exp '+' exp} @red{•} @yellow{'/' exp}
|
||||
Reduce derivation @yellow{exp @arrow{} [} @green{exp @arrow{} [ exp '+' exp} @red{•} @green{]} @yellow{'/' exp ]}
|
||||
@group
|
||||
Example: exp '+' exp • '/' exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp '+' exp
|
||||
↳ exp • '/' exp
|
||||
Example: exp '+' exp • '/' exp
|
||||
Reduce derivation
|
||||
exp
|
||||
↳ exp '/' exp
|
||||
↳ exp '+' exp •
|
||||
@end group
|
||||
@end example
|
||||
@end ifnottex
|
||||
@iftex
|
||||
@example
|
||||
shift/reduce conflict on token '/':
|
||||
1 exp: exp '+' exp •
|
||||
4 exp: exp • '/' exp
|
||||
@group
|
||||
Example: exp '+' exp • '/' exp
|
||||
Shift derivation
|
||||
exp
|
||||
@arrow{} exp '+' exp
|
||||
@arrow{} exp • '/' exp
|
||||
Example: exp '+' exp • '/' exp
|
||||
Reduce derivation
|
||||
exp
|
||||
@arrow{} exp '/' exp
|
||||
@arrow{} exp '+' exp •
|
||||
@end group
|
||||
@end example
|
||||
@end iftex
|
||||
|
||||
This shows two separate derivations in the grammar for the same @code{exp}:
|
||||
@samp{e1 + e2 / e3}. The derivations show how your rules would parse the
|
||||
@@ -11015,7 +11187,7 @@ The exit status of @command{bison} is:
|
||||
@item 0 (success)
|
||||
when there were no errors. Warnings, which are diagnostics about dubious
|
||||
constructs, do not change the exit status, unless they are turned into
|
||||
errors (@pxref{-Werror,,@option{-Werror}}).
|
||||
errors (@pxref{Werror,,@option{-Werror}}).
|
||||
|
||||
@item 1 (failure)
|
||||
when there were errors. No file was generated (except the reports generated
|
||||
@@ -11252,22 +11424,22 @@ Options controlling the diagnostics.
|
||||
Output warnings falling in @var{category}. @var{category} can be one
|
||||
of:
|
||||
@table @code
|
||||
@item conflicts-sr
|
||||
@itemx conflicts-rr
|
||||
@item @anchor{Wconflicts-sr}conflicts-sr
|
||||
@itemx @anchor{Wconflicts-rr}conflicts-rr
|
||||
S/R and R/R conflicts. These warnings are enabled by default. However, if
|
||||
the @code{%expect} or @code{%expect-rr} directive is specified, an
|
||||
unexpected number of conflicts is an error, and an expected number of
|
||||
conflicts is not reported, so @option{-W} and @option{--warning} then have
|
||||
no effect on the conflict report.
|
||||
|
||||
@item counterexamples
|
||||
@item @anchor{Wcounterexamples}counterexamples
|
||||
@itemx cex
|
||||
Provide counterexamples for conflicts. @xref{Counterexamples}.
|
||||
Counterexamples take time to compute. The option @option{-Wcex} should be
|
||||
used by the developer when working on the grammar; it hardly makes sense to
|
||||
use it in a CI.
|
||||
|
||||
@item dangling-alias
|
||||
@item @anchor{Wdangling-alias}dangling-alias
|
||||
Report string literals that are not bound to a token symbol.
|
||||
|
||||
String literals, which allow for better error messages, are (too) liberally
|
||||
@@ -11313,16 +11485,16 @@ foo: "baz" @{@}
|
||||
| @dwarning{^~~~~}
|
||||
@end example
|
||||
|
||||
@item deprecated
|
||||
@item @anchor{Wdeprecated}deprecated
|
||||
Deprecated constructs whose support will be removed in future versions of
|
||||
Bison.
|
||||
|
||||
@item empty-rule
|
||||
@item @anchor{Wempty-rule}empty-rule
|
||||
Empty rules without @code{%empty}. @xref{Empty Rules}. Disabled by
|
||||
default, but enabled by uses of @code{%empty}, unless
|
||||
@option{-Wno-empty-rule} was specified.
|
||||
|
||||
@item midrule-values
|
||||
@item @anchor{Wmidrule-values}midrule-values
|
||||
Warn about midrule values that are set but not used within any of the actions
|
||||
of the parent rule.
|
||||
For example, warn about unused @code{$2} in:
|
||||
@@ -11342,7 +11514,7 @@ These warnings are not enabled by default since they sometimes prove to
|
||||
be false alarms in existing grammars employing the Yacc constructs
|
||||
@code{$0} or @code{$-@var{n}} (where @var{n} is some positive integer).
|
||||
|
||||
@item precedence
|
||||
@item @anchor{Wprecedence}precedence
|
||||
Useless precedence and associativity directives. Disabled by default.
|
||||
|
||||
Consider for instance the following grammar:
|
||||
@@ -11403,20 +11575,21 @@ One would get the exact same parser with the following directives instead:
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@item yacc
|
||||
@item @anchor{Wyacc}yacc
|
||||
Incompatibilities with POSIX Yacc.
|
||||
|
||||
@item other
|
||||
@item @anchor{Wother}other
|
||||
All warnings not categorized above. These warnings are enabled by default.
|
||||
|
||||
This category is provided merely for the sake of completeness. Future
|
||||
releases of Bison may move warnings from this category to new, more specific
|
||||
categories.
|
||||
|
||||
@item all
|
||||
All the warnings except @code{dangling-alias} and @code{yacc}.
|
||||
@item @anchor{Wall}all
|
||||
All the warnings except @code{counterexamples}, @code{dangling-alias} and
|
||||
@code{yacc}.
|
||||
|
||||
@item none
|
||||
@item @anchor{Wnone}none
|
||||
Turn off all the warnings.
|
||||
|
||||
@item error
|
||||
@@ -11427,8 +11600,7 @@ A category can be turned off by prefixing its name with @samp{no-}. For
|
||||
instance, @option{-Wno-yacc} will hide the warnings about
|
||||
POSIX Yacc incompatibilities.
|
||||
|
||||
@item -Werror
|
||||
@anchor{-Werror}
|
||||
@item @anchor{Werror}-Werror
|
||||
Turn enabled warnings for every @var{category} into errors, unless they are
|
||||
explicitly disabled by @option{-Wno-error=@var{category}}.
|
||||
|
||||
@@ -15855,7 +16027,7 @@ London, Department of Computer Science, TR-00-12 (December 2000).
|
||||
@c LocalWords: TokenKind Automake's rtti Wcounterexamples Chinawat PLDI
|
||||
@c LocalWords: Isradisaikul tcite pcite rgbGreen colorGreen rgbYellow Wcex
|
||||
@c LocalWords: colorYellow rgbRed colorRed rgbBlue colorBlue rgbPurple
|
||||
@c LocalWords: colorPurple ifhtml ifnothtml situ rcex
|
||||
@c LocalWords: colorPurple ifhtml ifnothtml situ rcex MERCHANTABILITY Wnone
|
||||
|
||||
@c Local Variables:
|
||||
@c ispell-dictionary: "american"
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
%union
|
||||
{
|
||||
int ival;
|
||||
const char *sval;
|
||||
}
|
||||
|
||||
%token <ival> NUM
|
||||
%nterm <ival> exp
|
||||
%token <sval> STR
|
||||
%nterm <sval> useless
|
||||
|
||||
%left '+' '-'
|
||||
%left '*'
|
||||
|
||||
%%
|
||||
exp:
|
||||
exp '+' exp
|
||||
| exp '-' exp
|
||||
| exp '*' exp
|
||||
| exp '/' exp
|
||||
| NUM
|
||||
;
|
||||
useless: STR;
|
||||
@@ -0,0 +1,13 @@
|
||||
%%
|
||||
stmt:
|
||||
expr
|
||||
| if_stmt
|
||||
;
|
||||
|
||||
if_stmt:
|
||||
"if" expr "then" stmt
|
||||
| "if" expr "then" stmt "else" stmt
|
||||
;
|
||||
|
||||
expr:
|
||||
"identifier"
|
||||
@@ -0,0 +1,10 @@
|
||||
%%
|
||||
sequence:
|
||||
%empty
|
||||
| maybeword
|
||||
| sequence "word"
|
||||
;
|
||||
maybeword:
|
||||
%empty
|
||||
| "word"
|
||||
;
|
||||
+1
-1
Submodule gnulib updated: cf6d5db127...ac34618e85
+35
-3
@@ -35,6 +35,13 @@
|
||||
#include "getargs.h"
|
||||
#include "quote.h"
|
||||
|
||||
// The URL of the manual page about diagnostics. Use the per-node
|
||||
// manual, to avoid downloading repeatedly the whole manual over the
|
||||
// Internet.
|
||||
static const char *diagnostics_url
|
||||
= "https://www.gnu.org/software/bison/manual/html_node/Diagnostics.html";
|
||||
|
||||
|
||||
err_status complaint_status = status_none;
|
||||
|
||||
bool warnings_are_errors = false;
|
||||
@@ -96,6 +103,20 @@ end_use_class (const char *s, FILE *out)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
begin_hyperlink (FILE *out, const char *ref)
|
||||
{
|
||||
if (out == stderr)
|
||||
styled_ostream_set_hyperlink (errstream, ref, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
end_hyperlink (FILE *out)
|
||||
{
|
||||
if (out == stderr)
|
||||
styled_ostream_set_hyperlink (errstream, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
flush (FILE *out)
|
||||
{
|
||||
@@ -427,9 +448,20 @@ warnings_print_categories (warnings warn_flags, FILE *out)
|
||||
const char* style = severity_style (s);
|
||||
fputs (" [", out);
|
||||
begin_use_class (style, out);
|
||||
fprintf (out, "-W%s%s",
|
||||
s == severity_error ? "error=" : "",
|
||||
argmatch_warning_argument (&w));
|
||||
// E.g., "counterexamples".
|
||||
const char *warning = argmatch_warning_argument (&w);
|
||||
char ref[200];
|
||||
snprintf (ref, sizeof ref,
|
||||
"%s#W%s", diagnostics_url, warning);
|
||||
begin_hyperlink (out, ref);
|
||||
ostream_printf (errstream,
|
||||
"-W%s%s",
|
||||
s == severity_error ? "error=" : "",
|
||||
warning);
|
||||
end_hyperlink (out);
|
||||
// Because we mix stdio with ostream I/O, we need to flush
|
||||
// here for sake of color == debug.
|
||||
flush (out);
|
||||
end_use_class (style, out);
|
||||
fputc (']', out);
|
||||
/* Display only the first match, the second is "-Wall". */
|
||||
|
||||
+12
-8
@@ -686,7 +686,8 @@ conflicts_print (void)
|
||||
expected_rr_conflicts = -1;
|
||||
}
|
||||
|
||||
bool has_unexpected_conflicts = false;
|
||||
// The warning flags used to emit a diagnostic, if we did.
|
||||
warnings unexpected_conflicts_warning = Wnone;
|
||||
/* The following two blocks scream for factoring, but i18n support
|
||||
would make it ugly. */
|
||||
{
|
||||
@@ -703,7 +704,8 @@ conflicts_print (void)
|
||||
complain (NULL, complaint,
|
||||
_("shift/reduce conflicts: %d found, %d expected"),
|
||||
total, expected);
|
||||
has_unexpected_conflicts = true;
|
||||
if (total)
|
||||
unexpected_conflicts_warning = complaint;
|
||||
}
|
||||
}
|
||||
else if (total)
|
||||
@@ -713,7 +715,7 @@ conflicts_print (void)
|
||||
"%d shift/reduce conflicts",
|
||||
total),
|
||||
total);
|
||||
has_unexpected_conflicts = true;
|
||||
unexpected_conflicts_warning = Wconflicts_sr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,7 +733,8 @@ conflicts_print (void)
|
||||
complain (NULL, complaint,
|
||||
_("reduce/reduce conflicts: %d found, %d expected"),
|
||||
total, expected);
|
||||
has_unexpected_conflicts = true;
|
||||
if (total)
|
||||
unexpected_conflicts_warning = complaint;
|
||||
}
|
||||
}
|
||||
else if (total)
|
||||
@@ -741,15 +744,16 @@ conflicts_print (void)
|
||||
"%d reduce/reduce conflicts",
|
||||
total),
|
||||
total);
|
||||
has_unexpected_conflicts = true;
|
||||
unexpected_conflicts_warning = Wconflicts_rr;
|
||||
}
|
||||
}
|
||||
|
||||
if (warning_is_enabled (Wcounterexamples))
|
||||
report_counterexamples ();
|
||||
else if (has_unexpected_conflicts)
|
||||
complain (NULL, Wother,
|
||||
_("rerun with option '-Wcounterexamples' to generate conflict counterexamples"));
|
||||
else if (unexpected_conflicts_warning != Wnone)
|
||||
subcomplain (NULL, unexpected_conflicts_warning,
|
||||
_("rerun with option '-Wcounterexamples'"
|
||||
" to generate conflict counterexamples"));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+79
-26
@@ -26,6 +26,7 @@
|
||||
#include <gl_linked_list.h>
|
||||
#include <gl_rbtreehash_list.h>
|
||||
#include <hash.h>
|
||||
#include <mbswidth.h>
|
||||
#include <stdlib.h>
|
||||
#include <textstyle.h>
|
||||
#include <time.h>
|
||||
@@ -112,15 +113,37 @@ free_counterexample (counterexample *cex)
|
||||
free (cex);
|
||||
}
|
||||
|
||||
static int max (int a, int b)
|
||||
{
|
||||
return a < b ? b : a;
|
||||
}
|
||||
|
||||
static void
|
||||
print_counterexample (const counterexample *cex, FILE *out, const char *prefix)
|
||||
{
|
||||
const bool flat = getenv ("YYFLAT");
|
||||
fprintf (out, " %s%-20s ",
|
||||
prefix, cex->unifying ? _("Example") : _("First example"));
|
||||
derivation_print_leaves (cex->d1, out, prefix);
|
||||
fprintf (out, flat ? " %s%-20s " : " %s%s",
|
||||
prefix, cex->shift_reduce ? _("Shift derivation") : _("First derivation"));
|
||||
const char *example1_label
|
||||
= cex->unifying ? _("Example") : _("First example");
|
||||
const char *example2_label
|
||||
= cex->unifying ? _("Example") : _("Second example");
|
||||
const char *deriv1_label
|
||||
= cex->shift_reduce ? _("Shift derivation") : _("First reduce derivation");
|
||||
const char *deriv2_label
|
||||
= cex->shift_reduce ? _("Reduce derivation") : _("Second reduce derivation");
|
||||
const int width =
|
||||
max (max (mbswidth (example1_label, 0), mbswidth (example2_label, 0)),
|
||||
max (mbswidth (deriv1_label, 0), mbswidth (deriv2_label, 0)));
|
||||
if (flat)
|
||||
fprintf (out, " %s%s%*s ", prefix,
|
||||
example1_label, width - mbswidth (example1_label, 0), "");
|
||||
else
|
||||
fprintf (out, " %s%s: ", prefix, example1_label);
|
||||
derivation_print_leaves (cex->d1, out);
|
||||
if (flat)
|
||||
fprintf (out, " %s%s%*s ", prefix,
|
||||
deriv1_label, width - mbswidth (deriv1_label, 0), "");
|
||||
else
|
||||
fprintf (out, " %s%s", prefix, deriv1_label);
|
||||
derivation_print (cex->d1, out, prefix);
|
||||
|
||||
// If we output to the terminal (via stderr) and we have color
|
||||
@@ -128,15 +151,22 @@ print_counterexample (const counterexample *cex, FILE *out, const char *prefix)
|
||||
// to see the differences.
|
||||
if (!cex->unifying || is_styled (stderr))
|
||||
{
|
||||
fprintf (out, " %s%-20s ",
|
||||
prefix, cex->unifying ? _("Example") : _("Second example"));
|
||||
derivation_print_leaves (cex->d2, out, prefix);
|
||||
if (flat)
|
||||
fprintf (out, " %s%s%*s ", prefix,
|
||||
example2_label, width - mbswidth (example2_label, 0), "");
|
||||
else
|
||||
fprintf (out, " %s%s: ", prefix, example2_label);
|
||||
derivation_print_leaves (cex->d2, out);
|
||||
}
|
||||
fprintf (out, flat ? " %s%-20s " : " %s%s",
|
||||
prefix, cex->shift_reduce ? _("Reduce derivation") : _("Second derivation"));
|
||||
if (flat)
|
||||
fprintf (out, " %s%s%*s ", prefix,
|
||||
deriv2_label, width - mbswidth (deriv2_label, 0), "");
|
||||
else
|
||||
fprintf (out, " %s%s", prefix, deriv2_label);
|
||||
derivation_print (cex->d2, out, prefix);
|
||||
|
||||
fputc ('\n', out);
|
||||
if (out != stderr)
|
||||
putc ('\n', out);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -687,10 +717,10 @@ ssb_equals (const search_state_bundle *s1, const search_state_bundle *s2)
|
||||
typedef gl_list_t ssb_list;
|
||||
|
||||
static size_t
|
||||
visited_hasher (const search_state *ss, size_t max)
|
||||
visited_hasher (const search_state *ss, size_t maximum)
|
||||
{
|
||||
return (parse_state_hasher (ss->states[0], max)
|
||||
+ parse_state_hasher (ss->states[1], max)) % max;
|
||||
return (parse_state_hasher (ss->states[0], maximum)
|
||||
+ parse_state_hasher (ss->states[1], maximum)) % maximum;
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -1248,10 +1278,17 @@ counterexample_report_shift_reduce (state_item_number itm1, state_item_number it
|
||||
symbol_number next_sym,
|
||||
FILE *out, const char *prefix)
|
||||
{
|
||||
fputs (prefix, out);
|
||||
fprintf (out, _("Shift/reduce conflict on token %s:\n"), symbols[next_sym]->tag);
|
||||
if (out == stderr)
|
||||
complain (NULL, Wcounterexamples,
|
||||
_("shift/reduce conflict on token %s"), symbols[next_sym]->tag);
|
||||
else
|
||||
{
|
||||
fputs (prefix, out);
|
||||
fprintf (out, _("shift/reduce conflict on token %s"), symbols[next_sym]->tag);
|
||||
fprintf (out, "%s\n", _(":"));
|
||||
}
|
||||
// In the report, print the items.
|
||||
if (*prefix || trace_flag & trace_cex)
|
||||
if (out != stderr || trace_flag & trace_cex)
|
||||
{
|
||||
print_state_item (&state_items[itm1], out, prefix);
|
||||
print_state_item (&state_items[itm2], out, prefix);
|
||||
@@ -1265,27 +1302,43 @@ counterexample_report_reduce_reduce (state_item_number itm1, state_item_number i
|
||||
FILE *out, const char *prefix)
|
||||
{
|
||||
{
|
||||
fputs (prefix, out);
|
||||
fputs (ngettext ("Reduce/reduce conflict on token",
|
||||
"Reduce/reduce conflict on tokens",
|
||||
bitset_count (conflict_syms)), out);
|
||||
struct obstack obstack;
|
||||
obstack_init (&obstack);
|
||||
bitset_iterator biter;
|
||||
state_item_number sym;
|
||||
const char *sep = " ";
|
||||
const char *sep = "";
|
||||
BITSET_FOR_EACH (biter, conflict_syms, sym, 0)
|
||||
{
|
||||
fprintf (out, "%s%s", sep, symbols[sym]->tag);
|
||||
obstack_printf (&obstack, "%s%s", sep, symbols[sym]->tag);
|
||||
sep = ", ";
|
||||
}
|
||||
fputs (_(":\n"), out);
|
||||
char *tokens = obstack_finish0 (&obstack);
|
||||
if (out == stderr)
|
||||
complain (NULL, Wcounterexamples,
|
||||
ngettext ("reduce/reduce conflict on token %s",
|
||||
"reduce/reduce conflict on tokens %s",
|
||||
bitset_count (conflict_syms)),
|
||||
tokens);
|
||||
else
|
||||
{
|
||||
fputs (prefix, out);
|
||||
fprintf (out,
|
||||
ngettext ("reduce/reduce conflict on token %s",
|
||||
"reduce/reduce conflict on tokens %s",
|
||||
bitset_count (conflict_syms)),
|
||||
tokens);
|
||||
fprintf (out, "%s\n", _(":"));
|
||||
}
|
||||
obstack_free (&obstack, NULL);
|
||||
}
|
||||
// In the report, print the items.
|
||||
if (*prefix || trace_flag & trace_cex)
|
||||
if (out != stderr || trace_flag & trace_cex)
|
||||
{
|
||||
print_state_item (&state_items[itm1], out, prefix);
|
||||
print_state_item (&state_items[itm2], out, prefix);
|
||||
}
|
||||
counterexample_report (itm1, itm2, bitset_first (conflict_syms), false, out, prefix);
|
||||
counterexample_report (itm1, itm2, bitset_first (conflict_syms),
|
||||
false, out, prefix);
|
||||
}
|
||||
|
||||
static state_item_number
|
||||
|
||||
+3
-5
@@ -193,9 +193,8 @@ all_spaces (const char *s)
|
||||
//
|
||||
// This function implements this.
|
||||
//
|
||||
// When COND is true, put S on OUT, preceeded by *PADDING white
|
||||
// spaces. Otherwise add the width to *PADDING. Return the width of
|
||||
// S.
|
||||
// When COND is true, put S on OUT, preceded by *PADDING white spaces.
|
||||
// Otherwise add the width to *PADDING. Return the width of S.
|
||||
static int
|
||||
fputs_if (bool cond, FILE *out, int *padding, const char *s)
|
||||
{
|
||||
@@ -428,10 +427,9 @@ derivation_print_flat (const derivation *deriv, FILE *out, const char *prefix)
|
||||
}
|
||||
|
||||
void
|
||||
derivation_print_leaves (const derivation *deriv, FILE *out, const char *prefix)
|
||||
derivation_print_leaves (const derivation *deriv, FILE *out)
|
||||
{
|
||||
int counter = 0;
|
||||
fputs (prefix, out);
|
||||
derivation_print_flat_impl ((derivation *)deriv, out, true, &counter, "");
|
||||
fputc ('\n', out);
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ static inline derivation *derivation_new_leaf (symbol_number sym)
|
||||
// Number of symbols.
|
||||
size_t derivation_size (const derivation *deriv);
|
||||
void derivation_print (const derivation *deriv, FILE *out, const char *prefix);
|
||||
void derivation_print_leaves (const derivation *deriv, FILE *out, const char *prefix);
|
||||
void derivation_print_leaves (const derivation *deriv, FILE *out);
|
||||
void derivation_free (derivation *deriv);
|
||||
void derivation_retain (derivation *deriv);
|
||||
|
||||
|
||||
+16
-26
@@ -28,24 +28,17 @@
|
||||
#include <mbswidth.h>
|
||||
#include <unicodeio.h>
|
||||
|
||||
// In gnulib/lib/unicodeio.h unicode_to_mb uses a buffer of 25 bytes.
|
||||
typedef char glyph_buffer_t[26];
|
||||
|
||||
|
||||
static glyph_buffer_t arrow_buf;
|
||||
const char *arrow;
|
||||
glyph_buffer_t arrow;
|
||||
int arrow_width;
|
||||
|
||||
static glyph_buffer_t down_arrow_buf;
|
||||
const char *down_arrow;
|
||||
glyph_buffer_t down_arrow;
|
||||
int down_arrow_width;
|
||||
|
||||
static glyph_buffer_t dot_buf;
|
||||
const char *dot;
|
||||
glyph_buffer_t dot;
|
||||
int dot_width;
|
||||
|
||||
static glyph_buffer_t empty_buf;
|
||||
const char *empty;
|
||||
glyph_buffer_t empty;
|
||||
int empty_width;
|
||||
|
||||
const char *derivation_separator = " ";
|
||||
@@ -53,8 +46,7 @@ int derivation_separator_width = 1;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char **glyph;
|
||||
char *buf;
|
||||
glyph_buffer_t *pbuf;
|
||||
const char *fallback;
|
||||
} callback_arg_t;
|
||||
|
||||
@@ -63,8 +55,8 @@ static long
|
||||
on_success (const char *buf, size_t buflen, void *callback_arg)
|
||||
{
|
||||
callback_arg_t *arg = (callback_arg_t *) callback_arg;
|
||||
assert (buflen + 1 < sizeof arg->buf);
|
||||
*stpncpy (arg->buf, buf, buflen) = '\0';
|
||||
assert (buflen + 1 < sizeof *arg->pbuf);
|
||||
*stpncpy (*arg->pbuf, buf, buflen) = '\0';
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -73,19 +65,17 @@ on_failure (unsigned code MAYBE_UNUSED, const char *msg MAYBE_UNUSED,
|
||||
void *callback_arg)
|
||||
{
|
||||
callback_arg_t *arg = (callback_arg_t *) callback_arg;
|
||||
assert (strlen (arg->fallback) + 1 < sizeof arg->buf);
|
||||
strcpy (arg->buf, arg->fallback);
|
||||
assert (strlen (arg->fallback) + 1 < sizeof *arg->pbuf);
|
||||
strcpy (*arg->pbuf, arg->fallback);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
glyph_set (const char **glyph,
|
||||
char buf[26], int *width,
|
||||
glyph_set (glyph_buffer_t *glyph, int *width,
|
||||
unsigned code, const char *fallback)
|
||||
{
|
||||
callback_arg_t arg = { glyph, buf, fallback };
|
||||
callback_arg_t arg = { glyph, fallback };
|
||||
int res = unicode_to_mb (code, on_success, on_failure, &arg);
|
||||
*glyph = buf;
|
||||
*width = mbswidth (*glyph, 0);
|
||||
return res;
|
||||
}
|
||||
@@ -93,11 +83,11 @@ glyph_set (const char **glyph,
|
||||
void
|
||||
glyphs_init (void)
|
||||
{
|
||||
glyph_set (&arrow, arrow_buf, &arrow_width, 0x2192, "->");
|
||||
glyph_set (&dot, dot_buf, &dot_width, 0x2022, ".");
|
||||
glyph_set (&down_arrow, down_arrow_buf, &down_arrow_width, 0x21b3, "`->");
|
||||
glyph_set (&empty, empty_buf, &empty_width, 0x03b5, "%empty");
|
||||
glyph_set (&arrow, &arrow_width, 0x2192, "->");
|
||||
glyph_set (&dot, &dot_width, 0x2022, ".");
|
||||
glyph_set (&down_arrow, &down_arrow_width, 0x21b3, "`->");
|
||||
glyph_set (&empty, &empty_width, 0x03b5, "%empty");
|
||||
|
||||
strncat (down_arrow_buf, " ", sizeof down_arrow_buf - strlen (down_arrow_buf) - 1);
|
||||
strncat (down_arrow, " ", sizeof down_arrow - strlen (down_arrow) - 1);
|
||||
down_arrow_width += 1;
|
||||
}
|
||||
|
||||
+8
-4
@@ -23,20 +23,24 @@
|
||||
/* Initialize the following variables. */
|
||||
void glyphs_init (void);
|
||||
|
||||
/* In gnulib/lib/unicodeio.h unicode_to_mb uses a buffer of 25 bytes.
|
||||
In down_arrow, we append one space. */
|
||||
typedef char glyph_buffer_t[26];
|
||||
|
||||
/* "→", separates the lhs of a rule from its rhs. */
|
||||
extern const char *arrow;
|
||||
extern glyph_buffer_t arrow;
|
||||
extern int arrow_width;
|
||||
|
||||
/* "•", a point in an item (aka, a dotted rule). */
|
||||
extern const char *dot;
|
||||
extern glyph_buffer_t dot;
|
||||
extern int dot_width;
|
||||
|
||||
/* "↳ ", below an lhs to announce the rhs. */
|
||||
extern const char *down_arrow;
|
||||
extern glyph_buffer_t down_arrow;
|
||||
extern int down_arrow_width;
|
||||
|
||||
/* "ε", an empty rhs. */
|
||||
extern const char *empty;
|
||||
extern glyph_buffer_t empty;
|
||||
extern int empty_width;
|
||||
|
||||
/* " ", separate symbols in the rhs of a derivation. */
|
||||
|
||||
+47
-37
@@ -726,7 +726,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
AT_BISON_CHECK([[-Dlr.type=canonical-lr -o input.c input.y]],
|
||||
[[0]], [[]],
|
||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([[input]])
|
||||
AT_PARSER_CHECK([[input]], [[1]], [[]],
|
||||
@@ -737,7 +737,7 @@ AT_PARSER_CHECK([[input]], [[1]], [[]],
|
||||
AT_BISON_CHECK([[-Dlr.type=canonical-lr -Dparse.lac=full \
|
||||
-o input.c input.y]], [[0]], [[]],
|
||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([[input]])
|
||||
AT_PARSER_CHECK([[input]], [[1]], [[]],
|
||||
@@ -748,7 +748,7 @@ AT_PARSER_CHECK([[input]], [[1]], [[]],
|
||||
AT_BISON_CHECK([[-Dlr.type=ielr -Dparse.lac=full -o input.c input.y]],
|
||||
[[0]], [[]],
|
||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([[input]])
|
||||
AT_PARSER_CHECK([[input]], [[1]], [[]],
|
||||
@@ -773,7 +773,7 @@ exp: exp OP exp | NUM;
|
||||
|
||||
AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
|
||||
# Check the contents of the report.
|
||||
@@ -861,10 +861,10 @@ State 5
|
||||
OP [reduce using rule 1 (exp)]
|
||||
$default reduce using rule 1 (exp)
|
||||
|
||||
Shift/reduce conflict on token OP:
|
||||
shift/reduce conflict on token OP:
|
||||
1 exp: exp OP exp .
|
||||
1 exp: exp . OP exp
|
||||
Example exp OP exp . OP exp
|
||||
Example: exp OP exp . OP exp
|
||||
Shift derivation
|
||||
exp
|
||||
`-> exp OP exp
|
||||
@@ -1032,7 +1032,7 @@ cond:
|
||||
|
||||
AT_BISON_CHECK([-o input.c input.y], 0, [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -1137,7 +1137,7 @@ id : '0';
|
||||
|
||||
AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
|
||||
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
input.y:4.6-8: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -1209,15 +1209,15 @@ State 1
|
||||
$end [reduce using rule 4 (id)]
|
||||
$default reduce using rule 3 (num)
|
||||
|
||||
Reduce/reduce conflict on token $end:
|
||||
reduce/reduce conflict on token $end:
|
||||
3 num: '0' .
|
||||
4 id: '0' .
|
||||
Example '0' .
|
||||
First derivation
|
||||
Example: '0' .
|
||||
First reduce derivation
|
||||
exp
|
||||
`-> num
|
||||
`-> '0' .
|
||||
Second derivation
|
||||
Second reduce derivation
|
||||
exp
|
||||
`-> id
|
||||
`-> '0' .
|
||||
@@ -1272,7 +1272,7 @@ exp: exp OP exp | NUM;
|
||||
|
||||
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
||||
[[input.y: error: shift/reduce conflicts: 1 found, 0 expected
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -1309,7 +1309,7 @@ exp: exp OP exp | NUM;
|
||||
|
||||
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
||||
[[input.y: error: shift/reduce conflicts: 1 found, 2 expected
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -1329,7 +1329,7 @@ a: 'a';
|
||||
|
||||
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
||||
[[input.y: error: reduce/reduce conflicts: 1 found, 0 expected
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -1530,7 +1530,7 @@ e: e '+' e
|
||||
|
||||
AT_BISON_CHECK([-Wall -o input.c input.y], 0, [],
|
||||
[[input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
input.y:1.1-5: warning: useless precedence and associativity for '+' [-Wprecedence]
|
||||
input.y:2.1-5: warning: useless precedence and associativity for '*' [-Wprecedence]
|
||||
]])
|
||||
@@ -1638,7 +1638,7 @@ reported_conflicts:
|
||||
AT_BISON_CHECK([[--report=all input.y]], 0, [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
input.y:12.5-20: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:20.5-20: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:21.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
@@ -1764,29 +1764,29 @@ State 4
|
||||
|
||||
reported_conflicts go to state 6
|
||||
|
||||
Shift/reduce conflict on token 'a':
|
||||
shift/reduce conflict on token 'a':
|
||||
10 reported_conflicts: . %empty
|
||||
8 reported_conflicts: . 'a'
|
||||
First example resolved_conflict . 'a' 'a'
|
||||
First example: resolved_conflict . 'a' 'a'
|
||||
Shift derivation
|
||||
start
|
||||
`-> resolved_conflict reported_conflicts 'a'
|
||||
`-> . 'a'
|
||||
Second example resolved_conflict . 'a'
|
||||
Second example: resolved_conflict . 'a'
|
||||
Reduce derivation
|
||||
start
|
||||
`-> resolved_conflict reported_conflicts 'a'
|
||||
`-> .
|
||||
|
||||
Shift/reduce conflict on token 'a':
|
||||
shift/reduce conflict on token 'a':
|
||||
10 reported_conflicts: . %empty
|
||||
9 reported_conflicts: . 'a'
|
||||
First example resolved_conflict . 'a' 'a'
|
||||
First example: resolved_conflict . 'a' 'a'
|
||||
Shift derivation
|
||||
start
|
||||
`-> resolved_conflict reported_conflicts 'a'
|
||||
`-> . 'a'
|
||||
Second example resolved_conflict . 'a'
|
||||
Second example: resolved_conflict . 'a'
|
||||
Reduce derivation
|
||||
start
|
||||
`-> resolved_conflict reported_conflicts 'a'
|
||||
@@ -1803,14 +1803,14 @@ State 5
|
||||
'a' [reduce using rule 9 (reported_conflicts)]
|
||||
$default reduce using rule 8 (reported_conflicts)
|
||||
|
||||
Reduce/reduce conflict on token 'a':
|
||||
reduce/reduce conflict on token 'a':
|
||||
8 reported_conflicts: 'a' .
|
||||
9 reported_conflicts: 'a' .
|
||||
Example 'a' .
|
||||
First derivation
|
||||
Example: 'a' .
|
||||
First reduce derivation
|
||||
reported_conflicts
|
||||
`-> 'a' .
|
||||
Second derivation
|
||||
Second reduce derivation
|
||||
reported_conflicts
|
||||
`-> 'a' .
|
||||
|
||||
@@ -1838,7 +1838,7 @@ AT_CHECK([[cat input.y >> input-keep.y]])
|
||||
AT_BISON_CHECK([[input-keep.y]], 0, [],
|
||||
[[input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
input-keep.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input-keep.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
input-keep.y:22.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input-keep.y:26.16: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input-keep.y:32.5-7: warning: rule useless in parser due to conflicts [-Wother]
|
||||
@@ -1993,15 +1993,15 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
|
||||
Conflict between rule 10 and token 'b' resolved as an error (%nonassoc 'b').
|
||||
Conflict between rule 11 and token 'c' resolved as an error (%nonassoc 'c').
|
||||
|
||||
Reduce/reduce conflict on token 'c':
|
||||
reduce/reduce conflict on token 'c':
|
||||
12 empty_c2: . %empty
|
||||
13 empty_c3: . %empty
|
||||
Example . 'c'
|
||||
First derivation
|
||||
Example: . 'c'
|
||||
First reduce derivation
|
||||
start
|
||||
`-> empty_c2 'c'
|
||||
`-> .
|
||||
Second derivation
|
||||
Second reduce derivation
|
||||
start
|
||||
`-> empty_c3 'c'
|
||||
`-> .
|
||||
@@ -2038,7 +2038,7 @@ exp: 'a' | 'a';
|
||||
AT_BISON_CHECK([[2.y]], [[0]], [],
|
||||
[[2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
|
||||
2.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
2.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
2.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
2.y:3.12-14: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -2075,15 +2075,14 @@ B: ;
|
||||
AT_BISON_CHECK([[sr-rr.y]], [[0]], [[]],
|
||||
[[sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
sr-rr.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
sr-rr.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_BISON_CHECK([[-Wno-conflicts-sr sr-rr.y]], [[0]], [[]],
|
||||
[[sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
sr-rr.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
sr-rr.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_BISON_CHECK([[-Wno-conflicts-rr sr-rr.y]], [[0]], [[]],
|
||||
[[sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
sr-rr.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
]])
|
||||
|
||||
[
|
||||
@@ -2140,19 +2139,30 @@ for gram in sr-rr sr rr; do
|
||||
]AT_BISON_CHECK([[-Werror $file]])[
|
||||
else
|
||||
{
|
||||
issue_note=false
|
||||
if test -z "$sr_exp_i" && test "$sr_count" -ne 0; then
|
||||
echo "warning: $sr_count shift/reduce conflicts"
|
||||
issue_note=true
|
||||
elif test "$sr_exp_i" -ne "$sr_count"; then
|
||||
echo "error: shift/reduce conflicts: $sr_count found, $sr_exp_i expected"
|
||||
if test "$sr_count" -ne 0; then
|
||||
issue_note=true
|
||||
fi
|
||||
fi
|
||||
if test -z "$rr_exp_i" && test "$rr_count" -ne 0; then
|
||||
echo "warning: $rr_count reduce/reduce conflicts"
|
||||
issue_note=true
|
||||
elif test "$rr_exp_i" -ne "$rr_count"; then
|
||||
echo "error: reduce/reduce conflicts: $rr_count found, $rr_exp_i expected"
|
||||
if test "$rr_count" -ne 0; then
|
||||
issue_note=true
|
||||
fi
|
||||
fi
|
||||
if $issue_note; then
|
||||
echo "note: rerun with option '-Wcounterexamples' to generate conflict counterexamples"
|
||||
fi
|
||||
} | sed -e "s/^/$file: /" > experr
|
||||
]AT_BISON_CHECK([[-Wnone $file]], [[1]], [[]], [[experr]])[
|
||||
echo "$file: error: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Werror=other]" >> experr
|
||||
]AT_BISON_CHECK([[-Werror $file]], [[1]], [[]], [[experr]])[
|
||||
fi
|
||||
done
|
||||
|
||||
+208
-262
@@ -54,8 +54,8 @@ y: A | A B;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example A . B C
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example: A . B C
|
||||
Shift derivation
|
||||
s
|
||||
`-> y c
|
||||
@@ -64,15 +64,13 @@ Shift/reduce conflict on token B:
|
||||
s
|
||||
`-> a x
|
||||
`-> A . `-> B C
|
||||
|
||||
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example A . B C
|
||||
Shift derivation s -> [ y -> [ A . B ] c -> [ C ] ]
|
||||
Reduce derivation s -> [ a -> [ A . ] x -> [ B C ] ]
|
||||
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example A . B C
|
||||
Shift derivation s -> [ y -> [ A . B ] c -> [ C ] ]
|
||||
Reduce derivation s -> [ a -> [ A . ] x -> [ B C ] ]
|
||||
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -96,8 +94,8 @@ bc: B bc C | B C;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example A . B C
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example: A . B C
|
||||
Shift derivation
|
||||
s
|
||||
`-> ac
|
||||
@@ -108,9 +106,8 @@ Shift/reduce conflict on token B:
|
||||
s
|
||||
`-> a bc
|
||||
`-> A . `-> B C
|
||||
|
||||
Shift/reduce conflict on token B:
|
||||
Example A A . B B C C
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example: A A . B B C C
|
||||
Shift derivation
|
||||
s
|
||||
`-> ac
|
||||
@@ -124,20 +121,17 @@ Shift/reduce conflict on token B:
|
||||
`-> a bc
|
||||
`-> A a `-> B bc C
|
||||
`-> A . `-> B C
|
||||
|
||||
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example A . B C
|
||||
Shift derivation s -> [ ac -> [ A ac -> [ b -> [ . B ] ] C ] ]
|
||||
Reduce derivation s -> [ a -> [ A . ] bc -> [ B C ] ]
|
||||
|
||||
Shift/reduce conflict on token B:
|
||||
Example A A . B B C C
|
||||
Shift derivation s -> [ ac -> [ A ac -> [ A ac -> [ b -> [ . b -> [ B B ] ] ] C ] C ] ]
|
||||
Reduce derivation s -> [ a -> [ A a -> [ A . ] ] bc -> [ B bc -> [ B C ] C ] ]
|
||||
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example A . B C
|
||||
Shift derivation s -> [ ac -> [ A ac -> [ b -> [ . B ] ] C ] ]
|
||||
Reduce derivation s -> [ a -> [ A . ] bc -> [ B C ] ]
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example A A . B B C C
|
||||
Shift derivation s -> [ ac -> [ A ac -> [ A ac -> [ b -> [ . b -> [ B B ] ] ] C ] C ] ]
|
||||
Reduce derivation s -> [ a -> [ A a -> [ A . ] ] bc -> [ B bc -> [ B C ] C ] ]
|
||||
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -162,8 +156,8 @@ xby: B | X xby Y;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example A . B
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example: A . B
|
||||
Shift derivation
|
||||
s
|
||||
`-> A xby
|
||||
@@ -173,16 +167,15 @@ Shift/reduce conflict on token B:
|
||||
`-> ax by
|
||||
`-> A x `-> B y
|
||||
`-> . `-> %empty
|
||||
|
||||
Shift/reduce conflict on token B:
|
||||
First example A X . B Y $end
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
First example: A X . B Y $end
|
||||
Shift derivation
|
||||
$accept
|
||||
`-> s $end
|
||||
`-> A xby
|
||||
`-> X xby Y
|
||||
`-> . B
|
||||
Second example A X . B y $end
|
||||
Second example: A X . B y $end
|
||||
Reduce derivation
|
||||
$accept
|
||||
`-> s $end
|
||||
@@ -190,21 +183,18 @@ Shift/reduce conflict on token B:
|
||||
`-> A x `-> B y
|
||||
`-> X x
|
||||
`-> .
|
||||
|
||||
input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example A . B
|
||||
Shift derivation s -> [ A xby -> [ . B ] ]
|
||||
Reduce derivation s -> [ ax -> [ A x -> [ . ] ] by -> [ B y -> [ ] ] ]
|
||||
|
||||
Shift/reduce conflict on token B:
|
||||
First example A X . B Y $end
|
||||
Shift derivation $accept -> [ s -> [ A xby -> [ X xby -> [ . B ] Y ] ] $end ]
|
||||
Second example A X . B y $end
|
||||
Reduce derivation $accept -> [ s -> [ ax -> [ A x -> [ X x -> [ . ] ] ] by -> [ B y ] ] $end ]
|
||||
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example A . B
|
||||
Shift derivation s -> [ A xby -> [ . B ] ]
|
||||
Reduce derivation s -> [ ax -> [ A x -> [ . ] ] by -> [ B y -> [ ] ] ]
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
First example A X . B Y $end
|
||||
Shift derivation $accept -> [ s -> [ A xby -> [ X xby -> [ . B ] Y ] ] $end ]
|
||||
Second example A X . B y $end
|
||||
Reduce derivation $accept -> [ s -> [ ax -> [ A x -> [ X x -> [ . ] ] ] by -> [ B y ] ] $end ]
|
||||
input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -229,31 +219,29 @@ bc: B C;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token C:
|
||||
First example B . C $end
|
||||
input.y: warning: shift/reduce conflict on token C [-Wcounterexamples]
|
||||
First example: B . C $end
|
||||
Shift derivation
|
||||
$accept
|
||||
`-> g $end
|
||||
`-> x
|
||||
`-> bc
|
||||
`-> B . C
|
||||
Second example B . C D $end
|
||||
Second example: B . C D $end
|
||||
Reduce derivation
|
||||
$accept
|
||||
`-> g $end
|
||||
`-> x
|
||||
`-> b cd
|
||||
`-> B . `-> C D
|
||||
|
||||
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token C:
|
||||
First example B . C $end
|
||||
Shift derivation $accept -> [ g -> [ x -> [ bc -> [ B . C ] ] ] $end ]
|
||||
Second example B . C D $end
|
||||
Reduce derivation $accept -> [ g -> [ x -> [ b -> [ B . ] cd -> [ C D ] ] ] $end ]
|
||||
|
||||
input.y: warning: shift/reduce conflict on token C [-Wcounterexamples]
|
||||
First example B . C $end
|
||||
Shift derivation $accept -> [ g -> [ x -> [ bc -> [ B . C ] ] ] $end ]
|
||||
Second example B . C D $end
|
||||
Reduce derivation $accept -> [ g -> [ x -> [ b -> [ B . ] cd -> [ C D ] ] ] $end ]
|
||||
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -276,15 +264,15 @@ y: A A B;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token A:
|
||||
First example A . A B $end
|
||||
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
||||
First example: A . A B $end
|
||||
Shift derivation
|
||||
$accept
|
||||
`-> s $end
|
||||
`-> t
|
||||
`-> y
|
||||
`-> A . A B
|
||||
Second example A . A $end
|
||||
Second example: A . A $end
|
||||
Reduce derivation
|
||||
$accept
|
||||
`-> s $end
|
||||
@@ -292,15 +280,13 @@ Shift/reduce conflict on token A:
|
||||
`-> t `-> x
|
||||
`-> x `-> A
|
||||
`-> A .
|
||||
|
||||
]],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token A:
|
||||
First example A . A B $end
|
||||
Shift derivation $accept -> [ s -> [ t -> [ y -> [ A . A B ] ] ] $end ]
|
||||
Second example A . A $end
|
||||
Reduce derivation $accept -> [ s -> [ s -> [ t -> [ x -> [ A . ] ] ] t -> [ x -> [ A ] ] ] $end ]
|
||||
|
||||
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
||||
First example A . A B $end
|
||||
Shift derivation $accept -> [ s -> [ t -> [ y -> [ A . A B ] ] ] $end ]
|
||||
Second example A . A $end
|
||||
Reduce derivation $accept -> [ s -> [ s -> [ t -> [ x -> [ A . ] ] ] t -> [ x -> [ A ] ] ] $end ]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -327,8 +313,8 @@ y: Y;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token A:
|
||||
Example b . A X X Y
|
||||
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
||||
Example: b . A X X Y
|
||||
Shift derivation
|
||||
a
|
||||
`-> s
|
||||
@@ -339,35 +325,31 @@ Shift/reduce conflict on token A:
|
||||
`-> r t
|
||||
`-> b . `-> A x xy
|
||||
`-> X `-> X Y
|
||||
|
||||
Shift/reduce conflict on token X:
|
||||
First example A X . X
|
||||
input.y: warning: shift/reduce conflict on token X [-Wcounterexamples]
|
||||
First example: A X . X
|
||||
Shift derivation
|
||||
a
|
||||
`-> t
|
||||
`-> A xx
|
||||
`-> X . X
|
||||
Second example X . X xy
|
||||
Second example: X . X xy
|
||||
Reduce derivation
|
||||
a
|
||||
`-> x t
|
||||
`-> X . `-> X xy
|
||||
|
||||
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:8.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token A:
|
||||
Example b . A X X Y
|
||||
Shift derivation a -> [ s -> [ b . xx -> [ A X X ] y -> [ Y ] ] ]
|
||||
Reduce derivation a -> [ r -> [ b . ] t -> [ A x -> [ X ] xy -> [ X Y ] ] ]
|
||||
|
||||
Shift/reduce conflict on token X:
|
||||
First example A X . X
|
||||
Shift derivation a -> [ t -> [ A xx -> [ X . X ] ] ]
|
||||
Second example X . X xy
|
||||
Reduce derivation a -> [ x -> [ X . ] t -> [ X xy ] ]
|
||||
|
||||
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
||||
Example b . A X X Y
|
||||
Shift derivation a -> [ s -> [ b . xx -> [ A X X ] y -> [ Y ] ] ]
|
||||
Reduce derivation a -> [ r -> [ b . ] t -> [ A x -> [ X ] xy -> [ X Y ] ] ]
|
||||
input.y: warning: shift/reduce conflict on token X [-Wcounterexamples]
|
||||
First example A X . X
|
||||
Shift derivation a -> [ t -> [ A xx -> [ X . X ] ] ]
|
||||
Second example X . X xy
|
||||
Reduce derivation a -> [ x -> [ X . ] t -> [ X xy ] ]
|
||||
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:8.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
@@ -389,24 +371,22 @@ b : A | b;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
Reduce/reduce conflict on token $end:
|
||||
Example A b .
|
||||
First derivation
|
||||
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
|
||||
Example: A b .
|
||||
First reduce derivation
|
||||
a
|
||||
`-> A b .
|
||||
Second derivation
|
||||
Second reduce derivation
|
||||
a
|
||||
`-> A b
|
||||
`-> b .
|
||||
|
||||
input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
Reduce/reduce conflict on token $end:
|
||||
Example A b .
|
||||
First derivation a -> [ A b . ]
|
||||
Second derivation a -> [ A b -> [ b . ] ]
|
||||
|
||||
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
|
||||
Example A b .
|
||||
First reduce derivation a -> [ A b . ]
|
||||
Second reduce derivation a -> [ A b -> [ b . ] ]
|
||||
input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -428,29 +408,27 @@ b: D;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
Reduce/reduce conflict on tokens A, C:
|
||||
First example D . A $end
|
||||
First derivation
|
||||
input.y: warning: reduce/reduce conflict on tokens A, C [-Wcounterexamples]
|
||||
First example: D . A $end
|
||||
First reduce derivation
|
||||
$accept
|
||||
`-> s $end
|
||||
`-> a A
|
||||
`-> D .
|
||||
Second example B D . A $end
|
||||
Second derivation
|
||||
Second example: B D . A $end
|
||||
Second reduce derivation
|
||||
$accept
|
||||
`-> s $end
|
||||
`-> B b A
|
||||
`-> D .
|
||||
|
||||
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
Reduce/reduce conflict on tokens A, C:
|
||||
First example D . A $end
|
||||
First derivation $accept -> [ s -> [ a -> [ D . ] A ] $end ]
|
||||
Second example B D . A $end
|
||||
Second derivation $accept -> [ s -> [ B b -> [ D . ] A ] $end ]
|
||||
|
||||
input.y: warning: reduce/reduce conflict on tokens A, C [-Wcounterexamples]
|
||||
First example D . A $end
|
||||
First reduce derivation $accept -> [ s -> [ a -> [ D . ] A ] $end ]
|
||||
Second example B D . A $end
|
||||
Second reduce derivation $accept -> [ s -> [ B b -> [ D . ] A ] $end ]
|
||||
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -472,31 +450,29 @@ i: X | i J K;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token J:
|
||||
input.y: warning: shift/reduce conflict on token J [-Wcounterexamples]
|
||||
time limit exceeded: XXX
|
||||
First example H i . J K $end
|
||||
First example: H i . J K $end
|
||||
Shift derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
`-> H i
|
||||
`-> i . J K
|
||||
Second example H i . J $end
|
||||
Second example: H i . J $end
|
||||
Reduce derivation
|
||||
$accept
|
||||
`-> s $end
|
||||
`-> a J
|
||||
`-> H i .
|
||||
|
||||
input.y:4.4-6: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token J:
|
||||
input.y: warning: shift/reduce conflict on token J [-Wcounterexamples]
|
||||
time limit exceeded: XXX
|
||||
First example H i . J K $end
|
||||
Shift derivation $accept -> [ a -> [ H i -> [ i . J K ] ] $end ]
|
||||
Second example H i . J $end
|
||||
Reduce derivation $accept -> [ s -> [ a -> [ H i . ] J ] $end ]
|
||||
|
||||
First example H i . J K $end
|
||||
Shift derivation $accept -> [ a -> [ H i -> [ i . J K ] ] $end ]
|
||||
Second example H i . J $end
|
||||
Reduce derivation $accept -> [ s -> [ a -> [ H i . ] J ] $end ]
|
||||
input.y:4.4-6: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -522,8 +498,8 @@ b: A B C | A B D;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example N A . B C
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example: N A . B C
|
||||
Shift derivation
|
||||
s
|
||||
`-> n
|
||||
@@ -534,9 +510,8 @@ Shift/reduce conflict on token B:
|
||||
`-> n C
|
||||
`-> N a B
|
||||
`-> A .
|
||||
|
||||
Shift/reduce conflict on token B:
|
||||
Example N N A . B D C
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example: N N A . B D C
|
||||
Shift derivation
|
||||
s
|
||||
`-> n
|
||||
@@ -549,20 +524,17 @@ Shift/reduce conflict on token B:
|
||||
`-> N n D
|
||||
`-> N a B
|
||||
`-> A .
|
||||
|
||||
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example N A . B C
|
||||
Shift derivation s -> [ n -> [ N b -> [ A . B C ] ] ]
|
||||
Reduce derivation s -> [ n -> [ N a -> [ A . ] B ] C ]
|
||||
|
||||
Shift/reduce conflict on token B:
|
||||
Example N N A . B D C
|
||||
Shift derivation s -> [ n -> [ N n -> [ N b -> [ A . B D ] ] C ] ]
|
||||
Reduce derivation s -> [ n -> [ N n -> [ N a -> [ A . ] B ] D ] C ]
|
||||
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example N A . B C
|
||||
Shift derivation s -> [ n -> [ N b -> [ A . B C ] ] ]
|
||||
Reduce derivation s -> [ n -> [ N a -> [ A . ] B ] C ]
|
||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||
Example N N A . B D C
|
||||
Shift derivation s -> [ n -> [ N n -> [ N b -> [ A . B D ] ] C ] ]
|
||||
Reduce derivation s -> [ n -> [ N n -> [ N a -> [ A . ] B ] D ] C ]
|
||||
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -589,48 +561,44 @@ C : A c A;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
Reduce/reduce conflict on tokens b, c:
|
||||
Example B . b c
|
||||
First derivation
|
||||
input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
|
||||
Example: B . b c
|
||||
First reduce derivation
|
||||
S
|
||||
`-> B C
|
||||
`-> A b A `-> A c A
|
||||
`-> B . `-> %empty `-> %empty `-> %empty
|
||||
Second derivation
|
||||
Second reduce derivation
|
||||
S
|
||||
`-> B C
|
||||
`-> A c A
|
||||
`-> B `-> %empty
|
||||
`-> A b A
|
||||
`-> . `-> %empty
|
||||
|
||||
Reduce/reduce conflict on tokens b, c:
|
||||
Example C . c b
|
||||
First derivation
|
||||
input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
|
||||
Example: C . c b
|
||||
First reduce derivation
|
||||
S
|
||||
`-> C B
|
||||
`-> A c A `-> A b A
|
||||
`-> C . `-> %empty `-> %empty `-> %empty
|
||||
Second derivation
|
||||
Second reduce derivation
|
||||
S
|
||||
`-> C B
|
||||
`-> A b A
|
||||
`-> C `-> %empty
|
||||
`-> A c A
|
||||
`-> . `-> %empty
|
||||
|
||||
]],
|
||||
[[input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
Reduce/reduce conflict on tokens b, c:
|
||||
Example B . b c
|
||||
First derivation S -> [ B -> [ A -> [ B . ] b A -> [ ] ] C -> [ A -> [ ] c A -> [ ] ] ]
|
||||
Second derivation S -> [ B C -> [ A -> [ B -> [ A -> [ . ] b A -> [ ] ] ] c A -> [ ] ] ]
|
||||
|
||||
Reduce/reduce conflict on tokens b, c:
|
||||
Example C . c b
|
||||
First derivation S -> [ C -> [ A -> [ C . ] c A -> [ ] ] B -> [ A -> [ ] b A -> [ ] ] ]
|
||||
Second derivation S -> [ C B -> [ A -> [ C -> [ A -> [ . ] c A -> [ ] ] ] b A -> [ ] ] ]
|
||||
|
||||
input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
|
||||
Example B . b c
|
||||
First reduce derivation S -> [ B -> [ A -> [ B . ] b A -> [ ] ] C -> [ A -> [ ] c A -> [ ] ] ]
|
||||
Second reduce derivation S -> [ B C -> [ A -> [ B -> [ A -> [ . ] b A -> [ ] ] ] c A -> [ ] ] ]
|
||||
input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
|
||||
Example C . c b
|
||||
First reduce derivation S -> [ C -> [ A -> [ C . ] c A -> [ ] ] B -> [ A -> [ ] b A -> [ ] ] ]
|
||||
Second reduce derivation S -> [ C B -> [ A -> [ C -> [ A -> [ . ] c A -> [ ] ] ] b A -> [ ] ] ]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -653,64 +621,61 @@ d : a | c A | d;
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y: warning: 6 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
Reduce/reduce conflict on token A:
|
||||
First example . c A A $end
|
||||
First derivation
|
||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||
First example: . c A A $end
|
||||
First reduce derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
`-> b d
|
||||
`-> . `-> c A A
|
||||
Second example . c A A $end
|
||||
Second derivation
|
||||
Second example: . c A A $end
|
||||
Second reduce derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
`-> c d
|
||||
`-> . `-> c A A
|
||||
|
||||
Reduce/reduce conflict on token A:
|
||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||
time limit exceeded: XXX
|
||||
First example b . c A A $end
|
||||
First derivation
|
||||
First example: b . c A A $end
|
||||
First reduce derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
`-> b d
|
||||
`-> a
|
||||
`-> b d
|
||||
`-> . `-> c A A
|
||||
Second example b . A $end
|
||||
Second derivation
|
||||
Second example: b . A $end
|
||||
Second reduce derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
`-> b d
|
||||
`-> c A
|
||||
`-> .
|
||||
|
||||
Reduce/reduce conflict on token A:
|
||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||
time limit exceeded: XXX
|
||||
First example c . c A A $end
|
||||
First derivation
|
||||
First example: c . c A A $end
|
||||
First reduce derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
`-> c d
|
||||
`-> a
|
||||
`-> b d
|
||||
`-> . `-> c A A
|
||||
Second example c . A $end
|
||||
Second derivation
|
||||
Second example: c . A $end
|
||||
Second reduce derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
`-> c d
|
||||
`-> c A
|
||||
`-> .
|
||||
|
||||
Shift/reduce conflict on token A:
|
||||
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
||||
time limit exceeded: XXX
|
||||
First example b c . A
|
||||
First example: b c . A
|
||||
Shift derivation
|
||||
a
|
||||
`-> b d
|
||||
`-> c . A
|
||||
Second example b c . c A A $end
|
||||
Second example: b c . c A A $end
|
||||
Reduce derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
@@ -720,10 +685,9 @@ time limit exceeded: XXX
|
||||
`-> a
|
||||
`-> b d
|
||||
`-> . `-> c A A
|
||||
|
||||
Reduce/reduce conflict on token A:
|
||||
First example b c . c A A $end
|
||||
First derivation
|
||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||
First example: b c . c A A $end
|
||||
First reduce derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
`-> b d
|
||||
@@ -732,8 +696,8 @@ Reduce/reduce conflict on token A:
|
||||
`-> a
|
||||
`-> b d
|
||||
`-> . `-> c A A
|
||||
Second example b c . A $end
|
||||
Second derivation
|
||||
Second example: b c . A $end
|
||||
Second reduce derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
`-> b d
|
||||
@@ -741,14 +705,13 @@ Reduce/reduce conflict on token A:
|
||||
`-> c d
|
||||
`-> c A
|
||||
`-> .
|
||||
|
||||
Shift/reduce conflict on token A:
|
||||
First example b c . A
|
||||
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
||||
First example: b c . A
|
||||
Shift derivation
|
||||
a
|
||||
`-> b d
|
||||
`-> c . A
|
||||
Second example b c . A $end
|
||||
Second example: b c . A $end
|
||||
Reduce derivation
|
||||
$accept
|
||||
`-> a $end
|
||||
@@ -757,81 +720,70 @@ Shift/reduce conflict on token A:
|
||||
`-> c d
|
||||
`-> c A
|
||||
`-> .
|
||||
|
||||
Reduce/reduce conflict on token $end:
|
||||
Example b d .
|
||||
First derivation
|
||||
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
|
||||
Example: b d .
|
||||
First reduce derivation
|
||||
a
|
||||
`-> b d .
|
||||
Second derivation
|
||||
Second reduce derivation
|
||||
a
|
||||
`-> b d
|
||||
`-> d .
|
||||
|
||||
Reduce/reduce conflict on token $end:
|
||||
Example c d .
|
||||
First derivation
|
||||
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
|
||||
Example: c d .
|
||||
First reduce derivation
|
||||
a
|
||||
`-> c d .
|
||||
Second derivation
|
||||
Second reduce derivation
|
||||
a
|
||||
`-> c d
|
||||
`-> d .
|
||||
|
||||
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:6.15: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y: warning: 6 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
Reduce/reduce conflict on token A:
|
||||
First example . c A A $end
|
||||
First derivation $accept -> [ a -> [ b -> [ . ] d -> [ c A A ] ] $end ]
|
||||
Second example . c A A $end
|
||||
Second derivation $accept -> [ a -> [ c -> [ . ] d -> [ c A A ] ] $end ]
|
||||
|
||||
Reduce/reduce conflict on token A:
|
||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||
First example . c A A $end
|
||||
First reduce derivation $accept -> [ a -> [ b -> [ . ] d -> [ c A A ] ] $end ]
|
||||
Second example . c A A $end
|
||||
Second reduce derivation $accept -> [ a -> [ c -> [ . ] d -> [ c A A ] ] $end ]
|
||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||
time limit exceeded: XXX
|
||||
First example b . c A A $end
|
||||
First derivation $accept -> [ a -> [ b d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] $end ]
|
||||
Second example b . A $end
|
||||
Second derivation $accept -> [ a -> [ b d -> [ c -> [ . ] A ] ] $end ]
|
||||
|
||||
Reduce/reduce conflict on token A:
|
||||
First example b . c A A $end
|
||||
First reduce derivation $accept -> [ a -> [ b d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] $end ]
|
||||
Second example b . A $end
|
||||
Second reduce derivation $accept -> [ a -> [ b d -> [ c -> [ . ] A ] ] $end ]
|
||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||
time limit exceeded: XXX
|
||||
First example c . c A A $end
|
||||
First derivation $accept -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] $end ]
|
||||
Second example c . A $end
|
||||
Second derivation $accept -> [ a -> [ c d -> [ c -> [ . ] A ] ] $end ]
|
||||
|
||||
Shift/reduce conflict on token A:
|
||||
First example c . c A A $end
|
||||
First reduce derivation $accept -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] $end ]
|
||||
Second example c . A $end
|
||||
Second reduce derivation $accept -> [ a -> [ c d -> [ c -> [ . ] A ] ] $end ]
|
||||
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
||||
time limit exceeded: XXX
|
||||
First example b c . A
|
||||
Shift derivation a -> [ b d -> [ c . A ] ]
|
||||
Second example b c . c A A $end
|
||||
Reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
|
||||
|
||||
Reduce/reduce conflict on token A:
|
||||
First example b c . c A A $end
|
||||
First derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
|
||||
Second example b c . A $end
|
||||
Second derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
|
||||
|
||||
Shift/reduce conflict on token A:
|
||||
First example b c . A
|
||||
Shift derivation a -> [ b d -> [ c . A ] ]
|
||||
Second example b c . A $end
|
||||
Reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
|
||||
|
||||
Reduce/reduce conflict on token $end:
|
||||
Example b d .
|
||||
First derivation a -> [ b d . ]
|
||||
Second derivation a -> [ b d -> [ d . ] ]
|
||||
|
||||
Reduce/reduce conflict on token $end:
|
||||
Example c d .
|
||||
First derivation a -> [ c d . ]
|
||||
Second derivation a -> [ c d -> [ d . ] ]
|
||||
|
||||
First example b c . A
|
||||
Shift derivation a -> [ b d -> [ c . A ] ]
|
||||
Second example b c . c A A $end
|
||||
Reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
|
||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||
First example b c . c A A $end
|
||||
First reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
|
||||
Second example b c . A $end
|
||||
Second reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
|
||||
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
||||
First example b c . A
|
||||
Shift derivation a -> [ b d -> [ c . A ] ]
|
||||
Second example b c . A $end
|
||||
Reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
|
||||
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
|
||||
Example b d .
|
||||
First reduce derivation a -> [ b d . ]
|
||||
Second reduce derivation a -> [ b d -> [ d . ] ]
|
||||
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
|
||||
Example c d .
|
||||
First reduce derivation a -> [ c d . ]
|
||||
Second reduce derivation a -> [ c d -> [ d . ] ]
|
||||
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:6.15: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
@@ -857,8 +809,8 @@ i: %empty | i J;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token J:
|
||||
Example H i J . J J
|
||||
input.y: warning: shift/reduce conflict on token J [-Wcounterexamples]
|
||||
Example: H i J . J J
|
||||
Shift derivation
|
||||
s
|
||||
`-> a J
|
||||
@@ -868,15 +820,13 @@ Shift/reduce conflict on token J:
|
||||
`-> a
|
||||
`-> H i J J
|
||||
`-> i J .
|
||||
|
||||
input.y:5.13-15: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token J:
|
||||
Example H i J . J J
|
||||
Shift derivation s -> [ a -> [ H i J . J ] J ]
|
||||
Reduce derivation s -> [ a -> [ H i -> [ i J . ] J J ] ]
|
||||
|
||||
input.y: warning: shift/reduce conflict on token J [-Wcounterexamples]
|
||||
Example H i J . J J
|
||||
Shift derivation s -> [ a -> [ H i J . J ] J ]
|
||||
Reduce derivation s -> [ a -> [ H i -> [ i J . ] J J ] ]
|
||||
input.y:5.13-15: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -903,8 +853,8 @@ d: D;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token D:
|
||||
Example A a . D
|
||||
input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
|
||||
Example: A a . D
|
||||
Shift derivation
|
||||
s
|
||||
`-> A a d
|
||||
@@ -915,14 +865,12 @@ Shift/reduce conflict on token D:
|
||||
`-> b `-> D
|
||||
`-> c
|
||||
`-> .
|
||||
|
||||
]],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token D:
|
||||
Example A a . D
|
||||
Shift derivation s -> [ A a d -> [ . D ] ]
|
||||
Reduce derivation s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] ]
|
||||
|
||||
input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
|
||||
Example A a . D
|
||||
Shift derivation s -> [ A a d -> [ . D ] ]
|
||||
Reduce derivation s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] ]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -947,14 +895,14 @@ d: D;
|
||||
|
||||
AT_BISON_CHECK_CEX(
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token D:
|
||||
First example A a . D $end
|
||||
input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
|
||||
First example: A a . D $end
|
||||
Shift derivation
|
||||
$accept
|
||||
`-> s $end
|
||||
`-> A a d
|
||||
`-> . D
|
||||
Second example A a . D E $end
|
||||
Second example: A a . D E $end
|
||||
Reduce derivation
|
||||
$accept
|
||||
`-> s $end
|
||||
@@ -962,15 +910,13 @@ Shift/reduce conflict on token D:
|
||||
`-> b `-> D
|
||||
`-> c
|
||||
`-> .
|
||||
|
||||
]],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token D:
|
||||
First example A a . D $end
|
||||
Shift derivation $accept -> [ s -> [ A a d -> [ . D ] ] $end ]
|
||||
Second example A a . D E $end
|
||||
Reduce derivation $accept -> [ s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] E ] $end ]
|
||||
|
||||
input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
|
||||
First example A a . D $end
|
||||
Shift derivation $accept -> [ s -> [ A a d -> [ . D ] ] $end ]
|
||||
Second example A a . D E $end
|
||||
Reduce derivation $accept -> [ s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] E ] $end ]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
+19
-24
@@ -51,7 +51,7 @@ if $EGREP ['\^M|\\[0-9][0-9][0-9]'] input.y experr >/dev/null; then
|
||||
AT_PERL_REQUIRE([-pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $[]1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr])
|
||||
fi
|
||||
|
||||
AT_CHECK([LC_ALL="$locale" $5 bison -fcaret --color=debug -Wall,cex input.y], [$3], [], [experr])
|
||||
AT_CHECK(AT_SET_ENV [LC_ALL="$locale" $5 bison -fcaret --color=debug -Wall,cex input.y], [$3], [], [experr])
|
||||
|
||||
# When no style, same messages, but without style.
|
||||
# Except for the second display of the counterexample,
|
||||
@@ -68,7 +68,7 @@ AT_PERL_REQUIRE([-pi -e '
|
||||
# Cannot use AT_BISON_CHECK easily as we need to change the
|
||||
# environment.
|
||||
# FIXME: Enhance AT_BISON_CHECK.
|
||||
AT_CHECK([LC_ALL="$locale" $5 bison -fcaret -Wall,cex input.y], [$3], [], [experr])
|
||||
AT_CHECK(AT_SET_ENV [LC_ALL="$locale" $5 bison -fcaret -Wall,cex input.y], [$3], [], [experr])
|
||||
|
||||
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
@@ -535,54 +535,50 @@ exp
|
||||
]],
|
||||
[1],
|
||||
[[input.y: <error>error:</error> shift/reduce conflicts: 4 found, 0 expected
|
||||
Shift/reduce conflict on token "+":
|
||||
Example <cex-0><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
input.y: <warning>warning:</warning> shift/reduce conflict on token "+" [<warning>-Wcounterexamples</warning>]
|
||||
Example: <cex-0><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
Shift derivation
|
||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||
<cex-0><cex-step>↳ <cex-leaf>exp</cex-leaf><cex-leaf> "+"</cex-leaf><cex-1><cex-step> exp</cex-step></cex-1></cex-step></cex-0>
|
||||
<cex-1><cex-step> ↳ <cex-leaf>exp</cex-leaf><cex-dot> •</cex-dot><cex-leaf> "+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-1>
|
||||
Example <cex-0><cex-1><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Example: <cex-0><cex-1><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Reduce derivation
|
||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||
<cex-0><cex-step>↳ <cex-1><cex-step>exp</cex-step></cex-1><cex-leaf> "+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-0>
|
||||
<cex-1><cex-step> ↳ <cex-leaf>exp</cex-leaf><cex-leaf> "+"</cex-leaf><cex-leaf> exp</cex-leaf><cex-dot> •</cex-dot></cex-step></cex-1>
|
||||
|
||||
Shift/reduce conflict on token "else":
|
||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
input.y: <warning>warning:</warning> shift/reduce conflict on token "else" [<warning>-Wcounterexamples</warning>]
|
||||
Example: <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
Shift derivation
|
||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||
<cex-0><cex-step>↳ <cex-leaf>"if"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-1><cex-step> exp</cex-step></cex-1></cex-step></cex-0>
|
||||
<cex-1><cex-step> ↳ <cex-leaf>"if"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-leaf> exp</cex-leaf><cex-dot> •</cex-dot><cex-leaf> "else"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-1>
|
||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Example: <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Reduce derivation
|
||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||
<cex-0><cex-step>↳ <cex-leaf>"if"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-1><cex-step> exp</cex-step></cex-1><cex-leaf> "else"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-0>
|
||||
<cex-1><cex-step> ↳ <cex-leaf>"if"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-leaf> exp</cex-leaf><cex-dot> •</cex-dot></cex-step></cex-1>
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
input.y: <warning>warning:</warning> shift/reduce conflict on token "+" [<warning>-Wcounterexamples</warning>]
|
||||
Example: <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
Shift derivation
|
||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||
<cex-0><cex-step>↳ <cex-leaf>"if"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-1><cex-step> exp</cex-step></cex-1></cex-step></cex-0>
|
||||
<cex-1><cex-step> ↳ <cex-leaf>exp</cex-leaf><cex-dot> •</cex-dot><cex-leaf> "+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-1>
|
||||
Example <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Example: <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Reduce derivation
|
||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||
<cex-0><cex-step>↳ <cex-1><cex-step>exp</cex-step></cex-1><cex-leaf> "+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-0>
|
||||
<cex-1><cex-step> ↳ <cex-leaf>"if"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-leaf> exp</cex-leaf><cex-dot> •</cex-dot></cex-step></cex-1>
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
input.y: <warning>warning:</warning> shift/reduce conflict on token "+" [<warning>-Wcounterexamples</warning>]
|
||||
Example: <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
Shift derivation
|
||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||
<cex-0><cex-step>↳ <cex-leaf>"if"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf> "else"</cex-leaf><cex-1><cex-step> exp</cex-step></cex-1></cex-step></cex-0>
|
||||
<cex-1><cex-step> ↳ <cex-leaf>exp</cex-leaf><cex-dot> •</cex-dot><cex-leaf> "+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-1>
|
||||
Example <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Example: <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Reduce derivation
|
||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||
<cex-0><cex-step>↳ <cex-1><cex-step>exp</cex-step></cex-1><cex-leaf> "+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-0>
|
||||
<cex-1><cex-step> ↳ <cex-leaf>"if"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf> "else"</cex-leaf><cex-leaf> exp</cex-leaf><cex-dot> •</cex-dot></cex-step></cex-1>
|
||||
|
||||
]])
|
||||
|
||||
|
||||
@@ -621,9 +617,9 @@ input.y:31.4: <warning>warning:</warning> empty rule without %empty [<warning>-W
|
||||
| <warning>^</warning>
|
||||
| <fixit-insert>%empty</fixit-insert>
|
||||
input.y: <error>error:</error> reduce/reduce conflicts: 1 found, 0 expected
|
||||
Reduce/reduce conflict on token "X":
|
||||
Example <cex-0><cex-1><cex-2><cex-3><cex-leaf>"X"</cex-leaf> <cex-dot>•</cex-dot></cex-3></cex-2></cex-1><cex-4></cex-4><cex-5><cex-6><cex-7><cex-8><cex-9><cex-10> <cex-leaf>"X"</cex-leaf></cex-10></cex-9></cex-8><cex-11> <cex-leaf>"quuux"</cex-leaf></cex-11></cex-7></cex-6></cex-5><cex-12><cex-13><cex-14> <cex-leaf>"X"</cex-leaf></cex-14></cex-13></cex-12></cex-0>
|
||||
First derivation
|
||||
input.y: <warning>warning:</warning> reduce/reduce conflict on token "X" [<warning>-Wcounterexamples</warning>]
|
||||
Example: <cex-0><cex-1><cex-2><cex-3><cex-leaf>"X"</cex-leaf> <cex-dot>•</cex-dot></cex-3></cex-2></cex-1><cex-4></cex-4><cex-5><cex-6><cex-7><cex-8><cex-9><cex-10> <cex-leaf>"X"</cex-leaf></cex-10></cex-9></cex-8><cex-11> <cex-leaf>"quuux"</cex-leaf></cex-11></cex-7></cex-6></cex-5><cex-12><cex-13><cex-14> <cex-leaf>"X"</cex-leaf></cex-14></cex-13></cex-12></cex-0>
|
||||
First reduce derivation
|
||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||
<cex-0><cex-step>↳ <cex-1><cex-step>x1</cex-step></cex-1><cex-4><cex-step> e1</cex-step></cex-4><cex-5><cex-step> foo1</cex-step></cex-5><cex-12><cex-step> x1</cex-step></cex-12></cex-step></cex-0>
|
||||
<cex-1><cex-step> ↳ <cex-2><cex-step>x2</cex-step></cex-2></cex-step></cex-1><cex-4><cex-step> ↳ ε</cex-step></cex-4><cex-5><cex-step> ↳ <cex-6><cex-step>foo2</cex-step></cex-6></cex-step></cex-5><cex-12><cex-step> ↳ <cex-13><cex-step>x2</cex-step></cex-13></cex-step></cex-12>
|
||||
@@ -632,8 +628,8 @@ Reduce/reduce conflict on token "X":
|
||||
<cex-8><cex-step> ↳ <cex-9><cex-step>x2</cex-step></cex-9></cex-step></cex-8><cex-11><cex-step> ↳ <cex-leaf>"quuux"</cex-leaf></cex-step></cex-11>
|
||||
<cex-9><cex-step> ↳ <cex-10><cex-step>x3</cex-step></cex-10></cex-step></cex-9>
|
||||
<cex-10><cex-step> ↳ <cex-leaf>"X"</cex-leaf></cex-step></cex-10>
|
||||
Example <cex-0><cex-1><cex-2><cex-3><cex-leaf>"X"</cex-leaf> <cex-dot>•</cex-dot></cex-3></cex-2></cex-1><cex-4></cex-4><cex-5><cex-6><cex-7><cex-8><cex-9><cex-10> <cex-leaf>"X"</cex-leaf></cex-10></cex-9></cex-8><cex-11> <cex-leaf>"quuux"</cex-leaf></cex-11></cex-7></cex-6></cex-5><cex-12><cex-13><cex-14> <cex-leaf>"X"</cex-leaf></cex-14></cex-13></cex-12></cex-0>
|
||||
Second derivation
|
||||
Example: <cex-0><cex-1><cex-2><cex-3><cex-leaf>"X"</cex-leaf> <cex-dot>•</cex-dot></cex-3></cex-2></cex-1><cex-4></cex-4><cex-5><cex-6><cex-7><cex-8><cex-9><cex-10> <cex-leaf>"X"</cex-leaf></cex-10></cex-9></cex-8><cex-11> <cex-leaf>"quuux"</cex-leaf></cex-11></cex-7></cex-6></cex-5><cex-12><cex-13><cex-14> <cex-leaf>"X"</cex-leaf></cex-14></cex-13></cex-12></cex-0>
|
||||
Second reduce derivation
|
||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||
<cex-0><cex-step>↳ <cex-1><cex-step>y1</cex-step></cex-1><cex-4><cex-step> e2</cex-step></cex-4><cex-5><cex-step> bar1</cex-step></cex-5><cex-12><cex-step> y1</cex-step></cex-12></cex-step></cex-0>
|
||||
<cex-1><cex-step> ↳ <cex-2><cex-step>y2</cex-step></cex-2></cex-step></cex-1><cex-4><cex-step> ↳ ε</cex-step></cex-4><cex-5><cex-step> ↳ <cex-6><cex-step>bar2</cex-step></cex-6></cex-step></cex-5><cex-12><cex-step> ↳ <cex-13><cex-step>y2</cex-step></cex-13></cex-step></cex-12>
|
||||
@@ -642,7 +638,6 @@ Reduce/reduce conflict on token "X":
|
||||
<cex-8><cex-step> ↳ <cex-9><cex-step>y2</cex-step></cex-9></cex-step></cex-8><cex-11><cex-step> ↳ <cex-leaf>"quuux"</cex-leaf></cex-step></cex-11>
|
||||
<cex-9><cex-step> ↳ <cex-10><cex-step>y3</cex-step></cex-10></cex-step></cex-9>
|
||||
<cex-10><cex-step> ↳ <cex-leaf>"X"</cex-leaf></cex-step></cex-10>
|
||||
|
||||
input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
|
||||
]])
|
||||
|
||||
|
||||
+2
-2
@@ -434,7 +434,7 @@ input.y:323.10: warning: empty rule without %empty [-Wempty-rule]
|
||||
]AT_COND_CASE([[canonical LR]],
|
||||
[[input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr]]],
|
||||
[[input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr]]])[
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
|
||||
input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
|
||||
input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
|
||||
@@ -1419,7 +1419,7 @@ input.y:591.18: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr]]],
|
||||
[[input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr]]])[
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
|
||||
input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
|
||||
input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]
|
||||
|
||||
+17
-17
@@ -89,7 +89,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr1.c -rall glr-regr1.y]], 0, [],
|
||||
[[glr-regr1.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
glr-regr1.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr1.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr1])
|
||||
AT_PARSER_CHECK([[glr-regr1 BPBPB]], 0,
|
||||
@@ -214,7 +214,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr2a.c -rall glr-regr2a.y]], 0, [],
|
||||
[[glr-regr2a.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
glr-regr2a.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr2a.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr2a])
|
||||
|
||||
@@ -350,7 +350,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
AT_BISON_CHECK([[-o glr-regr3.c -rall glr-regr3.y]], 0, [],
|
||||
[[glr-regr3.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
glr-regr3.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
glr-regr3.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr3.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr3])
|
||||
|
||||
@@ -447,7 +447,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr4.c -rall glr-regr4.y]], 0, [],
|
||||
[[glr-regr4.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
glr-regr4.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr4.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr4])
|
||||
|
||||
@@ -505,7 +505,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr5.c -rall glr-regr5.y]], 0, [],
|
||||
[[glr-regr5.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
glr-regr5.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr5.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr5])
|
||||
|
||||
@@ -555,7 +555,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr6.c -rall glr-regr6.y]], 0, [],
|
||||
[[glr-regr6.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
glr-regr6.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr6.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr6])
|
||||
|
||||
@@ -646,7 +646,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr7.c -rall glr-regr7.y]], 0, [],
|
||||
[[glr-regr7.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
glr-regr7.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr7.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr7])
|
||||
|
||||
@@ -737,7 +737,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr8.c -rall glr-regr8.y]], 0, [],
|
||||
[[glr-regr8.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
glr-regr8.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr8.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr8])
|
||||
|
||||
@@ -819,7 +819,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr9.c -rall glr-regr9.y]], 0, [],
|
||||
[[glr-regr9.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
glr-regr9.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr9.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr9])
|
||||
|
||||
@@ -877,7 +877,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr10.c -rall glr-regr10.y]], 0, [],
|
||||
[[glr-regr10.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
glr-regr10.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr10.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr10])
|
||||
|
||||
@@ -937,7 +937,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr11.c -rall glr-regr11.y]], 0, [],
|
||||
[[glr-regr11.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
glr-regr11.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr11.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr11])
|
||||
|
||||
@@ -1060,7 +1060,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
AT_BISON_CHECK([[-o glr-regr12.c -rall glr-regr12.y]], 0, [],
|
||||
[[glr-regr12.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
glr-regr12.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
glr-regr12.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr12.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr12])
|
||||
|
||||
@@ -1392,7 +1392,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr14.c -rall glr-regr14.y]], 0, [],
|
||||
[[glr-regr14.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
glr-regr14.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr14.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr14])
|
||||
|
||||
@@ -1487,7 +1487,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr15.c -rall glr-regr15.y]], 0, [],
|
||||
[[glr-regr15.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
glr-regr15.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr15.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr15])
|
||||
|
||||
@@ -1549,7 +1549,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr16.c -rall glr-regr16.y]], 0, [],
|
||||
[[glr-regr16.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
glr-regr16.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr16.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr16])
|
||||
|
||||
@@ -1625,7 +1625,7 @@ AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([[-o glr-regr17.c -rall glr-regr17.y]], 0, [],
|
||||
[[glr-regr17.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
glr-regr17.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
glr-regr17.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([glr-regr17])
|
||||
|
||||
@@ -1719,7 +1719,7 @@ d: /* nada. */;
|
||||
|
||||
AT_BISON_CHECK([[-o input.c input.y]], 0, [],
|
||||
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]])
|
||||
AT_COMPILE([input])
|
||||
|
||||
|
||||
@@ -2887,7 +2887,6 @@ input.y:13.1-14: note: previous definition
|
||||
input.y:14.16-29: warning: %define variable 'parse.error' redefined [-Wother]
|
||||
input.y:13.16-29: note: previous definition
|
||||
input.y: error: reduce/reduce conflicts: 0 found, 42 expected
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
||||
]])
|
||||
|
||||
|
||||
+1
-1
@@ -1199,7 +1199,7 @@ m4_define([AT_BISON_CHECK_XML],
|
||||
# The testsuite verbose output, at least, will be incorrect, but nothing may
|
||||
# fail to make sure you notice.
|
||||
m4_define([AT_SET_ENV_IF],
|
||||
[[[COLUMNS=1000; export COLUMNS;]] m4_null_if($1, [], [[[VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; ]]])])
|
||||
[[[COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS;]] m4_null_if($1, [], [[[VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; ]]])])
|
||||
|
||||
|
||||
# AT_SET_ENV
|
||||
|
||||
+1
-1
@@ -1300,7 +1300,7 @@ dnl INPUT
|
||||
dnl BISON-STDERR
|
||||
[AT_COND_CASE([[LALR]],
|
||||
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
]], [])],
|
||||
|
||||
dnl TABLES
|
||||
|
||||
+28
-34
@@ -1537,8 +1537,8 @@ exp
|
||||
AT_CHECK([LC_ALL="$locale" bison -fno-caret -o input.cc -rall -Wcex --graph=input.gv --xml input.y], [], [],
|
||||
[[input.y: warning: 3 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
Shift/reduce conflict on token "⊕":
|
||||
Example exp "+" exp • "⊕" exp
|
||||
input.y: warning: shift/reduce conflict on token "⊕" [-Wcounterexamples]
|
||||
Example: exp "+" exp • "⊕" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "+" exp
|
||||
@@ -1547,18 +1547,16 @@ Shift/reduce conflict on token "⊕":
|
||||
exp
|
||||
↳ exp "⊕" exp
|
||||
↳ exp "+" exp •
|
||||
|
||||
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||
Example exp "+" exp •
|
||||
First derivation
|
||||
input.y: warning: reduce/reduce conflict on tokens $end, "+", "⊕" [-Wcounterexamples]
|
||||
Example: exp "+" exp •
|
||||
First reduce derivation
|
||||
exp
|
||||
↳ exp "+" exp •
|
||||
Second derivation
|
||||
Second reduce derivation
|
||||
exp
|
||||
↳ exp "+" exp •
|
||||
|
||||
Shift/reduce conflict on token "⊕":
|
||||
Example exp "+" exp • "⊕" exp
|
||||
input.y: warning: shift/reduce conflict on token "⊕" [-Wcounterexamples]
|
||||
Example: exp "+" exp • "⊕" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "+" exp
|
||||
@@ -1567,9 +1565,8 @@ Shift/reduce conflict on token "⊕":
|
||||
exp
|
||||
↳ exp "⊕" exp
|
||||
↳ exp "+" exp •
|
||||
|
||||
Shift/reduce conflict on token "⊕":
|
||||
Example exp "⊕" exp • "⊕" exp
|
||||
input.y: warning: shift/reduce conflict on token "⊕" [-Wcounterexamples]
|
||||
Example: exp "⊕" exp • "⊕" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "⊕" exp
|
||||
@@ -1578,9 +1575,8 @@ Shift/reduce conflict on token "⊕":
|
||||
exp
|
||||
↳ exp "⊕" exp
|
||||
↳ exp "⊕" exp •
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
Example exp "⊕" exp • "+" exp
|
||||
input.y: warning: shift/reduce conflict on token "+" [-Wcounterexamples]
|
||||
Example: exp "⊕" exp • "+" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "⊕" exp
|
||||
@@ -1589,9 +1585,8 @@ Shift/reduce conflict on token "+":
|
||||
exp
|
||||
↳ exp "+" exp
|
||||
↳ exp "⊕" exp •
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
Example exp "⊕" exp • "+" exp
|
||||
input.y: warning: shift/reduce conflict on token "+" [-Wcounterexamples]
|
||||
Example: exp "⊕" exp • "+" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "⊕" exp
|
||||
@@ -1600,7 +1595,6 @@ Shift/reduce conflict on token "+":
|
||||
exp
|
||||
↳ exp "+" exp
|
||||
↳ exp "⊕" exp •
|
||||
|
||||
input.y:6.3-13: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
@@ -1745,10 +1739,10 @@ State 7
|
||||
|
||||
Conflict between rule 2 and token "+" resolved as reduce (%left "+").
|
||||
|
||||
Shift/reduce conflict on token "⊕":
|
||||
shift/reduce conflict on token "⊕":
|
||||
2 exp: exp "+" exp •
|
||||
1 exp: exp • "⊕" exp
|
||||
Example exp "+" exp • "⊕" exp
|
||||
Example: exp "+" exp • "⊕" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "+" exp
|
||||
@@ -1758,21 +1752,21 @@ State 7
|
||||
↳ exp "⊕" exp
|
||||
↳ exp "+" exp •
|
||||
|
||||
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||
reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||
2 exp: exp "+" exp •
|
||||
3 exp: exp "+" exp •
|
||||
Example exp "+" exp •
|
||||
First derivation
|
||||
Example: exp "+" exp •
|
||||
First reduce derivation
|
||||
exp
|
||||
↳ exp "+" exp •
|
||||
Second derivation
|
||||
Second reduce derivation
|
||||
exp
|
||||
↳ exp "+" exp •
|
||||
|
||||
Shift/reduce conflict on token "⊕":
|
||||
shift/reduce conflict on token "⊕":
|
||||
3 exp: exp "+" exp •
|
||||
1 exp: exp • "⊕" exp
|
||||
Example exp "+" exp • "⊕" exp
|
||||
Example: exp "+" exp • "⊕" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "+" exp
|
||||
@@ -1798,10 +1792,10 @@ State 8
|
||||
"⊕" [reduce using rule 1 (exp)]
|
||||
$default reduce using rule 1 (exp)
|
||||
|
||||
Shift/reduce conflict on token "⊕":
|
||||
shift/reduce conflict on token "⊕":
|
||||
1 exp: exp "⊕" exp •
|
||||
1 exp: exp • "⊕" exp
|
||||
Example exp "⊕" exp • "⊕" exp
|
||||
Example: exp "⊕" exp • "⊕" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "⊕" exp
|
||||
@@ -1811,10 +1805,10 @@ State 8
|
||||
↳ exp "⊕" exp
|
||||
↳ exp "⊕" exp •
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
shift/reduce conflict on token "+":
|
||||
1 exp: exp "⊕" exp •
|
||||
2 exp: exp • "+" exp
|
||||
Example exp "⊕" exp • "+" exp
|
||||
Example: exp "⊕" exp • "+" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "⊕" exp
|
||||
@@ -1824,10 +1818,10 @@ State 8
|
||||
↳ exp "+" exp
|
||||
↳ exp "⊕" exp •
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
shift/reduce conflict on token "+":
|
||||
1 exp: exp "⊕" exp •
|
||||
3 exp: exp • "+" exp
|
||||
Example exp "⊕" exp • "+" exp
|
||||
Example: exp "⊕" exp • "+" exp
|
||||
Shift derivation
|
||||
exp
|
||||
↳ exp "⊕" exp
|
||||
|
||||
+1
-1
@@ -285,7 +285,7 @@ term: 'n'
|
||||
|
||||
AT_BISON_CHECK([[-fcaret input.y]], [], [],
|
||||
[[input.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
input.y: warning: rerun with option '-Wcounterexamples' to generate conflict counterexamples [-Wother]
|
||||
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
|
||||
input.y:2.14-17: warning: rule useless in parser due to conflicts [-Wother]
|
||||
2 | expr: term | term | term | term | term | term
|
||||
| ^~~~
|
||||
|
||||
Reference in New Issue
Block a user