From: helly Date: Mon, 18 Feb 2008 22:58:16 +0000 (+0000) Subject: - Partial support for flex syntax. X-Git-Tag: 0.13.6~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f35d6134a602e8a9277056067ae4826bad2de4c8;p=re2c - Partial support for flex syntax. --- diff --git a/re2c/CHANGELOG b/re2c/CHANGELOG index e218d26f..5aa8a176 100644 --- a/re2c/CHANGELOG +++ b/re2c/CHANGELOG @@ -1,5 +1,6 @@ Version 0.13.3 (2008-??-??) --------------------------- +- Partial support for flex syntax. - Changed to allow /* comments with -c switch. Version 0.13.2 (2008-02-14) diff --git a/re2c/bootstrap/scanner.cc b/re2c/bootstrap/scanner.cc index 3e114c85..7f9339df 100644 --- a/re2c/bootstrap/scanner.cc +++ b/re2c/bootstrap/scanner.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.2.dev on Fri Feb 15 01:08:50 2008 */ +/* Generated by re2c 0.13.3.dev on Mon Feb 18 22:23:11 2008 */ /* $Id$ */ #include #include @@ -499,11 +499,21 @@ scan: yy71: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') { - if (yych == ',') goto yy156; + if (yych <= '@') { + if (yych <= '/') { + if (yych == ',') goto yy158; + } else { + if (yych <= '0') goto yy155; + if (yych <= '9') goto yy156; + } } else { - if (yych <= '0') goto yy153; - if (yych <= '9') goto yy154; + if (yych <= '_') { + if (yych <= 'Z') goto yy153; + if (yych >= '_') goto yy153; + } else { + if (yych <= '`') goto yy72; + if (yych <= 'z') goto yy153; + } } yy72: { @@ -688,7 +698,7 @@ yy109: if (yyaccept <= 6) { goto yy112; } else { - goto yy157; + goto yy159; } } } @@ -922,51 +932,73 @@ yy151: RETURN(*tok); } yy153: + ++YYCURSOR; + if (YYLIMIT == YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '^') { + if (yych <= '9') { + if (yych <= '/') goto yy109; + goto yy153; + } else { + if (yych <= '@') goto yy109; + if (yych <= 'Z') goto yy153; + goto yy109; + } + } else { + if (yych <= 'z') { + if (yych == '`') goto yy109; + goto yy153; + } else { + if (yych == '}') goto yy172; + goto yy109; + } + } +yy155: yych = *++YYCURSOR; - if (yych == ',') goto yy167; - goto yy155; -yy154: + if (yych == ',') goto yy169; + goto yy157; +yy156: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; -yy155: +yy157: if (yybm[0+yych] & 128) { - goto yy154; + goto yy156; } - if (yych == ',') goto yy160; - if (yych == '}') goto yy158; + if (yych == ',') goto yy162; + if (yych == '}') goto yy160; goto yy109; -yy156: +yy158: ++YYCURSOR; -yy157: +yy159: { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -yy158: +yy160: ++YYCURSOR; { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = atoi((char *)tok+1); RETURN(CLOSESIZE); } -yy160: +yy162: yyaccept = 7; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy157; - if (yych <= '9') goto yy163; - if (yych != '}') goto yy157; + if (yych <= '/') goto yy159; + if (yych <= '9') goto yy165; + if (yych != '}') goto yy159; ++YYCURSOR; { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = -1; RETURN(CLOSESIZE); } -yy163: +yy165: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= '/') goto yy109; - if (yych <= '9') goto yy163; + if (yych <= '9') goto yy165; if (yych != '}') goto yy109; ++YYCURSOR; { @@ -974,17 +1006,27 @@ yy163: yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1)); RETURN(CLOSESIZE); } -yy167: +yy169: yyaccept = 7; yych = *(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy157; - if (yych <= '9') goto yy163; - if (yych != '}') goto yy157; + if (yych <= '/') goto yy159; + if (yych <= '9') goto yy165; + if (yych != '}') goto yy159; ++YYCURSOR; { yylval.op = '*'; RETURN(CLOSE); } +yy172: + ++YYCURSOR; + { + if (!FFlag) { + fatal("curly braces for names only allowed with -F switch"); + } + cur = cursor; + yylval.symbol = Symbol::find(token(1, cur - tok - 2)); + return ID; + } } @@ -1030,20 +1072,20 @@ code: yych = *YYCURSOR; if (yych <= '&') { if (yych <= 0x0A) { - if (yych <= 0x00) goto yy178; - if (yych <= 0x09) goto yy180; - goto yy176; - } else { - if (yych == '"') goto yy182; + if (yych <= 0x00) goto yy182; + if (yych <= 0x09) goto yy184; goto yy180; + } else { + if (yych == '"') goto yy186; + goto yy184; } } else { if (yych <= '{') { - if (yych <= '\'') goto yy183; - if (yych <= 'z') goto yy180; - goto yy174; + if (yych <= '\'') goto yy187; + if (yych <= 'z') goto yy184; + goto yy178; } else { - if (yych != '}') goto yy180; + if (yych != '}') goto yy184; } } ++YYCURSOR; @@ -1060,7 +1102,7 @@ code: } goto code; } -yy174: +yy178: ++YYCURSOR; { if (depth == 0) @@ -1073,17 +1115,17 @@ yy174: } goto code; } -yy176: +yy180: YYCTXMARKER = YYCURSOR + 1; ++YYCURSOR; if ((yych = *YYCURSOR) <= 0x0C) { - if (yych <= 0x08) goto yy177; - if (yych <= 0x0A) goto yy191; + if (yych <= 0x08) goto yy181; + if (yych <= 0x0A) goto yy195; } else { - if (yych <= 0x0D) goto yy191; - if (yych == ' ') goto yy191; + if (yych <= 0x0D) goto yy195; + if (yych == ' ') goto yy195; } -yy177: +yy181: { if (depth == 0) { @@ -1104,7 +1146,7 @@ yy177: cline++; goto code; } -yy178: +yy182: ++YYCURSOR; { if (cursor == eof) @@ -1117,56 +1159,56 @@ yy178: } goto code; } -yy180: +yy184: ++YYCURSOR; -yy181: +yy185: { goto code; } -yy182: +yy186: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 0x0A) goto yy181; - goto yy189; -yy183: + if (yych == 0x0A) goto yy185; + goto yy193; +yy187: yych = *(YYMARKER = ++YYCURSOR); - if (yych == 0x0A) goto yy181; - goto yy185; -yy184: + if (yych == 0x0A) goto yy185; + goto yy189; +yy188: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy185: +yy189: if (yybm[0+yych] & 64) { - goto yy184; + goto yy188; } - if (yych <= '&') goto yy186; - if (yych <= '\'') goto yy180; - goto yy187; -yy186: + if (yych <= '&') goto yy190; + if (yych <= '\'') goto yy184; + goto yy191; +yy190: YYCURSOR = YYMARKER; - goto yy181; -yy187: + goto yy185; +yy191: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == 0x0A) goto yy186; - goto yy184; -yy188: + if (yych == 0x0A) goto yy190; + goto yy188; +yy192: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy189: +yy193: if (yybm[0+yych] & 128) { - goto yy188; + goto yy192; } - if (yych <= '!') goto yy186; - if (yych <= '"') goto yy180; + if (yych <= '!') goto yy190; + if (yych <= '"') goto yy184; ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == 0x0A) goto yy186; - goto yy188; -yy191: + if (yych == 0x0A) goto yy190; + goto yy192; +yy195: ++YYCURSOR; YYCURSOR = YYCTXMARKER; { @@ -1192,17 +1234,17 @@ comment: if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych <= ')') { - if (yych == 0x0A) goto yy198; - goto yy200; + if (yych == 0x0A) goto yy202; + goto yy204; } else { - if (yych <= '*') goto yy195; - if (yych == '/') goto yy197; - goto yy200; + if (yych <= '*') goto yy199; + if (yych == '/') goto yy201; + goto yy204; } -yy195: +yy199: ++YYCURSOR; - if ((yych = *YYCURSOR) == '/') goto yy203; -yy196: + if ((yych = *YYCURSOR) == '/') goto yy207; +yy200: { if(cursor == eof) { @@ -1210,11 +1252,11 @@ yy196: } goto comment; } -yy197: +yy201: yych = *++YYCURSOR; - if (yych == '*') goto yy201; - goto yy196; -yy198: + if (yych == '*') goto yy205; + goto yy200; +yy202: ++YYCURSOR; { if(cursor == eof) @@ -1225,17 +1267,17 @@ yy198: cline++; goto comment; } -yy200: +yy204: yych = *++YYCURSOR; - goto yy196; -yy201: + goto yy200; +yy205: ++YYCURSOR; { ++depth; fatal("ambiguous /* found"); goto comment; } -yy203: +yy207: ++YYCURSOR; { if(--depth == 0) @@ -1291,52 +1333,52 @@ config: if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych <= 0x1F) { - if (yych != 0x09) goto yy211; + if (yych != 0x09) goto yy215; } else { - if (yych <= ' ') goto yy207; - if (yych == '=') goto yy209; - goto yy211; + if (yych <= ' ') goto yy211; + if (yych == '=') goto yy213; + goto yy215; } -yy207: +yy211: ++YYCURSOR; yych = *YYCURSOR; - goto yy216; -yy208: + goto yy220; +yy212: { goto config; } -yy209: +yy213: ++YYCURSOR; yych = *YYCURSOR; - goto yy214; -yy210: + goto yy218; +yy214: { iscfg = 2; cur = cursor; RETURN('='); } -yy211: +yy215: ++YYCURSOR; { fatal("missing '='"); } -yy213: +yy217: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy214: +yy218: if (yybm[0+yych] & 128) { - goto yy213; + goto yy217; } - goto yy210; -yy215: + goto yy214; +yy219: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy216: - if (yych == 0x09) goto yy215; - if (yych == ' ') goto yy215; - goto yy208; +yy220: + if (yych == 0x09) goto yy219; + if (yych == ' ') goto yy219; + goto yy212; } @@ -1382,191 +1424,191 @@ value: yych = *YYCURSOR; if (yych <= '&') { if (yych <= 0x0D) { - if (yych <= 0x08) goto yy225; - if (yych <= 0x0A) goto yy219; - if (yych <= 0x0C) goto yy225; + if (yych <= 0x08) goto yy229; + if (yych <= 0x0A) goto yy223; + if (yych <= 0x0C) goto yy229; } else { if (yych <= ' ') { - if (yych <= 0x1F) goto yy225; + if (yych <= 0x1F) goto yy229; } else { - if (yych == '"') goto yy227; - goto yy225; + if (yych == '"') goto yy231; + goto yy229; } } } else { if (yych <= '/') { - if (yych <= '\'') goto yy229; - if (yych == '-') goto yy222; - goto yy225; + if (yych <= '\'') goto yy233; + if (yych == '-') goto yy226; + goto yy229; } else { if (yych <= '9') { - if (yych <= '0') goto yy220; - goto yy223; + if (yych <= '0') goto yy224; + goto yy227; } else { - if (yych != ';') goto yy225; + if (yych != ';') goto yy229; } } } -yy219: +yy223: { cur = cursor; yylval.str = new Str(token()); iscfg = 0; return VALUE; } -yy220: +yy224: ++YYCURSOR; if (yybm[0+(yych = *YYCURSOR)] & 8) { - goto yy225; + goto yy229; } -yy221: +yy225: { cur = cursor; yylval.number = atoi(token().to_string().c_str()); iscfg = 0; return NUMBER; } -yy222: +yy226: yych = *++YYCURSOR; - if (yych <= '0') goto yy226; - if (yych >= ':') goto yy226; -yy223: + if (yych <= '0') goto yy230; + if (yych >= ':') goto yy230; +yy227: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 4) { - goto yy223; + goto yy227; } if (yych <= 0x0D) { - if (yych <= 0x08) goto yy225; - if (yych <= 0x0A) goto yy221; - if (yych >= 0x0D) goto yy221; + if (yych <= 0x08) goto yy229; + if (yych <= 0x0A) goto yy225; + if (yych >= 0x0D) goto yy225; } else { if (yych <= ' ') { - if (yych >= ' ') goto yy221; + if (yych >= ' ') goto yy225; } else { - if (yych == ';') goto yy221; + if (yych == ';') goto yy225; } } -yy225: +yy229: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy226: +yy230: if (yybm[0+yych] & 8) { - goto yy225; + goto yy229; } - goto yy219; -yy227: + goto yy223; +yy231: YYMARKER = ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 16) { - goto yy227; + goto yy231; } if (yych <= '!') { - if (yych == 0x0A) goto yy219; - goto yy237; + if (yych == 0x0A) goto yy223; + goto yy241; } else { - if (yych <= '"') goto yy225; - if (yych <= '[') goto yy237; - goto yy239; + if (yych <= '"') goto yy229; + if (yych <= '[') goto yy241; + goto yy243; } -yy229: +yy233: YYMARKER = ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 32) { - goto yy229; + goto yy233; } if (yych <= '&') { - if (yych == 0x0A) goto yy219; + if (yych == 0x0A) goto yy223; } else { - if (yych <= '\'') goto yy225; - if (yych >= '\\') goto yy234; + if (yych <= '\'') goto yy229; + if (yych >= '\\') goto yy238; } -yy231: +yy235: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 64) { - goto yy231; + goto yy235; } - if (yych <= '&') goto yy233; - if (yych <= '\'') goto yy235; - goto yy236; -yy233: + if (yych <= '&') goto yy237; + if (yych <= '\'') goto yy239; + goto yy240; +yy237: YYCURSOR = YYMARKER; - goto yy219; -yy234: + goto yy223; +yy238: YYMARKER = ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x0D) { if (yych <= 0x09) { - if (yych <= 0x08) goto yy229; - goto yy231; + if (yych <= 0x08) goto yy233; + goto yy235; } else { - if (yych <= 0x0A) goto yy219; - if (yych <= 0x0C) goto yy229; - goto yy231; + if (yych <= 0x0A) goto yy223; + if (yych <= 0x0C) goto yy233; + goto yy235; } } else { if (yych <= ' ') { - if (yych <= 0x1F) goto yy229; - goto yy231; + if (yych <= 0x1F) goto yy233; + goto yy235; } else { - if (yych == ';') goto yy231; - goto yy229; + if (yych == ';') goto yy235; + goto yy233; } } -yy235: +yy239: yych = *++YYCURSOR; - goto yy219; -yy236: + goto yy223; +yy240: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == 0x0A) goto yy233; - goto yy231; -yy237: + if (yych == 0x0A) goto yy237; + goto yy235; +yy241: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 128) { - goto yy237; + goto yy241; } - if (yych <= '!') goto yy233; - if (yych <= '"') goto yy235; - goto yy240; -yy239: + if (yych <= '!') goto yy237; + if (yych <= '"') goto yy239; + goto yy244; +yy243: YYMARKER = ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yych <= 0x0D) { if (yych <= 0x09) { - if (yych <= 0x08) goto yy227; - goto yy237; + if (yych <= 0x08) goto yy231; + goto yy241; } else { - if (yych <= 0x0A) goto yy219; - if (yych <= 0x0C) goto yy227; - goto yy237; + if (yych <= 0x0A) goto yy223; + if (yych <= 0x0C) goto yy231; + goto yy241; } } else { if (yych <= ' ') { - if (yych <= 0x1F) goto yy227; - goto yy237; + if (yych <= 0x1F) goto yy231; + goto yy241; } else { - if (yych == ';') goto yy237; - goto yy227; + if (yych == ';') goto yy241; + goto yy231; } } -yy240: +yy244: ++YYCURSOR; if (YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == 0x0A) goto yy233; - goto yy237; + if (yych == 0x0A) goto yy237; + goto yy241; } } diff --git a/re2c/globals.h b/re2c/globals.h index eb79e908..35ae798c 100644 --- a/re2c/globals.h +++ b/re2c/globals.h @@ -21,6 +21,7 @@ extern bool cFlag; extern bool dFlag; extern bool eFlag; extern bool fFlag; +extern bool FFlag; extern bool gFlag; extern bool iFlag; extern bool sFlag; diff --git a/re2c/htdocs/manual.html b/re2c/htdocs/manual.html index 85fbb444..582c3d61 100755 --- a/re2c/htdocs/manual.html +++ b/re2c/htdocs/manual.html @@ -15,7 +15,7 @@ Updated: 23 Aug 2007

