-/* 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"
/*
+----------------------------------------------------------------------+
free(s->c);
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)
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));
}
-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;
smart_str_appends(&ctx->result, "\"");
}
-#line 131
+#line 139
-#define NEXT goto nextiter
+#define NEXT continue
#define COPY_ALL \
smart_str_appendl(&ctx->result, start, YYCURSOR - start); \
static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
{
char *para_start, *arg_start, *tag_start;
- char *start;
+ char *start = NULL;
char *cursor, *marker;
PLS_FETCH();
while (YYCURSOR < YYLIMIT) {
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) {
case STATE_PLAIN:
if(yybm[0+yych] & 128) goto yy4;
yy2: yych = *++YYCURSOR;
yy3:
-#line 186
+#line 196
{ tag_start = YYCURSOR; GO(STATE_TAG); COPY_ALL;}
yy4: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy5: if(yybm[0+yych] & 128) goto yy4;
yy6:
-#line 187
+#line 197
{ COPY_ALL; }
}
-#line 188
+#line 198
break;
if(yych == ' ') goto yy12;
if(yych == '>') goto yy12;
yy10:
-#line 203
+#line 213
{
YYCURSOR--;
GO(STATE_PLAIN);
goto yy10;
yy12: yych = *++YYCURSOR;
yy13:
-#line 193
+#line 203
{
YYCURSOR--;
arg_start = YYCURSOR;
smart_str_copyl(&ctx->tag, start, YYCURSOR - start);
-#ifdef DEBUG
+#ifdef SCANNER_DEBUG
printf("TAG(%s)\n", ctx->tag.c);
#endif
GO(STATE_NEXT_ARG);
case 0: goto yy10;
}
}
-#line 209
+#line 219
break;
yych = *YYCURSOR;
yy21: if(yybm[0+yych] & 128) goto yy20;
yy22:
-#line 214
+#line 224
{
GO(STATE_ARG);
NEXT;
}
yy23: yych = *++YYCURSOR;
yy24:
-#line 218
+#line 228
{
HANDLE_FORM;
GO(STATE_PLAIN);
COPY_ALL;
}
}
-#line 224
+#line 234
break;
if(yych <= '<') goto yy30;
if(yych >= '?') goto yy30;
yy27:
-#line 239
+#line 252
{
arg_start = YYCURSOR;
ctx->state--;
yych = *YYCURSOR;
yy36: if(yych == ' ') goto yy35;
yy37:
-#line 230
+#line 240
{
- smart_str_copyl(&ctx->arg, start, YYCURSOR - start - 1);
-#ifdef DEBUG
+ char *p;
+
+ for (p = start; isalpha(*p); p++);
+ smart_str_copyl(&ctx->arg, start, p - start);
+#ifdef SCANNER_DEBUG
printf("ARG(%s)\n", ctx->arg.c);
#endif
para_start = YYCURSOR;
COPY_ALL;
}
}
-#line 244
+#line 257
break;
yych = *(YYMARKER = ++YYCURSOR);
if(yych != '^') goto yy51;
yy41:
-#line 273
+#line 286
{
YYCURSOR--;
ctx->state = 2;
goto yy41;
yy44: yych = *++YYCURSOR;
yy45:
-#line 261
+#line 274
{
YYCURSOR--;
para_start = NULL;
smart_str_copyl(&ctx->para, start, YYCURSOR - start);
-#ifdef DEBUG
+#ifdef SCANNER_DEBUG
printf("PARA(%s)\n", ctx->para.c);
#endif
tag_arg(ctx PLS_CC);
if(yych != '>') goto yy47;
yy53: yych = *++YYCURSOR;
yy54:
-#line 249
+#line 262
{
YYCURSOR--;
para_start = NULL;
smart_str_copyl(&ctx->para, start + 1, YYCURSOR - start - 2);
-#ifdef DEBUG
+#ifdef SCANNER_DEBUG
printf("PARA(%s)\n", ctx->para.c);
#endif
tag_arg(ctx PLS_CC);
yy58: yych = *++YYCURSOR;
goto yy54;
}
-#line 278
+#line 291
break;
}
smart_str_free(&ctx->work);
}
-#ifdef DEBUG
+#ifdef SCANNER_DEBUG
if (ctx->work.c) {
printf("PRESERVING %s'\n", ctx->work.c);
}
#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)
{
smart_str str = {0,0};
free(s->c);
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)
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));
}
-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;
all = [\000-\377];
*/
-#define NEXT goto nextiter
+#define NEXT continue
#define COPY_ALL \
smart_str_appendl(&ctx->result, start, YYCURSOR - start); \
static void mainloop(url_adapt_state_t *ctx, smart_str *newstuff)
{
char *para_start, *arg_start, *tag_start;
- char *start;
+ char *start = NULL;
char *cursor, *marker;
PLS_FETCH();
while (YYCURSOR < YYLIMIT) {
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) {
case STATE_PLAIN:
YYCURSOR--;
arg_start = YYCURSOR;
smart_str_copyl(&ctx->tag, start, YYCURSOR - start);
-#ifdef DEBUG
+#ifdef SCANNER_DEBUG
printf("TAG(%s)\n", ctx->tag.c);
#endif
GO(STATE_NEXT_ARG);
smart_str_appendl(&ctx->result, " ", 1);
/*!re2c
[a-zA-Z]+ [ ]* "=" [ ]* {
- smart_str_copyl(&ctx->arg, start, YYCURSOR - start - 1);
-#ifdef DEBUG
+ char *p;
+
+ for (p = start; isalpha(*p); p++);
+ smart_str_copyl(&ctx->arg, start, p - start);
+#ifdef SCANNER_DEBUG
printf("ARG(%s)\n", ctx->arg.c);
#endif
para_start = YYCURSOR;
YYCURSOR--;
para_start = NULL;
smart_str_copyl(&ctx->para, start + 1, YYCURSOR - start - 2);
-#ifdef DEBUG
+#ifdef SCANNER_DEBUG
printf("PARA(%s)\n", ctx->para.c);
#endif
tag_arg(ctx PLS_CC);
YYCURSOR--;
para_start = NULL;
smart_str_copyl(&ctx->para, start, YYCURSOR - start);
-#ifdef DEBUG
+#ifdef SCANNER_DEBUG
printf("PARA(%s)\n", ctx->para.c);
#endif
tag_arg(ctx PLS_CC);
smart_str_free(&ctx->work);
}
-#ifdef DEBUG
+#ifdef SCANNER_DEBUG
if (ctx->work.c) {
printf("PRESERVING %s'\n", ctx->work.c);
}
#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)
{
smart_str str = {0,0};