From a0de5091fc13a2fe53f72e6b2d3054b745d9dd8a Mon Sep 17 00:00:00 2001 From: "Joel E. Denny" Date: Wed, 17 Oct 2007 04:35:35 +0000 Subject: [PATCH] * 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. --- ChangeLog | 13 +++++++++++++ doc/bison.texinfo | 4 ++++ src/print-xml.c | 3 ++- src/print.c | 3 ++- tests/conflicts.at | 4 ++-- tests/regression.at | 40 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 63 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f34db94c..d175ccc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-10-17 Joel E. Denny + + * 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 * src/print-xml.c (print_core): Remove item set diff --git a/doc/bison.texinfo b/doc/bison.texinfo index dae36315..4b49c811 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -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} diff --git a/src/print-xml.c b/src/print-xml.c index d1535a33..cbe71a16 100644 --- a/src/print-xml.c +++ b/src/print-xml.c @@ -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]); diff --git a/src/print.c b/src/print.c index 157b25c6..0359632c 100644 --- a/src/print.c +++ b/src/print.c @@ -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); diff --git a/tests/conflicts.at b/tests/conflicts.at index 5e7df4a4..2db956ee 100644 --- a/tests/conflicts.at +++ b/tests/conflicts.at @@ -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) diff --git a/tests/regression.at b/tests/regression.at index caf445e6..e0ab6935 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -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 -- 2.45.2