-/* Generated by re2c 0.5 on Wed Sep 20 03:07:32 2000 */
+/* Generated by re2c 0.5 on Wed Sep 20 04:00:49 2000 */
#line 1 "/home/sas/src/php4/ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
smart_str_append(dest, &s);
}
+static inline void smart_str_set(smart_str *dest, smart_str *src)
+{
+ dest->len = src->len;
+ dest->a = src->a;
+ dest->c = src->c;
+}
+
static inline void smart_str_setl(smart_str *dest, const char *src, size_t len)
{
dest->len = len;
static inline void attach_url(smart_str *url, smart_str *name, smart_str *val, const char *separator)
{
- if (memchr(url->c, ':', url->len)) return;
-
- if (memchr(url->c, '?', url->len))
- smart_str_appendl(url, separator, 1);
- else
- smart_str_appendl(url, "?", 1);
+ register const char *p, *q;
+ const char *bash = NULL;
+ const char *sep = "?";
+
+ q = url->c + url->len;
+
+ for (p = url->c; p < q; p++) {
+ switch(*p) {
+ case ':':
+ return;
+ case '?':
+ sep = separator;
+ break;
+ case '#':
+ bash = p;
+ break;
+ }
+ }
- smart_str_append(url, name);
- smart_str_appendl(url, "=", 1);
- smart_str_append(url, val);
+ if (bash) {
+ smart_str new = {0};
+
+ smart_str_copyl(&new, url->c, bash - url->c);
+ smart_str_appendl(&new, sep, 1);
+ smart_str_append(&new, name);
+ smart_str_appendl(&new, "=", 1);
+ smart_str_append(&new, val);
+ smart_str_appendl(&new, bash, q - bash);
+
+ smart_str_free(url);
+ smart_str_set(url, &new);
+ } else {
+ smart_str_appendl(url, sep, 1);
+ smart_str_append(url, name);
+ smart_str_appendl(url, "=", 1);
+ smart_str_append(url, val);
+ }
}
struct php_tag_arg {
YYCURSOR = ctx->buf.c;
YYLIMIT = ctx->buf.c + ctx->buf.len;
-#line 254
+#line 288
while(1) {
if(yych != '<') goto yy4;
yy2: yych = *++YYCURSOR;
yy3:
-#line 265
+#line 299
{ PASSTHRU(); STATE = STATE_TAG; continue; }
yy4: yych = *++YYCURSOR;
yy5:
-#line 266
+#line 300
{ PASSTHRU(); continue; }
}
-#line 267
+#line 301
break;
yy8: yych = *++YYCURSOR;
goto yy13;
yy9:
-#line 272
+#line 306
{ HANDLE_TAG() /* Sets STATE */; PASSTHRU(); continue; }
yy10: yych = *++YYCURSOR;
yy11:
-#line 273
+#line 307
{ PASSTHRU(); continue; }
yy12: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yy13: if(yybm[0+yych] & 128) goto yy12;
goto yy9;
}
-#line 274
+#line 308
break;
}
yy16: yych = *++YYCURSOR;
yy17:
-#line 279
+#line 313
{ PASSTHRU(); HANDLE_FORM(); STATE = STATE_PLAIN; continue; }
yy18: yych = *++YYCURSOR;
yy19:
-#line 280
+#line 314
{ PASSTHRU(); continue; }
yy20: yych = *++YYCURSOR;
yy21:
-#line 281
+#line 315
{ YYCURSOR--; STATE = STATE_ARG; continue; }
yy22: yych = *++YYCURSOR;
yy23:
-#line 282
+#line 316
{ PASSTHRU(); continue; }
}
-#line 283
+#line 317
break;
yy26: yych = *++YYCURSOR;
goto yy31;
yy27:
-#line 288
+#line 322
{ PASSTHRU(); HANDLE_ARG(); STATE = STATE_BEFORE_VAL; continue; }
yy28: yych = *++YYCURSOR;
yy29:
-#line 289
+#line 323
{ PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
yy30: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yy31: if(yybm[0+yych] & 128) goto yy30;
goto yy27;
}
-#line 290
+#line 324
case STATE_BEFORE_VAL:
if(yych == ' ') goto yy41;
if(yych == '=') goto yy39;
yy35:
-#line 295
+#line 329
{ YYCURSOR--; STATE = STATE_NEXT_ARG; continue; }
yy36: yych = *++YYCURSOR;
goto yy40;
yy37:
-#line 294
+#line 328
{ PASSTHRU(); STATE = STATE_VAL; continue; }
yy38: yych = *++YYCURSOR;
goto yy35;
case 0: goto yy35;
}
}
-#line 296
+#line 330
break;
}
yy46: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if(yybm[0+yych] & 128) goto yy53;
+ if(yych != '>') goto yy54;
yy47:
-#line 303
+#line 337
{ PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
yy48: yych = *++YYCURSOR;
goto yy52;
yy49:
-#line 302
+#line 336
{ HANDLE_VAL(0); STATE = STATE_NEXT_ARG; continue; }
yy50: yych = *++YYCURSOR;
goto yy47;
}
yy56: yych = *++YYCURSOR;
yy57:
-#line 301
+#line 335
{ HANDLE_VAL(1); STATE = STATE_NEXT_ARG; continue; }
}
-#line 304
+#line 338
break;
}
smart_str_append(dest, &s);
}
+static inline void smart_str_set(smart_str *dest, smart_str *src)
+{
+ dest->len = src->len;
+ dest->a = src->a;
+ dest->c = src->c;
+}
+
static inline void smart_str_setl(smart_str *dest, const char *src, size_t len)
{
dest->len = len;
static inline void attach_url(smart_str *url, smart_str *name, smart_str *val, const char *separator)
{
- if (memchr(url->c, ':', url->len)) return;
-
- if (memchr(url->c, '?', url->len))
- smart_str_appendl(url, separator, 1);
- else
- smart_str_appendl(url, "?", 1);
+ register const char *p, *q;
+ const char *bash = NULL;
+ const char *sep = "?";
+
+ q = url->c + url->len;
+
+ for (p = url->c; p < q; p++) {
+ switch(*p) {
+ case ':':
+ return;
+ case '?':
+ sep = separator;
+ break;
+ case '#':
+ bash = p;
+ break;
+ }
+ }
- smart_str_append(url, name);
- smart_str_appendl(url, "=", 1);
- smart_str_append(url, val);
+ if (bash) {
+ smart_str new = {0};
+
+ smart_str_copyl(&new, url->c, bash - url->c);
+ smart_str_appendl(&new, sep, 1);
+ smart_str_append(&new, name);
+ smart_str_appendl(&new, "=", 1);
+ smart_str_append(&new, val);
+ smart_str_appendl(&new, bash, q - bash);
+
+ smart_str_free(url);
+ smart_str_set(url, &new);
+ } else {
+ smart_str_appendl(url, sep, 1);
+ smart_str_append(url, name);
+ smart_str_appendl(url, "=", 1);
+ smart_str_append(url, val);
+ }
}
struct php_tag_arg {
case STATE_VAL:
/*!re2c
- ["] (any\[">])+ ["] { HANDLE_VAL(1); STATE = STATE_NEXT_ARG; continue; }
+ ["] (any\[">])* ["] { HANDLE_VAL(1); STATE = STATE_NEXT_ARG; continue; }
(any\[ \n>"])+ { HANDLE_VAL(0); STATE = STATE_NEXT_ARG; continue; }
any { PASSTHRU(); STATE = STATE_NEXT_ARG; continue; }
*/