}
int
-main(int argc, char* argv[])
+main (int argc, char* argv[])
{
int res;
input = stdin;
%%
]AT_YYLEX_DEFINE(["a"])[
]AT_YYERROR_DEFINE[
-int
-main (void)
-{
- return yyparse () != 1;
-}
+]AT_MAIN_DEFINE[
]])
AT_BISON_OPTION_POPDEFS
]])
AT_COMPILE([glr-regr5])
-AT_PARSER_CHECK([[./glr-regr5]], 0, [],
+AT_PARSER_CHECK([[./glr-regr5]], 1, [],
[syntax is ambiguous
])
%%
]AT_YYERROR_DEFINE[
]AT_YYLEX_DEFINE(["a"])[
-int
-main (void)
-{
- return yyparse () != 1;
-}
+]AT_MAIN_DEFINE[
]])
AT_BISON_OPTION_POPDEFS
]])
AT_COMPILE([glr-regr6])
-AT_PARSER_CHECK([[./glr-regr6]], 0,
+AT_PARSER_CHECK([[./glr-regr6]], 1,
[Destructor called.
],
[syntax is ambiguous
}
}
-int
-main (void)
-{
- yyparse();
- return 0;
-}
+]AT_MAIN_DEFINE[
]])
AT_BISON_OPTION_POPDEFS
int exit_status = yyparse ();
if (parent_rhs_before_value)
{
- fprintf (stderr, "`parent_rhs_before' destructor not called.\n");
+ fprintf (stderr, "'parent_rhs_before' destructor not called.\n");
exit_status = 1;
}
if (merged_value)
{
- fprintf (stderr, "`merged' destructor not called.\n");
+ fprintf (stderr, "'merged' destructor not called.\n");
exit_status = 1;
}
if (parent_rhs_after_value)
{
- fprintf (stderr, "`PARENT_RHS_AFTER' destructor not called.\n");
+ fprintf (stderr, "'PARENT_RHS_AFTER' destructor not called.\n");
exit_status = 1;
}
return exit_status;
int exit_status = yyparse () != 1;
if (parent_rhs_before_value)
{
- fprintf (stderr, "`parent_rhs_before' destructor not called.\n");
+ fprintf (stderr, "'parent_rhs_before' destructor not called.\n");
exit_status = 1;
}
return exit_status;
return input[toknum++];
}
-int
-main (void)
-{
- return yyparse () != 1;
-}
+]AT_MAIN_DEFINE[
]])
AT_BISON_OPTION_POPDEFS
]])
AT_COMPILE([glr-regr17])
-AT_PARSER_CHECK([[./glr-regr17]], 0, [],
+AT_PARSER_CHECK([[./glr-regr17]], 1, [],
[1.1-2.2: syntax is ambiguous
])
%%
]AT_YYERROR_DEFINE[
]AT_YYLEX_DEFINE[
-int
-main (void)
-{
- return yyparse ();
-}
+]AT_MAIN_DEFINE[
]])
AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-o glr-regr18.c glr-regr18.y]], 1, [],
-[[glr-regr18.y:26.18-24: error: result type clash on merge function 'merge': <type2> != <type1>
-glr-regr18.y:25.18-24: previous declaration
-glr-regr18.y:27.13-19: error: result type clash on merge function 'merge': <type3> != <type2>
-glr-regr18.y:26.18-24: previous declaration
+[[glr-regr18.y:28.18-24: error: result type clash on merge function 'merge': <type2> != <type1>
+glr-regr18.y:27.18-24: previous declaration
+glr-regr18.y:29.13-19: error: result type clash on merge function 'merge': <type3> != <type2>
+glr-regr18.y:28.18-24: previous declaration
]])
AT_CLEANUP
AT_SETUP([Ambiguity reports])
-AT_BISON_OPTION_PUSHDEFS
+AT_BISON_OPTION_PUSHDEFS([%debug])
AT_DATA_GRAMMAR([input.y],
[[
%{
%%
]AT_YYLEX_DEFINE(["abc"])[
]AT_YYERROR_DEFINE[
-int
-main (void)
-{
- yydebug = 1;
- return !!yyparse ();
-}
+]AT_MAIN_DEFINE[
]])
AT_BISON_OPTION_POPDEFS
]])
AT_COMPILE([input])
-AT_PARSER_CHECK([[./input]], 1, [],
+AT_PARSER_CHECK([[./input --debug]], 1, [],
[Starting parse
Entering state 0
Reading a token: Next token is token 'a' ()
Reading a token: Next token is token 'b' ()
Shifting token 'b' ()
Entering state 3
-Reducing stack 0 by rule 3 (line 25):
+Reducing stack 0 by rule 3 (line 27):
$1 = token 'b' ()
-> $$ = nterm b ()
Entering state 4
Reading a token: Next token is token 'c' ()
Shifting token 'c' ()
Entering state 6
-Reducing stack 0 by rule 4 (line 26):
+Reducing stack 0 by rule 4 (line 28):
-> $$ = nterm d ()
Entering state 7
Reading a token: Now at end of input.