more accurate icnt for rep operator
This commit is contained in:
6
pike.c
6
pike.c
@@ -290,7 +290,7 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode)
|
|||||||
break;
|
break;
|
||||||
case '{':;
|
case '{':;
|
||||||
int maxcnt = 0, mincnt = 0,
|
int maxcnt = 0, mincnt = 0,
|
||||||
i = 0, icnt = 1, size, split;
|
i = 0, icnt = 0, size, split;
|
||||||
re++;
|
re++;
|
||||||
while (isdigit((unsigned char) *re))
|
while (isdigit((unsigned char) *re))
|
||||||
mincnt = mincnt * 10 + *re++ - '0';
|
mincnt = mincnt * 10 + *re++ - '0';
|
||||||
@@ -319,13 +319,15 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode)
|
|||||||
}
|
}
|
||||||
if (code) {
|
if (code) {
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
switch (code[term]) {
|
switch (code[term+i]) {
|
||||||
case CLASS:
|
case CLASS:
|
||||||
|
i += code[term+i+2] * 2 + 1;
|
||||||
case JMP:
|
case JMP:
|
||||||
case SPLIT:
|
case SPLIT:
|
||||||
case RSPLIT:
|
case RSPLIT:
|
||||||
case SAVE:
|
case SAVE:
|
||||||
case CHAR:
|
case CHAR:
|
||||||
|
i++;
|
||||||
icnt++;
|
icnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3
test.sh
3
test.sh
@@ -45,6 +45,7 @@ b[^c]*
|
|||||||
[а-г]+
|
[а-г]+
|
||||||
called|chief|dust|familiar|forth|waif|campaign|divers|smile|notice|kill|human|stands|nightshade|dollar|doughty|gloaming|twist|July|officers|wrest|coop|one|ability|welcome|significance|writer|spring|it's|helped|set|Paris|from|coomb|stay|hummock|taken|anon|makes|boat|nearly|am|justice|further|expression|contemporary|sooth|order|about|question|lived|apply|educational|of|night|satisfy|opened|never|success|until|visit|promise|parts|beneath|matter|typical|bade|apartment|rapidly|primary|bring|throat|hold|laws|understand|trade|desire|material|evidence|another|often|plash|model|someone|bond|hell|relationship|probably|exercise|performance|wants|known|countries|gammer|leeward|took|itself|representative|objection|aircraft
|
called|chief|dust|familiar|forth|waif|campaign|divers|smile|notice|kill|human|stands|nightshade|dollar|doughty|gloaming|twist|July|officers|wrest|coop|one|ability|welcome|significance|writer|spring|it's|helped|set|Paris|from|coomb|stay|hummock|taken|anon|makes|boat|nearly|am|justice|further|expression|contemporary|sooth|order|about|question|lived|apply|educational|of|night|satisfy|opened|never|success|until|visit|promise|parts|beneath|matter|typical|bade|apartment|rapidly|primary|bring|throat|hold|laws|understand|trade|desire|material|evidence|another|often|plash|model|someone|bond|hell|relationship|probably|exercise|performance|wants|known|countries|gammer|leeward|took|itself|representative|objection|aircraft
|
||||||
abc+h+d+f
|
abc+h+d+f
|
||||||
|
([0-9]|abc){5}[0-9]+(grh)
|
||||||
"
|
"
|
||||||
input="\
|
input="\
|
||||||
abcdef
|
abcdef
|
||||||
@@ -91,6 +92,7 @@ aaaabcdefghij
|
|||||||
ааааабвг...
|
ааааабвг...
|
||||||
hhfd h23 performance
|
hhfd h23 performance
|
||||||
abcccccccccccchdf
|
abcccccccccccchdf
|
||||||
|
344444442344grhhhsdfg
|
||||||
"
|
"
|
||||||
expect="\
|
expect="\
|
||||||
(0,3)
|
(0,3)
|
||||||
@@ -137,6 +139,7 @@ expect="\
|
|||||||
(0,16)
|
(0,16)
|
||||||
(10,21)
|
(10,21)
|
||||||
(0,17)
|
(0,17)
|
||||||
|
(0,15)(4,5)(12,15)
|
||||||
(0,0)
|
(0,0)
|
||||||
"
|
"
|
||||||
c=1
|
c=1
|
||||||
|
|||||||
Reference in New Issue
Block a user