Exemple #1
0
int Scanner::scan()
{
    char *cursor = cur;
    uint depth;

scan:
    tchar = cursor - pos;
    tline = cline;
    tok = cursor;
	if (iscfg == 1)
	{
		goto config;
	}
	else if (iscfg == 2)
	{
   		goto value;
    }

#line 272 "scanner.fs.c"

	YYSETSTATE(1);
	if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
yyFillLabel1:
	yych = *YYCURSOR;
	if (yych <= '/') {
		if (yych <= '!') {
			if (yych <= '\f') {
				if (yych <= 0x08) goto yy56;
				if (yych <= '\t') goto yy50;
				if (yych <= '\n') goto yy52;
				goto yy56;
			} else {
				if (yych <= '\r') goto yy54;
				if (yych == ' ') goto yy50;
				goto yy56;
			}
		} else {
			if (yych <= ')') {
				if (yych <= '"') goto yy37;
				if (yych <= '&') goto yy56;
				if (yych <= '\'') goto yy39;
				goto yy43;
			} else {
				if (yych <= '+') {
					if (yych <= '*') goto yy35;
					goto yy44;
				} else {
					if (yych <= '-') goto yy56;
					if (yych <= '.') goto yy48;
					goto yy33;
				}
			}
		}
	} else {
		if (yych <= 'Z') {
			if (yych <= '=') {
				if (yych == ';') goto yy43;
				if (yych <= '<') goto yy56;
				goto yy43;
			} else {
				if (yych == '?') goto yy44;
				if (yych <= '@') goto yy56;
				goto yy47;
			}
		} else {
			if (yych <= 'q') {
				if (yych <= '[') goto yy41;
				if (yych <= '\\') goto yy43;
				if (yych <= '`') goto yy56;
				goto yy47;
			} else {
				if (yych <= 'z') {
					if (yych <= 'r') goto yy45;
					goto yy47;
				} else {
					if (yych <= '{') goto yy31;
					if (yych <= '|') goto yy43;
					goto yy56;
				}
			}
		}
	}
yy31:
	yyaccept = 0;
	yych = *(YYMARKER = ++YYCURSOR);
	if (yych <= '/') {
		if (yych == ',') goto yy97;
	} else {
		if (yych <= '0') goto yy94;
		if (yych <= '9') goto yy95;
	}
yy32:
#line 166 "scanner.fs.re"
	{ depth = 1;
				  goto code;
				}
#line 350 "scanner.fs.c"
yy33:
	++YYCURSOR;
	if ((yych = *YYCURSOR) == '*') goto yy92;
yy34:
#line 196 "scanner.fs.re"
	{ RETURN(*tok); }
#line 357 "scanner.fs.c"
yy35:
	++YYCURSOR;
	if ((yych = *YYCURSOR) == '/') goto yy90;
yy36:
#line 198 "scanner.fs.re"
	{ yylval.op = *tok;
				  RETURN(CLOSE); }
#line 365 "scanner.fs.c"
yy37:
	yyaccept = 1;
	yych = *(YYMARKER = ++YYCURSOR);
	if (yych != '\n') goto yy86;
yy38:
#line 183 "scanner.fs.re"
	{ fatal("unterminated string constant (missing \")"); }
#line 373 "scanner.fs.c"
yy39:
	yyaccept = 2;
	yych = *(YYMARKER = ++YYCURSOR);
	if (yych != '\n') goto yy81;
yy40:
#line 184 "scanner.fs.re"
	{ fatal("unterminated string constant (missing ')"); }
#line 381 "scanner.fs.c"
yy41:
	yyaccept = 3;
	yych = *(YYMARKER = ++YYCURSOR);
	if (yych == '\n') goto yy42;
	if (yych == '^') goto yy72;
	goto yy71;
yy42:
#line 194 "scanner.fs.re"
	{ fatal("unterminated range (missing ])"); }
#line 391 "scanner.fs.c"
yy43:
	yych = *++YYCURSOR;
	goto yy34;
yy44:
	yych = *++YYCURSOR;
	goto yy36;
yy45:
	++YYCURSOR;
	if ((yych = *YYCURSOR) == 'e') goto yy62;
	goto yy61;
yy46:
#line 225 "scanner.fs.re"
	{ cur = cursor;
				  yylval.symbol = Symbol::find(token());
				  return ID; }
#line 407 "scanner.fs.c"
yy47:
	yych = *++YYCURSOR;
	goto yy61;
yy48:
	++YYCURSOR;
#line 229 "scanner.fs.re"
	{ cur = cursor;
				  yylval.regexp = mkDot();
				  return RANGE;
				}
#line 418 "scanner.fs.c"
yy50:
	++YYCURSOR;
	yych = *YYCURSOR;
	goto yy59;
yy51:
#line 234 "scanner.fs.re"
	{ goto scan; }
#line 426 "scanner.fs.c"
yy52:
	++YYCURSOR;
yy53:
#line 236 "scanner.fs.re"
	{ if(cursor == eof) RETURN(0);
				  pos = cursor; cline++;
				  goto scan;
	    			}
#line 435 "scanner.fs.c"
yy54:
	++YYCURSOR;
	if ((yych = *YYCURSOR) == '\n') goto yy57;
yy55:
#line 241 "scanner.fs.re"
	{ std::ostringstream msg;
				  msg << "unexpected character: ";
				  prtChOrHex(msg, *tok);
				  fatal(msg.str().c_str());
				  goto scan;
				}
#line 447 "scanner.fs.c"
yy56:
	yych = *++YYCURSOR;
	goto yy55;
yy57:
	yych = *++YYCURSOR;
	goto yy53;
yy58:
	++YYCURSOR;
	YYSETSTATE(2);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel2:
	yych = *YYCURSOR;
yy59:
	if (yych == '\t') goto yy58;
	if (yych == ' ') goto yy58;
	goto yy51;
yy60:
	++YYCURSOR;
	YYSETSTATE(3);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel3:
	yych = *YYCURSOR;
yy61:
	if (yych <= '@') {
		if (yych <= '/') goto yy46;
		if (yych <= '9') goto yy60;
		goto yy46;
	} else {
		if (yych <= 'Z') goto yy60;
		if (yych <= '`') goto yy46;
		if (yych <= 'z') goto yy60;
		goto yy46;
	}
yy62:
	yych = *++YYCURSOR;
	if (yych != '2') goto yy61;
	yych = *++YYCURSOR;
	if (yych != 'c') goto yy61;
	yyaccept = 4;
	yych = *(YYMARKER = ++YYCURSOR);
	if (yych != ':') goto yy61;
yy65:
	++YYCURSOR;
	YYSETSTATE(4);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel4:
	yych = *YYCURSOR;
	if (yych <= '@') goto yy66;
	if (yych <= 'Z') goto yy67;
	if (yych <= '`') goto yy66;
	if (yych <= 'z') goto yy67;
yy66:
	YYCURSOR = YYMARKER;
	if (yyaccept <= 3) {
		if (yyaccept <= 1) {
			if (yyaccept == 0) {
				goto yy32;
			} else {
				goto yy38;
			}
		} else {
			if (yyaccept == 2) {
				goto yy40;
			} else {
				goto yy42;
			}
		}
	} else {
		if (yyaccept <= 5) {
			if (yyaccept == 4) {
				goto yy46;
			} else {
				goto yy69;
			}
		} else {
			goto yy98;
		}
	}
yy67:
	yyaccept = 5;
	YYMARKER = ++YYCURSOR;
	YYSETSTATE(5);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel5:
	yych = *YYCURSOR;
	if (yych <= 'Z') {
		if (yych <= '9') {
			if (yych >= '0') goto yy67;
		} else {
			if (yych <= ':') goto yy65;
			if (yych >= 'A') goto yy67;
		}
	} else {
		if (yych <= '_') {
			if (yych >= '_') goto yy67;
		} else {
			if (yych <= '`') goto yy69;
			if (yych <= 'z') goto yy67;
		}
	}
yy69:
#line 218 "scanner.fs.re"
	{ cur = cursor;
				  tok+= 5; /* skip "re2c:" */
				  iscfg = 1;
				  yylval.str = new Str(token());
				  return CONFIG;
				}
#line 556 "scanner.fs.c"
yy70:
	++YYCURSOR;
	YYSETSTATE(6);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel6:
	yych = *YYCURSOR;
yy71:
	if (yych <= '[') {
		if (yych == '\n') goto yy66;
		goto yy70;
	} else {
		if (yych <= '\\') goto yy74;
		if (yych <= ']') goto yy75;
		goto yy70;
	}
yy72:
	++YYCURSOR;
	YYSETSTATE(7);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel7:
	yych = *YYCURSOR;
	if (yych <= '[') {
		if (yych == '\n') goto yy66;
		goto yy72;
	} else {
		if (yych <= '\\') goto yy77;
		if (yych <= ']') goto yy78;
		goto yy72;
	}
yy74:
	++YYCURSOR;
	YYSETSTATE(8);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel8:
	yych = *YYCURSOR;
	if (yych == '\n') goto yy66;
	goto yy70;
yy75:
	++YYCURSOR;
#line 190 "scanner.fs.re"
	{ cur = cursor;
				  yylval.regexp = ranToRE(token());
				  return RANGE; }
#line 600 "scanner.fs.c"
yy77:
	++YYCURSOR;
	YYSETSTATE(9);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel9:
	yych = *YYCURSOR;
	if (yych == '\n') goto yy66;
	goto yy72;
yy78:
	++YYCURSOR;
#line 186 "scanner.fs.re"
	{ cur = cursor;
				  yylval.regexp = invToRE(token());
				  return RANGE; }
#line 615 "scanner.fs.c"
yy80:
	++YYCURSOR;
	YYSETSTATE(10);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel10:
	yych = *YYCURSOR;
yy81:
	if (yych <= '&') {
		if (yych == '\n') goto yy66;
		goto yy80;
	} else {
		if (yych <= '\'') goto yy83;
		if (yych != '\\') goto yy80;
	}
	++YYCURSOR;
	YYSETSTATE(11);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel11:
	yych = *YYCURSOR;
	if (yych == '\n') goto yy66;
	goto yy80;
yy83:
	++YYCURSOR;
#line 179 "scanner.fs.re"
	{ cur = cursor;
				  yylval.regexp = strToCaseInsensitiveRE(token());
				  return STRING; }
#line 643 "scanner.fs.c"
yy85:
	++YYCURSOR;
	YYSETSTATE(12);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel12:
	yych = *YYCURSOR;
yy86:
	if (yych <= '!') {
		if (yych == '\n') goto yy66;
		goto yy85;
	} else {
		if (yych <= '"') goto yy88;
		if (yych != '\\') goto yy85;
	}
	++YYCURSOR;
	YYSETSTATE(13);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel13:
	yych = *YYCURSOR;
	if (yych == '\n') goto yy66;
	goto yy85;
yy88:
	++YYCURSOR;
#line 175 "scanner.fs.re"
	{ cur = cursor;
				  yylval.regexp = strToRE(token());
				  return STRING; }
#line 671 "scanner.fs.c"
yy90:
	++YYCURSOR;
#line 172 "scanner.fs.re"
	{ tok = cursor;
				  RETURN(0); }
#line 677 "scanner.fs.c"
yy92:
	++YYCURSOR;
#line 169 "scanner.fs.re"
	{ depth = 1;
				  goto comment; }
#line 683 "scanner.fs.c"
yy94:
	yych = *++YYCURSOR;
	if (yych == ',') goto yy108;
	goto yy96;
yy95:
	++YYCURSOR;
	YYSETSTATE(14);
	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yyFillLabel14:
	yych = *YYCURSOR;
yy96:
	if (yych <= '/') {
		if (yych == ',') goto yy101;
		goto yy66;
	} else {
		if (yych <= '9') goto yy95;
		if (yych == '}') goto yy99;
		goto yy66;
	}
yy97:
	++YYCURSOR;
yy98:
#line 216 "scanner.fs.re"
	{ fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); }
