diff --git a/pike.c b/pike.c index e1d6957..32d7dec 100644 --- a/pike.c +++ b/pike.c @@ -290,7 +290,7 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode) break; case '{':; int maxcnt = 0, mincnt = 0, - i = 0, icnt = 1, size, split; + i = 0, icnt = 0, size, split; re++; while (isdigit((unsigned char) *re)) mincnt = mincnt * 10 + *re++ - '0'; @@ -319,13 +319,15 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode) } if (code) { for (i = 0; i < size; i++) - switch (code[term]) { + switch (code[term+i]) { case CLASS: + i += code[term+i+2] * 2 + 1; case JMP: case SPLIT: case RSPLIT: case SAVE: case CHAR: + i++; icnt++; } } diff --git a/test.sh b/test.sh index ee4b4eb..a0465e3 100755 --- a/test.sh +++ b/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 abc+h+d+f +([0-9]|abc){5}[0-9]+(grh) " input="\ abcdef @@ -91,6 +92,7 @@ aaaabcdefghij ааааабвг... hhfd h23 performance abcccccccccccchdf +344444442344grhhhsdfg " expect="\ (0,3) @@ -137,6 +139,7 @@ expect="\ (0,16) (10,21) (0,17) +(0,15)(4,5)(12,15) (0,0) " c=1