* doc/bison.texinfo (Bison Options): Add entry for --print-datadir.

(Option Cross Key): Likewise.

* src/print-xml.c (print_core): Don't print a reduction's lookahead set
next to an item whose dot is not at the end of the RHS even if it
happens to be associated with the same rule.
* src/print.c (print_core): Likewise.
* tests/conflicts.at (Unresolved SR Conflicts): Update output.
(Resolved SR Conflicts): Update output.
* tests/regression.at (Extra lookahead sets in report): New test case.
This commit is contained in:
Joel E. Denny
2007-10-17 04:35:35 +00:00
parent 4c20d18dc1
commit a0de5091fc
6 changed files with 63 additions and 4 deletions

View File

@@ -1,3 +1,16 @@
2007-10-17 Joel E. Denny <jdenny@ces.clemson.edu>
* doc/bison.texinfo (Bison Options): Add entry for --print-datadir.
(Option Cross Key): Likewise.
* src/print-xml.c (print_core): Don't print a reduction's lookahead set
next to an item whose dot is not at the end of the RHS even if it
happens to be associated with the same rule.
* src/print.c (print_core): Likewise.
* tests/conflicts.at (Unresolved SR Conflicts): Update output.
(Resolved SR Conflicts): Update output.
* tests/regression.at (Extra lookahead sets in report): New test case.
2007-10-11 Wojciech Polak <polak@gnu.org>
* src/print-xml.c (print_core): Remove item set

View File

@@ -7649,6 +7649,9 @@ Print the version number of Bison and exit.
@item --print-localedir
Print the name of the directory containing locale-dependent data.
@item --print-datadir
Print the name of the directory containing skeletons and XSLT.
@item -y
@itemx --yacc
Act more like the traditional Yacc command. This can cause
@@ -7810,6 +7813,7 @@ the corresponding short option.
@item @option{--no-lines} @tab @option{-l}
@item @option{--output=@var{outfile}} @tab @option{-o @var{outfile}}
@item @option{--print-localedir} @tab
@item @option{--print-datadir} @tab
@item @option{--token-table} @tab @option{-k}
@item @option{--verbose} @tab @option{-v}
@item @option{--version} @tab @option{-V}

View File

@@ -122,7 +122,8 @@ print_core (FILE *out, int level, state *s)
sp = rules[r].rhs;
/* Display the lookahead tokens? */
if (report_flag & report_lookahead_tokens)
if (report_flag & report_lookahead_tokens
&& item_number_is_rule_number (*sp1))
{
reductions *reds = s->reductions;
int red = state_reduction_find (s, &rules[r]);

View File

@@ -110,7 +110,8 @@ print_core (FILE *out, state *s)
fprintf (out, " %s", symbols[*sp]->tag);
/* Display the lookahead tokens? */
if (report_flag & report_lookahead_tokens)
if (report_flag & report_lookahead_tokens
&& item_number_is_rule_number (*sp1))
state_rule_lookahead_tokens_print (s, &rules[r], out);
fputc ('\n', out);

View File

@@ -212,7 +212,7 @@ state 4
state 5
1 exp: exp . OP exp [$end, OP]
1 exp: exp . OP exp
1 | exp OP exp . [$end, OP]
OP shift, and go to state 4
@@ -315,7 +315,7 @@ state 4
state 5
1 exp: exp . OP exp [$end, OP]
1 exp: exp . OP exp
1 | exp OP exp . [$end, OP]
$default reduce using rule 1 (exp)

View File

@@ -1140,3 +1140,43 @@ start: 'a' "A" 'b';
AT_CHECK([bison -t -o input.c input.y])
AT_CLEANUP
## -------------------------------- ##
## Extra lookahead sets in report. ##
## -------------------------------- ##
AT_SETUP([[Extra lookahead sets in report]])
# Within a single state, Bison used to print a reduction's lookahead set next
# to all items of the associated rule. Instead, it should only print it next
# to the item that is of the associated rule and whose dot is at the end of the
# RHS. Printing it next to items whose dot is not at the end of the RHS is
# sometimes redundant and, as in this test case, is sometimes incorrect.
AT_DATA([[input.y]],
[[%%
start: a | 'a' a 'a' ;
a: 'a' ;
]])
AT_CHECK([[bison --report=all input.y]])
AT_CHECK([[sed -n '/^state 1$/,/^state 2$/p' input.output]], [[0]],
[[state 1
2 start: 'a' . a 'a'
3 a: . 'a'
3 | 'a' . [$end]
'a' shift, and go to state 4
$default reduce using rule 3 (a)
a go to state 5
state 2
]])
AT_CLEANUP