#line 708 "scanner.fs.c"
yy99:
	++YYCURSOR;
#line 204 "scanner.fs.re"
	{ yylval.extop.minsize = atoi((char *)tok+1);
				  yylval.extop.maxsize = atoi((char *)tok+1);
				  RETURN(CLOSESIZE); }
#line 715 "scanner.fs.c"
yy101:
	yyaccept = 6;
	yych = *(YYMARKER = ++YYCURSOR);
	if (yych <= '/') goto yy98;
	if (yych <= '9') goto yy104;
	if (yych != '}') goto yy98;
	++YYCURSOR;
#line 212 "scanner.fs.re"
	{ yylval.extop.minsize = atoi((char *)tok+1);
				  yylval.extop.maxsize = -1;
				  RETURN(CLOSESIZE); }
#line 727 "scanner.fs.c"
yy104:
	++YYCURSOR;
	YYSETSTATE(15);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel15:
	yych = *YYCURSOR;
	if (yych <= '/') goto yy66;
	if (yych <= '9') goto yy104;
	if (yych != '}') goto yy66;
	++YYCURSOR;
#line 208 "scanner.fs.re"
	{ yylval.extop.minsize = atoi((char *)tok+1);
				  yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1));
				  RETURN(CLOSESIZE); }
#line 742 "scanner.fs.c"
yy108:
	yyaccept = 6;
	yych = *(YYMARKER = ++YYCURSOR);
	if (yych <= '/') goto yy98;
	if (yych <= '9') goto yy104;
	if (yych != '}') goto yy98;
	++YYCURSOR;
#line 201 "scanner.fs.re"
	{ yylval.op = '*';
				  RETURN(CLOSE); }
#line 753 "scanner.fs.c"
#line 247 "scanner.fs.re"


code:

#line 759 "scanner.fs.c"

	YYSETSTATE(16);
	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yyFillLabel16:
	yych = *YYCURSOR;
	if (yych <= '&') {
		if (yych <= '\n') {
			if (yych <= '\t') goto yy119;
			goto yy117;
		} else {
			if (yych == '"') goto yy121;
			goto yy119;
		}
	} else {
		if (yych <= '{') {
			if (yych <= '\'') goto yy122;
			if (yych <= 'z') goto yy119;
			goto yy115;
		} else {
			if (yych != '}') goto yy119;
		}
	}
	++YYCURSOR;
#line 251 "scanner.fs.re"
	{ if(--depth == 0){
					cur = cursor;
					yylval.token = new Token(token(), tline);
					return CODE;
				  }
				  goto code; }
#line 790 "scanner.fs.c"
yy115:
	++YYCURSOR;
#line 257 "scanner.fs.re"
	{ ++depth;
				  goto code; }
#line 796 "scanner.fs.c"
yy117:
	++YYCURSOR;
#line 259 "scanner.fs.re"
	{ if(cursor == eof) fatal("missing '}'");
				  pos = cursor; cline++;
				  goto code;
				}
#line 804 "scanner.fs.c"
yy119:
	++YYCURSOR;
yy120:
#line 263 "scanner.fs.re"
	{ goto code; }
#line 810 "scanner.fs.c"
yy121:
	yych = *(YYMARKER = ++YYCURSOR);
	if (yych == '\n') goto yy120;
	goto yy128;
