ref: fa2e7bdd6a737a9096b296e8351a8d465b796e98
parent: 6a7ced303236cfa98b216834f197b6dab30ded4f
author: Andrew Chambers <ac@acha.ninja>
date: Tue Apr 12 10:32:14 CDT 2022
Define yycontext before the C header so function definitions can use it.
--- a/compile.c
+++ b/compile.c
@@ -446,7 +446,6 @@
\n\
#ifndef YY_PART\n\
\n\
-typedef struct _yycontext yycontext;\n\
typedef void (*yyaction)(yycontext *yy, char *yytext, int yyleng);\n\
typedef struct _yythunk { int begin, end; yyaction action; struct _yythunk *next; } yythunk;\n\
\n\
@@ -719,6 +718,7 @@
fprintf(output, "\n");
fprintf(output, "%s", header);
fprintf(output, "#define YYRULECOUNT %d\n", ruleCount);
+ fprintf(output, "typedef struct _yycontext yycontext;\n");
}
int consumesInput(Node *node)
--- a/minipeg.c
+++ b/minipeg.c
@@ -567,7 +567,6 @@
\n\
#ifndef YY_PART\n\
\n\
-typedef struct _yycontext yycontext;\n\
typedef void (*yyaction)(yycontext *yy, char *yytext, int yyleng);\n\
typedef struct _yythunk { int begin, end; yyaction action; struct _yythunk *next; } yythunk;\n\
\n\
@@ -840,6 +839,7 @@
fprintf(output, "\n");
fprintf(output, "%s", header);
fprintf(output, "#define YYRULECOUNT %d\n", ruleCount);
+ fprintf(output, "typedef struct _yycontext yycontext;\n");
}
int consumesInput(Node *node)
@@ -1277,6 +1277,7 @@
/* Parser generated by minipeg 4e9111b */
#define YYRULECOUNT 38
+typedef struct _yycontext yycontext;
#line 1 "peg.peg"
@@ -1374,7 +1375,6 @@
#ifndef YY_PART
-typedef struct _yycontext yycontext;
typedef void (*yyaction)(yycontext *yy, char *yytext, int yyleng);
typedef struct _yythunk { int begin, end; yyaction action; struct _yythunk *next; } yythunk;