mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
For push mode, add pull wrappers around yypush_parse.
* data/push.c: (b4_generate_macro_args, b4_parenthesize): New macros. (yypull_parse): New function wrapping yypush_parse. (yyparse): New #define wrapping yypull_parse. * tests/calc.at (_AT_DATA_CALC_Y): Call yyparse even when %push-parser is declared. * tests/headers.at (export YYLTYPE): Make yylex global. For push mode, prototype yylex in the module that calls yyparse, and don't prototype yyparse there. Otherwise, the yyparse expansion won't compile. * tests/input.at (Torturing the Scanner): Likewise.
This commit is contained in:
@@ -336,17 +336,7 @@ main (int argc, const char **argv)
|
||||
|
||||
]AT_SKEL_CC_IF([], [m4_bmatch([$4], [%debug],
|
||||
[ yydebug = 1;])])[
|
||||
]AT_PUSH_IF([
|
||||
{
|
||||
yypstate *pstate = yypstate_new ();
|
||||
YYSTYPE my_lval;
|
||||
]AT_LOCATION_IF([YYLTYPE my_lloc;])[
|
||||
do {
|
||||
status = yypush_parse (pstate, yylex (&my_lval]AT_LOCATION_IF([[, &my_lloc]])[), &my_lval]AT_LOCATION_IF([[, &my_lloc]])[);
|
||||
} while (status == YYPUSH_MORE);
|
||||
yypstate_delete (pstate);
|
||||
}],[
|
||||
status = yyparse (]AT_PARAM_IF([[&result, &count]])[);])[
|
||||
status = yyparse (]AT_PARAM_IF([[&result, &count]])[);
|
||||
fclose (input);
|
||||
if (global_result != result)
|
||||
abort ();
|
||||
|
||||
@@ -94,7 +94,9 @@ AT_DATA_GRAMMAR([input.y],
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static int
|
||||
int my_lex (void);
|
||||
|
||||
int
|
||||
my_lex (void)
|
||||
{
|
||||
return EOF;
|
||||
@@ -118,7 +120,11 @@ AT_DATA([caller.c],
|
||||
[[#include "input.h"
|
||||
YYLTYPE *my_llocp = &my_lloc;
|
||||
|
||||
#ifndef YYPUSH_DECLS
|
||||
int my_parse (void);
|
||||
#else
|
||||
int my_lex (void);
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
|
||||
@@ -470,7 +470,7 @@ char quote[] = "@:>@@:>@,";
|
||||
|
||||
%{
|
||||
static void yyerror (const char *s);
|
||||
static int yylex (void);
|
||||
int yylex (void);
|
||||
%}
|
||||
|
||||
%type <ival> '@<:@'
|
||||
@@ -503,7 +503,7 @@ value_as_yystype (value val)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
yylex (void)
|
||||
{
|
||||
static char const input[] = "@<:@\1\2$@{@oline@__@&t@oline__\
|
||||
@@ -529,7 +529,11 @@ AT_DATA([main.c],
|
||||
[[typedef int value;
|
||||
#include "input.h"
|
||||
|
||||
#ifndef YYPUSH_DECLS
|
||||
int yyparse (void);
|
||||
#else
|
||||
int yylex (void);
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
|
||||
Reference in New Issue
Block a user