yy122:
	yych = *(YYMARKER = ++YYCURSOR);
	if (yych == '\n') goto yy120;
	goto yy124;
yy123:
	++YYCURSOR;
	YYSETSTATE(17);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel17:
	yych = *YYCURSOR;
yy124:
	if (yych <= '&') {
		if (yych != '\n') goto yy123;
	} else {
		if (yych <= '\'') goto yy119;
		if (yych == '\\') goto yy126;
		goto yy123;
	}
yy125:
	YYCURSOR = YYMARKER;
	goto yy120;
yy126:
	++YYCURSOR;
	YYSETSTATE(18);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel18:
	yych = *YYCURSOR;
	if (yych == '\n') goto yy125;
	goto yy123;
yy127:
	++YYCURSOR;
	YYSETSTATE(19);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel19:
	yych = *YYCURSOR;
yy128:
	if (yych <= '!') {
		if (yych == '\n') goto yy125;
		goto yy127;
	} else {
		if (yych <= '"') goto yy119;
		if (yych != '\\') goto yy127;
	}
	++YYCURSOR;
	YYSETSTATE(20);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel20:
	yych = *YYCURSOR;
	if (yych == '\n') goto yy125;
	goto yy127;
#line 264 "scanner.fs.re"


comment:

#line 870 "scanner.fs.c"

	YYSETSTATE(21);
	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yyFillLabel21:
	yych = *YYCURSOR;
	if (yych <= ')') {
		if (yych == '\n') goto yy135;
		goto yy137;
	} else {
		if (yych <= '*') goto yy132;
		if (yych == '/') goto yy134;
		goto yy137;
	}
yy132:
	++YYCURSOR;
	if ((yych = *YYCURSOR) == '/') goto yy140;
yy133:
#line 279 "scanner.fs.re"
	{ if(cursor == eof) RETURN(0);
				  goto comment; }
#line 891 "scanner.fs.c"
yy134:
	yych = *++YYCURSOR;
	if (yych == '*') goto yy138;
	goto yy133;
yy135:
	++YYCURSOR;
#line 275 "scanner.fs.re"
	{ if(cursor == eof) RETURN(0);
				  tok = pos = cursor; cline++;
				  goto comment;
				}
#line 903 "scanner.fs.c"
yy137:
	yych = *++YYCURSOR;
	goto yy133;
yy138:
	++YYCURSOR;
#line 272 "scanner.fs.re"
	{ ++depth;
				  fatal("ambiguous /* found");
				  goto comment; }
#line 913 "scanner.fs.c"
yy140:
	++YYCURSOR;
#line 268 "scanner.fs.re"
	{ if(--depth == 0)
					goto scan;
				    else
					goto comment; }
#line 921 "scanner.fs.c"
#line 281 "scanner.fs.re"


config:

#line 927 "scanner.fs.c"

	YYSETSTATE(22);
	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yyFillLabel22:
	yych = *YYCURSOR;
	if (yych <= 0x1F) {
		if (yych != '\t') goto yy148;
	} else {
		if (yych <= ' ') goto yy144;
		if (yych == '=') goto yy146;
		goto yy148;
	}
yy144:
	++YYCURSOR;
	yych = *YYCURSOR;
	goto yy153;
yy145:
#line 285 "scanner.fs.re"
	{ goto config; }
#line 947 "scanner.fs.c"
yy146:
	++YYCURSOR;
	yych = *YYCURSOR;
	goto yy151;
yy147:
#line 286 "scanner.fs.re"
	{ iscfg = 2;
				  cur = cursor;
				  RETURN('='); 
				}
#line 958 "scanner.fs.c"
yy148:
	++YYCURSOR;
#line 290 "scanner.fs.re"
	{ fatal("missing '='"); }
#line 963 "scanner.fs.c"
yy150:
	++YYCURSOR;
	YYSETSTATE(23);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel23:
	yych = *YYCURSOR;
yy151:
	if (yych == '\t') goto yy150;
	if (yych == ' ') goto yy150;
	goto yy147;
yy152:
	++YYCURSOR;
	YYSETSTATE(24);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel24:
	yych = *YYCURSOR;
yy153:
	if (yych == '\t') goto yy152;
	if (yych == ' ') goto yy152;
	goto yy145;
#line 291 "scanner.fs.re"


value:

#line 989 "scanner.fs.c"

	YYSETSTATE(25);
	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yyFillLabel25:
	yych = *YYCURSOR;
	if (yych <= '&') {
		if (yych <= '\r') {
			if (yych <= 0x08) goto yy162;
			if (yych <= '\n') goto yy156;
			if (yych <= '\f') goto yy162;
		} else {
			if (yych <= ' ') {
				if (yych <= 0x1F) goto yy162;
			} else {
				if (yych == '"') goto yy164;
				goto yy162;
			}
		}
	} else {
		if (yych <= '/') {
			if (yych <= '\'') goto yy166;
			if (yych == '-') goto yy159;
			goto yy162;
		} else {
			if (yych <= '9') {
				if (yych <= '0') goto yy157;
				goto yy160;
			} else {
				if (yych != ';') goto yy162;
			}
		}
	}
yy156:
#line 300 "scanner.fs.re"
	{ cur = cursor;
				  yylval.str = new Str(token());
				  iscfg = 0;
				  return VALUE;
				}
#line 1029 "scanner.fs.c"
yy157:
	++YYCURSOR;
	if ((yych = *YYCURSOR) <= '\r') {
		if (yych <= 0x08) goto yy162;
		if (yych <= '\n') goto yy158;
		if (yych <= '\f') goto yy162;
	} else {
		if (yych <= ' ') {
			if (yych <= 0x1F) goto yy162;
		} else {
			if (yych != ';') goto yy162;
		}
	}
yy158:
#line 295 "scanner.fs.re"
	{ cur = cursor;
				  yylval.number = atoi(token().to_string().c_str());
				  iscfg = 0;
				  return NUMBER;
				}
#line 1050 "scanner.fs.c"
yy159:
	yych = *++YYCURSOR;
	if (yych <= '0') goto yy163;
	if (yych >= ':') goto yy163;
yy160:
	++YYCURSOR;
	YYSETSTATE(26);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel26:
	yych = *YYCURSOR;
	if (yych <= 0x1F) {
		if (yych <= '\n') {
			if (yych >= '\t') goto yy158;
		} else {
			if (yych == '\r') goto yy158;
		}
	} else {
		if (yych <= '9') {
			if (yych <= ' ') goto yy158;
			if (yych >= '0') goto yy160;
		} else {
			if (yych == ';') goto yy158;
		}
	}
yy162:
	++YYCURSOR;
	YYSETSTATE(27);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel27:
	yych = *YYCURSOR;
yy163:
	if (yych <= '\r') {
		if (yych <= 0x08) goto yy162;
		if (yych <= '\n') goto yy156;
		if (yych <= '\f') goto yy162;
		goto yy156;
	} else {
		if (yych <= ' ') {
			if (yych <= 0x1F) goto yy162;
			goto yy156;
		} else {
			if (yych == ';') goto yy156;
			goto yy162;
		}
	}
yy164:
	YYMARKER = ++YYCURSOR;
	YYSETSTATE(28);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel28:
	yych = *YYCURSOR;
	if (yych <= ' ') {
		if (yych <= '\n') {
			if (yych <= 0x08) goto yy164;
			if (yych <= '\t') goto yy174;
			goto yy156;
		} else {
			if (yych == '\r') goto yy174;
			if (yych <= 0x1F) goto yy164;
			goto yy174;
		}
	} else {
		if (yych <= ':') {
			if (yych == '"') goto yy162;
			goto yy164;
		} else {
			if (yych <= ';') goto yy174;
			if (yych == '\\') goto yy176;
			goto yy164;
		}
	}
