From 8b807f1177634400b307b32f120f16adfd0cead0 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 16 Feb 2013 12:46:09 +0100 Subject: [PATCH] report: use %empty to denote empty rules * src/gram.c (rule_rhs_print): Use %empty for empty rules. * tests/conflicts.at, tests/regression.at, tests/sets.at: Adjust. --- src/gram.c | 6 ++---- tests/conflicts.at | 18 +++++++++--------- tests/regression.at | 6 +++--- tests/sets.at | 6 +++--- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/gram.c b/src/gram.c index c0177df0..f6cc3c5d 100644 --- a/src/gram.c +++ b/src/gram.c @@ -93,16 +93,14 @@ rule_rhs_length (rule const *r) void rule_rhs_print (rule const *r, FILE *out) { - if (*r->rhs >= 0) + if (0 <= *r->rhs) { item_number *rp; for (rp = r->rhs; *rp >= 0; rp++) fprintf (out, " %s", symbols[*rp]->tag); } else - { - fprintf (out, " /* %s */", _("empty")); - } + fputs (" %empty", out); } static void diff --git a/tests/conflicts.at b/tests/conflicts.at index 9f7d59f9..7a993171 100644 --- a/tests/conflicts.at +++ b/tests/conflicts.at @@ -1299,13 +1299,13 @@ AT_CHECK([[cat input.output]], 0, 2 resolved_conflict: 'a' unreachable1 4 unreachable1: 'a' unreachable2 - 5 | /* empty */ + 5 | %empty - 6 unreachable2: /* empty */ - 7 | /* empty */ + 6 unreachable2: %empty + 7 | %empty 9 reported_conflicts: 'a' - 10 | /* empty */ + 10 | %empty State 4 conflicts: 1 shift/reduce @@ -1319,17 +1319,17 @@ Grammar 1 start: resolved_conflict 'a' reported_conflicts 'a' 2 resolved_conflict: 'a' unreachable1 - 3 | /* empty */ + 3 | %empty 4 unreachable1: 'a' unreachable2 - 5 | /* empty */ + 5 | %empty - 6 unreachable2: /* empty */ - 7 | /* empty */ + 6 unreachable2: %empty + 7 | %empty 8 reported_conflicts: 'a' 9 | 'a' - 10 | /* empty */ + 10 | %empty Terminals, with rules where they appear diff --git a/tests/regression.at b/tests/regression.at index debe932d..f101f218 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -263,11 +263,11 @@ AT_CHECK([cat input.output], [], 0 $accept: expr $end - 1 $@1: /* empty */ + 1 $@1: %empty 2 expr: 'a' $@1 'b' - 3 $@2: /* empty */ + 3 $@2: %empty 4 expr: $@2 'c' @@ -573,7 +573,7 @@ AT_CHECK([cat input.output], 0, 2 CONST_DEC_LIST: CONST_DEC 3 | CONST_DEC_LIST CONST_DEC - 4 $@1: /* empty */ + 4 $@1: %empty 5 CONST_DEC: $@1 undef_id_tok '=' const_id_tok ';' diff --git a/tests/sets.at b/tests/sets.at index 2007eef7..ca04f42c 100644 --- a/tests/sets.at +++ b/tests/sets.at @@ -86,7 +86,7 @@ AT_CHECK([[cat sets]], [], 0 e $end e derives 1 'e' - 2 /* empty */ + 2 %empty NULLABLE $accept: no e: yes @@ -100,10 +100,10 @@ FDERIVES $accept derives 0 e $end 1 'e' - 2 /* empty */ + 2 %empty e derives 1 'e' - 2 /* empty */ + 2 %empty ]]) AT_CLEANUP -- 2.45.2