1 # Checking the output filenames. -*- Autotest -*-
3 # Copyright (C) 2000-2002, 2005-2013 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 AT_BANNER([[Output file names.]])
21 # AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES, [SHELLIO],
22 # [ADDITIONAL-TESTS], [PRE-TESTS])
23 # -----------------------------------------------------------------------------
24 m4_define([AT_CHECK_OUTPUT],
25 [AT_SETUP([[Output files: ]$2 $3 $5])[
27 for file in ]$1 $4[; do
29 */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;;
38 ]AT_BISON_CHECK([$3 $1 $5], 0)[
39 # Ignore the files non-generated files
40 ]AT_CHECK([[find . -type f |
43 push @file, $_ unless m{^($1|testsuite.log)$};
44 END { print join (" ", sort @file), "\n" }']],
51 AT_CHECK_OUTPUT([foo.y], [], [-dv],
52 [foo.output foo.tab.c foo.tab.h])
54 # Some versions of Valgrind (at least valgrind-3.6.0.SVN-Debian) report
55 # "fgrep: write error: Bad file descriptor" when stdout is closed, so we
56 # skip this test group during maintainer-check-valgrind.
57 AT_CHECK_OUTPUT([foo.y], [], [-dv],
58 [foo.output foo.tab.c foo.tab.h],
60 [AT_CHECK([[case "$PREBISON" in *valgrind*) exit 77;; esac]])])
62 AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.c],
63 [foo.c foo.h foo.output])
64 AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.tab.c],
65 [foo.output foo.tab.c foo.tab.h])
67 AT_CHECK_OUTPUT([foo.y], [], [-dv -g --xml -y],
68 [y.dot y.output y.tab.c y.tab.h y.xml])
69 # With '-o y.tab.c', we expect 'y.output' etc. (for compatility with Yacc).
70 AT_CHECK_OUTPUT([foo.y], [], [-dv -g --xml -o y.tab.c],
71 [y.dot y.output y.tab.c y.tab.h y.xml])
73 AT_CHECK_OUTPUT([foo.y], [], [-dv -b bar],
74 [bar.output bar.tab.c bar.tab.h])
75 AT_CHECK_OUTPUT([foo.y], [], [-dv -g -o foo.c],
76 [foo.c foo.dot foo.h foo.output])
79 AT_CHECK_OUTPUT([foo.y], [%defines %verbose], [],
80 [foo.output foo.tab.c foo.tab.h])
81 AT_CHECK_OUTPUT([foo.y], [%defines %verbose %yacc],[],
82 [y.output y.tab.c y.tab.h])
84 AT_CHECK_OUTPUT([foo.yy], [%defines %verbose %yacc],[],
85 [y.output y.tab.c y.tab.h])
87 # Exercise %output and %file-prefix including deprecated '='
88 AT_CHECK_OUTPUT([foo.y], [%file-prefix "bar" %defines %verbose], [],
89 [bar.output bar.tab.c bar.tab.h])
90 AT_CHECK_OUTPUT([foo.y], [%output "bar.c" %defines %verbose %yacc],[],
91 [bar.c bar.h bar.output])
92 AT_CHECK_OUTPUT([foo.y],
93 [%file-prefix "baz" %output "bar.c" %defines %verbose %yacc],
95 [bar.c bar.h bar.output])
98 # Check priorities of extension control.
99 AT_CHECK_OUTPUT([foo.yy], [%defines %verbose], [],
100 [foo.output foo.tab.cc foo.tab.hh])
102 AT_CHECK_OUTPUT([foo.yy], [%defines %verbose ], [-o foo.c],
103 [foo.c foo.h foo.output])
105 AT_CHECK_OUTPUT([foo.yy], [],
106 [--defines=foo.hpp -o foo.c++],
109 AT_CHECK_OUTPUT([foo.yy], [%defines "foo.hpp"],
113 AT_CHECK_OUTPUT([foo.yy], [],
114 [-o foo.c++ --graph=foo.gph],
122 m4_define([AT_CHECK_NO_SUBDIR_PART],
123 [# Also make sure that the includes do not refer to the subdirectory.
124 AT_CHECK([grep 'include .subdir/' $1.cc], 1, [])
125 AT_CHECK([grep 'include .subdir/' $1.hh], 1, [])
128 AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %verbose], [],
129 [foo.output foo.tab.cc])
131 AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %defines %verbose], [],
132 [foo.output foo.tab.cc foo.tab.hh stack.hh])
134 AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %verbose %locations], [],
135 [foo.output foo.tab.cc])
137 AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %defines %verbose %locations], [],
138 [foo.output foo.tab.cc foo.tab.hh location.hh position.hh stack.hh])
140 AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose], [],
141 [foo.output foo.tab.cc foo.tab.hh stack.hh],
142 [], [AT_CHECK_NO_SUBDIR_PART([foo.tab])])
144 AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose %locations],
146 [subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/position.hh subdir/stack.hh],
147 [], [AT_CHECK_NO_SUBDIR_PART([subdir/foo])])
149 AT_CHECK_OUTPUT([gram_dir/foo.yy],
150 [%skeleton "lalr1.cc" %defines %verbose %file-prefix "output_dir/foo"],
152 [output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/stack.hh])
154 AT_CHECK_OUTPUT([gram_dir/foo.yy],
155 [%skeleton "lalr1.cc" %defines %locations %verbose %file-prefix "output_dir/foo"],
157 [output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/location.hh output_dir/position.hh output_dir/stack.hh])
160 # AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR,
162 # ------------------------------------------------------------------
163 m4_define([AT_CHECK_CONFLICTING_OUTPUT],
164 [AT_SETUP([Conflicting output files: $2 $3])
166 */*) mkdir `echo "$1" | sed 's,/.*,,'`;;
175 # Because an output file name conflict is still a warning, Bison exits
176 # with status 0, so AT_BISON_CHECK does not realize that there may be no
177 # output file against which to check the XML. AT_BISON_CHECK_NO_XML
178 # avoids that problem.
179 AT_BISON_CHECK_NO_XML([$3 $1], $5, [], [$4])
180 AT_CHECK([[cat $1]], [[0]], [expout])
184 AT_CHECK_CONFLICTING_OUTPUT([foo.y],
185 [], [--graph="foo.tab.c"],
186 [[foo.y: warning: conflicting outputs to file 'foo.tab.c' [-Wother]
189 AT_CHECK_CONFLICTING_OUTPUT([foo.y],
190 [%defines "foo.output"], [-v],
191 [[foo.y: warning: conflicting outputs to file 'foo.output' [-Wother]
194 AT_CHECK_CONFLICTING_OUTPUT([foo.y],
195 [%skeleton "lalr1.cc" %defines %locations], [--graph="location.hh"],
196 [[foo.y: warning: conflicting outputs to file 'location.hh' [-Wother]
199 AT_CHECK_CONFLICTING_OUTPUT([foo.y], [], [-o foo.y],
200 [[foo.y: error: refusing to overwrite the input file 'foo.y'
204 # AT_CHECK_OUTPUT_FILE_NAME(FILE-NAME-PREFIX, [ADDITIONAL-TESTS])
205 # ---------------------------------------------------------------
206 m4_define([AT_CHECK_OUTPUT_FILE_NAME],
207 [AT_SETUP([Output file name: $1])
209 AT_BISON_OPTION_PUSHDEFS
210 # Skip if platform doesn't support file name. For example, Cygwin
211 # doesn't support file names containing ":" or "\".
212 AT_CHECK([[touch "]AS_ESCAPE([$1[.tmp]])[" || exit 77]])
214 AT_DATA_GRAMMAR([glr.y],
217 ]AT_YYERROR_DECLARE_EXTERN[
218 ]AT_YYLEX_DECLARE_EXTERN[
223 AT_BISON_CHECK([-o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" glr.y])
224 AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore])
225 AT_COMPILE([glr.o], [-c "AS_ESCAPE([$1.c])"])
228 AT_DATA_GRAMMAR([cxx.y],
229 [[%skeleton "lalr1.cc"
230 %code { int yylex (yy::parser::semantic_type*); }
234 AT_BISON_CHECK([-o "AS_ESCAPE([$1.cc])" --defines="AS_ESCAPE([$1.hh])" cxx.y])
235 AT_CHECK([ls "AS_ESCAPE([$1.cc])" "AS_ESCAPE([$1.hh])"], [], [ignore])
236 AT_COMPILE_CXX([cxx.o], [-c "AS_ESCAPE([$1.cc])"])
239 AT_BISON_OPTION_POPDEFS
243 # Notice that the header file name here cannot contain
244 # '"' since FILENAME in '#include "FILENAME"' cannot.
245 AT_CHECK_OUTPUT_FILE_NAME([[`~!@#$%^&*()-=_+{}[]|\:;<>, .']])
246 dnl Work around a bug in m4_expand that broke AT_SETUP in autoconf 2.62,
247 dnl by using the definition from 2.63.
248 m4_version_prereq([2.63], [],
249 [m4_define([m4_expand], [_$0(-=<{($1)}>=-)])
250 m4_define([_m4_expand],
251 [m4_changequote([-=<{(], [)}>=-])$1m4_changequote([, ])])])
252 AT_CHECK_OUTPUT_FILE_NAME([[(]])
253 AT_CHECK_OUTPUT_FILE_NAME([[)]])
254 AT_CHECK_OUTPUT_FILE_NAME([[@%:@]])
255 AT_CHECK_OUTPUT_FILE_NAME([[@@]])
256 AT_CHECK_OUTPUT_FILE_NAME([[@{]])
257 AT_CHECK_OUTPUT_FILE_NAME([[@}]])
258 AT_CHECK_OUTPUT_FILE_NAME([[@<:@]])
259 AT_CHECK_OUTPUT_FILE_NAME([[@:>@]])
262 # AT_TEST(SETUP-NAME, GRAMMAR, DOT-BODY)
263 # --------------------------------------
264 # Check that the DOT graph for GRAMMAR is DOT-BODY.
265 m4_pushdef([AT_TEST],
267 AT_KEYWORDS([[graph]])
268 AT_DATA([[input.y]], [$2])
269 AT_BISON_CHECK([[-rall --graph input.y]], [0], [[]], [[ignore]])
270 AT_CHECK([[grep -v // input.dot]], [0],
274 node [fontname = courier, shape = box, colorscheme = paired6]
275 edge [fontname = courier]
282 ## ------------------------ ##
283 ## Graph with no conflicts. ##
284 ## ------------------------ ##
286 AT_TEST([Graph with no conflicts],
293 0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a '?' b\l 2 a: .\l"]
294 0 -> 1 [style=dashed label="exp"]
295 0 -> 2 [style=dashed label="a"]
296 0 -> "0R2" [style=solid]
297 "0R2" [label="R2", fillcolor=3, shape=diamond, style=filled]
298 1 [label="State 1\n\l 0 $accept: exp . $end\l"]
299 1 -> 3 [style=solid label="$end"]
300 2 [label="State 2\n\l 1 exp: a . '?' b\l"]
301 2 -> 4 [style=solid label="'?'"]
302 3 [label="State 3\n\l 0 $accept: exp $end .\l"]
303 3 -> "3R0" [style=solid]
304 "3R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
305 4 [label="State 4\n\l 1 exp: a '?' . b\l 3 b: . 'b'\l"]
306 4 -> 5 [style=solid label="'b'"]
307 4 -> 6 [style=dashed label="b"]
308 5 [label="State 5\n\l 3 b: 'b' .\l"]
309 5 -> "5R3" [style=solid]
310 "5R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
311 6 [label="State 6\n\l 1 exp: a '?' b .\l"]
312 6 -> "6R1" [style=solid]
313 "6R1" [label="R1", fillcolor=3, shape=diamond, style=filled]
316 ## ------------------------ ##
317 ## Graph with unsolved S/R. ##
318 ## ------------------------ ##
320 AT_TEST([Graph with unsolved S/R],
335 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"]
336 0 -> 1 [style=solid label="'a'"]
337 0 -> 2 [style=solid label="'b'"]
338 0 -> 3 [style=solid label="'c'"]
339 0 -> 4 [style=dashed label="start"]
340 0 -> 5 [style=dashed label="empty_a"]
341 0 -> 6 [style=dashed label="empty_b"]
342 0 -> 7 [style=dashed label="empty_c"]
343 0 -> "0R7d" [label="['a']", style=solid]
344 "0R7d" [label="R7", fillcolor=5, shape=diamond, style=filled]
345 0 -> "0R8d" [label="['b']", style=solid]
346 "0R8d" [label="R8", fillcolor=5, shape=diamond, style=filled]
347 0 -> "0R9d" [label="['c']", style=solid]
348 "0R9d" [label="R9", fillcolor=5, shape=diamond, style=filled]
349 1 [label="State 1\n\l 1 start: 'a' .\l"]
350 1 -> "1R1" [style=solid]
351 "1R1" [label="R1", fillcolor=3, shape=diamond, style=filled]
352 2 [label="State 2\n\l 3 start: 'b' .\l"]
353 2 -> "2R3" [style=solid]
354 "2R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
355 3 [label="State 3\n\l 5 start: 'c' .\l"]
356 3 -> "3R5" [style=solid]
357 "3R5" [label="R5", fillcolor=3, shape=diamond, style=filled]
358 4 [label="State 4\n\l 0 $accept: start . $end\l"]
359 4 -> 8 [style=solid label="$end"]
360 5 [label="State 5\n\l 2 start: empty_a . 'a'\l"]
361 5 -> 9 [style=solid label="'a'"]
362 6 [label="State 6\n\l 4 start: empty_b . 'b'\l"]
363 6 -> 10 [style=solid label="'b'"]
364 7 [label="State 7\n\l 6 start: empty_c . 'c'\l"]
365 7 -> 11 [style=solid label="'c'"]
366 8 [label="State 8\n\l 0 $accept: start $end .\l"]
367 8 -> "8R0" [style=solid]
368 "8R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
369 9 [label="State 9\n\l 2 start: empty_a 'a' .\l"]
370 9 -> "9R2" [style=solid]
371 "9R2" [label="R2", fillcolor=3, shape=diamond, style=filled]
372 10 [label="State 10\n\l 4 start: empty_b 'b' .\l"]
373 10 -> "10R4" [style=solid]
374 "10R4" [label="R4", fillcolor=3, shape=diamond, style=filled]
375 11 [label="State 11\n\l 6 start: empty_c 'c' .\l"]
376 11 -> "11R6" [style=solid]
377 "11R6" [label="R6", fillcolor=3, shape=diamond, style=filled]
380 ## ---------------------- ##
381 ## Graph with solved S/R. ##
382 ## ---------------------- ##
384 AT_TEST([Graph with solved S/R],
402 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"]
403 0 -> 1 [style=solid label="'b'"]
404 0 -> 2 [style=solid label="'c'"]
405 0 -> 3 [style=dashed label="start"]
406 0 -> 4 [style=dashed label="empty_a"]
407 0 -> 5 [style=dashed label="empty_b"]
408 0 -> 6 [style=dashed label="empty_c"]
409 0 -> "0R7" [style=solid]
410 "0R7" [label="R7", fillcolor=3, shape=diamond, style=filled]
411 1 [label="State 1\n\l 3 start: 'b' .\l"]
412 1 -> "1R3" [style=solid]
413 "1R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
414 2 [label="State 2\n\l 5 start: 'c' .\l"]
415 2 -> "2R5" [style=solid]
416 "2R5" [label="R5", fillcolor=3, shape=diamond, style=filled]
417 3 [label="State 3\n\l 0 $accept: start . $end\l"]
418 3 -> 7 [style=solid label="$end"]
419 4 [label="State 4\n\l 2 start: empty_a . 'a'\l"]
420 4 -> 8 [style=solid label="'a'"]
421 5 [label="State 5\n\l 4 start: empty_b . 'b'\l"]
422 5 -> 9 [style=solid label="'b'"]
423 6 [label="State 6\n\l 6 start: empty_c . 'c'\l"]
424 6 -> 10 [style=solid label="'c'"]
425 7 [label="State 7\n\l 0 $accept: start $end .\l"]
426 7 -> "7R0" [style=solid]
427 "7R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
428 8 [label="State 8\n\l 2 start: empty_a 'a' .\l"]
429 8 -> "8R2" [style=solid]
430 "8R2" [label="R2", fillcolor=3, shape=diamond, style=filled]
431 9 [label="State 9\n\l 4 start: empty_b 'b' .\l"]
432 9 -> "9R4" [style=solid]
433 "9R4" [label="R4", fillcolor=3, shape=diamond, style=filled]
434 10 [label="State 10\n\l 6 start: empty_c 'c' .\l"]
435 10 -> "10R6" [style=solid]
436 "10R6" [label="R6", fillcolor=3, shape=diamond, style=filled]
439 ## ---------------- ##
440 ## Graph with R/R. ##
441 ## ---------------- ##
443 AT_TEST([Graph with R/R],
450 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"]
451 0 -> 1 [style=dashed label="exp"]
452 0 -> 2 [style=dashed label="a"]
453 0 -> 3 [style=dashed label="b"]
454 0 -> "0R3" [style=solid]
455 "0R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
456 0 -> "0R4d" [label="[$end]", style=solid]
457 "0R4d" [label="R4", fillcolor=5, shape=diamond, style=filled]
458 1 [label="State 1\n\l 0 $accept: exp . $end\l"]
459 1 -> 4 [style=solid label="$end"]
460 2 [label="State 2\n\l 1 exp: a .\l"]
461 2 -> "2R1" [style=solid]
462 "2R1" [label="R1", fillcolor=3, shape=diamond, style=filled]
463 3 [label="State 3\n\l 2 exp: b .\l"]
464 3 -> "3R2" [style=solid]
465 "3R2" [label="R2", fillcolor=3, shape=diamond, style=filled]
466 4 [label="State 4\n\l 0 $accept: exp $end .\l"]
467 4 -> "4R0" [style=solid]
468 "4R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
471 ## ---------------------------------------- ##
472 ## Graph with reductions with multiple LAT. ##
473 ## ---------------------------------------- ##
475 AT_TEST([Graph with reductions with multiple LAT],
477 exp: a ';' | a ';' | a '.' | b '?' | b '!' | c '?' | c ';';
483 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"]
484 0 -> 1 [style=dashed label="exp"]
485 0 -> 2 [style=dashed label="a"]
486 0 -> 3 [style=dashed label="b"]
487 0 -> 4 [style=dashed label="c"]
488 0 -> "0R8" [style=solid]
489 "0R8" [label="R8", fillcolor=3, shape=diamond, style=filled]
490 0 -> "0R9" [label="['?', '!']", style=solid]
491 "0R9" [label="R9", fillcolor=3, shape=diamond, style=filled]
492 0 -> "0R10d" [label="[';', '?']", style=solid]
493 "0R10d" [label="R10", fillcolor=5, shape=diamond, style=filled]
494 1 [label="State 1\n\l 0 $accept: exp . $end\l"]
495 1 -> 5 [style=solid label="$end"]
496 2 [label="State 2\n\l 1 exp: a . ';'\l 2 | a . ';'\l 3 | a . '.'\l"]
497 2 -> 6 [style=solid label="';'"]
498 2 -> 7 [style=solid label="'.'"]
499 3 [label="State 3\n\l 4 exp: b . '?'\l 5 | b . '!'\l"]
500 3 -> 8 [style=solid label="'?'"]
501 3 -> 9 [style=solid label="'!'"]
502 4 [label="State 4\n\l 6 exp: c . '?'\l 7 | c . ';'\l"]
503 4 -> 10 [style=solid label="';'"]
504 4 -> 11 [style=solid label="'?'"]
505 5 [label="State 5\n\l 0 $accept: exp $end .\l"]
506 5 -> "5R0" [style=solid]
507 "5R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
508 6 [label="State 6\n\l 1 exp: a ';' . [$end]\l 2 | a ';' . [$end]\l"]
509 6 -> "6R1" [style=solid]
510 "6R1" [label="R1", fillcolor=3, shape=diamond, style=filled]
511 6 -> "6R2d" [label="[$end]", style=solid]
512 "6R2d" [label="R2", fillcolor=5, shape=diamond, style=filled]
513 7 [label="State 7\n\l 3 exp: a '.' .\l"]
514 7 -> "7R3" [style=solid]
515 "7R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
516 8 [label="State 8\n\l 4 exp: b '?' .\l"]
517 8 -> "8R4" [style=solid]
518 "8R4" [label="R4", fillcolor=3, shape=diamond, style=filled]
519 9 [label="State 9\n\l 5 exp: b '!' .\l"]
520 9 -> "9R5" [style=solid]
521 "9R5" [label="R5", fillcolor=3, shape=diamond, style=filled]
522 10 [label="State 10\n\l 7 exp: c ';' .\l"]
523 10 -> "10R7" [style=solid]
524 "10R7" [label="R7", fillcolor=3, shape=diamond, style=filled]
525 11 [label="State 11\n\l 6 exp: c '?' .\l"]
526 11 -> "11R6" [style=solid]
527 "11R6" [label="R6", fillcolor=3, shape=diamond, style=filled]
530 ## ------------------------------------------------------ ##
531 ## Graph with a reduction rule both enabled and disabled. ##
532 ## ------------------------------------------------------ ##
534 AT_TEST([Graph with a reduction rule both enabled and disabled],
536 exp: ifexp | opexp | imm;
537 ifexp: "if" exp "then" exp elseexp;
538 elseexp: "else" exp | ;
543 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"]
544 0 -> 1 [style=solid label="\"if\""]
545 0 -> 2 [style=solid label="'0'"]
546 0 -> 3 [style=dashed label="exp"]
547 0 -> 4 [style=dashed label="ifexp"]
548 0 -> 5 [style=dashed label="opexp"]
549 0 -> 6 [style=dashed label="imm"]
550 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"]
551 1 -> 1 [style=solid label="\"if\""]
552 1 -> 2 [style=solid label="'0'"]
553 1 -> 7 [style=dashed label="exp"]
554 1 -> 4 [style=dashed label="ifexp"]
555 1 -> 5 [style=dashed label="opexp"]
556 1 -> 6 [style=dashed label="imm"]
557 2 [label="State 2\n\l 8 imm: '0' .\l"]
558 2 -> "2R8" [style=solid]
559 "2R8" [label="R8", fillcolor=3, shape=diamond, style=filled]
560 3 [label="State 3\n\l 0 $accept: exp . $end\l 7 opexp: exp . '+' exp\l"]
561 3 -> 8 [style=solid label="$end"]
562 3 -> 9 [style=solid label="'+'"]
563 4 [label="State 4\n\l 1 exp: ifexp .\l"]
564 4 -> "4R1" [style=solid]
565 "4R1" [label="R1", fillcolor=3, shape=diamond, style=filled]
566 5 [label="State 5\n\l 2 exp: opexp .\l"]
567 5 -> "5R2" [style=solid]
568 "5R2" [label="R2", fillcolor=3, shape=diamond, style=filled]
569 6 [label="State 6\n\l 3 exp: imm .\l"]
570 6 -> "6R3" [style=solid]
571 "6R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
572 7 [label="State 7\n\l 4 ifexp: \"if\" exp . \"then\" exp elseexp\l 7 opexp: exp . '+' exp\l"]
573 7 -> 10 [style=solid label="\"then\""]
574 7 -> 9 [style=solid label="'+'"]
575 8 [label="State 8\n\l 0 $accept: exp $end .\l"]
576 8 -> "8R0" [style=solid]
577 "8R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
578 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"]
579 9 -> 1 [style=solid label="\"if\""]
580 9 -> 2 [style=solid label="'0'"]
581 9 -> 11 [style=dashed label="exp"]
582 9 -> 4 [style=dashed label="ifexp"]
583 9 -> 5 [style=dashed label="opexp"]
584 9 -> 6 [style=dashed label="imm"]
585 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"]
586 10 -> 1 [style=solid label="\"if\""]
587 10 -> 2 [style=solid label="'0'"]
588 10 -> 12 [style=dashed label="exp"]
589 10 -> 4 [style=dashed label="ifexp"]
590 10 -> 5 [style=dashed label="opexp"]
591 10 -> 6 [style=dashed label="imm"]
592 11 [label="State 11\n\l 7 opexp: exp . '+' exp\l 7 | exp '+' exp . [$end, \"then\", \"else\", '+']\l"]
593 11 -> 9 [style=solid label="'+'"]
594 11 -> "11R7d" [label="['+']", style=solid]
595 "11R7d" [label="R7", fillcolor=5, shape=diamond, style=filled]
596 11 -> "11R7" [style=solid]
597 "11R7" [label="R7", fillcolor=3, shape=diamond, style=filled]
598 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"]
599 12 -> 13 [style=solid label="\"else\""]
600 12 -> 9 [style=solid label="'+'"]
601 12 -> 14 [style=dashed label="elseexp"]
602 12 -> "12R6d" [label="[\"else\", '+']", style=solid]
603 "12R6d" [label="R6", fillcolor=5, shape=diamond, style=filled]
604 12 -> "12R6" [style=solid]
605 "12R6" [label="R6", fillcolor=3, shape=diamond, style=filled]
606 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"]
607 13 -> 1 [style=solid label="\"if\""]
608 13 -> 2 [style=solid label="'0'"]
609 13 -> 15 [style=dashed label="exp"]
610 13 -> 4 [style=dashed label="ifexp"]
611 13 -> 5 [style=dashed label="opexp"]
612 13 -> 6 [style=dashed label="imm"]
613 14 [label="State 14\n\l 4 ifexp: \"if\" exp \"then\" exp elseexp .\l"]
614 14 -> "14R4" [style=solid]
615 "14R4" [label="R4", fillcolor=3, shape=diamond, style=filled]
616 15 [label="State 15\n\l 5 elseexp: \"else\" exp . [$end, \"then\", \"else\", '+']\l 7 opexp: exp . '+' exp\l"]
617 15 -> 9 [style=solid label="'+'"]
618 15 -> "15R5d" [label="['+']", style=solid]
619 "15R5d" [label="R5", fillcolor=5, shape=diamond, style=filled]
620 15 -> "15R5" [style=solid]
621 "15R5" [label="R5", fillcolor=3, shape=diamond, style=filled]