yy166:
	YYMARKER = ++YYCURSOR;
	YYSETSTATE(29);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel29:
	yych = *YYCURSOR;
	if (yych <= ' ') {
		if (yych <= '\n') {
			if (yych <= 0x08) goto yy166;
			if (yych >= '\n') goto yy156;
		} else {
			if (yych == '\r') goto yy168;
			if (yych <= 0x1F) goto yy166;
		}
	} else {
		if (yych <= ':') {
			if (yych == '\'') goto yy162;
			goto yy166;
		} else {
			if (yych <= ';') goto yy168;
			if (yych == '\\') goto yy171;
			goto yy166;
		}
	}
yy168:
	++YYCURSOR;
	YYSETSTATE(30);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel30:
	yych = *YYCURSOR;
	if (yych <= '&') {
		if (yych != '\n') goto yy168;
	} else {
		if (yych <= '\'') goto yy172;
		if (yych == '\\') goto yy173;
		goto yy168;
	}
yy170:
	YYCURSOR = YYMARKER;
	goto yy156;
yy171:
	YYMARKER = ++YYCURSOR;
	YYSETSTATE(31);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel31:
	yych = *YYCURSOR;
	if (yych <= '\r') {
		if (yych <= '\t') {
			if (yych <= 0x08) goto yy166;
			goto yy168;
		} else {
			if (yych <= '\n') goto yy156;
			if (yych <= '\f') goto yy166;
			goto yy168;
		}
	} else {
		if (yych <= ' ') {
			if (yych <= 0x1F) goto yy166;
			goto yy168;
		} else {
			if (yych == ';') goto yy168;
			goto yy166;
		}
	}
yy172:
	yych = *++YYCURSOR;
	goto yy156;
yy173:
	++YYCURSOR;
	YYSETSTATE(32);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel32:
	yych = *YYCURSOR;
	if (yych == '\n') goto yy170;
	goto yy168;
yy174:
	++YYCURSOR;
	YYSETSTATE(33);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel33:
	yych = *YYCURSOR;
	if (yych <= '!') {
		if (yych == '\n') goto yy170;
		goto yy174;
	} else {
		if (yych <= '"') goto yy172;
		if (yych == '\\') goto yy177;
		goto yy174;
	}
yy176:
	YYMARKER = ++YYCURSOR;
	YYSETSTATE(34);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel34:
	yych = *YYCURSOR;
	if (yych <= '\r') {
		if (yych <= '\t') {
			if (yych <= 0x08) goto yy164;
			goto yy174;
		} else {
			if (yych <= '\n') goto yy156;
			if (yych <= '\f') goto yy164;
			goto yy174;
		}
	} else {
		if (yych <= ' ') {
			if (yych <= 0x1F) goto yy164;
			goto yy174;
		} else {
			if (yych == ';') goto yy174;
			goto yy164;
		}
	}
yy177:
	++YYCURSOR;
	YYSETSTATE(35);
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
yyFillLabel35:
	yych = *YYCURSOR;
	if (yych == '\n') goto yy170;
	goto yy174;
#line 305 "scanner.fs.re"

}
Exemple #2
0
int Scanner::scan()
{
    char *cursor = cur;
    uint depth;

scan:
    tchar = cursor - pos;
    tline = cline;
    tok = cursor;
	if (iscfg == 1)
	{
		goto config;
	}
	else if (iscfg == 2)
	{
   		goto value;
    }

#line 281 "<stdout>"
{
	YYCTYPE yych;
	unsigned int yyaccept = 0;
	if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
	yych = *YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy50;
	case '\n':	goto yy52;
	case '\r':	goto yy54;
	case '"':	goto yy37;
	case '\'':	goto yy39;
	case '(':
	case ')':
	case ';':
	case '=':
	case '\\':
	case '|':	goto yy43;
	case '*':	goto yy35;
	case '+':
	case '?':	goto yy44;
	case '.':	goto yy48;
	case '/':	goto yy33;
	case 'A':
	case 'B':
	case 'C':
	case 'D':
	case 'E':
	case 'F':
	case 'G':
	case 'H':
	case 'I':
	case 'J':
	case 'K':
	case 'L':
	case 'M':
	case 'N':
	case 'O':
	case 'P':
	case 'Q':
	case 'R':
	case 'S':
	case 'T':
	case 'U':
	case 'V':
	case 'W':
	case 'X':
	case 'Y':
	case 'Z':
	case 'a':
	case 'b':
	case 'c':
	case 'd':
	case 'e':
	case 'f':
	case 'g':
	case 'h':
	case 'i':
	case 'j':
	case 'k':
	case 'l':
	case 'm':
	case 'n':
	case 'o':
	case 'p':
	case 'q':
	case 's':
	case 't':
	case 'u':
	case 'v':
	case 'w':
	case 'x':
	case 'y':
	case 'z':	goto yy47;
	case '[':	goto yy41;
	case 'r':	goto yy45;
	case '{':	goto yy31;
	default:	goto yy56;
	}
yy31:
	yyaccept = 0;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
	case ',':	goto yy97;
	case '0':	goto yy94;
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy95;
	default:	goto yy32;
	}
yy32:
#line 166 "scanner.re"
	{ depth = 1;
				  goto code;
				}
#line 383 "<stdout>"
yy33:
	++YYCURSOR;
	switch ((yych = *YYCURSOR)) {
	case '*':	goto yy92;
	default:	goto yy34;
	}
yy34:
#line 196 "scanner.re"
	{ RETURN(*tok); }
#line 393 "<stdout>"
yy35:
	++YYCURSOR;
	switch ((yych = *YYCURSOR)) {
	case '/':	goto yy90;
	default:	goto yy36;
	}
yy36:
#line 198 "scanner.re"
	{ yylval.op = *tok;
				  RETURN(CLOSE); }
#line 404 "<stdout>"
yy37:
	yyaccept = 1;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
	case '\n':	goto yy38;
	default:	goto yy86;
	}
yy38:
#line 183 "scanner.re"
	{ fatal("unterminated string constant (missing \")"); }
#line 415 "<stdout>"
yy39:
	yyaccept = 2;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
	case '\n':	goto yy40;
	default:	goto yy81;
	}
yy40:
#line 184 "scanner.re"
	{ fatal("unterminated string constant (missing ')"); }
#line 426 "<stdout>"
yy41:
	yyaccept = 3;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
	case '\n':	goto yy42;
	case '^':	goto yy72;
	default:	goto yy71;
	}
yy42:
#line 194 "scanner.re"
	{ fatal("unterminated range (missing ])"); }
#line 438 "<stdout>"
yy43:
	yych = *++YYCURSOR;
	goto yy34;
yy44:
	yych = *++YYCURSOR;
	goto yy36;
yy45:
	++YYCURSOR;
	switch ((yych = *YYCURSOR)) {
	case 'e':	goto yy62;
	default:	goto yy61;
	}
yy46:
#line 225 "scanner.re"
	{ cur = cursor;
				  yylval.symbol = Symbol::find(token());
				  return ID; }
#line 456 "<stdout>"
yy47:
	yych = *++YYCURSOR;
	goto yy61;
yy48:
	++YYCURSOR;
#line 229 "scanner.re"
	{ cur = cursor;
				  yylval.regexp = mkDot();
				  return RANGE;
				}
#line 467 "<stdout>"
yy50:
	++YYCURSOR;
	yych = *YYCURSOR;
	goto yy59;
yy51:
#line 234 "scanner.re"
	{ goto scan; }
#line 475 "<stdout>"
yy52:
	++YYCURSOR;
