diff --git a/MSVC/.gitignore b/MSVC/.gitignore new file mode 100644 index 0000000..151afe7 --- /dev/null +++ b/MSVC/.gitignore @@ -0,0 +1,7 @@ +Debug +Release +*.iobj +*.ipdb +*.opendb +*.db +test diff --git a/compile.c b/compile.c index 4ee9251..c21a7d4 100644 --- a/compile.c +++ b/compile.c @@ -29,6 +29,8 @@ static int yyl(void) return ++prev; } +static int toLowerCase(int c) { return c >= 'A' && c <= 'Z' ? c | 0x20 : c; } +static int toUpperCase(int c) { return c >= 'a' && c <= 'z' ? c & ~0x20 : c; } static void charClassSet (unsigned char bits[], int c) { bits[c >> 3] |= (1 << (c & 7)); } static void charClassClear(unsigned char bits[], int c) { bits[c >> 3] &= ~(1 << (c & 7)); } @@ -54,6 +56,20 @@ static int readChar(unsigned char **cp) c= oct; goto done; } + else if (c == 'x') + { + unsigned char hex = 0; + c = toUpperCase(*cclass++); + for (i = 1; i >= 0; i--) { + if (!(c >= '0' && c <= '9') && !(c >= 'A' && c <= 'F')) + break; + hex = (hex * 16) + (c - (c < 'A' ? '0' : 'A' - 10)); + c = toUpperCase(*cclass++); + } + cclass--; + c = hex; + goto done; + } switch (c) { @@ -121,7 +137,7 @@ static char *yyqq(char* s) { return dst; } -static char *makeCharClass(unsigned char *cclass) +static char *makeCharClass(unsigned char *cclass, int flags) { unsigned char bits[32]; setter set; @@ -145,13 +161,28 @@ static char *makeCharClass(unsigned char *cclass) if ('-' == c && *cclass && prev >= 0) { for (c= readChar(&cclass); prev <= c; ++prev) - set(bits, prev); + { + if (IgnoreCase & flags) + { + set(bits, toLowerCase(prev)); + set(bits, toUpperCase(prev)); + } + else + set(bits, prev); + } prev= -1; } else - { - set(bits, prev= c); - } + { + prev = c; + if (IgnoreCase & flags) + { + set(bits, toLowerCase(prev)); + set(bits, toUpperCase(prev)); + } + else + set(bits, prev); + } } ptr= string; @@ -203,7 +234,11 @@ static void Node_compile_c_ko(Node *node, int ko) case String: { int len= strlen(node->string.value); - if (1 == len) + if (IgnoreCase & node->string.flags) + { + fprintf(output, " if (!yymatchNoCaseString(G, \"%s\")) goto l%d;\n", node->string.value, ko); + } + else if (1 == len) { if ('\'' == node->string.value[0]) fprintf(output, " if (!yymatchChar(G, '\\'')) goto l%d;\n", ko); @@ -219,7 +254,7 @@ static void Node_compile_c_ko(Node *node, int ko) break; case Class: - fprintf(output, " if (!yymatchClass(G, (const unsigned char *)\"%s\", \"%s\")) goto l%d;\n", makeCharClass(node->cclass.value), yyqq((char*)node->cclass.value), ko); + fprintf(output, " if (!yymatchClass(G, (const unsigned char *)\"%s\", \"%s\")) goto l%d;\n", makeCharClass(node->cclass.value, node->cclass.flags), yyqq((char*)node->cclass.value), ko); break; case Action: @@ -610,6 +645,25 @@ YY_LOCAL(int) yymatchString(GREG *G, const char *s)\n\ return 1;\n\ }\n\ \n\ +YY_LOCAL(int) yymatchNoCaseString(GREG *G, const char *s)\n\ +{\n\ + #define YY_TOUPPER(ch) ((ch) >= 'a' && (ch) <= 'z' ? (ch) & 0xffdf : (ch))\n\ + int yysav= G->pos;\n\ + while (*s)\n\ + {\n\ + if (G->pos >= G->limit && !yyrefill(G)) return 0;\n\ + if (YY_TOUPPER(G->buf[G->pos]) != YY_TOUPPER(*s))\n\ + {\n\ + G->pos= yysav;\n\ + return 0;\n\ + }\n\ + ++s;\n\ + ++G->pos;\n\ + }\n\ + return 1;\n\ + #undef YY_TOUPPER\n\ +}\n\ +\n\ YY_LOCAL(int) yymatchClass(GREG *G, const unsigned char *bits, const char *cclass)\n\ {\n\ int c;\n\ diff --git a/greg.c b/greg.c index 49b6f03..cb3298a 100644 --- a/greg.c +++ b/greg.c @@ -1,10 +1,10 @@ -/* A recursive-descent parser generated by greg 0.4.5 */ +/* A recursive-descent parser generated by greg 0.4.6 */ #include #include #include struct _GREG; -#define YYRULECOUNT 39 +#define YYRULECOUNT 43 # include "greg.h" @@ -344,20 +344,24 @@ YY_LOCAL(void) yySet(GREG *G, char *text, int count, yythunk *thunk, YY_XTYPE YY #define YYACCEPT yyAccept(G, yythunkpos0) -YY_RULE(int) yy_till_end_of_line(GREG *G); /* 39 */ -YY_RULE(int) yy_end_of_line(GREG *G); /* 38 */ -YY_RULE(int) yy_quoted_comment(GREG *G); /* 37 */ -YY_RULE(int) yy_single_line_comment(GREG *G); /* 36 */ -YY_RULE(int) yy_space(GREG *G); /* 35 */ -YY_RULE(int) yy_braces(GREG *G); /* 34 */ -YY_RULE(int) yy_range(GREG *G); /* 33 */ -YY_RULE(int) yy_char(GREG *G); /* 32 */ -YY_RULE(int) yy_errblock(GREG *G); /* 31 */ -YY_RULE(int) yy_END(GREG *G); /* 30 */ -YY_RULE(int) yy_BEGIN(GREG *G); /* 29 */ -YY_RULE(int) yy_DOT(GREG *G); /* 28 */ -YY_RULE(int) yy_class(GREG *G); /* 27 */ -YY_RULE(int) yy_literal(GREG *G); /* 26 */ +YY_RULE(int) yy_till_end_of_line(GREG *G); /* 43 */ +YY_RULE(int) yy_end_of_line(GREG *G); /* 42 */ +YY_RULE(int) yy_quoted_comment(GREG *G); /* 41 */ +YY_RULE(int) yy_single_line_comment(GREG *G); /* 40 */ +YY_RULE(int) yy_space(GREG *G); /* 39 */ +YY_RULE(int) yy_braces(GREG *G); /* 38 */ +YY_RULE(int) yy_range(GREG *G); /* 37 */ +YY_RULE(int) yy_class_core(GREG *G); /* 36 */ +YY_RULE(int) yy_char(GREG *G); /* 35 */ +YY_RULE(int) yy_literal_core(GREG *G); /* 34 */ +YY_RULE(int) yy_errblock(GREG *G); /* 33 */ +YY_RULE(int) yy_END(GREG *G); /* 32 */ +YY_RULE(int) yy_BEGIN(GREG *G); /* 31 */ +YY_RULE(int) yy_DOT(GREG *G); /* 30 */ +YY_RULE(int) yy_class(GREG *G); /* 29 */ +YY_RULE(int) yy_classi(GREG *G); /* 28 */ +YY_RULE(int) yy_literal(GREG *G); /* 27 */ +YY_RULE(int) yy_literali(GREG *G); /* 26 */ YY_RULE(int) yy_CLOSE(GREG *G); /* 25 */ YY_RULE(int) yy_OPEN(GREG *G); /* 24 */ YY_RULE(int) yy_COLON(GREG *G); /* 23 */ @@ -384,54 +388,68 @@ YY_RULE(int) yy_declaration(GREG *G); /* 3 */ YY_RULE(int) yy__(GREG *G); /* 2 */ YY_RULE(int) yy_grammar(GREG *G); /* 1 */ -YY_ACTION(void) yy_10_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) +YY_ACTION(void) yy_12_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) { - yyprintf((stderr, "do yy_10_primary")); + yyprintf((stderr, "do yy_12_primary")); yyprintfvTcontext(yytext); yyprintf((stderr, "\n {Node *node = pop(); ((struct Any *) node)->errblock = strdup(yytext); push(node); }\n")); Node *node = pop(); ((struct Any *) node)->errblock = strdup(yytext); push(node); ; } -YY_ACTION(void) yy_9_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) +YY_ACTION(void) yy_11_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) { - yyprintf((stderr, "do yy_9_primary")); + yyprintf((stderr, "do yy_11_primary")); yyprintfvTcontext(yytext); yyprintf((stderr, "\n {push(makePredicate(\"YY_END\")); }\n")); push(makePredicate("YY_END")); ; } -YY_ACTION(void) yy_8_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) +YY_ACTION(void) yy_10_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) { - yyprintf((stderr, "do yy_8_primary")); + yyprintf((stderr, "do yy_10_primary")); yyprintfvTcontext(yytext); yyprintf((stderr, "\n {push(makePredicate(\"YY_BEGIN\")); }\n")); push(makePredicate("YY_BEGIN")); ; } -YY_ACTION(void) yy_7_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) +YY_ACTION(void) yy_9_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) { - yyprintf((stderr, "do yy_7_primary")); + yyprintf((stderr, "do yy_9_primary")); yyprintfvTcontext(yytext); yyprintf((stderr, "\n {push(makeAction(yytext)); }\n")); push(makeAction(yytext)); ; } -YY_ACTION(void) yy_6_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) +YY_ACTION(void) yy_8_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) { - yyprintf((stderr, "do yy_6_primary")); + yyprintf((stderr, "do yy_8_primary")); yyprintfvTcontext(yytext); yyprintf((stderr, "\n {push(makeDot()); }\n")); push(makeDot()); ; } +YY_ACTION(void) yy_7_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) +{ + yyprintf((stderr, "do yy_7_primary")); + yyprintfvTcontext(yytext); + yyprintf((stderr, "\n {push(makeClass(yytext,0)); }\n")); + push(makeClass(yytext,0)); ; +} +YY_ACTION(void) yy_6_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) +{ + yyprintf((stderr, "do yy_6_primary")); + yyprintfvTcontext(yytext); + yyprintf((stderr, "\n {push(makeClass(yytext,1)); }\n")); + push(makeClass(yytext,1)); ; +} YY_ACTION(void) yy_5_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) { yyprintf((stderr, "do yy_5_primary")); yyprintfvTcontext(yytext); - yyprintf((stderr, "\n {push(makeClass(yytext)); }\n")); - push(makeClass(yytext)); ; + yyprintf((stderr, "\n {push(makeString(yytext,0)); }\n")); + push(makeString(yytext,0)); ; } YY_ACTION(void) yy_4_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) { yyprintf((stderr, "do yy_4_primary")); yyprintfvTcontext(yytext); - yyprintf((stderr, "\n {push(makeString(yytext)); }\n")); - push(makeString(yytext)); ; + yyprintf((stderr, "\n {push(makeString(yytext,1)); }\n")); + push(makeString(yytext,1)); ; } YY_ACTION(void) yy_3_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) { @@ -704,37 +722,109 @@ YY_RULE(int) yy_range(GREG *G) return 0; } +YY_RULE(int) yy_class_core(GREG *G) +{ int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "class_core")); + if (!yymatchChar(G, '[')) goto l30; + yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l30; + l31:; + { int yypos32= G->pos, yythunkpos32= G->thunkpos; + { int yypos33= G->pos, yythunkpos33= G->thunkpos; if (!yymatchChar(G, ']')) goto l33; + goto l32; + l33:; G->pos= yypos33; G->thunkpos= yythunkpos33; + } if (!yy_range(G)) goto l32; + goto l31; + l32:; G->pos= yypos32; G->thunkpos= yythunkpos32; + } yyText(G, G->begin, G->end); if (!(YY_END)) goto l30; if (!yymatchChar(G, ']')) goto l30; + yyprintf((stderr, " ok class_core")); + yyprintfGcontext; + yyprintf((stderr, "\n")); + + return 1; + l30:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "class_core")); + yyprintfvGcontext; + yyprintfv((stderr, "\n")); + + return 0; +} YY_RULE(int) yy_char(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "char")); - { int yypos31= G->pos, yythunkpos31= G->thunkpos; if (!yymatchChar(G, '\\')) goto l32; - if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\204\000\000\000\000\000\000\070\146\100\124\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "abefnrtv'\"\\[\\]\\\\")) goto l32; - goto l31; - l32:; G->pos= yypos31; G->thunkpos= yythunkpos31; if (!yymatchChar(G, '\\')) goto l33; - if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\017\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-3")) goto l33; - if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l33; - if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l33; - goto l31; - l33:; G->pos= yypos31; G->thunkpos= yythunkpos31; if (!yymatchChar(G, '\\')) goto l34; - if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l34; - - { int yypos35= G->pos, yythunkpos35= G->thunkpos; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l35; - goto l36; - l35:; G->pos= yypos35; G->thunkpos= yythunkpos35; + { int yypos35= G->pos, yythunkpos35= G->thunkpos; if (!yymatchChar(G, '\\')) goto l36; + if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\204\000\000\000\000\000\000\070\146\100\124\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "abefnrtv'\"\\[\\]\\\\")) goto l36; + goto l35; + l36:; G->pos= yypos35; G->thunkpos= yythunkpos35; if (!yymatchChar(G, '\\')) goto l37; + if (!yymatchChar(G, 'x')) goto l37; + if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\003\176\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-9A-Fa-f")) goto l37; + if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\003\176\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-9A-Fa-f")) goto l37; + goto l35; + l37:; G->pos= yypos35; G->thunkpos= yythunkpos35; if (!yymatchChar(G, '\\')) goto l38; + if (!yymatchChar(G, 'x')) goto l38; + if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\003\176\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-9A-Fa-f")) goto l38; + goto l35; + l38:; G->pos= yypos35; G->thunkpos= yythunkpos35; if (!yymatchChar(G, '\\')) goto l39; + if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\017\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-3")) goto l39; + if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l39; + if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l39; + goto l35; + l39:; G->pos= yypos35; G->thunkpos= yythunkpos35; if (!yymatchChar(G, '\\')) goto l40; + if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l40; + + { int yypos41= G->pos, yythunkpos41= G->thunkpos; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "0-7")) goto l41; + goto l42; + l41:; G->pos= yypos41; G->thunkpos= yythunkpos41; } - l36:; goto l31; - l34:; G->pos= yypos31; G->thunkpos= yythunkpos31; - { int yypos37= G->pos, yythunkpos37= G->thunkpos; if (!yymatchChar(G, '\\')) goto l37; - goto l30; - l37:; G->pos= yypos37; G->thunkpos= yythunkpos37; - } if (!yymatchDot(G)) goto l30; + l42:; goto l35; + l40:; G->pos= yypos35; G->thunkpos= yythunkpos35; + { int yypos43= G->pos, yythunkpos43= G->thunkpos; if (!yymatchChar(G, '\\')) goto l43; + goto l34; + l43:; G->pos= yypos43; G->thunkpos= yythunkpos43; + } if (!yymatchDot(G)) goto l34; + } + l35:; yyprintf((stderr, " ok char")); + yyprintfGcontext; + yyprintf((stderr, "\n")); + + return 1; + l34:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "char")); + yyprintfvGcontext; + yyprintfv((stderr, "\n")); + + return 0; +} +YY_RULE(int) yy_literal_core(GREG *G) +{ int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "literal_core")); + + { int yypos45= G->pos, yythunkpos45= G->thunkpos; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "'")) goto l46; + yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l46; + l47:; + { int yypos48= G->pos, yythunkpos48= G->thunkpos; + { int yypos49= G->pos, yythunkpos49= G->thunkpos; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "'")) goto l49; + goto l48; + l49:; G->pos= yypos49; G->thunkpos= yythunkpos49; + } if (!yy_char(G)) goto l48; + goto l47; + l48:; G->pos= yypos48; G->thunkpos= yythunkpos48; + } yyText(G, G->begin, G->end); if (!(YY_END)) goto l46; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "'")) goto l46; + goto l45; + l46:; G->pos= yypos45; G->thunkpos= yythunkpos45; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\"")) goto l44; + yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l44; + l50:; + { int yypos51= G->pos, yythunkpos51= G->thunkpos; + { int yypos52= G->pos, yythunkpos52= G->thunkpos; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\"")) goto l52; + goto l51; + l52:; G->pos= yypos52; G->thunkpos= yythunkpos52; + } if (!yy_char(G)) goto l51; + goto l50; + l51:; G->pos= yypos51; G->thunkpos= yythunkpos51; + } yyText(G, G->begin, G->end); if (!(YY_END)) goto l44; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\"")) goto l44; + } - l31:; yyprintf((stderr, " ok char")); + l45:; yyprintf((stderr, " ok literal_core")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l30:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "char")); + l44:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "literal_core")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -742,20 +832,20 @@ YY_RULE(int) yy_char(GREG *G) } YY_RULE(int) yy_errblock(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "errblock")); - if (!yymatchString(G, "~{")) goto l38; - yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l38; - l39:; - { int yypos40= G->pos, yythunkpos40= G->thunkpos; if (!yy_braces(G)) goto l40; - goto l39; - l40:; G->pos= yypos40; G->thunkpos= yythunkpos40; - } yyText(G, G->begin, G->end); if (!(YY_END)) goto l38; if (!yymatchChar(G, '}')) goto l38; - if (!yy__(G)) goto l38; + if (!yymatchString(G, "~{")) goto l53; + yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l53; + l54:; + { int yypos55= G->pos, yythunkpos55= G->thunkpos; if (!yy_braces(G)) goto l55; + goto l54; + l55:; G->pos= yypos55; G->thunkpos= yythunkpos55; + } yyText(G, G->begin, G->end); if (!(YY_END)) goto l53; if (!yymatchChar(G, '}')) goto l53; + if (!yy__(G)) goto l53; yyprintf((stderr, " ok errblock")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l38:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "errblock")); + l53:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "errblock")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -763,14 +853,14 @@ YY_RULE(int) yy_errblock(GREG *G) } YY_RULE(int) yy_END(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "END")); - if (!yymatchChar(G, '>')) goto l41; - if (!yy__(G)) goto l41; + if (!yymatchChar(G, '>')) goto l56; + if (!yy__(G)) goto l56; yyprintf((stderr, " ok END")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l41:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "END")); + l56:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "END")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -778,14 +868,14 @@ YY_RULE(int) yy_END(GREG *G) } YY_RULE(int) yy_BEGIN(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "BEGIN")); - if (!yymatchChar(G, '<')) goto l42; - if (!yy__(G)) goto l42; + if (!yymatchChar(G, '<')) goto l57; + if (!yy__(G)) goto l57; yyprintf((stderr, " ok BEGIN")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l42:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "BEGIN")); + l57:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "BEGIN")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -793,14 +883,14 @@ YY_RULE(int) yy_BEGIN(GREG *G) } YY_RULE(int) yy_DOT(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "DOT")); - if (!yymatchChar(G, '.')) goto l43; - if (!yy__(G)) goto l43; + if (!yymatchChar(G, '.')) goto l58; + if (!yy__(G)) goto l58; yyprintf((stderr, " ok DOT")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l43:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "DOT")); + l58:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "DOT")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -808,24 +898,30 @@ YY_RULE(int) yy_DOT(GREG *G) } YY_RULE(int) yy_class(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "class")); - if (!yymatchChar(G, '[')) goto l44; - yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l44; - l45:; - { int yypos46= G->pos, yythunkpos46= G->thunkpos; - { int yypos47= G->pos, yythunkpos47= G->thunkpos; if (!yymatchChar(G, ']')) goto l47; - goto l46; - l47:; G->pos= yypos47; G->thunkpos= yythunkpos47; - } if (!yy_range(G)) goto l46; - goto l45; - l46:; G->pos= yypos46; G->thunkpos= yythunkpos46; - } yyText(G, G->begin, G->end); if (!(YY_END)) goto l44; if (!yymatchChar(G, ']')) goto l44; - if (!yy__(G)) goto l44; + if (!yy_class_core(G)) goto l59; + if (!yy__(G)) goto l59; yyprintf((stderr, " ok class")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l44:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "class")); + l59:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "class")); + yyprintfvGcontext; + yyprintfv((stderr, "\n")); + + return 0; +} +YY_RULE(int) yy_classi(GREG *G) +{ int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "classi")); + if (!yy_class_core(G)) goto l60; + if (!yymatchChar(G, 'i')) goto l60; + if (!yy__(G)) goto l60; + yyprintf((stderr, " ok classi")); + yyprintfGcontext; + yyprintf((stderr, "\n")); + + return 1; + l60:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "classi")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -833,40 +929,30 @@ YY_RULE(int) yy_class(GREG *G) } YY_RULE(int) yy_literal(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "literal")); + if (!yy_literal_core(G)) goto l61; + if (!yy__(G)) goto l61; + yyprintf((stderr, " ok literal")); + yyprintfGcontext; + yyprintf((stderr, "\n")); - { int yypos49= G->pos, yythunkpos49= G->thunkpos; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "'")) goto l50; - yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l50; - l51:; - { int yypos52= G->pos, yythunkpos52= G->thunkpos; - { int yypos53= G->pos, yythunkpos53= G->thunkpos; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "'")) goto l53; - goto l52; - l53:; G->pos= yypos53; G->thunkpos= yythunkpos53; - } if (!yy_char(G)) goto l52; - goto l51; - l52:; G->pos= yypos52; G->thunkpos= yythunkpos52; - } yyText(G, G->begin, G->end); if (!(YY_END)) goto l50; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "'")) goto l50; - if (!yy__(G)) goto l50; - goto l49; - l50:; G->pos= yypos49; G->thunkpos= yythunkpos49; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\"")) goto l48; - yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l48; - l54:; - { int yypos55= G->pos, yythunkpos55= G->thunkpos; - { int yypos56= G->pos, yythunkpos56= G->thunkpos; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\"")) goto l56; - goto l55; - l56:; G->pos= yypos56; G->thunkpos= yythunkpos56; - } if (!yy_char(G)) goto l55; - goto l54; - l55:; G->pos= yypos55; G->thunkpos= yythunkpos55; - } yyText(G, G->begin, G->end); if (!(YY_END)) goto l48; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\"")) goto l48; - if (!yy__(G)) goto l48; + return 1; + l61:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "literal")); + yyprintfvGcontext; + yyprintfv((stderr, "\n")); - } - l49:; yyprintf((stderr, " ok literal")); + return 0; +} +YY_RULE(int) yy_literali(GREG *G) +{ int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "literali")); + if (!yy_literal_core(G)) goto l62; + if (!yymatchChar(G, 'i')) goto l62; + if (!yy__(G)) goto l62; + yyprintf((stderr, " ok literali")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l48:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "literal")); + l62:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "literali")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -874,14 +960,14 @@ YY_RULE(int) yy_literal(GREG *G) } YY_RULE(int) yy_CLOSE(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "CLOSE")); - if (!yymatchChar(G, ')')) goto l57; - if (!yy__(G)) goto l57; + if (!yymatchChar(G, ')')) goto l63; + if (!yy__(G)) goto l63; yyprintf((stderr, " ok CLOSE")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l57:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "CLOSE")); + l63:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "CLOSE")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -889,14 +975,14 @@ YY_RULE(int) yy_CLOSE(GREG *G) } YY_RULE(int) yy_OPEN(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "OPEN")); - if (!yymatchChar(G, '(')) goto l58; - if (!yy__(G)) goto l58; + if (!yymatchChar(G, '(')) goto l64; + if (!yy__(G)) goto l64; yyprintf((stderr, " ok OPEN")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l58:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "OPEN")); + l64:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "OPEN")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -904,14 +990,14 @@ YY_RULE(int) yy_OPEN(GREG *G) } YY_RULE(int) yy_COLON(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "COLON")); - if (!yymatchChar(G, ':')) goto l59; - if (!yy__(G)) goto l59; + if (!yymatchChar(G, ':')) goto l65; + if (!yy__(G)) goto l65; yyprintf((stderr, " ok COLON")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l59:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "COLON")); + l65:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "COLON")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -919,14 +1005,14 @@ YY_RULE(int) yy_COLON(GREG *G) } YY_RULE(int) yy_PLUS(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "PLUS")); - if (!yymatchChar(G, '+')) goto l60; - if (!yy__(G)) goto l60; + if (!yymatchChar(G, '+')) goto l66; + if (!yy__(G)) goto l66; yyprintf((stderr, " ok PLUS")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l60:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "PLUS")); + l66:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "PLUS")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -934,14 +1020,14 @@ YY_RULE(int) yy_PLUS(GREG *G) } YY_RULE(int) yy_STAR(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "STAR")); - if (!yymatchChar(G, '*')) goto l61; - if (!yy__(G)) goto l61; + if (!yymatchChar(G, '*')) goto l67; + if (!yy__(G)) goto l67; yyprintf((stderr, " ok STAR")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l61:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "STAR")); + l67:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "STAR")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -949,14 +1035,14 @@ YY_RULE(int) yy_STAR(GREG *G) } YY_RULE(int) yy_QUESTION(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "QUESTION")); - if (!yymatchChar(G, '?')) goto l62; - if (!yy__(G)) goto l62; + if (!yymatchChar(G, '?')) goto l68; + if (!yy__(G)) goto l68; yyprintf((stderr, " ok QUESTION")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l62:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "QUESTION")); + l68:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "QUESTION")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -965,58 +1051,64 @@ YY_RULE(int) yy_QUESTION(GREG *G) YY_RULE(int) yy_primary(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "primary")); - { int yypos64= G->pos, yythunkpos64= G->thunkpos; if (!yy_identifier(G)) goto l65; + { int yypos70= G->pos, yythunkpos70= G->thunkpos; if (!yy_identifier(G)) goto l71; yyDo(G, yy_1_primary, G->begin, G->end, "yy_1_primary"); - if (!yy_COLON(G)) goto l65; - if (!yy_identifier(G)) goto l65; + if (!yy_COLON(G)) goto l71; + if (!yy_identifier(G)) goto l71; - { int yypos66= G->pos, yythunkpos66= G->thunkpos; if (!yy_EQUAL(G)) goto l66; - goto l65; - l66:; G->pos= yypos66; G->thunkpos= yythunkpos66; + { int yypos72= G->pos, yythunkpos72= G->thunkpos; if (!yy_EQUAL(G)) goto l72; + goto l71; + l72:; G->pos= yypos72; G->thunkpos= yythunkpos72; } yyDo(G, yy_2_primary, G->begin, G->end, "yy_2_primary"); - goto l64; - l65:; G->pos= yypos64; G->thunkpos= yythunkpos64; if (!yy_identifier(G)) goto l67; + goto l70; + l71:; G->pos= yypos70; G->thunkpos= yythunkpos70; if (!yy_identifier(G)) goto l73; - { int yypos68= G->pos, yythunkpos68= G->thunkpos; if (!yy_EQUAL(G)) goto l68; - goto l67; - l68:; G->pos= yypos68; G->thunkpos= yythunkpos68; + { int yypos74= G->pos, yythunkpos74= G->thunkpos; if (!yy_EQUAL(G)) goto l74; + goto l73; + l74:; G->pos= yypos74; G->thunkpos= yythunkpos74; } yyDo(G, yy_3_primary, G->begin, G->end, "yy_3_primary"); - goto l64; - l67:; G->pos= yypos64; G->thunkpos= yythunkpos64; if (!yy_OPEN(G)) goto l69; - if (!yy_expression(G)) goto l69; - if (!yy_CLOSE(G)) goto l69; - goto l64; - l69:; G->pos= yypos64; G->thunkpos= yythunkpos64; if (!yy_literal(G)) goto l70; + goto l70; + l73:; G->pos= yypos70; G->thunkpos= yythunkpos70; if (!yy_OPEN(G)) goto l75; + if (!yy_expression(G)) goto l75; + if (!yy_CLOSE(G)) goto l75; + goto l70; + l75:; G->pos= yypos70; G->thunkpos= yythunkpos70; if (!yy_literali(G)) goto l76; yyDo(G, yy_4_primary, G->begin, G->end, "yy_4_primary"); - goto l64; - l70:; G->pos= yypos64; G->thunkpos= yythunkpos64; if (!yy_class(G)) goto l71; + goto l70; + l76:; G->pos= yypos70; G->thunkpos= yythunkpos70; if (!yy_literal(G)) goto l77; yyDo(G, yy_5_primary, G->begin, G->end, "yy_5_primary"); - goto l64; - l71:; G->pos= yypos64; G->thunkpos= yythunkpos64; if (!yy_DOT(G)) goto l72; + goto l70; + l77:; G->pos= yypos70; G->thunkpos= yythunkpos70; if (!yy_classi(G)) goto l78; yyDo(G, yy_6_primary, G->begin, G->end, "yy_6_primary"); - goto l64; - l72:; G->pos= yypos64; G->thunkpos= yythunkpos64; if (!yy_action(G)) goto l73; + goto l70; + l78:; G->pos= yypos70; G->thunkpos= yythunkpos70; if (!yy_class(G)) goto l79; yyDo(G, yy_7_primary, G->begin, G->end, "yy_7_primary"); - goto l64; - l73:; G->pos= yypos64; G->thunkpos= yythunkpos64; if (!yy_BEGIN(G)) goto l74; + goto l70; + l79:; G->pos= yypos70; G->thunkpos= yythunkpos70; if (!yy_DOT(G)) goto l80; yyDo(G, yy_8_primary, G->begin, G->end, "yy_8_primary"); - goto l64; - l74:; G->pos= yypos64; G->thunkpos= yythunkpos64; if (!yy_END(G)) goto l63; + goto l70; + l80:; G->pos= yypos70; G->thunkpos= yythunkpos70; if (!yy_action(G)) goto l81; yyDo(G, yy_9_primary, G->begin, G->end, "yy_9_primary"); + goto l70; + l81:; G->pos= yypos70; G->thunkpos= yythunkpos70; if (!yy_BEGIN(G)) goto l82; + yyDo(G, yy_10_primary, G->begin, G->end, "yy_10_primary"); + goto l70; + l82:; G->pos= yypos70; G->thunkpos= yythunkpos70; if (!yy_END(G)) goto l69; + yyDo(G, yy_11_primary, G->begin, G->end, "yy_11_primary"); } - l64:; - { int yypos75= G->pos, yythunkpos75= G->thunkpos; if (!yy_errblock(G)) goto l75; - yyDo(G, yy_10_primary, G->begin, G->end, "yy_10_primary"); - goto l76; - l75:; G->pos= yypos75; G->thunkpos= yythunkpos75; + l70:; + { int yypos83= G->pos, yythunkpos83= G->thunkpos; if (!yy_errblock(G)) goto l83; + yyDo(G, yy_12_primary, G->begin, G->end, "yy_12_primary"); + goto l84; + l83:; G->pos= yypos83; G->thunkpos= yythunkpos83; } - l76:; yyprintf((stderr, " ok primary")); + l84:; yyprintf((stderr, " ok primary")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l63:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "primary")); + l69:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "primary")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1024,14 +1116,14 @@ YY_RULE(int) yy_primary(GREG *G) } YY_RULE(int) yy_NOT(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "NOT")); - if (!yymatchChar(G, '!')) goto l77; - if (!yy__(G)) goto l77; + if (!yymatchChar(G, '!')) goto l85; + if (!yy__(G)) goto l85; yyprintf((stderr, " ok NOT")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l77:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "NOT")); + l85:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "NOT")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1039,28 +1131,28 @@ YY_RULE(int) yy_NOT(GREG *G) } YY_RULE(int) yy_suffix(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "suffix")); - if (!yy_primary(G)) goto l78; + if (!yy_primary(G)) goto l86; - { int yypos79= G->pos, yythunkpos79= G->thunkpos; - { int yypos81= G->pos, yythunkpos81= G->thunkpos; if (!yy_QUESTION(G)) goto l82; + { int yypos87= G->pos, yythunkpos87= G->thunkpos; + { int yypos89= G->pos, yythunkpos89= G->thunkpos; if (!yy_QUESTION(G)) goto l90; yyDo(G, yy_1_suffix, G->begin, G->end, "yy_1_suffix"); - goto l81; - l82:; G->pos= yypos81; G->thunkpos= yythunkpos81; if (!yy_STAR(G)) goto l83; + goto l89; + l90:; G->pos= yypos89; G->thunkpos= yythunkpos89; if (!yy_STAR(G)) goto l91; yyDo(G, yy_2_suffix, G->begin, G->end, "yy_2_suffix"); - goto l81; - l83:; G->pos= yypos81; G->thunkpos= yythunkpos81; if (!yy_PLUS(G)) goto l79; + goto l89; + l91:; G->pos= yypos89; G->thunkpos= yythunkpos89; if (!yy_PLUS(G)) goto l87; yyDo(G, yy_3_suffix, G->begin, G->end, "yy_3_suffix"); } - l81:; goto l80; - l79:; G->pos= yypos79; G->thunkpos= yythunkpos79; + l89:; goto l88; + l87:; G->pos= yypos87; G->thunkpos= yythunkpos87; } - l80:; yyprintf((stderr, " ok suffix")); + l88:; yyprintf((stderr, " ok suffix")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l78:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "suffix")); + l86:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "suffix")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1068,20 +1160,20 @@ YY_RULE(int) yy_suffix(GREG *G) } YY_RULE(int) yy_action(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "action")); - if (!yymatchChar(G, '{')) goto l84; - yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l84; - l85:; - { int yypos86= G->pos, yythunkpos86= G->thunkpos; if (!yy_braces(G)) goto l86; - goto l85; - l86:; G->pos= yypos86; G->thunkpos= yythunkpos86; - } yyText(G, G->begin, G->end); if (!(YY_END)) goto l84; if (!yymatchChar(G, '}')) goto l84; - if (!yy__(G)) goto l84; + if (!yymatchChar(G, '{')) goto l92; + yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l92; + l93:; + { int yypos94= G->pos, yythunkpos94= G->thunkpos; if (!yy_braces(G)) goto l94; + goto l93; + l94:; G->pos= yypos94; G->thunkpos= yythunkpos94; + } yyText(G, G->begin, G->end); if (!(YY_END)) goto l92; if (!yymatchChar(G, '}')) goto l92; + if (!yy__(G)) goto l92; yyprintf((stderr, " ok action")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l84:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "action")); + l92:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "action")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1089,14 +1181,14 @@ YY_RULE(int) yy_action(GREG *G) } YY_RULE(int) yy_AND(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "AND")); - if (!yymatchChar(G, '&')) goto l87; - if (!yy__(G)) goto l87; + if (!yymatchChar(G, '&')) goto l95; + if (!yy__(G)) goto l95; yyprintf((stderr, " ok AND")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l87:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "AND")); + l95:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "AND")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1105,27 +1197,27 @@ YY_RULE(int) yy_AND(GREG *G) YY_RULE(int) yy_prefix(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "prefix")); - { int yypos89= G->pos, yythunkpos89= G->thunkpos; if (!yy_AND(G)) goto l90; - if (!yy_action(G)) goto l90; + { int yypos97= G->pos, yythunkpos97= G->thunkpos; if (!yy_AND(G)) goto l98; + if (!yy_action(G)) goto l98; yyDo(G, yy_1_prefix, G->begin, G->end, "yy_1_prefix"); - goto l89; - l90:; G->pos= yypos89; G->thunkpos= yythunkpos89; if (!yy_AND(G)) goto l91; - if (!yy_suffix(G)) goto l91; + goto l97; + l98:; G->pos= yypos97; G->thunkpos= yythunkpos97; if (!yy_AND(G)) goto l99; + if (!yy_suffix(G)) goto l99; yyDo(G, yy_2_prefix, G->begin, G->end, "yy_2_prefix"); - goto l89; - l91:; G->pos= yypos89; G->thunkpos= yythunkpos89; if (!yy_NOT(G)) goto l92; - if (!yy_suffix(G)) goto l92; + goto l97; + l99:; G->pos= yypos97; G->thunkpos= yythunkpos97; if (!yy_NOT(G)) goto l100; + if (!yy_suffix(G)) goto l100; yyDo(G, yy_3_prefix, G->begin, G->end, "yy_3_prefix"); - goto l89; - l92:; G->pos= yypos89; G->thunkpos= yythunkpos89; if (!yy_suffix(G)) goto l88; + goto l97; + l100:; G->pos= yypos97; G->thunkpos= yythunkpos97; if (!yy_suffix(G)) goto l96; } - l89:; yyprintf((stderr, " ok prefix")); + l97:; yyprintf((stderr, " ok prefix")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l88:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "prefix")); + l96:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "prefix")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1133,14 +1225,14 @@ YY_RULE(int) yy_prefix(GREG *G) } YY_RULE(int) yy_BAR(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "BAR")); - if (!yymatchChar(G, '|')) goto l93; - if (!yy__(G)) goto l93; + if (!yymatchChar(G, '|')) goto l101; + if (!yy__(G)) goto l101; yyprintf((stderr, " ok BAR")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l93:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "BAR")); + l101:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "BAR")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1148,19 +1240,19 @@ YY_RULE(int) yy_BAR(GREG *G) } YY_RULE(int) yy_sequence(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "sequence")); - if (!yy_prefix(G)) goto l94; + if (!yy_prefix(G)) goto l102; - l95:; - { int yypos96= G->pos, yythunkpos96= G->thunkpos; if (!yy_prefix(G)) goto l96; + l103:; + { int yypos104= G->pos, yythunkpos104= G->thunkpos; if (!yy_prefix(G)) goto l104; yyDo(G, yy_1_sequence, G->begin, G->end, "yy_1_sequence"); - goto l95; - l96:; G->pos= yypos96; G->thunkpos= yythunkpos96; + goto l103; + l104:; G->pos= yypos104; G->thunkpos= yythunkpos104; } yyprintf((stderr, " ok sequence")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l94:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "sequence")); + l102:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "sequence")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1168,14 +1260,14 @@ YY_RULE(int) yy_sequence(GREG *G) } YY_RULE(int) yy_SEMICOLON(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "SEMICOLON")); - if (!yymatchChar(G, ';')) goto l97; - if (!yy__(G)) goto l97; + if (!yymatchChar(G, ';')) goto l105; + if (!yy__(G)) goto l105; yyprintf((stderr, " ok SEMICOLON")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l97:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "SEMICOLON")); + l105:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "SEMICOLON")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1183,20 +1275,20 @@ YY_RULE(int) yy_SEMICOLON(GREG *G) } YY_RULE(int) yy_expression(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "expression")); - if (!yy_sequence(G)) goto l98; + if (!yy_sequence(G)) goto l106; - l99:; - { int yypos100= G->pos, yythunkpos100= G->thunkpos; if (!yy_BAR(G)) goto l100; - if (!yy_sequence(G)) goto l100; + l107:; + { int yypos108= G->pos, yythunkpos108= G->thunkpos; if (!yy_BAR(G)) goto l108; + if (!yy_sequence(G)) goto l108; yyDo(G, yy_1_expression, G->begin, G->end, "yy_1_expression"); - goto l99; - l100:; G->pos= yypos100; G->thunkpos= yythunkpos100; + goto l107; + l108:; G->pos= yypos108; G->thunkpos= yythunkpos108; } yyprintf((stderr, " ok expression")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l98:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "expression")); + l106:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "expression")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1204,14 +1296,14 @@ YY_RULE(int) yy_expression(GREG *G) } YY_RULE(int) yy_EQUAL(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "EQUAL")); - if (!yymatchChar(G, '=')) goto l101; - if (!yy__(G)) goto l101; + if (!yymatchChar(G, '=')) goto l109; + if (!yy__(G)) goto l109; yyprintf((stderr, " ok EQUAL")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l101:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "EQUAL")); + l109:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "EQUAL")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1219,19 +1311,19 @@ YY_RULE(int) yy_EQUAL(GREG *G) } YY_RULE(int) yy_identifier(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "identifier")); - yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l102; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\040\000\000\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "-a-zA-Z_")) goto l102; + yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l110; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\040\000\000\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "-a-zA-Z_")) goto l110; - l103:; - { int yypos104= G->pos, yythunkpos104= G->thunkpos; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "-a-zA-Z_0-9")) goto l104; - goto l103; - l104:; G->pos= yypos104; G->thunkpos= yythunkpos104; - } yyText(G, G->begin, G->end); if (!(YY_END)) goto l102; if (!yy__(G)) goto l102; + l111:; + { int yypos112= G->pos, yythunkpos112= G->thunkpos; if (!yymatchClass(G, (const unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "-a-zA-Z_0-9")) goto l112; + goto l111; + l112:; G->pos= yypos112; G->thunkpos= yythunkpos112; + } yyText(G, G->begin, G->end); if (!(YY_END)) goto l110; if (!yy__(G)) goto l110; yyprintf((stderr, " ok identifier")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l102:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "identifier")); + l110:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "identifier")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1239,14 +1331,14 @@ YY_RULE(int) yy_identifier(GREG *G) } YY_RULE(int) yy_RPERCENT(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "RPERCENT")); - if (!yymatchString(G, "%}")) goto l105; - if (!yy__(G)) goto l105; + if (!yymatchString(G, "%}")) goto l113; + if (!yy__(G)) goto l113; yyprintf((stderr, " ok RPERCENT")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l105:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "RPERCENT")); + l113:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "RPERCENT")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1255,14 +1347,14 @@ YY_RULE(int) yy_RPERCENT(GREG *G) YY_RULE(int) yy_end_of_file(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "end_of_file")); - { int yypos107= G->pos, yythunkpos107= G->thunkpos; if (!yymatchDot(G)) goto l107; goto l106; - l107:; G->pos= yypos107; G->thunkpos= yythunkpos107; + { int yypos115= G->pos, yythunkpos115= G->thunkpos; if (!yymatchDot(G)) goto l115; goto l114; + l115:; G->pos= yypos115; G->thunkpos= yythunkpos115; } yyprintf((stderr, " ok end_of_file")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l106:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "end_of_file")); + l114:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "end_of_file")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1270,18 +1362,18 @@ YY_RULE(int) yy_end_of_file(GREG *G) } YY_RULE(int) yy_trailer(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "trailer")); - if (!yymatchString(G, "%%")) goto l108; - yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l108; - l109:; - { int yypos110= G->pos, yythunkpos110= G->thunkpos; if (!yymatchDot(G)) goto l110; goto l109; - l110:; G->pos= yypos110; G->thunkpos= yythunkpos110; - } yyText(G, G->begin, G->end); if (!(YY_END)) goto l108; yyDo(G, yy_1_trailer, G->begin, G->end, "yy_1_trailer"); + if (!yymatchString(G, "%%")) goto l116; + yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l116; + l117:; + { int yypos118= G->pos, yythunkpos118= G->thunkpos; if (!yymatchDot(G)) goto l118; goto l117; + l118:; G->pos= yypos118; G->thunkpos= yythunkpos118; + } yyText(G, G->begin, G->end); if (!(YY_END)) goto l116; yyDo(G, yy_1_trailer, G->begin, G->end, "yy_1_trailer"); yyprintf((stderr, " ok trailer")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l108:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "trailer")); + l116:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "trailer")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1290,23 +1382,23 @@ YY_RULE(int) yy_trailer(GREG *G) YY_RULE(int) yy_definition(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyDo(G, yyPush, 1, 0, "yyPush"); yyprintfv((stderr, "%s\n", "definition")); - if (!yy_identifier(G)) goto l111; + if (!yy_identifier(G)) goto l119; yyDo(G, yySet, -1, 0, "yySet"); yyDo(G, yy_1_definition, G->begin, G->end, "yy_1_definition"); - if (!yy_EQUAL(G)) goto l111; - if (!yy_expression(G)) goto l111; + if (!yy_EQUAL(G)) goto l119; + if (!yy_expression(G)) goto l119; yyDo(G, yy_2_definition, G->begin, G->end, "yy_2_definition"); - { int yypos112= G->pos, yythunkpos112= G->thunkpos; if (!yy_SEMICOLON(G)) goto l112; - goto l113; - l112:; G->pos= yypos112; G->thunkpos= yythunkpos112; + { int yypos120= G->pos, yythunkpos120= G->thunkpos; if (!yy_SEMICOLON(G)) goto l120; + goto l121; + l120:; G->pos= yypos120; G->thunkpos= yythunkpos120; } - l113:; yyprintf((stderr, " ok definition")); + l121:; yyprintf((stderr, " ok definition")); yyprintfGcontext; yyprintf((stderr, "\n")); yyDo(G, yyPop, 1, 0, "yyPop"); return 1; - l111:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "definition")); + l119:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "definition")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1314,23 +1406,23 @@ YY_RULE(int) yy_definition(GREG *G) } YY_RULE(int) yy_declaration(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "declaration")); - if (!yymatchString(G, "%{")) goto l114; - yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l114; - l115:; - { int yypos116= G->pos, yythunkpos116= G->thunkpos; - { int yypos117= G->pos, yythunkpos117= G->thunkpos; if (!yymatchString(G, "%}")) goto l117; - goto l116; - l117:; G->pos= yypos117; G->thunkpos= yythunkpos117; - } if (!yymatchDot(G)) goto l116; goto l115; - l116:; G->pos= yypos116; G->thunkpos= yythunkpos116; - } yyText(G, G->begin, G->end); if (!(YY_END)) goto l114; if (!yy_RPERCENT(G)) goto l114; + if (!yymatchString(G, "%{")) goto l122; + yyText(G, G->begin, G->end); if (!(YY_BEGIN)) goto l122; + l123:; + { int yypos124= G->pos, yythunkpos124= G->thunkpos; + { int yypos125= G->pos, yythunkpos125= G->thunkpos; if (!yymatchString(G, "%}")) goto l125; + goto l124; + l125:; G->pos= yypos125; G->thunkpos= yythunkpos125; + } if (!yymatchDot(G)) goto l124; goto l123; + l124:; G->pos= yypos124; G->thunkpos= yythunkpos124; + } yyText(G, G->begin, G->end); if (!(YY_END)) goto l122; if (!yy_RPERCENT(G)) goto l122; yyDo(G, yy_1_declaration, G->begin, G->end, "yy_1_declaration"); yyprintf((stderr, " ok declaration")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l114:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "declaration")); + l122:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "declaration")); yyprintfvGcontext; yyprintfv((stderr, "\n")); @@ -1339,17 +1431,17 @@ YY_RULE(int) yy_declaration(GREG *G) YY_RULE(int) yy__(GREG *G) { yyprintfv((stderr, "%s\n", "_")); - l119:; - { int yypos120= G->pos, yythunkpos120= G->thunkpos; - { int yypos121= G->pos, yythunkpos121= G->thunkpos; if (!yy_space(G)) goto l122; - goto l121; - l122:; G->pos= yypos121; G->thunkpos= yythunkpos121; if (!yy_single_line_comment(G)) goto l123; - goto l121; - l123:; G->pos= yypos121; G->thunkpos= yythunkpos121; if (!yy_quoted_comment(G)) goto l120; + l127:; + { int yypos128= G->pos, yythunkpos128= G->thunkpos; + { int yypos129= G->pos, yythunkpos129= G->thunkpos; if (!yy_space(G)) goto l130; + goto l129; + l130:; G->pos= yypos129; G->thunkpos= yythunkpos129; if (!yy_single_line_comment(G)) goto l131; + goto l129; + l131:; G->pos= yypos129; G->thunkpos= yythunkpos129; if (!yy_quoted_comment(G)) goto l128; } - l121:; goto l119; - l120:; G->pos= yypos120; G->thunkpos= yythunkpos120; + l129:; goto l127; + l128:; G->pos= yypos128; G->thunkpos= yythunkpos128; } yyprintf((stderr, " ok _")); yyprintfGcontext; yyprintf((stderr, "\n")); @@ -1358,35 +1450,35 @@ YY_RULE(int) yy__(GREG *G) } YY_RULE(int) yy_grammar(GREG *G) { int yypos0= G->pos, yythunkpos0= G->thunkpos; yyprintfv((stderr, "%s\n", "grammar")); - if (!yy__(G)) goto l124; + if (!yy__(G)) goto l132; - { int yypos127= G->pos, yythunkpos127= G->thunkpos; if (!yy_declaration(G)) goto l128; - goto l127; - l128:; G->pos= yypos127; G->thunkpos= yythunkpos127; if (!yy_definition(G)) goto l124; + { int yypos135= G->pos, yythunkpos135= G->thunkpos; if (!yy_declaration(G)) goto l136; + goto l135; + l136:; G->pos= yypos135; G->thunkpos= yythunkpos135; if (!yy_definition(G)) goto l132; } - l127:; - l125:; - { int yypos126= G->pos, yythunkpos126= G->thunkpos; - { int yypos129= G->pos, yythunkpos129= G->thunkpos; if (!yy_declaration(G)) goto l130; - goto l129; - l130:; G->pos= yypos129; G->thunkpos= yythunkpos129; if (!yy_definition(G)) goto l126; + l135:; + l133:; + { int yypos134= G->pos, yythunkpos134= G->thunkpos; + { int yypos137= G->pos, yythunkpos137= G->thunkpos; if (!yy_declaration(G)) goto l138; + goto l137; + l138:; G->pos= yypos137; G->thunkpos= yythunkpos137; if (!yy_definition(G)) goto l134; } - l129:; goto l125; - l126:; G->pos= yypos126; G->thunkpos= yythunkpos126; + l137:; goto l133; + l134:; G->pos= yypos134; G->thunkpos= yythunkpos134; } - { int yypos131= G->pos, yythunkpos131= G->thunkpos; if (!yy_trailer(G)) goto l131; - goto l132; - l131:; G->pos= yypos131; G->thunkpos= yythunkpos131; + { int yypos139= G->pos, yythunkpos139= G->thunkpos; if (!yy_trailer(G)) goto l139; + goto l140; + l139:; G->pos= yypos139; G->thunkpos= yythunkpos139; } - l132:; if (!yy_end_of_file(G)) goto l124; + l140:; if (!yy_end_of_file(G)) goto l132; yyprintf((stderr, " ok grammar")); yyprintfGcontext; yyprintf((stderr, "\n")); return 1; - l124:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "grammar")); + l132:; G->pos= yypos0; G->thunkpos= yythunkpos0; yyprintfv((stderr, " fail %s", "grammar")); yyprintfvGcontext; yyprintfv((stderr, "\n")); diff --git a/greg.g b/greg.g index f6f1312..f95dfc6 100644 --- a/greg.g +++ b/greg.g @@ -99,8 +99,10 @@ primary= ( COLON identifier !EQUAL { Node *name= makeName(findRule(yytext,0)); name->name.variable= pop(); push(name); } | identifier !EQUAL { push(makeName(findRule(yytext,0))); } | OPEN expression CLOSE -| literal { push(makeString(yytext)); } -| class { push(makeClass(yytext)); } +| literali { push(makeString(yytext,1)); } +| literal { push(makeString(yytext,0)); } +| classi { push(makeClass(yytext,1)); } +| class { push(makeClass(yytext,0)); } | DOT { push(makeDot()); } | action { push(makeAction(yytext)); } | BEGIN { push(makePredicate("YY_BEGIN")); } @@ -111,14 +113,20 @@ primary= ( identifier= < [-a-zA-Z_][-a-zA-Z_0-9]* > - -literal= ['] < ( !['] char )* > ['] - -| ["] < ( !["] char )* > ["] - +literali= literal-core 'i' - +literal= literal-core - +literal-core= ['] < ( !['] char )* > ['] +| ["] < ( !["] char )* > ["] -class= '[' < ( !']' range )* > ']' - +classi= class-core 'i' - +class= class-core - +class-core= '[' < ( !']' range )* > ']' range= char '-' char | char char= '\\' [abefnrtv'"\[\]\\] +| '\\' 'x'[0-9A-Fa-f][0-9A-Fa-f] +| '\\' 'x'[0-9A-Fa-f] | '\\' [0-3][0-7][0-7] | '\\' [0-7][0-7]? | !'\\' . diff --git a/greg.h b/greg.h index 89afc43..4e58b1d 100644 --- a/greg.h +++ b/greg.h @@ -34,6 +34,7 @@ enum { Unknown= 0, Rule, Variable, Name, Dot, Character, String, Class, Action, enum { RuleUsed = 1<<0, RuleReached = 1<<1, + IgnoreCase = 1<<0 }; typedef union Node Node; @@ -44,8 +45,8 @@ struct Variable { NODE_COMMON; char *name; Node *value; int offset; }; struct Name { NODE_COMMON; Node *rule; Node *variable; }; struct Dot { NODE_COMMON; }; struct Character { NODE_COMMON; char *value; }; -struct String { NODE_COMMON; char *value; }; -struct Class { NODE_COMMON; unsigned char *value; }; +struct String { NODE_COMMON; char *value; int flags; }; +struct Class { NODE_COMMON; unsigned char *value; int flags; }; struct Action { NODE_COMMON; char *text; Node *list; char *name; Node *rule; }; struct Predicate { NODE_COMMON; char *text; }; struct Alternate { NODE_COMMON; Node *first; Node *last; }; @@ -92,13 +93,12 @@ extern Node *makeRule(char *name, int defined); extern Node *findRule(char *name, int defined); extern Node *beginRule(Node *rule); extern void Rule_setExpression(Node *rule, Node *expression); -extern Node *Rule_beToken(Node *rule); extern Node *makeVariable(char *name); extern Node *makeName(Node *rule); extern Node *makeDot(void); extern Node *makeCharacter(char *text); -extern Node *makeString(char *text); -extern Node *makeClass(char *text); +extern Node *makeString(char *text, int nocase); +extern Node *makeClass(char *text, int nocase); extern Node *makeAction(char *text); extern Node *makePredicate(const char *text); extern Node *makeAlternate(Node *e); diff --git a/tree.c b/tree.c index d0d892f..a892cd9 100644 --- a/tree.c +++ b/tree.c @@ -131,17 +131,19 @@ Node *makeCharacter(char *text) return node; } -Node *makeString(char *text) +Node *makeString(char *text, int nocase) { Node *node= newNode(String); node->string.value= strdup(text); + node->string.flags = nocase ? IgnoreCase : 0; return node; } -Node *makeClass(char *text) +Node *makeClass(char *text, int nocase) { Node *node= newNode(Class); node->cclass.value= (unsigned char *)strdup(text); + node->cclass.flags = nocase ? IgnoreCase : 0; return node; } @@ -310,8 +312,10 @@ static void Node_fprint(FILE *stream, Node *node) case Name: fprintf(stream, " %s", node->name.rule->rule.name); break; case Dot: fprintf(stream, " ."); break; case Character: fprintf(stream, " '%s'", node->character.value); break; - case String: fprintf(stream, " \"%s\"", node->string.value); break; - case Class: fprintf(stream, " [%s]", node->cclass.value); break; + case String: fprintf(stream, " \"%s\"%s", node->string.value, + (IgnoreCase & node->string.flags) ? "i" : ""); break; + case Class: fprintf(stream, " [%s]%s", node->cclass.value, + (IgnoreCase & node->string.flags) ? "i" : ""); break; case Action: fprintf(stream, " { %s }", node->action.text); break; case Predicate: fprintf(stream, " ?{ %s }", node->action.text); break;