mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
s/DEBUG/SCANNER_DEBUG/. "Convert" one macro to inline function to be more
consistent. Also use continue.
This commit is contained in:
parent
5b0ca1585a
commit
7f86b7224c
@ -1,4 +1,4 @@
|
|||||||
/* Generated by re2c 0.5 on Tue Sep 19 19:28:00 2000 */
|
/* Generated by re2c 0.5 on Tue Sep 19 20:00:09 2000 */
|
||||||
#line 1 "/home/sas/src/php4/ext/standard/url_scanner_ex.re"
|
#line 1 "/home/sas/src/php4/ext/standard/url_scanner_ex.re"
|
||||||
/*
|
/*
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
@ -62,7 +62,7 @@ static inline void smart_str_free(smart_str *s)
|
|||||||
free(s->c);
|
free(s->c);
|
||||||
s->c = NULL;
|
s->c = NULL;
|
||||||
}
|
}
|
||||||
s->len = 0;
|
s->a = s->len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void smart_str_copyl(smart_str *dest, const char *src, size_t len)
|
static inline void smart_str_copyl(smart_str *dest, const char *src, size_t len)
|
||||||
@ -83,12 +83,17 @@ static inline void smart_str_appendl(smart_str *dest, const char *src, size_t le
|
|||||||
smart_str_append(dest, &s);
|
smart_str_append(dest, &s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void smart_str_appends(smart_str *dest, char *src)
|
static inline void smart_str_appends(smart_str *dest, const char *src)
|
||||||
{
|
{
|
||||||
smart_str_appendl(dest, src, strlen(src));
|
smart_str_appendl(dest, src, strlen(src));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void attach_url(smart_str *url, smart_str *name, smart_str *val, char *separator)
|
static inline void smart_str_copys(smart_str *dest, const char *src)
|
||||||
|
{
|
||||||
|
smart_str_copyl(dest, src, strlen(src));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void attach_url(smart_str *url, smart_str *name, smart_str *val, const char *separator)
|
||||||
{
|
{
|
||||||
if (strchr(url->c, ':')) return;
|
if (strchr(url->c, ':')) return;
|
||||||
|
|
||||||
@ -131,10 +136,10 @@ static inline void tag_arg(url_adapt_state_t *ctx PLS_DC)
|
|||||||
smart_str_appends(&ctx->result, "\"");
|
smart_str_appends(&ctx->result, "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 131
|
#line 139
|
||||||
|
|
||||||
|
|
||||||
#define NEXT goto nextiter
|
#define NEXT continue
|
||||||
|
|
||||||
#define COPY_ALL \
|
#define COPY_ALL \
|
||||||
smart_str_appendl(&ctx->result, start, YYCURSOR - start); \
|
smart_str_appendl(&ctx->result, start, YYCURSOR - start); \
|
||||||
@ -169,7 +174,7 @@ enum {
|
|||||||
static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
|
static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
|
||||||
{
|
{
|
||||||
char *para_start, *arg_start, *tag_start;
|
char *para_start, *arg_start, *tag_start;
|
||||||
char *start;
|
char *start = NULL;
|
||||||
char *cursor, *marker;
|
char *cursor, *marker;
|
||||||
PLS_FETCH();
|
PLS_FETCH();
|
||||||
|
|
||||||
@ -182,7 +187,9 @@ static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
|
|||||||
while (YYCURSOR < YYLIMIT) {
|
while (YYCURSOR < YYLIMIT) {
|
||||||
start = YYCURSOR;
|
start = YYCURSOR;
|
||||||
|
|
||||||
// printf("state %d:%s'\n", ctx->state, YYCURSOR);
|
#ifdef SCANNER_DEBUG
|
||||||
|
printf("state %d:%s'\n", ctx->state, YYCURSOR);
|
||||||
|
#endif
|
||||||
switch (ctx->state) {
|
switch (ctx->state) {
|
||||||
|
|
||||||
case STATE_PLAIN:
|
case STATE_PLAIN:
|
||||||
@ -231,17 +238,17 @@ yy0:
|
|||||||
if(yybm[0+yych] & 128) goto yy4;
|
if(yybm[0+yych] & 128) goto yy4;
|
||||||
yy2: yych = *++YYCURSOR;
|
yy2: yych = *++YYCURSOR;
|
||||||
yy3:
|
yy3:
|
||||||
#line 186
|
#line 196
|
||||||
{ tag_start = YYCURSOR; GO(STATE_TAG); COPY_ALL;}
|
{ tag_start = YYCURSOR; GO(STATE_TAG); COPY_ALL;}
|
||||||
yy4: ++YYCURSOR;
|
yy4: ++YYCURSOR;
|
||||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||||
yych = *YYCURSOR;
|
yych = *YYCURSOR;
|
||||||
yy5: if(yybm[0+yych] & 128) goto yy4;
|
yy5: if(yybm[0+yych] & 128) goto yy4;
|
||||||
yy6:
|
yy6:
|
||||||
#line 187
|
#line 197
|
||||||
{ COPY_ALL; }
|
{ COPY_ALL; }
|
||||||
}
|
}
|
||||||
#line 188
|
#line 198
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -298,7 +305,7 @@ yy9: yyaccept = 0;
|
|||||||
if(yych == ' ') goto yy12;
|
if(yych == ' ') goto yy12;
|
||||||
if(yych == '>') goto yy12;
|
if(yych == '>') goto yy12;
|
||||||
yy10:
|
yy10:
|
||||||
#line 203
|
#line 213
|
||||||
{
|
{
|
||||||
YYCURSOR--;
|
YYCURSOR--;
|
||||||
GO(STATE_PLAIN);
|
GO(STATE_PLAIN);
|
||||||
@ -309,12 +316,12 @@ yy11: yych = *++YYCURSOR;
|
|||||||
goto yy10;
|
goto yy10;
|
||||||
yy12: yych = *++YYCURSOR;
|
yy12: yych = *++YYCURSOR;
|
||||||
yy13:
|
yy13:
|
||||||
#line 193
|
#line 203
|
||||||
{
|
{
|
||||||
YYCURSOR--;
|
YYCURSOR--;
|
||||||
arg_start = YYCURSOR;
|
arg_start = YYCURSOR;
|
||||||
smart_str_copyl(&ctx->tag, start, YYCURSOR - start);
|
smart_str_copyl(&ctx->tag, start, YYCURSOR - start);
|
||||||
#ifdef DEBUG
|
#ifdef SCANNER_DEBUG
|
||||||
printf("TAG(%s)\n", ctx->tag.c);
|
printf("TAG(%s)\n", ctx->tag.c);
|
||||||
#endif
|
#endif
|
||||||
GO(STATE_NEXT_ARG);
|
GO(STATE_NEXT_ARG);
|
||||||
@ -331,7 +338,7 @@ yy16: YYCURSOR = YYMARKER;
|
|||||||
case 0: goto yy10;
|
case 0: goto yy10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#line 209
|
#line 219
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -385,14 +392,14 @@ yy19:yy20: ++YYCURSOR;
|
|||||||
yych = *YYCURSOR;
|
yych = *YYCURSOR;
|
||||||
yy21: if(yybm[0+yych] & 128) goto yy20;
|
yy21: if(yybm[0+yych] & 128) goto yy20;
|
||||||
yy22:
|
yy22:
|
||||||
#line 214
|
#line 224
|
||||||
{
|
{
|
||||||
GO(STATE_ARG);
|
GO(STATE_ARG);
|
||||||
NEXT;
|
NEXT;
|
||||||
}
|
}
|
||||||
yy23: yych = *++YYCURSOR;
|
yy23: yych = *++YYCURSOR;
|
||||||
yy24:
|
yy24:
|
||||||
#line 218
|
#line 228
|
||||||
{
|
{
|
||||||
HANDLE_FORM;
|
HANDLE_FORM;
|
||||||
GO(STATE_PLAIN);
|
GO(STATE_PLAIN);
|
||||||
@ -400,7 +407,7 @@ yy24:
|
|||||||
COPY_ALL;
|
COPY_ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#line 224
|
#line 234
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -453,7 +460,7 @@ yy25:
|
|||||||
if(yych <= '<') goto yy30;
|
if(yych <= '<') goto yy30;
|
||||||
if(yych >= '?') goto yy30;
|
if(yych >= '?') goto yy30;
|
||||||
yy27:
|
yy27:
|
||||||
#line 239
|
#line 252
|
||||||
{
|
{
|
||||||
arg_start = YYCURSOR;
|
arg_start = YYCURSOR;
|
||||||
ctx->state--;
|
ctx->state--;
|
||||||
@ -492,10 +499,13 @@ yy35: ++YYCURSOR;
|
|||||||
yych = *YYCURSOR;
|
yych = *YYCURSOR;
|
||||||
yy36: if(yych == ' ') goto yy35;
|
yy36: if(yych == ' ') goto yy35;
|
||||||
yy37:
|
yy37:
|
||||||
#line 230
|
#line 240
|
||||||
{
|
{
|
||||||
smart_str_copyl(&ctx->arg, start, YYCURSOR - start - 1);
|
char *p;
|
||||||
#ifdef DEBUG
|
|
||||||
|
for (p = start; isalpha(*p); p++);
|
||||||
|
smart_str_copyl(&ctx->arg, start, p - start);
|
||||||
|
#ifdef SCANNER_DEBUG
|
||||||
printf("ARG(%s)\n", ctx->arg.c);
|
printf("ARG(%s)\n", ctx->arg.c);
|
||||||
#endif
|
#endif
|
||||||
para_start = YYCURSOR;
|
para_start = YYCURSOR;
|
||||||
@ -503,7 +513,7 @@ yy37:
|
|||||||
COPY_ALL;
|
COPY_ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#line 244
|
#line 257
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -566,7 +576,7 @@ yy40: yyaccept = 0;
|
|||||||
yych = *(YYMARKER = ++YYCURSOR);
|
yych = *(YYMARKER = ++YYCURSOR);
|
||||||
if(yych != '^') goto yy51;
|
if(yych != '^') goto yy51;
|
||||||
yy41:
|
yy41:
|
||||||
#line 273
|
#line 286
|
||||||
{
|
{
|
||||||
YYCURSOR--;
|
YYCURSOR--;
|
||||||
ctx->state = 2;
|
ctx->state = 2;
|
||||||
@ -580,12 +590,12 @@ yy43: yych = *++YYCURSOR;
|
|||||||
goto yy41;
|
goto yy41;
|
||||||
yy44: yych = *++YYCURSOR;
|
yy44: yych = *++YYCURSOR;
|
||||||
yy45:
|
yy45:
|
||||||
#line 261
|
#line 274
|
||||||
{
|
{
|
||||||
YYCURSOR--;
|
YYCURSOR--;
|
||||||
para_start = NULL;
|
para_start = NULL;
|
||||||
smart_str_copyl(&ctx->para, start, YYCURSOR - start);
|
smart_str_copyl(&ctx->para, start, YYCURSOR - start);
|
||||||
#ifdef DEBUG
|
#ifdef SCANNER_DEBUG
|
||||||
printf("PARA(%s)\n", ctx->para.c);
|
printf("PARA(%s)\n", ctx->para.c);
|
||||||
#endif
|
#endif
|
||||||
tag_arg(ctx PLS_CC);
|
tag_arg(ctx PLS_CC);
|
||||||
@ -621,12 +631,12 @@ yy52: yych = *++YYCURSOR;
|
|||||||
if(yych != '>') goto yy47;
|
if(yych != '>') goto yy47;
|
||||||
yy53: yych = *++YYCURSOR;
|
yy53: yych = *++YYCURSOR;
|
||||||
yy54:
|
yy54:
|
||||||
#line 249
|
#line 262
|
||||||
{
|
{
|
||||||
YYCURSOR--;
|
YYCURSOR--;
|
||||||
para_start = NULL;
|
para_start = NULL;
|
||||||
smart_str_copyl(&ctx->para, start + 1, YYCURSOR - start - 2);
|
smart_str_copyl(&ctx->para, start + 1, YYCURSOR - start - 2);
|
||||||
#ifdef DEBUG
|
#ifdef SCANNER_DEBUG
|
||||||
printf("PARA(%s)\n", ctx->para.c);
|
printf("PARA(%s)\n", ctx->para.c);
|
||||||
#endif
|
#endif
|
||||||
tag_arg(ctx PLS_CC);
|
tag_arg(ctx PLS_CC);
|
||||||
@ -647,7 +657,7 @@ yy57: if(yybm[0+yych] & 128) goto yy56;
|
|||||||
yy58: yych = *++YYCURSOR;
|
yy58: yych = *++YYCURSOR;
|
||||||
goto yy54;
|
goto yy54;
|
||||||
}
|
}
|
||||||
#line 278
|
#line 291
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -677,15 +687,13 @@ finish:
|
|||||||
smart_str_free(&ctx->work);
|
smart_str_free(&ctx->work);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef SCANNER_DEBUG
|
||||||
if (ctx->work.c) {
|
if (ctx->work.c) {
|
||||||
printf("PRESERVING %s'\n", ctx->work.c);
|
printf("PRESERVING %s'\n", ctx->work.c);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define smart_str_copys(a,b) smart_str_copyl(a,b,strlen(b))
|
|
||||||
|
|
||||||
char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char *value, size_t *newlen)
|
char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char *value, size_t *newlen)
|
||||||
{
|
{
|
||||||
smart_str str = {0,0};
|
smart_str str = {0,0};
|
||||||
|
@ -60,7 +60,7 @@ static inline void smart_str_free(smart_str *s)
|
|||||||
free(s->c);
|
free(s->c);
|
||||||
s->c = NULL;
|
s->c = NULL;
|
||||||
}
|
}
|
||||||
s->len = 0;
|
s->a = s->len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void smart_str_copyl(smart_str *dest, const char *src, size_t len)
|
static inline void smart_str_copyl(smart_str *dest, const char *src, size_t len)
|
||||||
@ -81,12 +81,17 @@ static inline void smart_str_appendl(smart_str *dest, const char *src, size_t le
|
|||||||
smart_str_append(dest, &s);
|
smart_str_append(dest, &s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void smart_str_appends(smart_str *dest, char *src)
|
static inline void smart_str_appends(smart_str *dest, const char *src)
|
||||||
{
|
{
|
||||||
smart_str_appendl(dest, src, strlen(src));
|
smart_str_appendl(dest, src, strlen(src));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void attach_url(smart_str *url, smart_str *name, smart_str *val, char *separator)
|
static inline void smart_str_copys(smart_str *dest, const char *src)
|
||||||
|
{
|
||||||
|
smart_str_copyl(dest, src, strlen(src));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void attach_url(smart_str *url, smart_str *name, smart_str *val, const char *separator)
|
||||||
{
|
{
|
||||||
if (strchr(url->c, ':')) return;
|
if (strchr(url->c, ':')) return;
|
||||||
|
|
||||||
@ -133,7 +138,7 @@ static inline void tag_arg(url_adapt_state_t *ctx PLS_DC)
|
|||||||
all = [\000-\377];
|
all = [\000-\377];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NEXT goto nextiter
|
#define NEXT continue
|
||||||
|
|
||||||
#define COPY_ALL \
|
#define COPY_ALL \
|
||||||
smart_str_appendl(&ctx->result, start, YYCURSOR - start); \
|
smart_str_appendl(&ctx->result, start, YYCURSOR - start); \
|
||||||
@ -168,7 +173,7 @@ enum {
|
|||||||
static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
|
static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
|
||||||
{
|
{
|
||||||
char *para_start, *arg_start, *tag_start;
|
char *para_start, *arg_start, *tag_start;
|
||||||
char *start;
|
char *start = NULL;
|
||||||
char *cursor, *marker;
|
char *cursor, *marker;
|
||||||
PLS_FETCH();
|
PLS_FETCH();
|
||||||
|
|
||||||
@ -181,7 +186,9 @@ static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
|
|||||||
while (YYCURSOR < YYLIMIT) {
|
while (YYCURSOR < YYLIMIT) {
|
||||||
start = YYCURSOR;
|
start = YYCURSOR;
|
||||||
|
|
||||||
// printf("state %d:%s'\n", ctx->state, YYCURSOR);
|
#ifdef SCANNER_DEBUG
|
||||||
|
printf("state %d:%s'\n", ctx->state, YYCURSOR);
|
||||||
|
#endif
|
||||||
switch (ctx->state) {
|
switch (ctx->state) {
|
||||||
|
|
||||||
case STATE_PLAIN:
|
case STATE_PLAIN:
|
||||||
@ -197,7 +204,7 @@ static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
|
|||||||
YYCURSOR--;
|
YYCURSOR--;
|
||||||
arg_start = YYCURSOR;
|
arg_start = YYCURSOR;
|
||||||
smart_str_copyl(&ctx->tag, start, YYCURSOR - start);
|
smart_str_copyl(&ctx->tag, start, YYCURSOR - start);
|
||||||
#ifdef DEBUG
|
#ifdef SCANNER_DEBUG
|
||||||
printf("TAG(%s)\n", ctx->tag.c);
|
printf("TAG(%s)\n", ctx->tag.c);
|
||||||
#endif
|
#endif
|
||||||
GO(STATE_NEXT_ARG);
|
GO(STATE_NEXT_ARG);
|
||||||
@ -231,8 +238,11 @@ static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
|
|||||||
smart_str_appendl(&ctx->result, " ", 1);
|
smart_str_appendl(&ctx->result, " ", 1);
|
||||||
/*!re2c
|
/*!re2c
|
||||||
[a-zA-Z]+ [ ]* "=" [ ]* {
|
[a-zA-Z]+ [ ]* "=" [ ]* {
|
||||||
smart_str_copyl(&ctx->arg, start, YYCURSOR - start - 1);
|
char *p;
|
||||||
#ifdef DEBUG
|
|
||||||
|
for (p = start; isalpha(*p); p++);
|
||||||
|
smart_str_copyl(&ctx->arg, start, p - start);
|
||||||
|
#ifdef SCANNER_DEBUG
|
||||||
printf("ARG(%s)\n", ctx->arg.c);
|
printf("ARG(%s)\n", ctx->arg.c);
|
||||||
#endif
|
#endif
|
||||||
para_start = YYCURSOR;
|
para_start = YYCURSOR;
|
||||||
@ -253,7 +263,7 @@ static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
|
|||||||
YYCURSOR--;
|
YYCURSOR--;
|
||||||
para_start = NULL;
|
para_start = NULL;
|
||||||
smart_str_copyl(&ctx->para, start + 1, YYCURSOR - start - 2);
|
smart_str_copyl(&ctx->para, start + 1, YYCURSOR - start - 2);
|
||||||
#ifdef DEBUG
|
#ifdef SCANNER_DEBUG
|
||||||
printf("PARA(%s)\n", ctx->para.c);
|
printf("PARA(%s)\n", ctx->para.c);
|
||||||
#endif
|
#endif
|
||||||
tag_arg(ctx PLS_CC);
|
tag_arg(ctx PLS_CC);
|
||||||
@ -265,7 +275,7 @@ static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
|
|||||||
YYCURSOR--;
|
YYCURSOR--;
|
||||||
para_start = NULL;
|
para_start = NULL;
|
||||||
smart_str_copyl(&ctx->para, start, YYCURSOR - start);
|
smart_str_copyl(&ctx->para, start, YYCURSOR - start);
|
||||||
#ifdef DEBUG
|
#ifdef SCANNER_DEBUG
|
||||||
printf("PARA(%s)\n", ctx->para.c);
|
printf("PARA(%s)\n", ctx->para.c);
|
||||||
#endif
|
#endif
|
||||||
tag_arg(ctx PLS_CC);
|
tag_arg(ctx PLS_CC);
|
||||||
@ -307,15 +317,13 @@ finish:
|
|||||||
smart_str_free(&ctx->work);
|
smart_str_free(&ctx->work);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef SCANNER_DEBUG
|
||||||
if (ctx->work.c) {
|
if (ctx->work.c) {
|
||||||
printf("PRESERVING %s'\n", ctx->work.c);
|
printf("PRESERVING %s'\n", ctx->work.c);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define smart_str_copys(a,b) smart_str_copyl(a,b,strlen(b))
|
|
||||||
|
|
||||||
char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char *value, size_t *newlen)
|
char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char *value, size_t *newlen)
|
||||||
{
|
{
|
||||||
smart_str str = {0,0};
|
smart_str str = {0,0};
|
||||||
|
Loading…
Reference in New Issue
Block a user