yy53:
#line 236 "scanner.re"
	{ if(cursor == eof) RETURN(0);
				  pos = cursor; cline++;
				  goto scan;
	    			}
#line 484 "<stdout>"
yy54:
	++YYCURSOR;
	switch ((yych = *YYCURSOR)) {
	case '\n':	goto yy57;
	default:	goto yy55;
	}
yy55:
#line 241 "scanner.re"
	{ std::ostringstream msg;
				  msg << "unexpected character: ";
				  prtChOrHex(msg, *tok);
				  fatal(msg.str().c_str());
				  goto scan;
				}
#line 499 "<stdout>"
yy56:
	yych = *++YYCURSOR;
	goto yy55;
yy57:
	yych = *++YYCURSOR;
	goto yy53;
yy58:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
yy59:
	switch (yych) {
	case '\t':
	case ' ':	goto yy58;
	default:	goto yy51;
	}
yy60:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
yy61:
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	case 'A':
	case 'B':
	case 'C':
	case 'D':
	case 'E':
	case 'F':
	case 'G':
	case 'H':
	case 'I':
	case 'J':
	case 'K':
	case 'L':
	case 'M':
	case 'N':
	case 'O':
	case 'P':
	case 'Q':
	case 'R':
	case 'S':
	case 'T':
	case 'U':
	case 'V':
	case 'W':
	case 'X':
	case 'Y':
	case 'Z':
	case 'a':
	case 'b':
	case 'c':
	case 'd':
	case 'e':
	case 'f':
	case 'g':
	case 'h':
	case 'i':
	case 'j':
	case 'k':
	case 'l':
	case 'm':
	case 'n':
	case 'o':
	case 'p':
	case 'q':
	case 'r':
	case 's':
	case 't':
	case 'u':
	case 'v':
	case 'w':
	case 'x':
	case 'y':
	case 'z':	goto yy60;
	default:	goto yy46;
	}
yy62:
	yych = *++YYCURSOR;
	switch (yych) {
	case '2':	goto yy63;
	default:	goto yy61;
	}
yy63:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'c':	goto yy64;
	default:	goto yy61;
	}
yy64:
	yyaccept = 4;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
	case ':':	goto yy65;
	default:	goto yy61;
	}
yy65:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case 'A':
	case 'B':
	case 'C':
	case 'D':
	case 'E':
	case 'F':
	case 'G':
	case 'H':
	case 'I':
	case 'J':
	case 'K':
	case 'L':
	case 'M':
	case 'N':
	case 'O':
	case 'P':
	case 'Q':
	case 'R':
	case 'S':
	case 'T':
	case 'U':
	case 'V':
	case 'W':
	case 'X':
	case 'Y':
	case 'Z':
	case 'a':
	case 'b':
	case 'c':
	case 'd':
	case 'e':
	case 'f':
	case 'g':
	case 'h':
	case 'i':
	case 'j':
	case 'k':
	case 'l':
	case 'm':
	case 'n':
	case 'o':
	case 'p':
	case 'q':
	case 'r':
	case 's':
	case 't':
	case 'u':
	case 'v':
	case 'w':
	case 'x':
	case 'y':
	case 'z':	goto yy67;
	default:	goto yy66;
	}
yy66:
	YYCURSOR = YYMARKER;
	switch (yyaccept) {
	case 0: 	goto yy32;
	case 1: 	goto yy38;
	case 2: 	goto yy40;
	case 3: 	goto yy42;
	case 4: 	goto yy46;
	case 5: 	goto yy69;
	default:	goto yy98;
	}
yy67:
	yyaccept = 5;
	YYMARKER = ++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	case 'A':
	case 'B':
	case 'C':
	case 'D':
	case 'E':
	case 'F':
	case 'G':
	case 'H':
	case 'I':
	case 'J':
	case 'K':
	case 'L':
	case 'M':
	case 'N':
	case 'O':
	case 'P':
	case 'Q':
	case 'R':
	case 'S':
	case 'T':
	case 'U':
	case 'V':
	case 'W':
	case 'X':
	case 'Y':
	case 'Z':
	case '_':
	case 'a':
	case 'b':
	case 'c':
	case 'd':
	case 'e':
	case 'f':
	case 'g':
	case 'h':
	case 'i':
	case 'j':
	case 'k':
	case 'l':
	case 'm':
	case 'n':
	case 'o':
	case 'p':
	case 'q':
	case 'r':
	case 's':
	case 't':
	case 'u':
	case 'v':
	case 'w':
	case 'x':
	case 'y':
	case 'z':	goto yy67;
	case ':':	goto yy65;
	default:	goto yy69;
	}
yy69:
#line 218 "scanner.re"
	{ cur = cursor;
				  tok+= 5; /* skip "re2c:" */
				  iscfg = 1;
				  yylval.str = new Str(token());
				  return CONFIG;
				}
#line 755 "<stdout>"
yy70:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
yy71:
	switch (yych) {
	case '\n':	goto yy66;
	case '\\':	goto yy74;
	case ']':	goto yy75;
	default:	goto yy70;
	}
yy72:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy66;
	case '\\':	goto yy77;
	case ']':	goto yy78;
	default:	goto yy72;
	}
yy74:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy66;
	default:	goto yy70;
	}
yy75:
	++YYCURSOR;
#line 190 "scanner.re"
	{ cur = cursor;
				  yylval.regexp = ranToRE(token());
				  return RANGE; }
#line 791 "<stdout>"
yy77:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy66;
	default:	goto yy72;
	}
yy78:
	++YYCURSOR;
#line 186 "scanner.re"
	{ cur = cursor;
				  yylval.regexp = invToRE(token());
				  return RANGE; }
#line 806 "<stdout>"
yy80:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
yy81:
	switch (yych) {
	case '\n':	goto yy66;
	case '\'':	goto yy83;
	case '\\':	goto yy82;
	default:	goto yy80;
	}
yy82:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy66;
	default:	goto yy80;
	}
yy83:
	++YYCURSOR;
#line 179 "scanner.re"
	{ cur = cursor;
				  yylval.regexp = strToCaseInsensitiveRE(token());
				  return STRING; }
#line 832 "<stdout>"
yy85:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
yy86:
	switch (yych) {
	case '\n':	goto yy66;
	case '"':	goto yy88;
	case '\\':	goto yy87;
	default:	goto yy85;
	}
yy87:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy66;
	default:	goto yy85;
	}
yy88:
	++YYCURSOR;
#line 175 "scanner.re"
	{ cur = cursor;
				  yylval.regexp = strToRE(token());
				  return STRING; }
#line 858 "<stdout>"
yy90:
	++YYCURSOR;
#line 172 "scanner.re"
	{ tok = cursor;
				  RETURN(0); }
#line 864 "<stdout>"
yy92:
	++YYCURSOR;
#line 169 "scanner.re"
	{ depth = 1;
				  goto comment; }
#line 870 "<stdout>"
yy94:
	yych = *++YYCURSOR;
	switch (yych) {
	case ',':	goto yy108;
	default:	goto yy96;
	}
yy95:
	++YYCURSOR;
	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
	yych = *YYCURSOR;
yy96:
	switch (yych) {
	case ',':	goto yy101;
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy95;
	case '}':	goto yy99;
	default:	goto yy66;
	}
yy97:
	++YYCURSOR;
yy98:
#line 216 "scanner.re"
	{ fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); }
#line 902 "<stdout>"
yy99:
	++YYCURSOR;
#line 204 "scanner.re"
	{ yylval.extop.minsize = atoi((char *)tok+1);
				  yylval.extop.maxsize = atoi((char *)tok+1);
				  RETURN(CLOSESIZE); }
