diff options
author | Akim Demaille <akim@lrde.epita.fr> | 2013-11-26 15:24:53 +0100 |
---|---|---|
committer | Akim Demaille <akim@lrde.epita.fr> | 2013-11-26 15:31:52 +0100 |
commit | 21cf80399f199a565fc5cffe2cad734313ad4e8f (patch) | |
tree | ced3a9ad1af6db2c32dfe0c62cd7300d8a6180f3 /src | |
parent | 7b0ca050f7153f3d038243bf1182b23854996788 (diff) | |
download | bison-21cf80399f199a565fc5cffe2cad734313ad4e8f.tar.gz |
reports: display %empty in the generated pointed-rules
* src/print.c (print_core): Use %empty for empty rules.
* src/print_graph.c (print_core): Ditto.
* tests/conflicts.at, tests/output.at, tests/reduce.at: Adjust
expectations.
Diffstat (limited to 'src')
-rw-r--r-- | src/print.c | 7 | ||||
-rw-r--r-- | src/print_graph.c | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/print.c b/src/print.c index 824bb4ae..53779def 100644 --- a/src/print.c +++ b/src/print.c @@ -106,8 +106,11 @@ print_core (FILE *out, state *s) for (sp = rules[r].rhs; sp < sp1; sp++) fprintf (out, " %s", symbols[*sp]->tag); fputs (" .", out); - for (/* Nothing */; *sp >= 0; ++sp) - fprintf (out, " %s", symbols[*sp]->tag); + if (0 <= *rules[r].rhs) + for (/* Nothing */; 0 <= *sp; ++sp) + fprintf (out, " %s", symbols[*sp]->tag); + else + fprintf (out, " %%empty"); /* Display the lookahead tokens? */ if (report_flag & report_lookahead_tokens diff --git a/src/print_graph.c b/src/print_graph.c index 7e429dbd..f15bc523 100644 --- a/src/print_graph.c +++ b/src/print_graph.c @@ -84,8 +84,11 @@ print_core (struct obstack *oout, state *s) obstack_1grow (oout, '.'); - for (/* Nothing */; *sp >= 0; ++sp) - obstack_printf (oout, " %s", escape (symbols[*sp]->tag)); + if (0 <= *r->rhs) + for (/* Nothing */; *sp >= 0; ++sp) + obstack_printf (oout, " %s", escape (symbols[*sp]->tag)); + else + obstack_printf (oout, " %%empty"); /* Experimental feature: display the lookahead tokens. */ if (report_flag & report_lookahead_tokens |