Skip to content
This repository has been archived by the owner on Jul 26, 2018. It is now read-only.

Capture buffer enhancements #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,19 @@ static const char *preamble= "\
#ifndef YY_BUFFER_START_SIZE\n\
#define YY_BUFFER_START_SIZE 1024\n\
#endif\n\
#ifndef YY_TEXT_START_SIZE\n\
#define YY_TEXT_START_SIZE 1024\n\
#endif\n\
\n\
#ifndef YY_PART\n\
#define yydata G->data\n\
#define yybuf G->buf\n\
#define yycapture (*thunk)\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\
typedef struct _yythunk { int begin, end; yyaction action; const char *name; } yythunk;\n\
\n\
typedef struct _GREG {\n\
char *buf;\n\
Expand Down Expand Up @@ -648,7 +653,7 @@ YY_LOCAL(int) yyText(GREG *G, int begin, int end)\n\
int yyleng= end - begin;\n\
if (yyleng <= 0)\n\
yyleng= 0;\n\
else\n\
else if (G->text)\n\
{\n\
while (G->textlen < (yyleng + 1))\n\
{\n\
Expand All @@ -657,7 +662,7 @@ YY_LOCAL(int) yyText(GREG *G, int begin, int end)\n\
}\n\
memcpy(G->text, G->buf + begin, yyleng);\n\
}\n\
G->text[yyleng]= '\\0';\n\
if (G->text) G->text[yyleng]= '\\0';\n\
return yyleng;\n\
}\n\
\n\
Expand Down Expand Up @@ -736,8 +741,8 @@ YY_PARSE(int) YY_NAME(parse_from)(GREG *G, yyrule yystart)\n\
{\n\
G->buflen= YY_BUFFER_START_SIZE;\n\
G->buf= (char*)YY_ALLOC(G->buflen, G->data);\n\
G->textlen= YY_BUFFER_START_SIZE;\n\
G->text= (char*)YY_ALLOC(G->textlen, G->data);\n\
G->textlen= YY_TEXT_START_SIZE;\n\
G->text= (char*)(G->textlen ? YY_ALLOC(G->textlen, G->data) : 0);\n\
G->thunkslen= YY_STACK_SIZE;\n\
G->thunks= (yythunk*)YY_ALLOC(sizeof(yythunk) * G->thunkslen, G->data);\n\
G->valslen= YY_STACK_SIZE;\n\
Expand Down