#line 909 "<stdout>"
yy101:
	yyaccept = 6;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy104;
	case '}':	goto yy102;
	default:	goto yy98;
	}
yy102:
	++YYCURSOR;
#line 212 "scanner.re"
	{ yylval.extop.minsize = atoi((char *)tok+1);
				  yylval.extop.maxsize = -1;
				  RETURN(CLOSESIZE); }
#line 933 "<stdout>"
yy104:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy104;
	case '}':	goto yy106;
	default:	goto yy66;
	}
yy106:
	++YYCURSOR;
#line 208 "scanner.re"
	{ yylval.extop.minsize = atoi((char *)tok+1);
				  yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1));
				  RETURN(CLOSESIZE); }
#line 958 "<stdout>"
yy108:
	yyaccept = 6;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy104;
	case '}':	goto yy109;
	default:	goto yy98;
	}
yy109:
	++YYCURSOR;
#line 201 "scanner.re"
	{ yylval.op = '*';
				  RETURN(CLOSE); }
#line 981 "<stdout>"
}
#line 247 "scanner.re"


code:

#line 988 "<stdout>"
{
	YYCTYPE yych;
	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy117;
	case '"':	goto yy121;
	case '\'':	goto yy122;
	case '{':	goto yy115;
	case '}':	goto yy113;
	default:	goto yy119;
	}
yy113:
	++YYCURSOR;
#line 251 "scanner.re"
	{ if(--depth == 0){
					cur = cursor;
					yylval.token = new Token(token(), tline);
					return CODE;
				  }
				  goto code; }
#line 1010 "<stdout>"
yy115:
	++YYCURSOR;
#line 257 "scanner.re"
	{ ++depth;
				  goto code; }
#line 1016 "<stdout>"
yy117:
	++YYCURSOR;
#line 259 "scanner.re"
	{ if(cursor == eof) fatal("missing '}'");
				  pos = cursor; cline++;
				  goto code;
				}
#line 1024 "<stdout>"
yy119:
	++YYCURSOR;
yy120:
#line 263 "scanner.re"
	{ goto code; }
#line 1030 "<stdout>"
yy121:
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
	case '\n':	goto yy120;
	default:	goto yy128;
	}
yy122:
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
	case '\n':	goto yy120;
	default:	goto yy124;
	}
yy123:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
yy124:
	switch (yych) {
	case '\n':	goto yy125;
	case '\'':	goto yy119;
	case '\\':	goto yy126;
	default:	goto yy123;
	}
yy125:
	YYCURSOR = YYMARKER;
	goto yy120;
yy126:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy125;
	default:	goto yy123;
	}
yy127:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
yy128:
	switch (yych) {
	case '\n':	goto yy125;
	case '"':	goto yy119;
	case '\\':	goto yy129;
	default:	goto yy127;
	}
yy129:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy125;
	default:	goto yy127;
	}
}
#line 264 "scanner.re"


comment:

#line 1090 "<stdout>"
{
	YYCTYPE yych;
	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy135;
	case '*':	goto yy132;
	case '/':	goto yy134;
	default:	goto yy137;
	}
yy132:
	++YYCURSOR;
	switch ((yych = *YYCURSOR)) {
	case '/':	goto yy140;
	default:	goto yy133;
	}
yy133:
#line 279 "scanner.re"
	{ if(cursor == eof) RETURN(0);
				  goto comment; }
#line 1111 "<stdout>"
yy134:
	yych = *++YYCURSOR;
	switch (yych) {
	case '*':	goto yy138;
	default:	goto yy133;
	}
yy135:
	++YYCURSOR;
#line 275 "scanner.re"
	{ if(cursor == eof) RETURN(0);
				  tok = pos = cursor; cline++;
				  goto comment;
				}
#line 1125 "<stdout>"
yy137:
	yych = *++YYCURSOR;
	goto yy133;
yy138:
	++YYCURSOR;
#line 272 "scanner.re"
	{ ++depth;
				  fatal("ambiguous /* found");
				  goto comment; }
#line 1135 "<stdout>"
yy140:
	++YYCURSOR;
#line 268 "scanner.re"
	{ if(--depth == 0)
					goto scan;
				    else
					goto comment; }
#line 1143 "<stdout>"
}
#line 281 "scanner.re"


config:

#line 1150 "<stdout>"
{
	YYCTYPE yych;
	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
	yych = *YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy144;
	case '=':	goto yy146;
	default:	goto yy148;
	}
yy144:
	++YYCURSOR;
	yych = *YYCURSOR;
	goto yy153;
yy145:
#line 285 "scanner.re"
	{ goto config; }
#line 1168 "<stdout>"
yy146:
	++YYCURSOR;
	yych = *YYCURSOR;
	goto yy151;
yy147:
#line 286 "scanner.re"
	{ iscfg = 2;
				  cur = cursor;
				  RETURN('='); 
				}
#line 1179 "<stdout>"
yy148:
	++YYCURSOR;
#line 290 "scanner.re"
	{ fatal("missing '='"); }
#line 1184 "<stdout>"
yy150:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
yy151:
	switch (yych) {
	case '\t':
	case ' ':	goto yy150;
	default:	goto yy147;
	}
yy152:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
yy153:
	switch (yych) {
	case '\t':
	case ' ':	goto yy152;
	default:	goto yy145;
	}
}
#line 291 "scanner.re"


value:

#line 1211 "<stdout>"
{
	YYCTYPE yych;
	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
	yych = *YYCURSOR;
	switch (yych) {
	case '\t':
	case '\n':
	case '\r':
	case ' ':
	case ';':	goto yy156;
	case '"':	goto yy164;
	case '\'':	goto yy166;
	case '-':	goto yy159;
	case '0':	goto yy157;
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy160;
	default:	goto yy162;
	}
yy156:
#line 300 "scanner.re"
	{ cur = cursor;
				  yylval.str = new Str(token());
				  iscfg = 0;
				  return VALUE;
				}
#line 1244 "<stdout>"
yy157:
	++YYCURSOR;
	switch ((yych = *YYCURSOR)) {
	case '\t':
	case '\n':
	case '\r':
	case ' ':
	case ';':	goto yy158;
	default:	goto yy162;
	}
yy158:
#line 295 "scanner.re"
	{ cur = cursor;
				  yylval.number = atoi(token().to_string().c_str());
				  iscfg = 0;
				  return NUMBER;
				}
#line 1262 "<stdout>"
yy159:
	yych = *++YYCURSOR;
	switch (yych) {
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy160;
	default:	goto yy163;
	}
yy160:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\t':
	case '\n':
	case '\r':
	case ' ':
	case ';':	goto yy158;
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy160;
	default:	goto yy162;
	}
yy162:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
yy163:
	switch (yych) {
	case '\t':
	case '\n':
	case '\r':
	case ' ':
	case ';':	goto yy156;
	default:	goto yy162;
	}
yy164:
	YYMARKER = ++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\t':
	case '\r':
	case ' ':
	case ';':	goto yy174;
	case '\n':	goto yy156;
	case '"':	goto yy162;
	case '\\':	goto yy176;
	default:	goto yy164;
	}
yy166:
	YYMARKER = ++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\t':
	case '\r':
	case ' ':
	case ';':	goto yy168;
	case '\n':	goto yy156;
	case '\'':	goto yy162;
	case '\\':	goto yy171;
	default:	goto yy166;
	}
yy168:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy170;
	case '\'':	goto yy172;
	case '\\':	goto yy173;
	default:	goto yy168;
	}
yy170:
	YYCURSOR = YYMARKER;
	goto yy156;
yy171:
	YYMARKER = ++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\t':
	case '\r':
	case ' ':
	case ';':	goto yy168;
	case '\n':	goto yy156;
	default:	goto yy166;
	}
