doc: fixes

* doc/bison.texi: Fix spello.
Fix missing colors, and factor.
This commit is contained in:
Akim Demaille
2020-07-28 07:00:48 +02:00
parent 72b3c1a673
commit 17fdf5eca2

View File

@@ -9887,7 +9887,7 @@ initially developed by Chinawat Isradisaikul and Andrew Myers
@pcite{Isradisaikul 2015}. @pcite{Isradisaikul 2015}.
As a first example, see the example grammar of @ref{Shift/Reduce}, which As a first example, see the example grammar of @ref{Shift/Reduce}, which
features on shift/reduce conflict: features one shift/reduce conflict:
@c see doc/if-then-else.y @c see doc/if-then-else.y
@example @example
@@ -9901,46 +9901,40 @@ Let's rerun @command{bison} with the option
@option{-Wcex}/@option{-Wcounterexamples}@inlinefmt{info, (the following @option{-Wcex}/@option{-Wcounterexamples}@inlinefmt{info, (the following
output is actually in color)}: output is actually in color)}:
@ifnottex
@example @example
if-then-else.y: @dwarning{warning}: 1 shift/reduce conflict [@dwarning{-Wconflicts-sr}] 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}] if-then-else.y: @dwarning{warning}: shift/reduce conflict on token "else" [@dwarning{-Wcounterexamples}]
@group @group
Example: @yellow{"if" expr "then"} "if" expr "then" stmt • "else" stmt @ifnottex
Example: @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @blue{"else" stmt}
Shift derivation Shift derivation
@yellow{if_stmt} @yellow{if_stmt}
@yellow{↳ "if" expr "then"} @green{stmt} @yellow{↳ "if" expr "then"} @green{stmt}
@green{↳} @blue{if_stmt} @green{↳} @blue{if_stmt}
@blue{↳ "if" expr "then" stmt} @red{•} @blue{"else" stmt} @blue{↳ "if" expr "then" stmt} @red{•} @blue{"else" stmt}
Example: @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt} Example: @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
Reduce derivation Reduce derivation
@yellow{if_stmt} @yellow{if_stmt}
@yellow{↳ "if" expr "then"} @green{stmt} @yellow{"else" stmt} @yellow{↳ "if" expr "then"} @green{stmt} @yellow{"else" stmt}
@green{↳} @blue{if_stmt} @green{↳} @blue{if_stmt}
@blue{↳ "if" expr "then" stmt} @red{•} @blue{↳ "if" expr "then" stmt} @red{•}
@end group
@end example
@end ifnottex @end ifnottex
@iftex @iftex
@example Example: @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @blue{"else" stmt}
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"} "if" expr "then" stmt • "else" stmt
Shift derivation Shift derivation
@yellow{if_stmt} @yellow{if_stmt}
@yellow{@arrow{} "if" expr "then"} @green{stmt} @yellow{@arrow{} "if" expr "then"} @green{stmt}
@green{@arrow{}} @blue{if_stmt} @green{@arrow{}} @blue{if_stmt}
@blue{@arrow{} "if" expr "then" stmt} @red{•} @blue{"else" 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} Example: @yellow{"if" expr "then"} @blue{"if" expr "then" stmt} @red{•} @yellow{"else" stmt}
Reduce derivation Reduce derivation
@yellow{if_stmt} @yellow{if_stmt}
@yellow{@arrow{} "if" expr "then"} @green{stmt} @yellow{"else" stmt} @yellow{@arrow{} "if" expr "then"} @green{stmt} @yellow{"else" stmt}
@green{@arrow{}} @blue{if_stmt} @green{@arrow{}} @blue{if_stmt}
@blue{@arrow{} "if" expr "then" stmt} @red{•} @blue{@arrow{} "if" expr "then" stmt} @red{•}
@end iftex
@end group @end group
@end example @end example
@end iftex
This shows two different derivations for one single expression. That This shows two different derivations for one single expression. That
demonstrates that the grammar is ambiguous. demonstrates that the grammar is ambiguous.