-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move struct _GREG to greg.h, expose it in P as P->parser. Idea by Peter Arthur
- Loading branch information
Showing
7 changed files
with
157 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* Copyright (c) 2007 by Ian Piumarta | ||
* Copyright (c) 2011 by Amos Wenger [email protected] | ||
* Copyright (c) 2013 by perl11 org | ||
* Copyright (c) 2013,2019 by perl11 org | ||
* All rights reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
|
@@ -470,7 +470,7 @@ static char *header= "\ | |
#include <stdio.h>\n\ | ||
#include <stdlib.h>\n\ | ||
#include <string.h>\n\ | ||
struct _GREG;\n\ | ||
#include \"greg.h\"\n\ | ||
"; | ||
|
||
static char *preamble= "\ | ||
|
@@ -564,12 +564,6 @@ static char *preamble= "\ | |
# define yyprintfvokrule(rule)\n\ | ||
# define yyprintfvfailrule(rule)\n\ | ||
#endif\n\ | ||
#ifndef YYSTYPE\n\ | ||
#define YYSTYPE int\n\ | ||
#endif\n\ | ||
#ifndef YY_XTYPE\n\ | ||
#define YY_XTYPE void *\n\ | ||
#endif\n\ | ||
#ifndef YY_XVAR\n\ | ||
#define YY_XVAR yyxvar\n\ | ||
#endif\n\ | ||
|
@@ -586,35 +580,9 @@ static char *preamble= "\ | |
#define yydata G->data\n\ | ||
#define yy G->ss\n\ | ||
\n\ | ||
struct _yythunk; // forward declaration\n\ | ||
typedef void (*yyaction)(struct _GREG *G, char *yytext, int yyleng, struct _yythunk *thunkpos, YY_XTYPE YY_XVAR);\n\ | ||
typedef struct _yythunk { int begin, end; yyaction action; const char *name; struct _yythunk *next; } yythunk;\n\ | ||
\n\ | ||
typedef struct _GREG {\n\ | ||
char *buf;\n\ | ||
int buflen;\n\ | ||
int offset;\n\ | ||
int pos;\n\ | ||
int limit;\n\ | ||
char *text;\n\ | ||
int textlen;\n\ | ||
int begin;\n\ | ||
int end;\n\ | ||
yythunk *thunks;\n\ | ||
int thunkslen;\n\ | ||
int thunkpos;\n\ | ||
int lineno;\n\ | ||
char *filename;\n\ | ||
FILE *input;\n\ | ||
YYSTYPE ss;\n\ | ||
YYSTYPE *val;\n\ | ||
YYSTYPE *vals;\n\ | ||
int valslen;\n\ | ||
YY_XTYPE data;\n\ | ||
#ifdef YY_DEBUG\n\ | ||
int debug;\n\ | ||
#endif\n\ | ||
} GREG;\n\ | ||
\n\ | ||
YY_LOCAL(int) yyrefill(GREG *G)\n\ | ||
{\n\ | ||
|
@@ -925,7 +893,8 @@ YY_PARSE(void) YY_NAME(parse_free)(GREG *G)\n\ | |
|
||
void Rule_compile_c_header(void) | ||
{ | ||
fprintf(output, "/* A recursive-descent parser generated by greg %d.%d.%d */\n", GREG_MAJOR, GREG_MINOR, GREG_LEVEL); | ||
fprintf(output, "/* A recursive-descent parser generated by greg %d.%d.%d */\n", | ||
GREG_MAJOR, GREG_MINOR, GREG_LEVEL); | ||
fprintf(output, "\n"); | ||
fprintf(output, "%s", header); | ||
fprintf(output, "#define YYRULECOUNT %d\n", ruleCount); | ||
|
Oops, something went wrong.