re2c - convert regular expressions to C/C++

 

SYNOPSIS

-

re2c [-bdefghisuvVw1] [-o output] [-c [-t header]] file

+

re2c [-bdefFghisuvVw1] [-o output] [-c [-t header]] file

 

DESCRIPTION

re2c is a preprocessor that generates C-based recognizers from @@ -105,6 +105,8 @@ YYDEBUG(int state, char current). The first parameter receives the state or

-f
Generate a scanner with support for storable state. For details see below at SCANNER WITH STORABLE STATES.

+
-F
+
Partial support for flex syntax.

-g
Generate a scanner that utilizes GCC's computed goto feature. That is re2c generates jump tables whenever a decision is of a certain complexity (e.g. a @@ -213,7 +215,7 @@ information in YYMARKER. Some easy scanners might not use this.

above.

YYSETCONDITION(c)
This define is used to set the condition in transition rules. This is only -being used when -c is active and transition rules are being used.
+being used when -c is active and transition rules are being used.

YYSETSTATE(s)
The user only needs to define this macro if the -f flag was specified. In that case, the generated code "calls" YYSETSTATE just before diff --git a/re2c/logo.pspimage b/re2c/logo.pspimage index 17c66223..e096faca 100755 Binary files a/re2c/logo.pspimage and b/re2c/logo.pspimage differ diff --git a/re2c/main.cc b/re2c/main.cc index 6d3beea4..9cd57851 100644 --- a/re2c/main.cc +++ b/re2c/main.cc @@ -27,6 +27,7 @@ bool cFlag = false; bool dFlag = false; bool eFlag = false; bool fFlag = false; +bool FFlag = false; bool gFlag = false; bool iFlag = false; bool sFlag = false; @@ -105,6 +106,7 @@ static const mbo_opt_struct OPTIONS[] = mbo_opt_struct('d', 0, "debug-output"), mbo_opt_struct('e', 0, "ecb"), mbo_opt_struct('f', 0, "storable-state"), + mbo_opt_struct('F', 0, "flex-syntax"), mbo_opt_struct('g', 0, "computed-gotos"), mbo_opt_struct('h', 0, "help"), mbo_opt_struct('i', 0, "no-debug-info"), @@ -144,6 +146,8 @@ static void usage() "\n" "-f --storable-state Generate a scanner that supports storable states.\n" "\n" + "-F --flex-syntax Partial support for flex syntax.\n" + "\n" "-g --computed-gotos Implies -b. Generate computed goto code (only useable\n" " with gcc).\n" "\n" @@ -227,6 +231,10 @@ int main(int argc, char *argv[]) fFlag = true; break; + case 'F': + FFlag = true; + break; + case 'g': gFlag = true; bFlag = true; diff --git a/re2c/re2c.1.in b/re2c/re2c.1.in index 809b2b2e..bd7f1628 100644 --- a/re2c/re2c.1.in +++ b/re2c/re2c.1.in @@ -11,7 +11,7 @@ \*(re \- convert \*(rxs to C/C++ .SH SYNOPSIS -\*(re [\fB-bdefghisuvVw1\fP] [\fB-o output\fP] [\fB-c\fP [\fB-t header\fP]] \fBfile\fP +\*(re [\fB-bdefFghisuvVw1\fP] [\fB-o output\fP] [\fB-c\fP [\fB-t header\fP]] \fBfile\fP .SH DESCRIPTION \*(re is a preprocessor that generates C-based recognizers from regular @@ -116,6 +116,9 @@ Cross-compile from an ASCII platform to an EBCDIC one. Generate a scanner with support for storable state. For details see below at \fBSCANNER WITH STORABLE STATES\fP. .TP +\fB-F\fP +Partial support for flex syntax. +.TP \fB-g\fP Generate a scanner that utilizes GCC's computed goto feature. That is \*(re generates jump tables whenever a decision is of a certain complexity (e.g. a diff --git a/re2c/scanner.h b/re2c/scanner.h index cce224dc..a3033a02 100644 --- a/re2c/scanner.h +++ b/re2c/scanner.h @@ -40,6 +40,7 @@ public: void config(const Str&, const Str&); SubStr token() const; + SubStr token(uint start, uint len) const; virtual uint get_line() const; uint xlat(uint c) const; @@ -66,6 +67,11 @@ inline SubStr Scanner::token() const return SubStr(tok, cur - tok); } +inline SubStr Scanner::token(uint start, uint len) const +{ + return SubStr(tok + start, len); +} + inline uint Scanner::xlat(uint c) const { return re2c::wFlag ? c : re2c::xlat[c & 0xFF]; diff --git a/re2c/scanner.re b/re2c/scanner.re index fc92db1e..d5e4c4be 100644 --- a/re2c/scanner.re +++ b/re2c/scanner.re @@ -364,6 +364,15 @@ scan: fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } + "{" name "}" { + if (!FFlag) { + fatal("curly braces for names only allowed with -F switch"); + } + cur = cursor; + yylval.symbol = Symbol::find(token(1, cur - tok - 2)); + return ID; + } + config { cur = cursor; tok+= 5; /* skip "re2c:" */ diff --git a/re2c/test/flex-01.i.c b/re2c/test/flex-01.i.c new file mode 100755 index 00000000..3c580016 --- /dev/null +++ b/re2c/test/flex-01.i.c @@ -0,0 +1 @@ +re2c: error: line 6, column 1: curly braces for names only allowed with -F switch diff --git a/re2c/test/flex-01.i.re b/re2c/test/flex-01.i.re new file mode 100755 index 00000000..62ab1c12 --- /dev/null +++ b/re2c/test/flex-01.i.re @@ -0,0 +1,9 @@ +/*!re2c + +F1 = "a"; +F2 = "b"; + +{F1} { return "a"; } +{F2} { return "b"; } + +*/ diff --git a/re2c/test/flex-01.iF.c b/re2c/test/flex-01.iF.c new file mode 100755 index 00000000..9b3d8c07 --- /dev/null +++ b/re2c/test/flex-01.iF.c @@ -0,0 +1,21 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; + + if (YYLIMIT == YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy3; + case 'b': goto yy5; + default: goto yy2; + } +yy2: +yy3: + ++YYCURSOR; + { return "a"; } +yy5: + ++YYCURSOR; + { return "b"; } +} + diff --git a/re2c/test/flex-01.iF.re b/re2c/test/flex-01.iF.re new file mode 100755 index 00000000..62ab1c12 --- /dev/null +++ b/re2c/test/flex-01.iF.re @@ -0,0 +1,9 @@ +/*!re2c + +F1 = "a"; +F2 = "b"; + +{F1} { return "a"; } +{F2} { return "b"; } + +*/