-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for --invert-captures option.
- Loading branch information
Showing
4 changed files
with
626 additions
and
0 deletions.
There are no files selected for viewing
241 changes: 241 additions & 0 deletions
241
test/captures/noncapturing/explicit2_leftmost_inverted.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,241 @@ | ||
/* Generated by re2c */ | ||
// re2c $INPUT -o $OUTPUT -i --leftmost-captures --invert-captures | ||
|
||
|
||
{ | ||
YYCTYPE yych; | ||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); | ||
yych = *YYCURSOR; | ||
switch (yych) { | ||
case 'a': goto yy3; | ||
default: goto yy1; | ||
} | ||
yy1: | ||
++YYCURSOR; | ||
yy2: | ||
{} | ||
yy3: | ||
yych = *++YYCURSOR; | ||
switch (yych) { | ||
case 'a': goto yy4; | ||
default: goto yy2; | ||
} | ||
yy4: | ||
++YYCURSOR; | ||
{} | ||
} | ||
|
||
|
||
|
||
{ | ||
YYCTYPE yych; | ||
if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); | ||
yych = *YYCURSOR; | ||
switch (yych) { | ||
case 'a': goto yy8; | ||
default: goto yy6; | ||
} | ||
yy6: | ||
++YYCURSOR; | ||
yy7: | ||
{} | ||
yy8: | ||
yych = *(YYMARKER = ++YYCURSOR); | ||
switch (yych) { | ||
case 'b': goto yy9; | ||
default: goto yy7; | ||
} | ||
yy9: | ||
yych = *++YYCURSOR; | ||
switch (yych) { | ||
case 'a': goto yy11; | ||
default: goto yy10; | ||
} | ||
yy10: | ||
YYCURSOR = YYMARKER; | ||
goto yy7; | ||
yy11: | ||
yych = *++YYCURSOR; | ||
switch (yych) { | ||
case 'b': goto yy12; | ||
default: goto yy10; | ||
} | ||
yy12: | ||
++YYCURSOR; | ||
{} | ||
} | ||
|
||
|
||
|
||
{ | ||
YYCTYPE yych; | ||
if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); | ||
yych = *YYCURSOR; | ||
switch (yych) { | ||
case 'a': goto yy16; | ||
default: goto yy14; | ||
} | ||
yy14: | ||
++YYCURSOR; | ||
yy15: | ||
{} | ||
yy16: | ||
yych = *(YYMARKER = ++YYCURSOR); | ||
switch (yych) { | ||
case 'b': goto yy17; | ||
default: goto yy15; | ||
} | ||
yy17: | ||
yych = *++YYCURSOR; | ||
switch (yych) { | ||
case 'a': goto yy19; | ||
default: goto yy18; | ||
} | ||
yy18: | ||
YYCURSOR = YYMARKER; | ||
goto yy15; | ||
yy19: | ||
yych = *++YYCURSOR; | ||
switch (yych) { | ||
case 'b': goto yy20; | ||
default: goto yy18; | ||
} | ||
yy20: | ||
++YYCURSOR; | ||
yynmatch = 2; | ||
yypmatch[0] = YYCURSOR - 3; | ||
yypmatch[1] = YYCURSOR - 2; | ||
yypmatch[2] = YYCURSOR - 1; | ||
yypmatch[3] = YYCURSOR; | ||
{} | ||
} | ||
|
||
|
||
|
||
{ | ||
YYCTYPE yych; | ||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); | ||
yych = *YYCURSOR; | ||
switch (yych) { | ||
case 'a': | ||
case 'b': goto yy24; | ||
default: goto yy22; | ||
} | ||
yy22: | ||
++YYCURSOR; | ||
yy23: | ||
{} | ||
yy24: | ||
yych = *++YYCURSOR; | ||
switch (yych) { | ||
case 'a': | ||
case 'b': goto yy25; | ||
default: goto yy23; | ||
} | ||
yy25: | ||
++YYCURSOR; | ||
{} | ||
} | ||
|
||
|
||
|
||
{ | ||
YYCTYPE yych; | ||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); | ||
yych = *YYCURSOR; | ||
switch (yych) { | ||
case 'a': goto yy29; | ||
case 'b': goto yy30; | ||
default: goto yy27; | ||
} | ||
yy27: | ||
++YYCURSOR; | ||
yy28: | ||
{} | ||
yy29: | ||
yych = *++YYCURSOR; | ||
switch (yych) { | ||
case 'a': | ||
yyt1 = NULL; | ||
goto yy31; | ||
case 'b': | ||
yyt1 = NULL; | ||
goto yy33; | ||
default: goto yy28; | ||
} | ||
yy30: | ||
yych = *++YYCURSOR; | ||
switch (yych) { | ||
case 'a': | ||
yyt1 = YYCURSOR; | ||
goto yy31; | ||
case 'b': | ||
yyt1 = YYCURSOR; | ||
goto yy33; | ||
default: goto yy28; | ||
} | ||
yy31: | ||
++YYCURSOR; | ||
yyt2 = NULL; | ||
yy32: | ||
yynmatch = 2; | ||
yypmatch[1] = yyt1; | ||
yypmatch[3] = yyt2; | ||
yypmatch[0] = yyt1; | ||
if (yyt1 != NULL) yypmatch[0] -= 1; | ||
yypmatch[2] = yyt2; | ||
if (yyt2 != NULL) yypmatch[2] -= 1; | ||
{} | ||
yy33: | ||
++YYCURSOR; | ||
yyt2 = YYCURSOR; | ||
goto yy32; | ||
} | ||
|
||
|
||
|
||
{ | ||
YYCTYPE yych; | ||
goto yy34; | ||
yy35: | ||
++YYCURSOR; | ||
yy34: | ||
if (YYLIMIT <= YYCURSOR) YYFILL(1); | ||
yych = *YYCURSOR; | ||
switch (yych) { | ||
case 'a': goto yy35; | ||
default: goto yy36; | ||
} | ||
yy36: | ||
{} | ||
} | ||
|
||
|
||
|
||
{ | ||
YYCTYPE yych; | ||
goto yy37; | ||
yy38: | ||
++YYCURSOR; | ||
yy37: | ||
if (YYLIMIT <= YYCURSOR) YYFILL(1); | ||
yych = *YYCURSOR; | ||
switch (yych) { | ||
case 'a': goto yy38; | ||
default: | ||
yyt1 = NULL; | ||
goto yy39; | ||
} | ||
yy39: | ||
yynmatch = 2; | ||
yypmatch[1] = yyt1; | ||
yypmatch[3] = yyt1; | ||
yypmatch[0] = yyt1; | ||
if (yyt1 != NULL) yypmatch[0] -= 2; | ||
yypmatch[2] = yyt1; | ||
if (yyt1 != NULL) yypmatch[2] -= 2; | ||
{} | ||
} | ||
|
||
captures/noncapturing/explicit2_leftmost_inverted.re:35:9: warning: rule matches empty string [-Wmatch-empty-string] | ||
captures/noncapturing/explicit2_leftmost_inverted.re:40:9: warning: rule matches empty string [-Wmatch-empty-string] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// re2c $INPUT -o $OUTPUT -i --leftmost-captures --invert-captures | ||
|
||
/*!local:re2c | ||
x = ("a"); | ||
x x {} | ||
* {} | ||
*/ | ||
|
||
/*!local:re2c | ||
x = ("a" "b"); | ||
x x {} | ||
* {} | ||
*/ | ||
|
||
/*!local:re2c | ||
x = ("a" (!"b")); | ||
x x {} | ||
* {} | ||
*/ | ||
|
||
/*!local:re2c | ||
x = ("a" | "b"); | ||
x x {} | ||
* {} | ||
*/ | ||
|
||
/*!local:re2c | ||
x = ("a" | (!"b")); | ||
x x {} | ||
* {} | ||
*/ | ||
|
||
/*!local:re2c | ||
x = ("a" | "aa"); | ||
x*x* {} | ||
*/ | ||
|
||
/*!local:re2c | ||
x = ("a" | (!"aa")); | ||
x*x* {} | ||
*/ |
Oops, something went wrong.