summaryrefslogtreecommitdiff
path: root/ext/standard/url_scanner_ex.c
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2002-09-25 12:15:42 +0000
committerSascha Schumann <sas@php.net>2002-09-25 12:15:42 +0000
commitc57d41992589c315d9db3338cd3f50caa47806db (patch)
tree5d2a73f6077730a84682b7f91b3583a11ec5f2b9 /ext/standard/url_scanner_ex.c
parent41c0b43772b9b884a7df49eadaed9c7a70d63803 (diff)
downloadphp-git-c57d41992589c315d9db3338cd3f50caa47806db.tar.gz
Sync
Diffstat (limited to 'ext/standard/url_scanner_ex.c')
-rw-r--r--ext/standard/url_scanner_ex.c108
1 files changed, 65 insertions, 43 deletions
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index 84a1a9a597..c80aeab616 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -1,5 +1,5 @@
-/* Generated by re2c 0.5 on Wed Sep 25 12:35:38 2002 */
-#line 1 "url_scanner_ex.re"
+/* Generated by re2c 0.5 on Wed Sep 25 14:14:17 2002 */
+#line 1 "/home/sas/src/php4/ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
@@ -83,10 +83,10 @@ static PHP_INI_MH(OnUpdateTags)
}
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=fakeentry", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals)
+ STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals)
PHP_INI_END()
-#line 91
+#line 92
#define YYFILL(n) goto done
@@ -151,25 +151,25 @@ yy0:
if(yych >= ';') goto yy4;
yy2: yych = *++YYCURSOR;
yy3:
-#line 109
+#line 110
{ smart_str_append(dest, url); return; }
yy4: yych = *++YYCURSOR;
yy5:
-#line 110
+#line 111
{ sep = separator; goto scan; }
yy6: yych = *++YYCURSOR;
yy7:
-#line 111
+#line 112
{ bash = p - 1; goto done; }
yy8: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy9: if(yybm[0+yych] & 128) goto yy8;
yy10:
-#line 112
+#line 113
{ goto scan; }
}
-#line 113
+#line 114
done:
@@ -235,20 +235,48 @@ enum {
#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC
#define STD_ARGS ctx, start, xp TSRMLS_CC
+#if SCANNER_DEBUG
+#define scdebug(x) printf x
+#else
+#define scdebug(x)
+#endif
+
static inline void passthru(STD_PARA)
{
+ scdebug(("appending %d chars, starting with %c\n", YYCURSOR-start, *start));
smart_str_appendl(&ctx->result, start, YYCURSOR - start);
}
-static inline void handle_form(STD_PARA)
+/*
+ * This function appends a hidden input field after a <form> or
+ * <fieldset>. The latter is important for XHTML.
+ */
+
+static void handle_form(STD_PARA)
{
- if (ctx->form_app.len > 0
- && ctx->tag.len == 4
- && strncasecmp(ctx->tag.c, "form", 4) == 0) {
- smart_str_append(&ctx->result, &ctx->form_app);
+ int doit = 0;
+
+ if (ctx->form_app.len > 0) {
+ switch (ctx->tag.len) {
+
+ case sizeof("form")-1:
+ if (strcasecmp(ctx->tag.c, "form") == 0)
+ doit = 1;
+ break;
+
+ case sizeof("fieldset")-1:
+ if (strcasecmp(ctx->tag.c, "fieldset") == 0)
+ doit = 1;
+ break;
+ }
+
+ if (doit)
+ smart_str_append(&ctx->result, &ctx->form_app);
}
}
+
+
/*
* HANDLE_TAG copies the HTML Tag and checks whether we
* have that tag in our table. If we might modify it,
@@ -282,12 +310,6 @@ static inline void handle_val(STD_PARA, char quotes, char type)
tag_arg(ctx, quotes, type TSRMLS_CC);
}
-#ifdef SCANNER_DEBUG
-#define scdebug(x) printf x
-#else
-#define scdebug(x)
-#endif
-
static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen TSRMLS_DC)
{
char *end, *q;
@@ -360,17 +382,17 @@ yy11:
if(yybm[0+yych] & 128) goto yy15;
yy13: yych = *++YYCURSOR;
yy14:
-#line 259
+#line 282
{ passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
yy15: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy16: if(yybm[0+yych] & 128) goto yy15;
yy17:
-#line 260
+#line 283
{ passthru(STD_ARGS); goto state_plain; }
}
-#line 261
+#line 284
state_tag:
@@ -424,11 +446,11 @@ yy18:
yy20: yych = *++YYCURSOR;
goto yy25;
yy21:
-#line 266
+#line 289
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
yy22: yych = *++YYCURSOR;
yy23:
-#line 267
+#line 290
{ passthru(STD_ARGS); goto state_plain_begin; }
yy24: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -436,7 +458,7 @@ yy24: ++YYCURSOR;
yy25: if(yybm[0+yych] & 128) goto yy24;
goto yy21;
}
-#line 268
+#line 291
state_next_arg_begin:
@@ -507,20 +529,20 @@ yy26:
}
yy28: yych = *++YYCURSOR;
yy29:
-#line 276
+#line 299
{ passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
yy30: yych = *++YYCURSOR;
goto yy37;
yy31:
-#line 277
+#line 300
{ passthru(STD_ARGS); goto state_next_arg; }
yy32: yych = *++YYCURSOR;
yy33:
-#line 278
+#line 301
{ --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
yy34: yych = *++YYCURSOR;
yy35:
-#line 279
+#line 302
{ passthru(STD_ARGS); goto state_plain_begin; }
yy36: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -528,7 +550,7 @@ yy36: ++YYCURSOR;
yy37: if(yybm[0+yych] & 128) goto yy36;
goto yy31;
}
-#line 280
+#line 303
state_arg:
@@ -542,7 +564,7 @@ state_arg:
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 128, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 128, 128, 128, 128, 128, 128, 128,
@@ -582,11 +604,11 @@ yy38:
yy40: yych = *++YYCURSOR;
goto yy45;
yy41:
-#line 285
+#line 308
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
yy42: yych = *++YYCURSOR;
yy43:
-#line 286
+#line 309
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
yy44: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -594,7 +616,7 @@ yy44: ++YYCURSOR;
yy45: if(yybm[0+yych] & 128) goto yy44;
goto yy41;
}
-#line 287
+#line 310
state_before_val:
@@ -649,12 +671,12 @@ yy48: yyaccept = 0;
if(yych == ' ') goto yy55;
if(yych == '=') goto yy53;
yy49:
-#line 293
+#line 316
{ --YYCURSOR; goto state_next_arg_begin; }
yy50: yych = *++YYCURSOR;
goto yy54;
yy51:
-#line 292
+#line 315
{ passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
yy52: yych = *++YYCURSOR;
goto yy49;
@@ -673,7 +695,7 @@ yy57: YYCURSOR = YYMARKER;
case 0: goto yy49;
}
}
-#line 294
+#line 317
@@ -743,7 +765,7 @@ yy60: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy77;
yy61:
-#line 302
+#line 325
{ handle_val(STD_ARGS, 0, '\0'); goto state_next_arg_begin; }
yy62: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -752,7 +774,7 @@ yy63: yych = *++YYCURSOR;
goto yy67;
yy64: yych = *++YYCURSOR;
yy65:
-#line 303
+#line 326
{ passthru(STD_ARGS); goto state_next_arg_begin; }
yy66: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -769,7 +791,7 @@ yy69: if(yybm[0+yych] & 16) goto yy68;
yy70: yych = *++YYCURSOR;
if(yybm[0+yych] & 8) goto yy66;
yy71:
-#line 301
+#line 324
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
yy72: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -792,7 +814,7 @@ yy77: if(yybm[0+yych] & 64) goto yy76;
yy78: yych = *++YYCURSOR;
if(yybm[0+yych] & 8) goto yy66;
yy79:
-#line 300
+#line 323
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
yy80: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -802,7 +824,7 @@ yy81: if(yybm[0+yych] & 128) goto yy80;
yy82: yych = *++YYCURSOR;
goto yy79;
}
-#line 304
+#line 327
stop: