From d42fe46ec330a0b202b28c2af4c8171a627ab531 Mon Sep 17 00:00:00 2001 From: Theophile Ranquet Date: Thu, 18 Oct 2012 12:02:05 +0000 Subject: [PATCH 1/6] output: capitalize State * src/print.c (print_state): Here. * tests/conflicts.at, tests/existing.at, tests/local.at, tests/reduce.at, tests/regression.at, tests/sets.at: Adjust. --- src/print.c | 2 +- tests/conflicts.at | 64 +++++++------- tests/existing.at | 40 ++++----- tests/local.at | 4 +- tests/reduce.at | 198 ++++++++++++++++++++++---------------------- tests/regression.at | 44 +++++----- tests/sets.at | 2 +- 7 files changed, 177 insertions(+), 177 deletions(-) diff --git a/src/print.c b/src/print.c index cb227aa5..5fdb28b5 100644 --- a/src/print.c +++ b/src/print.c @@ -370,7 +370,7 @@ static void print_state (FILE *out, state *s) { fputs ("\n\n", out); - fprintf (out, _("state %d"), s->number); + fprintf (out, _("State %d"), s->number); fputc ('\n', out); print_core (out, s); print_actions (out, s); diff --git a/tests/conflicts.at b/tests/conflicts.at index 3934a6cf..a13d7546 100644 --- a/tests/conflicts.at +++ b/tests/conflicts.at @@ -580,7 +580,7 @@ exp (6) on left: 1 2, on right: 0 1 -state 0 +State 0 0 $accept: . exp $end 1 exp: . exp OP exp @@ -591,14 +591,14 @@ state 0 exp go to state 2 -state 1 +State 1 2 exp: NUM . $default reduce using rule 2 (exp) -state 2 +State 2 0 $accept: exp . $end 1 exp: exp . OP exp @@ -607,14 +607,14 @@ state 2 OP shift, and go to state 4 -state 3 +State 3 0 $accept: exp $end . $default accept -state 4 +State 4 1 exp: . exp OP exp 1 | exp OP . exp @@ -625,7 +625,7 @@ state 4 exp go to state 5 -state 5 +State 5 1 exp: exp . OP exp 1 | exp OP exp . [$end, OP] @@ -683,7 +683,7 @@ exp (6) on left: 1 2, on right: 0 1 -state 0 +State 0 0 $accept: . exp $end 1 exp: . exp OP exp @@ -694,14 +694,14 @@ state 0 exp go to state 2 -state 1 +State 1 2 exp: NUM . $default reduce using rule 2 (exp) -state 2 +State 2 0 $accept: exp . $end 1 exp: exp . OP exp @@ -710,14 +710,14 @@ state 2 OP shift, and go to state 4 -state 3 +State 3 0 $accept: exp $end . $default accept -state 4 +State 4 1 exp: . exp OP exp 1 | exp OP . exp @@ -728,7 +728,7 @@ state 4 exp go to state 5 -state 5 +State 5 1 exp: exp . OP exp 1 | exp OP exp . [$end, OP] @@ -823,7 +823,7 @@ id (7) on left: 4, on right: 2 -state 0 +State 0 0 $accept: . exp $end 1 exp: . num @@ -838,7 +838,7 @@ state 0 id go to state 4 -state 1 +State 1 3 num: '0' . [$end] 4 id: '0' . [$end] @@ -848,28 +848,28 @@ state 1 $default reduce using rule 3 (num) -state 2 +State 2 0 $accept: exp . $end $end shift, and go to state 5 -state 3 +State 3 1 exp: num . $default reduce using rule 1 (exp) -state 4 +State 4 2 exp: id . $default reduce using rule 2 (exp) -state 5 +State 5 0 $accept: exp $end . @@ -1170,7 +1170,7 @@ reported_conflicts (9) on left: 8 9 10, on right: 1 -state 0 +State 0 0 $accept: . start $end 1 start: . resolved_conflict 'a' reported_conflicts 'a' @@ -1185,28 +1185,28 @@ state 0 Conflict between rule 3 and token 'a' resolved as reduce (%left 'a'). -state 1 +State 1 0 $accept: start . $end $end shift, and go to state 3 -state 2 +State 2 1 start: resolved_conflict . 'a' reported_conflicts 'a' 'a' shift, and go to state 4 -state 3 +State 3 0 $accept: start $end . $default accept -state 4 +State 4 1 start: resolved_conflict 'a' . reported_conflicts 'a' 8 reported_conflicts: . 'a' @@ -1220,7 +1220,7 @@ state 4 reported_conflicts go to state 6 -state 5 +State 5 8 reported_conflicts: 'a' . ['a'] 9 | 'a' . ['a'] @@ -1230,14 +1230,14 @@ state 5 $default reduce using rule 8 (reported_conflicts) -state 6 +State 6 1 start: resolved_conflict 'a' reported_conflicts . 'a' 'a' shift, and go to state 7 -state 7 +State 7 1 start: resolved_conflict 'a' reported_conflicts 'a' . @@ -1291,8 +1291,8 @@ empty_c2: %prec 'c' ; empty_c3: %prec 'd' ; ]]) AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore]) -AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0, -[[state 0 +AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0, +[[State 0 0 $accept: . start $end 1 start: . 'a' @@ -1328,7 +1328,7 @@ AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0, Conflict between rule 13 and token 'c' resolved as reduce ('c' < 'd'). -state 1 +State 1 ]]) AT_CLEANUP @@ -1367,8 +1367,8 @@ empty_c3: %prec 'c' ; ]]) AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore]) -AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0, -[[state 0 +AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0, +[[State 0 0 $accept: . start $end 1 start: . 'a' @@ -1404,7 +1404,7 @@ AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0, Conflict between rule 11 and token 'c' resolved as an error (%nonassoc 'c'). -state 1 +State 1 ]]) AT_CLEANUP diff --git a/tests/existing.at b/tests/existing.at index 149499d4..1b6fa4d1 100644 --- a/tests/existing.at +++ b/tests/existing.at @@ -489,7 +489,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%' $default reduce using rule 45 (statement) + + -+state 320 ++State 320 + + 139 non_post_simp_exp: . '!' simp_exp + 140 | . '(' exp r_paren @@ -527,7 +527,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%' + variable go to state 63 + + -+state 321 ++State 321 + + 146 non_post_simp_exp: INCREMENT . variable + 154 variable: . NAME @@ -540,7 +540,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%' + variable go to state 50 + + -+state 322 ++State 322 + + 147 non_post_simp_exp: DECREMENT . variable + 154 variable: . NAME @@ -553,7 +553,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%' + variable go to state 51 + + -+state 323 ++State 323 + + 130 simp_exp: . non_post_simp_exp + 131 | . simp_exp '^' simp_exp @@ -601,7 +601,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%' + variable go to state 57 + + -+state 324 ++State 324 + + 130 simp_exp: . non_post_simp_exp + 131 | . simp_exp '^' simp_exp @@ -649,7 +649,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%' + variable go to state 57 + + -+state 325 ++State 325 + + 130 simp_exp: . non_post_simp_exp + 131 | . simp_exp '^' simp_exp @@ -697,7 +697,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%' + variable go to state 57 + + -+state 326 ++State 326 + + 131 simp_exp: simp_exp . '^' simp_exp + 132 | simp_exp . '*' simp_exp @@ -718,7 +718,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%' + Conflict between rule 151 and token '-' resolved as reduce ('-' < UNARY). + + -+state 327 ++State 327 + + 131 simp_exp: simp_exp . '^' simp_exp + 132 | simp_exp . '*' simp_exp @@ -739,7 +739,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%' + Conflict between rule 150 and token '-' resolved as reduce ('-' < UNARY). + + -+state 328 ++State 328 + + 131 simp_exp: simp_exp . '^' simp_exp + 132 | simp_exp . '*' simp_exp @@ -2040,7 +2040,7 @@ dnl - 383 -> 427 nth_primitive go to state 105 @@ -3256,7 +3256,7 @@ - state 102 + State 102 - 146 place: label . [$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, AND, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '`', ',', '>', '+', '-', '!', ';', '}', '@:>@', ')'] + 146 place: label . [$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '`', '+', '-', '!', ';', '}', '@:>@'] @@ -2205,7 +2205,7 @@ dnl - 383 -> 427 + expr go to state 424 - state 165 + State 165 @@ -7987,7 +7987,7 @@ text_expr go to state 112 text go to state 113 @@ -2322,7 +2322,7 @@ dnl - 383 -> 427 + between go to state 425 - state 193 + State 193 @@ -10152,7 +10152,7 @@ expr_pair go to state 317 @@ -2490,7 +2490,7 @@ dnl - 383 -> 427 + expr go to state 424 - state 238 + State 238 @@ -12937,7 +12937,7 @@ '!' shift, and go to state 94 @@ -2577,7 +2577,7 @@ dnl - 383 -> 427 + expr go to state 424 - state 315 + State 315 @@ -16124,7 +16124,7 @@ $default reduce using rule 239 (expr) @@ -2628,7 +2628,7 @@ dnl - 383 -> 427 + expr go to state 424 - state 383 + State 383 @@ -18071,7 +18071,7 @@ '!' shift, and go to state 94 @@ -2671,7 +2671,7 @@ dnl - 383 -> 427 $default reduce using rule 29 (placeless_element) + + -+state 423 ++State 423 + + 146 place: label . [$end, AND, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, ',', '>', '+', '-', ';', '}', '@:>@', ')'] + 147 | label . corner @@ -2742,7 +2742,7 @@ dnl - 383 -> 427 + corner go to state 205 + + -+state 424 ++State 424 + + 140 position_not_place: expr . between position AND position + 141 | expr . '<' position ',' position '>' @@ -2785,7 +2785,7 @@ dnl - 383 -> 427 + between go to state 425 + + -+state 425 ++State 425 + + 134 position: . position_not_place + 135 | . place @@ -2941,7 +2941,7 @@ dnl - 383 -> 427 + expr go to state 424 + + -+state 426 ++State 426 + + 137 position_not_place: position . '+' expr_pair + 138 | position . '-' expr_pair @@ -2952,7 +2952,7 @@ dnl - 383 -> 427 + '-' shift, and go to state 198 + + -+state 427 ++State 427 + + 134 position: . position_not_place + 135 | . place diff --git a/tests/local.at b/tests/local.at index a33ea9b2..ca64693e 100644 --- a/tests/local.at +++ b/tests/local.at @@ -868,9 +868,9 @@ m4_if(m4_index(m4_quote($3), [no-xml]), -1, [0], [], m4_dquote($7)) m4_if(m4_index(m4_quote($3), [last-state]), -1, - [AT_CHECK([[sed -n '/^state 0$/,$p' input.output]], [[0]], + [AT_CHECK([[sed -n '/^State 0$/,$p' input.output]], [[0]], m4_dquote($8))], - [AT_CHECK([[sed -n 's/^state //p' input.output | tail -1]], [[0]], + [AT_CHECK([[sed -n 's/^State //p' input.output | tail -1]], [[0]], m4_dquote($8)[[ ]])]) diff --git a/tests/reduce.at b/tests/reduce.at index c528eed8..bf43bf9d 100644 --- a/tests/reduce.at +++ b/tests/reduce.at @@ -437,7 +437,7 @@ dnl BISON-STDERR [], dnl TABLES -[[state 0 +[[State 0 0 $accept: . S $end 1 S: . 'a' A 'a' @@ -451,7 +451,7 @@ dnl TABLES S go to state 4 -state 1 +State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' @@ -462,7 +462,7 @@ state 1 A go to state 6 -state 2 +State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' @@ -473,7 +473,7 @@ state 2 A go to state 7 -state 3 +State 3 3 S: 'c' . c 4 A: . 'a' 'a' @@ -487,14 +487,14 @@ state 3 c go to state 10 -state 4 +State 4 0 $accept: S . $end $end shift, and go to state 11 -state 5 +State 5 4 A: 'a' . 'a' 5 | 'a' . ]AT_COND_CASE([[LALR]], [[['a', 'b']]], [[['a']]])[ @@ -505,21 +505,21 @@ state 5 Conflict between rule 5 and token 'a' resolved as reduce (%left 'a'). -state 6 +State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 -state 7 +State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 -state 8 +State 8 4 A: 'a' . 'a' 5 | 'a' . [$end] @@ -533,7 +533,7 @@ state 8 [[$default]])[ reduce using rule 5 (A) -state 9 +State 9 7 c: A .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -541,7 +541,7 @@ state 9 [[$default]])[ reduce using rule 7 (c) -state 10 +State 10 3 S: 'c' c .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -549,14 +549,14 @@ state 10 [[$default]])[ reduce using rule 3 (S) -state 11 +State 11 0 $accept: S $end . $default accept -state 12 +State 12 4 A: 'a' 'a' .]AT_COND_CASE([[canonical LR]], [[ ['a']]])[ @@ -564,7 +564,7 @@ state 12 [[$default]])[ reduce using rule 4 (A) -state 13 +State 13 1 S: 'a' A 'a' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -572,7 +572,7 @@ state 13 [[$default]])[ reduce using rule 1 (S) -state 14 +State 14 2 S: 'b' A 'b' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -580,7 +580,7 @@ state 14 [[$default]])[ reduce using rule 2 (S) -state 15 +State 15 6 c: 'a' 'b' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -589,7 +589,7 @@ state 15 [[]], [[ -state 16 +State 16 4 A: 'a' . 'a' 5 | 'a' . ['b'] @@ -601,14 +601,14 @@ state 16 [[$default]])[ reduce using rule 5 (A)]AT_COND_CASE([[canonical LR]], [[ -state 17 +State 17 4 A: 'a' 'a' . [$end] $end reduce using rule 4 (A) -state 18 +State 18 4 A: 'a' 'a' . ['b'] @@ -653,7 +653,7 @@ dnl BISON-STDERR [], dnl TABLES -[[state 0 +[[State 0 0 $accept: . S $end 1 S: . 'a' A 'a' @@ -667,7 +667,7 @@ dnl TABLES S go to state 4 -state 1 +State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' 'a' @@ -678,7 +678,7 @@ state 1 A go to state 6 -state 2 +State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' 'a' @@ -689,7 +689,7 @@ state 2 A go to state 7 -state 3 +State 3 3 S: 'c' . c 4 A: . 'a' 'a' 'a' @@ -703,14 +703,14 @@ state 3 c go to state 10 -state 4 +State 4 0 $accept: S . $end $end shift, and go to state 11 -state 5 +State 5 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' @@ -718,21 +718,21 @@ state 5 'a' shift, and go to state 12 -state 6 +State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 -state 7 +State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 -state 8 +State 8 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' @@ -741,7 +741,7 @@ state 8 'a' shift, and go to state 15 -state 9 +State 9 7 c: A .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -749,7 +749,7 @@ state 9 [[$default]])[ reduce using rule 7 (c) -state 10 +State 10 3 S: 'c' c .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -757,14 +757,14 @@ state 10 [[$default]])[ reduce using rule 3 (S) -state 11 +State 11 0 $accept: S $end . $default accept -state 12 +State 12 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . ]AT_COND_CASE([[LALR]], [[['a', 'b']]], [[['a']]])[ @@ -775,7 +775,7 @@ state 12 Conflict between rule 5 and token 'a' resolved as reduce (%left 'a'). -state 13 +State 13 1 S: 'a' A 'a' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -783,7 +783,7 @@ state 13 [[$default]])[ reduce using rule 1 (S) -state 14 +State 14 2 S: 'b' A 'b' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -791,7 +791,7 @@ state 14 [[$default]])[ reduce using rule 2 (S) -state 15 +State 15 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . [$end] @@ -805,7 +805,7 @@ state 15 [[$default]])[ reduce using rule 5 (A) -state 16 +State 16 4 A: 'a' 'a' 'a' .]AT_COND_CASE([[canonical LR]], [[ ['a']]])[ @@ -813,7 +813,7 @@ state 16 [[$default]])[ reduce using rule 4 (A) -state 17 +State 17 6 c: 'a' 'a' 'b' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -822,7 +822,7 @@ state 17 [[]], [[ -state 18 +State 18 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' @@ -831,7 +831,7 @@ state 18 [[19]])[ -state 19]AT_COND_CASE([[canonical LR]], [[ +State 19]AT_COND_CASE([[canonical LR]], [[ 4 A: 'a' 'a' 'a' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -839,7 +839,7 @@ state 19]AT_COND_CASE([[canonical LR]], [[ [[$default]])[ reduce using rule 4 (A) -state 20]])[ +State 20]])[ 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . ['b'] @@ -851,7 +851,7 @@ state 20]])[ [[$default]])[ reduce using rule 5 (A)]AT_COND_CASE([[canonical LR]], [[ -state 21 +State 21 4 A: 'a' 'a' 'a' .]AT_COND_CASE([[canonical LR]], [[ ['b']]])[ @@ -900,7 +900,7 @@ dnl BISON-STDERR [], dnl TABLES -[[state 0 +[[State 0 0 $accept: . S $end 1 S: . 'a' A 'a' @@ -914,7 +914,7 @@ dnl TABLES S go to state 4 -state 1 +State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' B @@ -924,7 +924,7 @@ state 1 A go to state 6 -state 2 +State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' B @@ -934,7 +934,7 @@ state 2 A go to state 7 -state 3 +State 3 3 S: 'c' . c 4 A: . 'a' 'a' B @@ -947,35 +947,35 @@ state 3 c go to state 10 -state 4 +State 4 0 $accept: S . $end $end shift, and go to state 11 -state 5 +State 5 4 A: 'a' . 'a' B 'a' shift, and go to state 12 -state 6 +State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 -state 7 +State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 -state 8 +State 8 4 A: 'a' . 'a' B 7 c: 'a' . 'a' 'b' @@ -983,7 +983,7 @@ state 8 'a' shift, and go to state 15 -state 9 +State 9 8 c: A .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -991,7 +991,7 @@ state 9 [[$default]])[ reduce using rule 8 (c) -state 10 +State 10 3 S: 'c' c .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -999,14 +999,14 @@ state 10 [[$default]])[ reduce using rule 3 (S) -state 11 +State 11 0 $accept: S $end . $default accept -state 12 +State 12 4 A: 'a' 'a' . B 5 B: . 'a' @@ -1020,7 +1020,7 @@ state 12 Conflict between rule 6 and token 'a' resolved as reduce (%left 'a'). -state 13 +State 13 1 S: 'a' A 'a' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -1028,7 +1028,7 @@ state 13 [[$default]])[ reduce using rule 1 (S) -state 14 +State 14 2 S: 'b' A 'b' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -1036,7 +1036,7 @@ state 14 [[$default]])[ reduce using rule 2 (S) -state 15 +State 15 4 A: 'a' 'a' . B 5 B: . 'a' @@ -1053,7 +1053,7 @@ state 15 B go to state ]AT_COND_CASE([[canonical LR]], [[21]], [[17]])[ -state 16 +State 16 5 B: 'a' .]AT_COND_CASE([[canonical LR]], [[ ['a']]])[ @@ -1061,7 +1061,7 @@ state 16 [[$default]])[ reduce using rule 5 (B) -state 17 +State 17 4 A: 'a' 'a' B .]AT_COND_CASE([[canonical LR]], [[ ['a']]])[ @@ -1069,7 +1069,7 @@ state 17 [[$default]])[ reduce using rule 4 (A) -state 18 +State 18 7 c: 'a' 'a' 'b' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -1077,7 +1077,7 @@ state 18 [[$default]])[ reduce using rule 7 (c)]AT_COND_CASE([[LALR]], [], [[ -state 19 +State 19 4 A: 'a' . 'a' B @@ -1085,21 +1085,21 @@ state 19 [[20]])[ -state 20]AT_COND_CASE([[canonical LR]], [[ +State 20]AT_COND_CASE([[canonical LR]], [[ 5 B: 'a' . [$end] $end reduce using rule 5 (B) -state 21 +State 21 4 A: 'a' 'a' B . [$end] $end reduce using rule 4 (A) -state 22]])[ +State 22]])[ 4 A: 'a' 'a' . B 5 B: . 'a' @@ -1114,14 +1114,14 @@ state 22]])[ B go to state ]AT_COND_CASE([[canonical LR]], [[24 -state 23 +State 23 5 B: 'a' . ['b'] 'b' reduce using rule 5 (B) -state 24 +State 24 4 A: 'a' 'a' B . ['b'] @@ -1195,7 +1195,7 @@ dnl BISON-STDERR ]], [])], dnl TABLES -[[state 0 +[[State 0 0 $accept: . S $end 1 S: . 'a' A 'f' @@ -1213,7 +1213,7 @@ dnl TABLES S go to state 4 -state 1 +State 1 1 S: 'a' . A 'f' 2 | 'a' . B @@ -1226,7 +1226,7 @@ state 1 B go to state 7 -state 2 +State 2 3 S: 'b' . A 'f' 4 | 'b' . B 'g' @@ -1240,7 +1240,7 @@ state 2 B go to state 10 -state 3 +State 3 6 S: 'c' . 'c' A 'g' 7 | 'c' . 'c' B @@ -1248,14 +1248,14 @@ state 3 'c' shift, and go to state 11 -state 4 +State 4 0 $accept: S . $end $end shift, and go to state 12 -state 5 +State 5 8 A: 'd' . 'e' 9 B: 'd' . 'e' @@ -1265,14 +1265,14 @@ state 5 [[20]])[ -state 6 +State 6 1 S: 'a' A . 'f' 'f' shift, and go to state 14 -state 7 +State 7 2 S: 'a' B .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -1280,7 +1280,7 @@ state 7 [[$default]])[ reduce using rule 2 (S) -state 8 +State 8 5 S: 'b' 'd' . [$end] 8 A: 'd' . 'e' @@ -1293,21 +1293,21 @@ state 8 [[$default]])[ reduce using rule 5 (S) -state 9 +State 9 3 S: 'b' A . 'f' 'f' shift, and go to state 15 -state 10 +State 10 4 S: 'b' B . 'g' 'g' shift, and go to state 16 -state 11 +State 11 6 S: 'c' 'c' . A 'g' 7 | 'c' 'c' . B @@ -1321,14 +1321,14 @@ state 11 B go to state 18 -state 12 +State 12 0 $accept: S $end . $default accept]AT_COND_CASE([[LALR]], [[ -state 13 +State 13 8 A: 'd' 'e' . ['f', 'g'] 9 B: 'd' 'e' . [$end, 'g'] @@ -1339,7 +1339,7 @@ state 13 $default reduce using rule 8 (A)]], [[ -state 13 +State 13 8 A: 'd' 'e' . ['f'] 9 B: 'd' 'e' . ]AT_COND_CASE([[canonical LR]], [[[$end]]], [[['g']]])[ @@ -1350,7 +1350,7 @@ state 13 [[$default]])[ reduce using rule 8 (A)]])[ -state 14 +State 14 1 S: 'a' A 'f' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -1358,7 +1358,7 @@ state 14 [[$default]])[ reduce using rule 1 (S) -state 15 +State 15 3 S: 'b' A 'f' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -1366,7 +1366,7 @@ state 15 [[$default]])[ reduce using rule 3 (S) -state 16 +State 16 4 S: 'b' B 'g' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -1374,14 +1374,14 @@ state 16 [[$default]])[ reduce using rule 4 (S) -state 17 +State 17 6 S: 'c' 'c' A . 'g' 'g' shift, and go to state 19 -state 18 +State 18 7 S: 'c' 'c' B .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -1389,7 +1389,7 @@ state 18 [[$default]])[ reduce using rule 7 (S) -state 19 +State 19 6 S: 'c' 'c' A 'g' .]AT_COND_CASE([[canonical LR]], [[ [$end]]])[ @@ -1398,7 +1398,7 @@ state 19 [[]], [[ -state 20]AT_COND_CASE([[canonical LR]], [[ +State 20]AT_COND_CASE([[canonical LR]], [[ 8 A: 'd' 'e' . ['f'] 9 B: 'd' 'e' . ['g'] @@ -1407,7 +1407,7 @@ state 20]AT_COND_CASE([[canonical LR]], [[ 'g' reduce using rule 9 (B) -state 21 +State 21 8 A: 'd' . 'e' 9 B: 'd' . 'e' @@ -1415,7 +1415,7 @@ state 21 'e' shift, and go to state 22 -state 22 +State 22 8 A: 'd' 'e' . ['g'] 9 B: 'd' 'e' . [$end] @@ -1491,7 +1491,7 @@ c: ; ]], dnl Visit each state mentioned above. [['a', 'a']], -[[state 0 +[[State 0 0 $accept: . start $end 1 start: . a b @@ -1505,7 +1505,7 @@ dnl Visit each state mentioned above. a go to state 3 -state 1 +State 1 4 a: 'a' .]AT_COND_CASE([[accepting]], [[ [$end, 'a', 'b'] @@ -1516,14 +1516,14 @@ state 1 $default reduce using rule 4 (a)]])[ -state 2 +State 2 0 $accept: start . $end $end shift, and go to state 4 -state 3 +State 3 1 start: a . b 2 | a . b 'a' @@ -1542,14 +1542,14 @@ state 3 c go to state 6 -state 4 +State 4 0 $accept: start $end . $default accept -state 5 +State 5 1 start: a b . [$end] 2 | a b . 'a' @@ -1560,14 +1560,14 @@ state 5 [[$end]])[ reduce using rule 1 (start) -state 6 +State 6 3 start: a c . 'b' 'b' shift, and go to state 8 -state 7 +State 7 2 start: a b 'a' .]AT_COND_CASE([[accepting]], [[ [$end] @@ -1576,7 +1576,7 @@ state 7 $default reduce using rule 2 (start)]])[ -state 8 +State 8 3 start: a c 'b' .]AT_COND_CASE([[accepting]], [[ [$end] diff --git a/tests/regression.at b/tests/regression.at index 374bd82a..3fa20e27 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -293,7 +293,7 @@ $@2 (9) on left: 3, on right: 4 -state 0 +State 0 0 $accept: . expr $end @@ -305,7 +305,7 @@ state 0 $@2 go to state 3 -state 1 +State 1 2 expr: 'a' . $@1 'b' @@ -314,42 +314,42 @@ state 1 $@1 go to state 4 -state 2 +State 2 0 $accept: expr . $end $end shift, and go to state 5 -state 3 +State 3 4 expr: $@2 . 'c' 'c' shift, and go to state 6 -state 4 +State 4 2 expr: 'a' $@1 . 'b' 'b' shift, and go to state 7 -state 5 +State 5 0 $accept: expr $end . $default accept -state 6 +State 6 4 expr: $@2 'c' . $default reduce using rule 4 (expr) -state 7 +State 7 2 expr: 'a' $@1 'b' . @@ -598,7 +598,7 @@ $@1 (11) on left: 4, on right: 5 -state 0 +State 0 0 $accept: . CONST_DEC_PART $end @@ -610,14 +610,14 @@ state 0 $@1 go to state 4 -state 1 +State 1 0 $accept: CONST_DEC_PART . $end $end shift, and go to state 5 -state 2 +State 2 1 CONST_DEC_PART: CONST_DEC_LIST . 3 CONST_DEC_LIST: CONST_DEC_LIST . CONST_DEC @@ -629,56 +629,56 @@ state 2 $@1 go to state 4 -state 3 +State 3 2 CONST_DEC_LIST: CONST_DEC . $default reduce using rule 2 (CONST_DEC_LIST) -state 4 +State 4 5 CONST_DEC: $@1 . undef_id_tok '=' const_id_tok ';' undef_id_tok shift, and go to state 7 -state 5 +State 5 0 $accept: CONST_DEC_PART $end . $default accept -state 6 +State 6 3 CONST_DEC_LIST: CONST_DEC_LIST CONST_DEC . $default reduce using rule 3 (CONST_DEC_LIST) -state 7 +State 7 5 CONST_DEC: $@1 undef_id_tok . '=' const_id_tok ';' '=' shift, and go to state 8 -state 8 +State 8 5 CONST_DEC: $@1 undef_id_tok '=' . const_id_tok ';' const_id_tok shift, and go to state 9 -state 9 +State 9 5 CONST_DEC: $@1 undef_id_tok '=' const_id_tok . ';' ';' shift, and go to state 10 -state 10 +State 10 5 CONST_DEC: $@1 undef_id_tok '=' const_id_tok ';' . @@ -1125,8 +1125,8 @@ a: 'a' ; ]]) AT_BISON_CHECK([[--report=all input.y]]) -AT_CHECK([[sed -n '/^state 1$/,/^state 2$/p' input.output]], [[0]], -[[state 1 +AT_CHECK([[sed -n '/^State 1$/,/^State 2$/p' input.output]], [[0]], +[[State 1 2 start: 'a' . a 'a' 3 a: . 'a' @@ -1139,7 +1139,7 @@ AT_CHECK([[sed -n '/^state 1$/,/^state 2$/p' input.output]], [[0]], a go to state 5 -state 2 +State 2 ]]) AT_CLEANUP diff --git a/tests/sets.at b/tests/sets.at index 388ee099..4cbdfd62 100644 --- a/tests/sets.at +++ b/tests/sets.at @@ -287,7 +287,7 @@ mv stdout expout # Get the final state in the report, from the "accept" action.. AT_CHECK([sed -n ' - /^state \(.*\)/{ + /^State \(.*\)/{ s//final state \1/ x } From 9c16d39944f2083dde29e364c1f61aebae6f2643 Mon Sep 17 00:00:00 2001 From: Theophile Ranquet Date: Mon, 22 Oct 2012 17:37:57 +0000 Subject: [PATCH 2/6] xml: documentation The XML output combined with the XSL Transformations provided in data/ are incredibly useful, they should be documented. * doc/bison.texi (Xml): New node. --- NEWS | 7 ++++++- doc/bison.texi | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index bb016bb3..46d614cf 100644 --- a/NEWS +++ b/NEWS @@ -42,7 +42,7 @@ GNU Bison NEWS position_type are deprecated in favor of api.location.type and api.position.type. -** Graphviz improvements +** Graph improvements in DOT and XSLT The graphical presentation of the states is more readable: their shape is now rectangular, the state number is clearly displayed, and the items are @@ -51,6 +51,11 @@ GNU Bison NEWS The reductions are now explicitly represented as transitions to other diamond shaped nodes. + These changes are present in both --graph output and xml2dot.xsl XSLT + processing, with minor (documented) differences. + + Two nodes were added to the documentation: Xml and Graphviz. + * Noteworthy changes in release 2.6.5 (2012-11-07) [stable] We consider compiler warnings about Bison generated parsers to be bugs. diff --git a/doc/bison.texi b/doc/bison.texi index 7b900b27..023edd51 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -295,6 +295,7 @@ Debugging Your Parser * Understanding:: Understanding the structure of your parser. * Graphviz:: Getting a visual representation of the parser. +* Xml:: Getting a markup representation of the parser. * Tracing:: Tracing the execution of your parser. Tracing Your Parser @@ -8095,6 +8096,7 @@ automaton, and how to enable and understand the parser run-time traces. @menu * Understanding:: Understanding the structure of your parser. * Graphviz:: Getting a visual representation of the parser. +* Xml:: Getting a markup representation of the parser. * Tracing:: Tracing the execution of your parser. @end menu @@ -8511,6 +8513,9 @@ precedence of @samp{/} with respect to @samp{+}, @samp{-}, and @samp{*}, but also because the associativity of @samp{/} is not specified. +Note that Bison may also produce an HTML version of this output, via an XML +file and XSLT processing (@pxref{Xml}). + @c ================================================= Graphical Representation @node Graphviz @@ -8618,6 +8623,55 @@ is shown as a blue diamond, labelled "Acc". The @samp{go to} jump transitions are represented as dotted lines bearing the name of the rule being jumped to. +Note that a DOT file may also be produced via an XML file and XSLT +processing (@pxref{Xml}). + +@c ================================================= XML + +@node Xml +@section Visualizing your parser in multiple formats +@cindex xml + +Bison supports two major report formats: textual output +(@pxref{Understanding}) when invoked with option @option{--verbose}, and DOT +(@pxref{Graphviz}) when invoked with option @option{--graph}. However, +another alternative is to output an XML file that may then be, with +@command{xsltproc}, rendered as either a raw text format equivalent to the +verbose file, or as an HTML version of the same file, with clickable +transitions, or even as a DOT. The @file{.output} and DOT files obtained via +XSLT have no difference whatsoever with those obtained by invoking bison +with options @option{--verbose} or @option{--graph}. + +The textual file is generated when the options @option{-x} or +@option{--xml[=FILE]} are specified, see @ref{Invocation,,Invoking Bison}. +If not specified, its name is made by removing @samp{.tab.c} or @samp{.c} +from the parser implementation file name, and adding @samp{.xml} instead. +For instance, if the grammar file is @file{foo.y}, the default XML output +file is @file{foo.xml}. + +Bison ships with a @file{data/xslt} directory, containing XSL Transformation +files to apply to the XML file. Their names are non-ambiguous: + +@table @file +@item xml2dot.xsl +Used to output a DOT version of the automaton. This might not be exactly the +same as the one obtained through @option{--graph}. +@item xml2text.xsl +Used to output a copy of the .output file. +@item xml2xhtml.xsl +Used to output an xhtml enhancement of the .output file. +@end table + +Sample usage (requires @code{xsltproc}): +@example +$ bison -x input.y +@group +$ bison --print-datadir +/usr/local/share/bison +@end group +$ xsltproc /usr/local/share/bison/xslt/xml2xhtml.xsl input.xml > input.html +@end example + @c ================================================= Tracing @node Tracing From ccda5c9eacfd97f0064c8d6102d3c5f06cb541c1 Mon Sep 17 00:00:00 2001 From: Theophile Ranquet Date: Fri, 9 Nov 2012 16:40:45 +0000 Subject: [PATCH 3/6] graph: fix a memory leak * src/graphviz.c (output_red): Here. --- src/graphviz.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/graphviz.c b/src/graphviz.c index 3ae0b546..ec102a49 100644 --- a/src/graphviz.c +++ b/src/graphviz.c @@ -204,6 +204,7 @@ output_red (state const *s, reductions const *reds, FILE *fout) } obstack_free (&eout, 0); obstack_free (&dout, 0); + bitset_free (no_reduce_set); } void From 489b320d4a70692313a059b10786913a1310f617 Mon Sep 17 00:00:00 2001 From: Theophile Ranquet Date: Wed, 7 Nov 2012 09:54:06 +0000 Subject: [PATCH 4/6] xml: factor xslt space template * data/xslt/bison.xsl (space): New, import from... * data/xslt/xml2text.xsl: Here. --- data/xslt/bison.xsl | 12 ++++++++++++ data/xslt/xml2text.xsl | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data/xslt/bison.xsl b/data/xslt/bison.xsl index 353c75a0..40575efd 100644 --- a/data/xslt/bison.xsl +++ b/data/xslt/bison.xsl @@ -90,4 +90,16 @@ + + 0 + + + + + + + + + + diff --git a/data/xslt/xml2text.xsl b/data/xslt/xml2text.xsl index d14f1be5..94e78e63 100644 --- a/data/xslt/xml2text.xsl +++ b/data/xslt/xml2text.xsl @@ -522,18 +522,6 @@ - - 0 - - - - - - - - - - From be3517b007a833ffec1735691f256f6a37e4a67f Mon Sep 17 00:00:00 2001 From: Theophile Ranquet Date: Tue, 23 Oct 2012 15:43:54 +0000 Subject: [PATCH 5/6] xml: match DOT output and xml2dot.xsl processing Make the DOT produced by XSLT processing equivalent to the one made with the --graph option. * data/xslt/xml2dot.xsl: Stylistic changes, and add support for reductions. * doc/bison.texi (Xml): Update. * src/graphviz.c (conclude_red): Minor stylistic changes to DOT internals. (output_red): Swap enabled and disabled reductions output, for coherence with XSLT output. * src/print_graph.c (print_core): Minor stylistic change to States' output. (print_actions): Swap order of output for reductions and transitions. * tests/local.at (AT_BISON_CHECK_XML): Ignore differences in order. * tests/output.at: Adjust to changes in DOT internals. --- data/xslt/xml2dot.xsl | 185 ++++++++++++++++++++++- data/xslt/xml2text.xsl | 2 +- doc/bison.texi | 7 +- src/graphviz.c | 34 +++-- src/print_graph.c | 7 +- tests/local.at | 4 +- tests/output.at | 322 ++++++++++++++++++++--------------------- 7 files changed, 367 insertions(+), 194 deletions(-) diff --git a/data/xslt/xml2dot.xsl b/data/xslt/xml2dot.xsl index 111613ce..dceb8e1e 100644 --- a/data/xslt/xml2dot.xsl +++ b/data/xslt/xml2dot.xsl @@ -55,7 +55,7 @@ - { + " { node [fontname = courier, shape = box, colorscheme = paired6] edge [fontname = courier] @@ -68,11 +68,87 @@ - + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + label="[ + + + + + + , + + + ]", + + + + style=solid] + + + + + + + + + 3 + + + 5 + + + + + + @@ -80,17 +156,48 @@ + + + + + - - -> + + + + + + + + + + + + + + + + + + + + + + + : + + . @@ -110,7 +217,7 @@ - [ + [ ] @@ -122,6 +229,50 @@ + + + + + + + + -> " + + R + + + d + + " [ + + + + + + + + " + + R + + + d + + " [label=" + + + Acc", fillcolor=1 + + + R + + ", fillcolor= + + + + , shape=diamond, style=filled] + + @@ -153,10 +304,13 @@ [label=" + State + + \n - "] + \l"] @@ -197,7 +351,7 @@ - + @@ -223,4 +377,21 @@ + + + + + + + + + + + + + + + + + diff --git a/data/xslt/xml2text.xsl b/data/xslt/xml2text.xsl index 94e78e63..8b3f5ae4 100644 --- a/data/xslt/xml2text.xsl +++ b/data/xslt/xml2text.xsl @@ -230,7 +230,7 @@ - state + State diff --git a/doc/bison.texi b/doc/bison.texi index 023edd51..7bb41460 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -8639,8 +8639,8 @@ another alternative is to output an XML file that may then be, with @command{xsltproc}, rendered as either a raw text format equivalent to the verbose file, or as an HTML version of the same file, with clickable transitions, or even as a DOT. The @file{.output} and DOT files obtained via -XSLT have no difference whatsoever with those obtained by invoking bison -with options @option{--verbose} or @option{--graph}. +XSLT have no difference whatsoever with those obtained by invoking +@command{bison} with options @option{--verbose} or @option{--graph}. The textual file is generated when the options @option{-x} or @option{--xml[=FILE]} are specified, see @ref{Invocation,,Invoking Bison}. @@ -8654,8 +8654,7 @@ files to apply to the XML file. Their names are non-ambiguous: @table @file @item xml2dot.xsl -Used to output a DOT version of the automaton. This might not be exactly the -same as the one obtained through @option{--graph}. +Used to output a copy of the DOT visualization of the automaton. @item xml2text.xsl Used to output a copy of the .output file. @item xml2xhtml.xsl diff --git a/src/graphviz.c b/src/graphviz.c index ec102a49..16ea8b9e 100644 --- a/src/graphviz.c +++ b/src/graphviz.c @@ -106,7 +106,7 @@ conclude_red (struct obstack *out, int source, rule_number ruleno, return (void) obstack_finish0 (out); else { - char const *ed = enabled ? "e" : "d"; + char const *ed = enabled ? "" : "d"; char const *color = enabled ? ruleno ? "3" : "1" : "5"; /* First, build the edge's head. The name of reduction nodes is "nRm", @@ -116,24 +116,28 @@ conclude_red (struct obstack *out, int source, rule_number ruleno, fprintf (fout, " %1$d -> \"%1$dR%2$d%3$s\" [", source, ruleno, ed); + /* (The lookahead tokens have been added to the beginning of the + obstack, in the caller function.) */ if (! obstack_empty_p (out)) - /* (The lookahead tokens have been added to the beginning of the - obstack, in the caller function.) */ - fprintf (fout, "label = \"[%s]\" ", obstack_finish0 (out)); + { + char *label = obstack_finish0 (out); + fprintf (fout, "label=\"[%s]\", ", label); + obstack_free (out, label); + } /* Then, the edge's tail. */ - fprintf (fout, "style = solid]\n"); + fprintf (fout, "style=solid]\n"); /* Build the associated diamond representation of the target rule. */ - fprintf (fout, " \"%dR%d%s\" [style = filled, " - "shape = diamond, fillcolor = %s, ", - source, ruleno, ed, color); - - if (ruleno) - fprintf (fout, "label = \"R%d\"]\n", ruleno); + fprintf (fout, " \"%dR%d%s\" [label=\"", + source, ruleno, ed); + if (ruleno) + fprintf (fout, "R%d", ruleno); else - fprintf (fout, "label = \"Acc\"]\n"); + fprintf (fout, "Acc"); + fprintf (fout, "\", fillcolor=%s, shape=diamond, style=filled]\n", + color); } } @@ -171,7 +175,7 @@ output_red (state const *s, reductions const *reds, FILE *fout) bool defaulted = false; bool firstd = true; bool firste = true; - rule_number ruleno = reds->rules[j]->user_number; + rule_number ruleno = reds->rules[j]->number; rule *default_reduction = NULL; if (yydefact[s->number] != 0) @@ -199,11 +203,11 @@ output_red (state const *s, reductions const *reds, FILE *fout) } /* Do the actual output. */ - conclude_red (&eout, source, ruleno, true, firste && !defaulted, fout); conclude_red (&dout, source, ruleno, false, firstd, fout); + conclude_red (&eout, source, ruleno, true, firste && !defaulted, fout); } - obstack_free (&eout, 0); obstack_free (&dout, 0); + obstack_free (&eout, 0); bitset_free (no_reduce_set); } diff --git a/src/print_graph.c b/src/print_graph.c index 5ce0aa98..f4742b16 100644 --- a/src/print_graph.c +++ b/src/print_graph.c @@ -76,7 +76,7 @@ print_core (struct obstack *oout, state *s) } obstack_printf (oout, _("State %d"), s->number); - obstack_sgrow (oout, "\\n"); + obstack_sgrow (oout, "\\n\\l"); for (i = 0; i < snritems; i++) { item_number *sp; @@ -142,9 +142,6 @@ print_actions (state const *s, FILE *fgraph) transitions const *trans = s->transitions; int i; - /* Display reductions. */ - output_red (s, s->reductions, fgraph); - if (!trans->num && !s->reductions) return; @@ -167,6 +164,8 @@ print_actions (state const *s, FILE *fgraph) TRANSITION_IS_ERROR (trans, i) ? NULL : symbols[sym]->tag, style, fgraph); } + /* Display reductions. */ + output_red (s, s->reductions, fgraph); } diff --git a/tests/local.at b/tests/local.at index ca64693e..efba29dc 100644 --- a/tests/local.at +++ b/tests/local.at @@ -556,10 +556,10 @@ m4_define([AT_BISON_CHECK_XML], AT_CHECK([[$XSLTPROC \ `]]AT_QUELL_VALGRIND[[ bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml]], [[0]], [expout]) - [cp xml-tests/test.dot expout] + [sort xml-tests/test.dot > expout] AT_CHECK([[$XSLTPROC \ `]]AT_QUELL_VALGRIND[[ bison --print-datadir`/xslt/xml2dot.xsl \ - xml-tests/test.xml]], [[0]], [expout]) + xml-tests/test.xml | sort]], [[0]], [expout]) [rm -rf xml-tests expout] AT_RESTORE_SPECIAL_FILES [fi]]) diff --git a/tests/output.at b/tests/output.at index 37d2c3da..657903a5 100644 --- a/tests/output.at +++ b/tests/output.at @@ -264,27 +264,27 @@ a: ; b: 'b'; ]], [[ - 0 [label="State 0\n 0 $accept: . exp $end\l 1 exp: . a '?' b\l 2 a: .\l"] - 0 -> "0R2e" [style = solid] - "0R2e" [style = filled, shape = diamond, fillcolor = 3, label = "R2"] + 0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a '?' b\l 2 a: .\l"] 0 -> 1 [style=dashed label="exp"] 0 -> 2 [style=dashed label="a"] - 1 [label="State 1\n 0 $accept: exp . $end\l"] + 0 -> "0R2" [style=solid] + "0R2" [label="R2", fillcolor=3, shape=diamond, style=filled] + 1 [label="State 1\n\l 0 $accept: exp . $end\l"] 1 -> 3 [style=solid label="$end"] - 2 [label="State 2\n 1 exp: a . '?' b\l"] + 2 [label="State 2\n\l 1 exp: a . '?' b\l"] 2 -> 4 [style=solid label="'?'"] - 3 [label="State 3\n 0 $accept: exp $end .\l"] - 3 -> "3R0e" [style = solid] - "3R0e" [style = filled, shape = diamond, fillcolor = 1, label = "Acc"] - 4 [label="State 4\n 1 exp: a '?' . b\l 3 b: . 'b'\l"] + 3 [label="State 3\n\l 0 $accept: exp $end .\l"] + 3 -> "3R0" [style=solid] + "3R0" [label="Acc", fillcolor=1, shape=diamond, style=filled] + 4 [label="State 4\n\l 1 exp: a '?' . b\l 3 b: . 'b'\l"] 4 -> 5 [style=solid label="'b'"] 4 -> 6 [style=dashed label="b"] - 5 [label="State 5\n 3 b: 'b' .\l"] - 5 -> "5R3e" [style = solid] - "5R3e" [style = filled, shape = diamond, fillcolor = 3, label = "R3"] - 6 [label="State 6\n 1 exp: a '?' b .\l"] - 6 -> "6R1e" [style = solid] - "6R1e" [style = filled, shape = diamond, fillcolor = 3, label = "R1"] + 5 [label="State 5\n\l 3 b: 'b' .\l"] + 5 -> "5R3" [style=solid] + "5R3" [label="R3", fillcolor=3, shape=diamond, style=filled] + 6 [label="State 6\n\l 1 exp: a '?' b .\l"] + 6 -> "6R1" [style=solid] + "6R1" [label="R1", fillcolor=3, shape=diamond, style=filled] ]]) ## ------------------------ ## @@ -306,13 +306,7 @@ empty_b: %prec 'b'; empty_c: %prec 'c'; ]], [[ - 0 [label="State 0\n 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . ['a']\l 8 empty_b: . ['b']\l 9 empty_c: . ['c']\l"] - 0 -> "0R7d" [label = "['a']" style = solid] - "0R7d" [style = filled, shape = diamond, fillcolor = 5, label = "R7"] - 0 -> "0R8d" [label = "['b']" style = solid] - "0R8d" [style = filled, shape = diamond, fillcolor = 5, label = "R8"] - 0 -> "0R9d" [label = "['c']" style = solid] - "0R9d" [style = filled, shape = diamond, fillcolor = 5, label = "R9"] + 0 [label="State 0\n\l 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . ['a']\l 8 empty_b: . ['b']\l 9 empty_c: . ['c']\l"] 0 -> 1 [style=solid label="'a'"] 0 -> 2 [style=solid label="'b'"] 0 -> 3 [style=solid label="'c'"] @@ -320,35 +314,41 @@ empty_c: %prec 'c'; 0 -> 5 [style=dashed label="empty_a"] 0 -> 6 [style=dashed label="empty_b"] 0 -> 7 [style=dashed label="empty_c"] - 1 [label="State 1\n 1 start: 'a' .\l"] - 1 -> "1R1e" [style = solid] - "1R1e" [style = filled, shape = diamond, fillcolor = 3, label = "R1"] - 2 [label="State 2\n 3 start: 'b' .\l"] - 2 -> "2R3e" [style = solid] - "2R3e" [style = filled, shape = diamond, fillcolor = 3, label = "R3"] - 3 [label="State 3\n 5 start: 'c' .\l"] - 3 -> "3R5e" [style = solid] - "3R5e" [style = filled, shape = diamond, fillcolor = 3, label = "R5"] - 4 [label="State 4\n 0 $accept: start . $end\l"] + 0 -> "0R7d" [label="['a']", style=solid] + "0R7d" [label="R7", fillcolor=5, shape=diamond, style=filled] + 0 -> "0R8d" [label="['b']", style=solid] + "0R8d" [label="R8", fillcolor=5, shape=diamond, style=filled] + 0 -> "0R9d" [label="['c']", style=solid] + "0R9d" [label="R9", fillcolor=5, shape=diamond, style=filled] + 1 [label="State 1\n\l 1 start: 'a' .\l"] + 1 -> "1R1" [style=solid] + "1R1" [label="R1", fillcolor=3, shape=diamond, style=filled] + 2 [label="State 2\n\l 3 start: 'b' .\l"] + 2 -> "2R3" [style=solid] + "2R3" [label="R3", fillcolor=3, shape=diamond, style=filled] + 3 [label="State 3\n\l 5 start: 'c' .\l"] + 3 -> "3R5" [style=solid] + "3R5" [label="R5", fillcolor=3, shape=diamond, style=filled] + 4 [label="State 4\n\l 0 $accept: start . $end\l"] 4 -> 8 [style=solid label="$end"] - 5 [label="State 5\n 2 start: empty_a . 'a'\l"] + 5 [label="State 5\n\l 2 start: empty_a . 'a'\l"] 5 -> 9 [style=solid label="'a'"] - 6 [label="State 6\n 4 start: empty_b . 'b'\l"] + 6 [label="State 6\n\l 4 start: empty_b . 'b'\l"] 6 -> 10 [style=solid label="'b'"] - 7 [label="State 7\n 6 start: empty_c . 'c'\l"] + 7 [label="State 7\n\l 6 start: empty_c . 'c'\l"] 7 -> 11 [style=solid label="'c'"] - 8 [label="State 8\n 0 $accept: start $end .\l"] - 8 -> "8R0e" [style = solid] - "8R0e" [style = filled, shape = diamond, fillcolor = 1, label = "Acc"] - 9 [label="State 9\n 2 start: empty_a 'a' .\l"] - 9 -> "9R2e" [style = solid] - "9R2e" [style = filled, shape = diamond, fillcolor = 3, label = "R2"] - 10 [label="State 10\n 4 start: empty_b 'b' .\l"] - 10 -> "10R4e" [style = solid] - "10R4e" [style = filled, shape = diamond, fillcolor = 3, label = "R4"] - 11 [label="State 11\n 6 start: empty_c 'c' .\l"] - 11 -> "11R6e" [style = solid] - "11R6e" [style = filled, shape = diamond, fillcolor = 3, label = "R6"] + 8 [label="State 8\n\l 0 $accept: start $end .\l"] + 8 -> "8R0" [style=solid] + "8R0" [label="Acc", fillcolor=1, shape=diamond, style=filled] + 9 [label="State 9\n\l 2 start: empty_a 'a' .\l"] + 9 -> "9R2" [style=solid] + "9R2" [label="R2", fillcolor=3, shape=diamond, style=filled] + 10 [label="State 10\n\l 4 start: empty_b 'b' .\l"] + 10 -> "10R4" [style=solid] + "10R4" [label="R4", fillcolor=3, shape=diamond, style=filled] + 11 [label="State 11\n\l 6 start: empty_c 'c' .\l"] + 11 -> "11R6" [style=solid] + "11R6" [label="R6", fillcolor=3, shape=diamond, style=filled] ]]) ## ---------------------- ## @@ -373,41 +373,41 @@ empty_b: %prec 'b'; empty_c: %prec 'c'; ]], [[ - 0 [label="State 0\n 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . ['a']\l 8 empty_b: . []\l 9 empty_c: . []\l"] - 0 -> "0R7e" [style = solid] - "0R7e" [style = filled, shape = diamond, fillcolor = 3, label = "R7"] + 0 [label="State 0\n\l 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . ['a']\l 8 empty_b: . []\l 9 empty_c: . []\l"] 0 -> 1 [style=solid label="'b'"] 0 -> 2 [style=solid label="'c'"] 0 -> 3 [style=dashed label="start"] 0 -> 4 [style=dashed label="empty_a"] 0 -> 5 [style=dashed label="empty_b"] 0 -> 6 [style=dashed label="empty_c"] - 1 [label="State 1\n 3 start: 'b' .\l"] - 1 -> "1R3e" [style = solid] - "1R3e" [style = filled, shape = diamond, fillcolor = 3, label = "R3"] - 2 [label="State 2\n 5 start: 'c' .\l"] - 2 -> "2R5e" [style = solid] - "2R5e" [style = filled, shape = diamond, fillcolor = 3, label = "R5"] - 3 [label="State 3\n 0 $accept: start . $end\l"] + 0 -> "0R7" [style=solid] + "0R7" [label="R7", fillcolor=3, shape=diamond, style=filled] + 1 [label="State 1\n\l 3 start: 'b' .\l"] + 1 -> "1R3" [style=solid] + "1R3" [label="R3", fillcolor=3, shape=diamond, style=filled] + 2 [label="State 2\n\l 5 start: 'c' .\l"] + 2 -> "2R5" [style=solid] + "2R5" [label="R5", fillcolor=3, shape=diamond, style=filled] + 3 [label="State 3\n\l 0 $accept: start . $end\l"] 3 -> 7 [style=solid label="$end"] - 4 [label="State 4\n 2 start: empty_a . 'a'\l"] + 4 [label="State 4\n\l 2 start: empty_a . 'a'\l"] 4 -> 8 [style=solid label="'a'"] - 5 [label="State 5\n 4 start: empty_b . 'b'\l"] + 5 [label="State 5\n\l 4 start: empty_b . 'b'\l"] 5 -> 9 [style=solid label="'b'"] - 6 [label="State 6\n 6 start: empty_c . 'c'\l"] + 6 [label="State 6\n\l 6 start: empty_c . 'c'\l"] 6 -> 10 [style=solid label="'c'"] - 7 [label="State 7\n 0 $accept: start $end .\l"] - 7 -> "7R0e" [style = solid] - "7R0e" [style = filled, shape = diamond, fillcolor = 1, label = "Acc"] - 8 [label="State 8\n 2 start: empty_a 'a' .\l"] - 8 -> "8R2e" [style = solid] - "8R2e" [style = filled, shape = diamond, fillcolor = 3, label = "R2"] - 9 [label="State 9\n 4 start: empty_b 'b' .\l"] - 9 -> "9R4e" [style = solid] - "9R4e" [style = filled, shape = diamond, fillcolor = 3, label = "R4"] - 10 [label="State 10\n 6 start: empty_c 'c' .\l"] - 10 -> "10R6e" [style = solid] - "10R6e" [style = filled, shape = diamond, fillcolor = 3, label = "R6"] + 7 [label="State 7\n\l 0 $accept: start $end .\l"] + 7 -> "7R0" [style=solid] + "7R0" [label="Acc", fillcolor=1, shape=diamond, style=filled] + 8 [label="State 8\n\l 2 start: empty_a 'a' .\l"] + 8 -> "8R2" [style=solid] + "8R2" [label="R2", fillcolor=3, shape=diamond, style=filled] + 9 [label="State 9\n\l 4 start: empty_b 'b' .\l"] + 9 -> "9R4" [style=solid] + "9R4" [label="R4", fillcolor=3, shape=diamond, style=filled] + 10 [label="State 10\n\l 6 start: empty_c 'c' .\l"] + 10 -> "10R6" [style=solid] + "10R6" [label="R6", fillcolor=3, shape=diamond, style=filled] ]]) ## ---------------- ## @@ -421,25 +421,25 @@ a: ; b: ; ]], [[ - 0 [label="State 0\n 0 $accept: . exp $end\l 1 exp: . a\l 2 | . b\l 3 a: . [$end]\l 4 b: . [$end]\l"] - 0 -> "0R3e" [style = solid] - "0R3e" [style = filled, shape = diamond, fillcolor = 3, label = "R3"] - 0 -> "0R4d" [label = "[$end]" style = solid] - "0R4d" [style = filled, shape = diamond, fillcolor = 5, label = "R4"] + 0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a\l 2 | . b\l 3 a: . [$end]\l 4 b: . [$end]\l"] 0 -> 1 [style=dashed label="exp"] 0 -> 2 [style=dashed label="a"] 0 -> 3 [style=dashed label="b"] - 1 [label="State 1\n 0 $accept: exp . $end\l"] + 0 -> "0R3" [style=solid] + "0R3" [label="R3", fillcolor=3, shape=diamond, style=filled] + 0 -> "0R4d" [label="[$end]", style=solid] + "0R4d" [label="R4", fillcolor=5, shape=diamond, style=filled] + 1 [label="State 1\n\l 0 $accept: exp . $end\l"] 1 -> 4 [style=solid label="$end"] - 2 [label="State 2\n 1 exp: a .\l"] - 2 -> "2R1e" [style = solid] - "2R1e" [style = filled, shape = diamond, fillcolor = 3, label = "R1"] - 3 [label="State 3\n 2 exp: b .\l"] - 3 -> "3R2e" [style = solid] - "3R2e" [style = filled, shape = diamond, fillcolor = 3, label = "R2"] - 4 [label="State 4\n 0 $accept: exp $end .\l"] - 4 -> "4R0e" [style = solid] - "4R0e" [style = filled, shape = diamond, fillcolor = 1, label = "Acc"] + 2 [label="State 2\n\l 1 exp: a .\l"] + 2 -> "2R1" [style=solid] + "2R1" [label="R1", fillcolor=3, shape=diamond, style=filled] + 3 [label="State 3\n\l 2 exp: b .\l"] + 3 -> "3R2" [style=solid] + "3R2" [label="R2", fillcolor=3, shape=diamond, style=filled] + 4 [label="State 4\n\l 0 $accept: exp $end .\l"] + 4 -> "4R0" [style=solid] + "4R0" [label="Acc", fillcolor=1, shape=diamond, style=filled] ]]) ## ---------------------------------------- ## @@ -454,51 +454,51 @@ b: ; c: ; ]], [[ - 0 [label="State 0\n 0 $accept: . exp $end\l 1 exp: . a ';'\l 2 | . a ';'\l 3 | . a '.'\l 4 | . b '?'\l 5 | . b '!'\l 6 | . c '?'\l 7 | . c ';'\l 8 a: . [';', '.']\l 9 b: . ['?', '!']\l 10 c: . [';', '?']\l"] - 0 -> "0R8e" [style = solid] - "0R8e" [style = filled, shape = diamond, fillcolor = 3, label = "R8"] - 0 -> "0R9e" [label = "['?', '!']" style = solid] - "0R9e" [style = filled, shape = diamond, fillcolor = 3, label = "R9"] - 0 -> "0R10d" [label = "[';', '?']" style = solid] - "0R10d" [style = filled, shape = diamond, fillcolor = 5, label = "R10"] + 0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a ';'\l 2 | . a ';'\l 3 | . a '.'\l 4 | . b '?'\l 5 | . b '!'\l 6 | . c '?'\l 7 | . c ';'\l 8 a: . [';', '.']\l 9 b: . ['?', '!']\l 10 c: . [';', '?']\l"] 0 -> 1 [style=dashed label="exp"] 0 -> 2 [style=dashed label="a"] 0 -> 3 [style=dashed label="b"] 0 -> 4 [style=dashed label="c"] - 1 [label="State 1\n 0 $accept: exp . $end\l"] + 0 -> "0R8" [style=solid] + "0R8" [label="R8", fillcolor=3, shape=diamond, style=filled] + 0 -> "0R9" [label="['?', '!']", style=solid] + "0R9" [label="R9", fillcolor=3, shape=diamond, style=filled] + 0 -> "0R10d" [label="[';', '?']", style=solid] + "0R10d" [label="R10", fillcolor=5, shape=diamond, style=filled] + 1 [label="State 1\n\l 0 $accept: exp . $end\l"] 1 -> 5 [style=solid label="$end"] - 2 [label="State 2\n 1 exp: a . ';'\l 2 | a . ';'\l 3 | a . '.'\l"] + 2 [label="State 2\n\l 1 exp: a . ';'\l 2 | a . ';'\l 3 | a . '.'\l"] 2 -> 6 [style=solid label="';'"] 2 -> 7 [style=solid label="'.'"] - 3 [label="State 3\n 4 exp: b . '?'\l 5 | b . '!'\l"] + 3 [label="State 3\n\l 4 exp: b . '?'\l 5 | b . '!'\l"] 3 -> 8 [style=solid label="'?'"] 3 -> 9 [style=solid label="'!'"] - 4 [label="State 4\n 6 exp: c . '?'\l 7 | c . ';'\l"] + 4 [label="State 4\n\l 6 exp: c . '?'\l 7 | c . ';'\l"] 4 -> 10 [style=solid label="';'"] 4 -> 11 [style=solid label="'?'"] - 5 [label="State 5\n 0 $accept: exp $end .\l"] - 5 -> "5R0e" [style = solid] - "5R0e" [style = filled, shape = diamond, fillcolor = 1, label = "Acc"] - 6 [label="State 6\n 1 exp: a ';' . [$end]\l 2 | a ';' . [$end]\l"] - 6 -> "6R1e" [style = solid] - "6R1e" [style = filled, shape = diamond, fillcolor = 3, label = "R1"] - 6 -> "6R2d" [label = "[$end]" style = solid] - "6R2d" [style = filled, shape = diamond, fillcolor = 5, label = "R2"] - 7 [label="State 7\n 3 exp: a '.' .\l"] - 7 -> "7R3e" [style = solid] - "7R3e" [style = filled, shape = diamond, fillcolor = 3, label = "R3"] - 8 [label="State 8\n 4 exp: b '?' .\l"] - 8 -> "8R4e" [style = solid] - "8R4e" [style = filled, shape = diamond, fillcolor = 3, label = "R4"] - 9 [label="State 9\n 5 exp: b '!' .\l"] - 9 -> "9R5e" [style = solid] - "9R5e" [style = filled, shape = diamond, fillcolor = 3, label = "R5"] - 10 [label="State 10\n 7 exp: c ';' .\l"] - 10 -> "10R7e" [style = solid] - "10R7e" [style = filled, shape = diamond, fillcolor = 3, label = "R7"] - 11 [label="State 11\n 6 exp: c '?' .\l"] - 11 -> "11R6e" [style = solid] - "11R6e" [style = filled, shape = diamond, fillcolor = 3, label = "R6"] + 5 [label="State 5\n\l 0 $accept: exp $end .\l"] + 5 -> "5R0" [style=solid] + "5R0" [label="Acc", fillcolor=1, shape=diamond, style=filled] + 6 [label="State 6\n\l 1 exp: a ';' . [$end]\l 2 | a ';' . [$end]\l"] + 6 -> "6R1" [style=solid] + "6R1" [label="R1", fillcolor=3, shape=diamond, style=filled] + 6 -> "6R2d" [label="[$end]", style=solid] + "6R2d" [label="R2", fillcolor=5, shape=diamond, style=filled] + 7 [label="State 7\n\l 3 exp: a '.' .\l"] + 7 -> "7R3" [style=solid] + "7R3" [label="R3", fillcolor=3, shape=diamond, style=filled] + 8 [label="State 8\n\l 4 exp: b '?' .\l"] + 8 -> "8R4" [style=solid] + "8R4" [label="R4", fillcolor=3, shape=diamond, style=filled] + 9 [label="State 9\n\l 5 exp: b '!' .\l"] + 9 -> "9R5" [style=solid] + "9R5" [label="R5", fillcolor=3, shape=diamond, style=filled] + 10 [label="State 10\n\l 7 exp: c ';' .\l"] + 10 -> "10R7" [style=solid] + "10R7" [label="R7", fillcolor=3, shape=diamond, style=filled] + 11 [label="State 11\n\l 6 exp: c '?' .\l"] + 11 -> "11R6" [style=solid] + "11R6" [label="R6", fillcolor=3, shape=diamond, style=filled] ]]) ## ------------------------------------------------------ ## @@ -514,85 +514,85 @@ opexp: exp '+' exp; imm: '0'; ]], [[ - 0 [label="State 0\n 0 $accept: . exp $end\l 1 exp: . ifexp\l 2 | . opexp\l 3 | . imm\l 4 ifexp: . \"if\" exp \"then\" exp elseexp\l 7 opexp: . exp '+' exp\l 8 imm: . '0'\l"] + 0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . ifexp\l 2 | . opexp\l 3 | . imm\l 4 ifexp: . \"if\" exp \"then\" exp elseexp\l 7 opexp: . exp '+' exp\l 8 imm: . '0'\l"] 0 -> 1 [style=solid label="\"if\""] 0 -> 2 [style=solid label="'0'"] 0 -> 3 [style=dashed label="exp"] 0 -> 4 [style=dashed label="ifexp"] 0 -> 5 [style=dashed label="opexp"] 0 -> 6 [style=dashed label="imm"] - 1 [label="State 1\n 1 exp: . ifexp\l 2 | . opexp\l 3 | . imm\l 4 ifexp: . \"if\" exp \"then\" exp elseexp\l 4 | \"if\" . exp \"then\" exp elseexp\l 7 opexp: . exp '+' exp\l 8 imm: . '0'\l"] + 1 [label="State 1\n\l 1 exp: . ifexp\l 2 | . opexp\l 3 | . imm\l 4 ifexp: . \"if\" exp \"then\" exp elseexp\l 4 | \"if\" . exp \"then\" exp elseexp\l 7 opexp: . exp '+' exp\l 8 imm: . '0'\l"] 1 -> 1 [style=solid label="\"if\""] 1 -> 2 [style=solid label="'0'"] 1 -> 7 [style=dashed label="exp"] 1 -> 4 [style=dashed label="ifexp"] 1 -> 5 [style=dashed label="opexp"] 1 -> 6 [style=dashed label="imm"] - 2 [label="State 2\n 8 imm: '0' .\l"] - 2 -> "2R8e" [style = solid] - "2R8e" [style = filled, shape = diamond, fillcolor = 3, label = "R8"] - 3 [label="State 3\n 0 $accept: exp . $end\l 7 opexp: exp . '+' exp\l"] + 2 [label="State 2\n\l 8 imm: '0' .\l"] + 2 -> "2R8" [style=solid] + "2R8" [label="R8", fillcolor=3, shape=diamond, style=filled] + 3 [label="State 3\n\l 0 $accept: exp . $end\l 7 opexp: exp . '+' exp\l"] 3 -> 8 [style=solid label="$end"] 3 -> 9 [style=solid label="'+'"] - 4 [label="State 4\n 1 exp: ifexp .\l"] - 4 -> "4R1e" [style = solid] - "4R1e" [style = filled, shape = diamond, fillcolor = 3, label = "R1"] - 5 [label="State 5\n 2 exp: opexp .\l"] - 5 -> "5R2e" [style = solid] - "5R2e" [style = filled, shape = diamond, fillcolor = 3, label = "R2"] - 6 [label="State 6\n 3 exp: imm .\l"] - 6 -> "6R3e" [style = solid] - "6R3e" [style = filled, shape = diamond, fillcolor = 3, label = "R3"] - 7 [label="State 7\n 4 ifexp: \"if\" exp . \"then\" exp elseexp\l 7 opexp: exp . '+' exp\l"] + 4 [label="State 4\n\l 1 exp: ifexp .\l"] + 4 -> "4R1" [style=solid] + "4R1" [label="R1", fillcolor=3, shape=diamond, style=filled] + 5 [label="State 5\n\l 2 exp: opexp .\l"] + 5 -> "5R2" [style=solid] + "5R2" [label="R2", fillcolor=3, shape=diamond, style=filled] + 6 [label="State 6\n\l 3 exp: imm .\l"] + 6 -> "6R3" [style=solid] + "6R3" [label="R3", fillcolor=3, shape=diamond, style=filled] + 7 [label="State 7\n\l 4 ifexp: \"if\" exp . \"then\" exp elseexp\l 7 opexp: exp . '+' exp\l"] 7 -> 10 [style=solid label="\"then\""] 7 -> 9 [style=solid label="'+'"] - 8 [label="State 8\n 0 $accept: exp $end .\l"] - 8 -> "8R0e" [style = solid] - "8R0e" [style = filled, shape = diamond, fillcolor = 1, label = "Acc"] - 9 [label="State 9\n 1 exp: . ifexp\l 2 | . opexp\l 3 | . imm\l 4 ifexp: . \"if\" exp \"then\" exp elseexp\l 7 opexp: . exp '+' exp\l 7 | exp '+' . exp\l 8 imm: . '0'\l"] + 8 [label="State 8\n\l 0 $accept: exp $end .\l"] + 8 -> "8R0" [style=solid] + "8R0" [label="Acc", fillcolor=1, shape=diamond, style=filled] + 9 [label="State 9\n\l 1 exp: . ifexp\l 2 | . opexp\l 3 | . imm\l 4 ifexp: . \"if\" exp \"then\" exp elseexp\l 7 opexp: . exp '+' exp\l 7 | exp '+' . exp\l 8 imm: . '0'\l"] 9 -> 1 [style=solid label="\"if\""] 9 -> 2 [style=solid label="'0'"] 9 -> 11 [style=dashed label="exp"] 9 -> 4 [style=dashed label="ifexp"] 9 -> 5 [style=dashed label="opexp"] 9 -> 6 [style=dashed label="imm"] - 10 [label="State 10\n 1 exp: . ifexp\l 2 | . opexp\l 3 | . imm\l 4 ifexp: . \"if\" exp \"then\" exp elseexp\l 4 | \"if\" exp \"then\" . exp elseexp\l 7 opexp: . exp '+' exp\l 8 imm: . '0'\l"] + 10 [label="State 10\n\l 1 exp: . ifexp\l 2 | . opexp\l 3 | . imm\l 4 ifexp: . \"if\" exp \"then\" exp elseexp\l 4 | \"if\" exp \"then\" . exp elseexp\l 7 opexp: . exp '+' exp\l 8 imm: . '0'\l"] 10 -> 1 [style=solid label="\"if\""] 10 -> 2 [style=solid label="'0'"] 10 -> 12 [style=dashed label="exp"] 10 -> 4 [style=dashed label="ifexp"] 10 -> 5 [style=dashed label="opexp"] 10 -> 6 [style=dashed label="imm"] - 11 [label="State 11\n 7 opexp: exp . '+' exp\l 7 | exp '+' exp . [$end, \"then\", \"else\", '+']\l"] - 11 -> "11R7e" [style = solid] - "11R7e" [style = filled, shape = diamond, fillcolor = 3, label = "R7"] - 11 -> "11R7d" [label = "['+']" style = solid] - "11R7d" [style = filled, shape = diamond, fillcolor = 5, label = "R7"] + 11 [label="State 11\n\l 7 opexp: exp . '+' exp\l 7 | exp '+' exp . [$end, \"then\", \"else\", '+']\l"] 11 -> 9 [style=solid label="'+'"] - 12 [label="State 12\n 4 ifexp: \"if\" exp \"then\" exp . elseexp\l 5 elseexp: . \"else\" exp\l 6 | . [$end, \"then\", \"else\", '+']\l 7 opexp: exp . '+' exp\l"] - 12 -> "12R6e" [style = solid] - "12R6e" [style = filled, shape = diamond, fillcolor = 3, label = "R6"] - 12 -> "12R6d" [label = "[\"else\", '+']" style = solid] - "12R6d" [style = filled, shape = diamond, fillcolor = 5, label = "R6"] + 11 -> "11R7d" [label="['+']", style=solid] + "11R7d" [label="R7", fillcolor=5, shape=diamond, style=filled] + 11 -> "11R7" [style=solid] + "11R7" [label="R7", fillcolor=3, shape=diamond, style=filled] + 12 [label="State 12\n\l 4 ifexp: \"if\" exp \"then\" exp . elseexp\l 5 elseexp: . \"else\" exp\l 6 | . [$end, \"then\", \"else\", '+']\l 7 opexp: exp . '+' exp\l"] 12 -> 13 [style=solid label="\"else\""] 12 -> 9 [style=solid label="'+'"] 12 -> 14 [style=dashed label="elseexp"] - 13 [label="State 13\n 1 exp: . ifexp\l 2 | . opexp\l 3 | . imm\l 4 ifexp: . \"if\" exp \"then\" exp elseexp\l 5 elseexp: \"else\" . exp\l 7 opexp: . exp '+' exp\l 8 imm: . '0'\l"] + 12 -> "12R6d" [label="[\"else\", '+']", style=solid] + "12R6d" [label="R6", fillcolor=5, shape=diamond, style=filled] + 12 -> "12R6" [style=solid] + "12R6" [label="R6", fillcolor=3, shape=diamond, style=filled] + 13 [label="State 13\n\l 1 exp: . ifexp\l 2 | . opexp\l 3 | . imm\l 4 ifexp: . \"if\" exp \"then\" exp elseexp\l 5 elseexp: \"else\" . exp\l 7 opexp: . exp '+' exp\l 8 imm: . '0'\l"] 13 -> 1 [style=solid label="\"if\""] 13 -> 2 [style=solid label="'0'"] 13 -> 15 [style=dashed label="exp"] 13 -> 4 [style=dashed label="ifexp"] 13 -> 5 [style=dashed label="opexp"] 13 -> 6 [style=dashed label="imm"] - 14 [label="State 14\n 4 ifexp: \"if\" exp \"then\" exp elseexp .\l"] - 14 -> "14R4e" [style = solid] - "14R4e" [style = filled, shape = diamond, fillcolor = 3, label = "R4"] - 15 [label="State 15\n 5 elseexp: \"else\" exp . [$end, \"then\", \"else\", '+']\l 7 opexp: exp . '+' exp\l"] - 15 -> "15R5e" [style = solid] - "15R5e" [style = filled, shape = diamond, fillcolor = 3, label = "R5"] - 15 -> "15R5d" [label = "['+']" style = solid] - "15R5d" [style = filled, shape = diamond, fillcolor = 5, label = "R5"] + 14 [label="State 14\n\l 4 ifexp: \"if\" exp \"then\" exp elseexp .\l"] + 14 -> "14R4" [style=solid] + "14R4" [label="R4", fillcolor=3, shape=diamond, style=filled] + 15 [label="State 15\n\l 5 elseexp: \"else\" exp . [$end, \"then\", \"else\", '+']\l 7 opexp: exp . '+' exp\l"] 15 -> 9 [style=solid label="'+'"] + 15 -> "15R5d" [label="['+']", style=solid] + "15R5d" [label="R5", fillcolor=5, shape=diamond, style=filled] + 15 -> "15R5" [style=solid] + "15R5" [label="R5", fillcolor=3, shape=diamond, style=filled] ]]) m4_popdef([AT_TEST]) From 05c93b7d844e59ecaa5dec3bd6d9091f5aa5d1b0 Mon Sep 17 00:00:00 2001 From: Theophile Ranquet Date: Mon, 12 Nov 2012 15:41:52 +0000 Subject: [PATCH 6/6] tests: close files in glr-regression * tests/glr-regression.at: Here. --- tests/glr-regression.at | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/glr-regression.at b/tests/glr-regression.at index 7df17b62..6ca021f9 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -196,8 +196,12 @@ int main (int argc, char **argv) { input = stdin; - if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; - return yyparse (); + if (argc == 2 && !(input = fopen (argv[1], "r"))) + return 3; + int res = yyparse (); + if (argc == 2 && fclose (input)) + return 4; + return res; } ]]) AT_BISON_OPTION_POPDEFS @@ -324,8 +328,12 @@ int main(int argc, char* argv[]) { input = stdin; - if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; - return yyparse (); + if (argc == 2 && !(input = fopen (argv[1], "r"))) + return 3; + int res = yyparse (); + if (argc == 2 && fclose (input)) + return 4; + return res; } ]]) AT_BISON_OPTION_POPDEFS