yy172:
	yych = *++YYCURSOR;
	goto yy156;
yy173:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy170;
	default:	goto yy168;
	}
yy174:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy170;
	case '"':	goto yy172;
	case '\\':	goto yy177;
	default:	goto yy174;
	}
yy176:
	YYMARKER = ++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\t':
	case '\r':
	case ' ':
	case ';':	goto yy174;
	case '\n':	goto yy156;
	default:	goto yy164;
	}
yy177:
	++YYCURSOR;
	if (YYLIMIT <= YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	switch (yych) {
	case '\n':	goto yy170;
	default:	goto yy174;
	}
}
#line 305 "scanner.re"

}
Exemple #3
0
int
Scanner_scan(Scanner *s)
{
    unsigned char *cursor = s->cur;
    unsigned int depth;

scan:
    s->tchar = cursor - s->pos;
    s->tline = s->cline;
    s->tok = cursor;

#line 224 "scanner.c"
{
	YYCTYPE yych;
	unsigned int yyaccept;
	goto yy29;
	++YYCURSOR;
yy29:
	if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
	yych = *YYCURSOR;
	if(yych <= '/'){
		if(yych <= '"'){
			if(yych <= '\n'){
				if(yych <= '\b')	goto yy53;
				if(yych <= '\t')	goto yy47;
				goto yy49;
			} else {
				if(yych == ' ')	goto yy47;
				if(yych <= '!')	goto yy53;
				goto yy37;
			}
		} else {
			if(yych <= '*'){
				if(yych <= '&')	goto yy53;
				if(yych <= '\'')	goto yy39;
				if(yych <= ')')	goto yy43;
				goto yy35;
			} else {
				if(yych <= '+')	goto yy44;
				if(yych <= '-')	goto yy53;
				if(yych <= '.')	goto yy51;
				goto yy33;
			}
		}
	} else {
		if(yych <= '@'){
			if(yych <= '<'){
				if(yych == ';')	goto yy43;
				goto yy53;
			} else {
				if(yych <= '=')	goto yy43;
				if(yych == '?')	goto yy44;
				goto yy53;
			}
		} else {
			if(yych <= '`'){
				if(yych <= 'Z')	goto yy45;
				if(yych <= '[')	goto yy41;
				if(yych <= '\\')	goto yy43;
				goto yy53;
			} else {
				if(yych <= 'z')	goto yy45;
				if(yych <= '{')	goto yy31;
				if(yych <= '|')	goto yy43;
				goto yy53;
			}
		}
	}
yy31:	yyaccept = 0;
	yych = *(YYMARKER = ++YYCURSOR);
	if(yych <= '/')	goto yy32;
	if(yych <= '9')	goto yy84;
	goto yy32;
yy32:
#line 133 "scanner.re"
{ depth = 1;
				  goto code;
				}
#line 291 "scanner.c"
yy33:	yych = *++YYCURSOR;
	if(yych == '*')	goto yy82;
	goto yy34;
yy34:
#line 163 "scanner.re"
{ RETURN(*s->tok); }
#line 298 "scanner.c"
yy35:	yych = *++YYCURSOR;
	if(yych == '/')	goto yy80;
	goto yy36;
yy36:
#line 165 "scanner.re"
{ yylval.op = *s->tok;
				  RETURN(CLOSE); }
#line 306 "scanner.c"
yy37:	yyaccept = 1;
	yych = *(YYMARKER = ++YYCURSOR);
	if(yych != '\n')	goto yy76;
	goto yy38;
yy38:
#line 150 "scanner.re"
{ Scanner_fatal(s, "unterminated string constant (missing \")"); }
#line 314 "scanner.c"
yy39:	yyaccept = 2;
	yych = *(YYMARKER = ++YYCURSOR);
	if(yych != '\n')	goto yy71;
	goto yy40;
yy40:
#line 151 "scanner.re"
{ Scanner_fatal(s, "unterminated string constant (missing ')"); }
#line 322 "scanner.c"
yy41:	yyaccept = 3;
	yych = *(YYMARKER = ++YYCURSOR);
	if(yych == '\n')	goto yy42;
	if(yych == '^')	goto yy62;
	goto yy60;
yy42:
#line 161 "scanner.re"
{ Scanner_fatal(s, "unterminated range (missing ])"); }
#line 331 "scanner.c"
yy43:	yych = *++YYCURSOR;
	goto yy34;
yy44:	yych = *++YYCURSOR;
	goto yy36;
yy45:	yych = *++YYCURSOR;
	goto yy58;
yy46:
#line 180 "scanner.re"
{ SubStr substr;
				  s->cur = cursor;
				  substr = Scanner_token(s);
				  yylval.symbol = Symbol_find(&substr);
				  return ID; }
#line 345 "scanner.c"
yy47:	yych = *++YYCURSOR;
	goto yy56;
yy48:
#line 186 "scanner.re"
{ goto scan; }
#line 351 "scanner.c"
yy49:	yych = *++YYCURSOR;
	goto yy50;
yy50:
#line 188 "scanner.re"
{ if(cursor == s->eof) RETURN(0);
				  s->pos = cursor; s->cline++;
				  goto scan;
	    			}
#line 360 "scanner.c"
yy51:	yych = *++YYCURSOR;
	goto yy52;
yy52:
#line 193 "scanner.re"
{ s->cur = cursor;
				  yylval.regexp = mkDot();
				  return RANGE;
				}
#line 369 "scanner.c"
yy53:	yych = *++YYCURSOR;
	goto yy54;
yy54:
#line 198 "scanner.re"
{ fprintf(stderr, "unexpected character: '%c'\n", *s->tok);
				  goto scan;
				}
#line 377 "scanner.c"
yy55:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	goto yy56;
yy56:	if(yych == '\t')	goto yy55;
	if(yych == ' ')	goto yy55;
	goto yy48;
yy57:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	goto yy58;
yy58:	if(yych <= '@'){
		if(yych <= '/')	goto yy46;
		if(yych <= '9')	goto yy57;
		goto yy46;
	} else {
		if(yych <= 'Z')	goto yy57;
		if(yych <= '`')	goto yy46;
		if(yych <= 'z')	goto yy57;
		goto yy46;
	}
yy59:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	goto yy60;
yy60:	if(yych <= '['){
		if(yych != '\n')	goto yy59;
		goto yy61;
	} else {
		if(yych <= '\\')	goto yy64;
		if(yych <= ']')	goto yy65;
		goto yy59;
	}
yy61:	YYCURSOR = YYMARKER;
	switch(yyaccept){
	case 0:	goto yy32;
	case 1:	goto yy38;
	case 2:	goto yy40;
	case 3:	goto yy42;
	}
yy62:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	goto yy63;
yy63:	if(yych <= '['){
		if(yych == '\n')	goto yy61;
		goto yy62;
	} else {
		if(yych <= '\\')	goto yy67;
		if(yych <= ']')	goto yy68;
		goto yy62;
	}
yy64:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	if(yych == '\n')	goto yy61;
	goto yy59;
yy65:	yych = *++YYCURSOR;
	goto yy66;
yy66:
#line 157 "scanner.re"
{ s->cur = cursor;
				  yylval.regexp = ranToRE(Scanner_token(s));
				  return RANGE; }
#line 442 "scanner.c"
yy67:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	if(yych == '\n')	goto yy61;
	goto yy62;
yy68:	yych = *++YYCURSOR;
	goto yy69;
yy69:
#line 153 "scanner.re"
{ s->cur = cursor;
				  yylval.regexp = invToRE(Scanner_token(s));
				  return RANGE; }
#line 455 "scanner.c"
yy70:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	goto yy71;
yy71:	if(yych <= '&'){
		if(yych == '\n')	goto yy61;
		goto yy70;
	} else {
		if(yych <= '\'')	goto yy73;
		if(yych != '\\')	goto yy70;
		goto yy72;
	}
yy72:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	if(yych == '\n')	goto yy61;
	goto yy70;
yy73:	yych = *++YYCURSOR;
	goto yy74;
yy74:
#line 146 "scanner.re"
{ s->cur = cursor;
				  yylval.regexp = strToCaseInsensitiveRE(Scanner_token(s));
				  return STRING; }
#line 480 "scanner.c"
yy75:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	goto yy76;
yy76:	if(yych <= '!'){
		if(yych == '\n')	goto yy61;
		goto yy75;
	} else {
		if(yych <= '"')	goto yy78;
		if(yych != '\\')	goto yy75;
		goto yy77;
	}
yy77:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	if(yych == '\n')	goto yy61;
	goto yy75;
yy78:	yych = *++YYCURSOR;
	goto yy79;
yy79:
#line 142 "scanner.re"
{ s->cur = cursor;
				  yylval.regexp = strToRE(Scanner_token(s));
				  return STRING; }
#line 505 "scanner.c"
yy80:	yych = *++YYCURSOR;
	goto yy81;
yy81:
#line 139 "scanner.re"
{ s->tok = cursor;
				  RETURN(0); }
#line 512 "scanner.c"
yy82:	yych = *++YYCURSOR;
	goto yy83;
yy83:
#line 136 "scanner.re"
{ depth = 1;
				  goto comment; }
#line 519 "scanner.c"
yy84:	++YYCURSOR;
	if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
	yych = *YYCURSOR;
	goto yy85;
yy85:	if(yych <= '/'){
		if(yych == ',')	goto yy88;
		goto yy61;
	} else {
		if(yych <= '9')	goto yy84;
		if(yych != '}')	goto yy61;
		goto yy86;
	}
yy86:	yych = *++YYCURSOR;
	goto yy87;
yy87:
#line 168 "scanner.re"
{ yylval.extop.minsize = atoi((char *)s->tok+1);
				  yylval.extop.maxsize = atoi((char *)s->tok+1);
				  RETURN(CLOSESIZE); }
#line 539 "scanner.c"
yy88:	yych = *++YYCURSOR;
	if(yych != '}')	goto yy92;
	goto yy89;
yy89:	yych = *++YYCURSOR;
	goto yy90;
yy90:
#line 176 "scanner.re"
{ yylval.extop.minsize = atoi((char *)s->tok+1);
				  yylval.extop.maxsize = -1;
				  RETURN(CLOSESIZE); }
#line 550 "scanner.c"
yy91:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	goto yy92;
yy92:	if(yych <= '/')	goto yy61;
	if(yych <= '9')	goto yy91;
	if(yych != '}')	goto yy61;
	goto yy93;
yy93:	yych = *++YYCURSOR;
	goto yy94;
yy94:
#line 172 "scanner.re"
{ yylval.extop.minsize = atoi((char *)s->tok+1);
				  yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)s->tok, ',')+1));
				  RETURN(CLOSESIZE); }
