int
main (int argc, const char *argv[])
{
+ int status;
yydebug = !!getenv ("YYDEBUG");
assert (argc == 2);
yysource = argv[1];
- if (yyparse ())
+ status = yyparse ();
+ switch (status)
{
- printf ("Parsing FAILED.\n");
- exit (1);
+ case 0: printf ("Successful parse.\n"); break;
+ case 1: printf ("Parsing FAILED.\n"); break;
+ default: printf ("Parsing FAILED (status %d).\n", status); break;
}
- printf ("Successful parse.\n");
- return 0;
+ return status;
}
]])
sending: EOF (3@30-39)
input (0@29-29): /* Nothing */
input (2@0-29): line (0@0-29) input (0@29-29)
+Freeing nterm input (2@0-29)
Successful parse.
]])
sending: EOF (3@30-39)
input (0@29-29): /* Nothing */
input (2@0-29): line (-1@0-29) input (0@29-29)
+Freeing nterm input (2@0-29)
Successful parse.
]])
# Upon stack overflow, all symbols on the stack should be destroyed.
# Only check for yacc.c.
AT_YACC_IF([
-AT_PARSER_CHECK([./input '(x)(x)(x)(x)(x)(x)(x)'], 1,
+AT_PARSER_CHECK([./input '(x)(x)(x)(x)(x)(x)(x)'], 2,
[[sending: '(' (0@0-9)
sending: 'x' (1@10-19)
thing (1@10-19): 'x' (1@10-19)
sending: 'x' (19@190-199)
thing (19@190-199): 'x' (19@190-199)
sending: ')' (20@200-209)
-200-209: parser stack overflow
+200-209: memory exhausted
Freeing nterm thing (19@190-199)
Freeing nterm line (15@150-179)
Freeing nterm line (12@120-149)
Freeing nterm line (6@60-89)
Freeing nterm line (3@30-59)
Freeing nterm line (0@0-29)
-Parsing FAILED.
+Parsing FAILED (status 2).
]])
])