#line 566 "scanner.c"
}
#line 201 "scanner.re"


code:

#line 573 "scanner.c"
{
	YYCTYPE yych;
	unsigned int yyaccept;
	goto yy95;
	++YYCURSOR;
yy95:
	if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
	yych = *YYCURSOR;
	if(yych <= '&'){
		if(yych <= '\n'){
			if(yych <= '\t')	goto yy103;
			goto yy101;
		} else {
			if(yych == '"')	goto yy105;
			goto yy103;
		}
	} else {
		if(yych <= '{'){
			if(yych <= '\'')	goto yy106;
			if(yych <= 'z')	goto yy103;
			goto yy99;
		} else {
			if(yych != '}')	goto yy103;
			goto yy97;
		}
	}
yy97:	yych = *++YYCURSOR;
	goto yy98;
yy98:
#line 205 "scanner.re"
{ if(--depth == 0){
					s->cur = cursor;
					yylval.token = Token_new(Scanner_token(s), s->tline);
					return CODE;
				  }
				  goto code; }
#line 610 "scanner.c"
yy99:	yych = *++YYCURSOR;
	goto yy100;
yy100:
#line 211 "scanner.re"
{ ++depth;
				  goto code; }
#line 617 "scanner.c"
yy101:	yych = *++YYCURSOR;
	goto yy102;
yy102:
#line 213 "scanner.re"
{ if(cursor == s->eof) Scanner_fatal(s, "missing '}'");
				  s->pos = cursor; s->cline++;
				  goto code;
				}
#line 626 "scanner.c"
yy103:	yych = *++YYCURSOR;
	goto yy104;
yy104:
#line 217 "scanner.re"
{ goto code; }
#line 632 "scanner.c"
yy105:	yyaccept = 0;
	yych = *(YYMARKER = ++YYCURSOR);
	if(yych == '\n')	goto yy104;
	goto yy112;
yy106:	yyaccept = 0;
	yych = *(YYMARKER = ++YYCURSOR);
	if(yych == '\n')	goto yy104;
	goto yy108;
yy107:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	goto yy108;
yy108:	if(yych <= '&'){
		if(yych != '\n')	goto yy107;
		goto yy109;
	} else {
		if(yych <= '\'')	goto yy103;
		if(yych == '\\')	goto yy110;
		goto yy107;
	}
yy109:	YYCURSOR = YYMARKER;
	switch(yyaccept){
	case 0:	goto yy104;
	}
yy110:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	if(yych == '\n')	goto yy109;
	goto yy107;
yy111:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	goto yy112;
yy112:	if(yych <= '!'){
		if(yych == '\n')	goto yy109;
		goto yy111;
	} else {
		if(yych <= '"')	goto yy103;
		if(yych != '\\')	goto yy111;
		goto yy113;
	}
yy113:	++YYCURSOR;
	if(YYLIMIT == YYCURSOR) YYFILL(1);
	yych = *YYCURSOR;
	if(yych == '\n')	goto yy109;
	goto yy111;
}
#line 218 "scanner.re"


comment:

#line 685 "scanner.c"
{
	YYCTYPE yych;
	goto yy114;
	++YYCURSOR;
yy114:
	if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
	yych = *YYCURSOR;
	if(yych <= ')'){
		if(yych == '\n')	goto yy119;
		goto yy121;
	} else {
		if(yych <= '*')	goto yy116;
		if(yych == '/')	goto yy118;
		goto yy121;
	}
yy116:	yych = *++YYCURSOR;
	if(yych == '/')	goto yy124;
	goto yy117;
yy117:
#line 232 "scanner.re"
{ goto comment; }
#line 707 "scanner.c"
yy118:	yych = *++YYCURSOR;
	if(yych == '*')	goto yy122;
	goto yy117;
yy119:	yych = *++YYCURSOR;
	goto yy120;
yy120:
#line 228 "scanner.re"
{ if(cursor == s->eof) RETURN(0);
				  s->tok = s->pos = cursor; s->cline++;
				  goto comment;
				}
#line 719 "scanner.c"
yy121:	yych = *++YYCURSOR;
	goto yy117;
yy122:	yych = *++YYCURSOR;
	goto yy123;
yy123:
#line 226 "scanner.re"
{ ++depth;
				  goto comment; }
#line 728 "scanner.c"
yy124:	yych = *++YYCURSOR;
	goto yy125;
yy125:
#line 222 "scanner.re"
{ if(--depth == 0)
					goto scan;
				    else
					goto comment; }
#line 737 "scanner.c"
}
#line 233 "scanner.re"

}