summaryrefslogtreecommitdiff
path: root/ext/pcre/pcrelib/study.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pcre/pcrelib/study.c')
-rw-r--r--ext/pcre/pcrelib/study.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/ext/pcre/pcrelib/study.c b/ext/pcre/pcrelib/study.c
index 676db94665..f924543d21 100644
--- a/ext/pcre/pcrelib/study.c
+++ b/ext/pcre/pcrelib/study.c
@@ -9,7 +9,7 @@ the file Tech.Notes for some information on the internals.
Written by: Philip Hazel <ph10@cam.ac.uk>
- Copyright (c) 1997-2000 University of Cambridge
+ Copyright (c) 1997-2001 University of Cambridge
-----------------------------------------------------------------------------
Permission is granted to anyone to use this software for any purpose on any
@@ -104,8 +104,6 @@ do
while (try_next)
{
- try_next = FALSE;
-
/* If a branch starts with a bracket or a positive lookahead assertion,
recurse to set bits from within them. That's all for this branch. */
@@ -113,6 +111,7 @@ do
{
if (!set_start_bits(tcode, start_bits, caseless, cd))
return FALSE;
+ try_next = FALSE;
}
else switch(*tcode)
@@ -120,12 +119,17 @@ do
default:
return FALSE;
+ /* Skip over extended extraction bracket number */
+
+ case OP_BRANUMBER:
+ tcode += 3;
+ break;
+
/* Skip over lookbehind and negative lookahead assertions */
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
- try_next = TRUE;
do tcode += (tcode[1] << 8) + tcode[2]; while (*tcode == OP_ALT);
tcode += 3;
break;
@@ -135,7 +139,6 @@ do
case OP_OPT:
caseless = (tcode[1] & PCRE_CASELESS) != 0;
tcode += 2;
- try_next = TRUE;
break;
/* BRAZERO does the bracket, but carries on. */
@@ -147,7 +150,6 @@ do
dummy = 1;
do tcode += (tcode[1] << 8) + tcode[2]; while (*tcode == OP_ALT);
tcode += 3;
- try_next = TRUE;
break;
/* Single-char * or ? sets the bit and tries the next item */
@@ -158,7 +160,6 @@ do
case OP_MINQUERY:
set_bit(start_bits, tcode[1], caseless, cd);
tcode += 2;
- try_next = TRUE;
break;
/* Single-char upto sets the bit and tries the next */
@@ -167,7 +168,6 @@ do
case OP_MINUPTO:
set_bit(start_bits, tcode[3], caseless, cd);
tcode += 4;
- try_next = TRUE;
break;
/* At least one single char sets the bit and stops */
@@ -181,6 +181,7 @@ do
case OP_PLUS:
case OP_MINPLUS:
set_bit(start_bits, tcode[1], caseless, cd);
+ try_next = FALSE;
break;
/* Single character type sets the bits and stops */
@@ -188,31 +189,37 @@ do
case OP_NOT_DIGIT:
for (c = 0; c < 32; c++)
start_bits[c] |= ~cd->cbits[c+cbit_digit];
+ try_next = FALSE;
break;
case OP_DIGIT:
for (c = 0; c < 32; c++)
start_bits[c] |= cd->cbits[c+cbit_digit];
+ try_next = FALSE;
break;
case OP_NOT_WHITESPACE:
for (c = 0; c < 32; c++)
start_bits[c] |= ~cd->cbits[c+cbit_space];
+ try_next = FALSE;
break;
case OP_WHITESPACE:
for (c = 0; c < 32; c++)
start_bits[c] |= cd->cbits[c+cbit_space];
+ try_next = FALSE;
break;
case OP_NOT_WORDCHAR:
for (c = 0; c < 32; c++)
start_bits[c] |= ~cd->cbits[c+cbit_word];
+ try_next = FALSE;
break;
case OP_WORDCHAR:
for (c = 0; c < 32; c++)
start_bits[c] |= cd->cbits[c+cbit_word];
+ try_next = FALSE;
break;
/* One or more character type fudges the pointer and restarts, knowing
@@ -221,12 +228,10 @@ do
case OP_TYPEPLUS:
case OP_TYPEMINPLUS:
tcode++;
- try_next = TRUE;
break;
case OP_TYPEEXACT:
tcode += 3;
- try_next = TRUE;
break;
/* Zero or more repeats of character types set the bits and then
@@ -274,7 +279,6 @@ do
}
tcode += 2;
- try_next = TRUE;
break;
/* Character class: set the bits and either carry on or not,
@@ -292,16 +296,16 @@ do
case OP_CRQUERY:
case OP_CRMINQUERY:
tcode++;
- try_next = TRUE;
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
- if (((tcode[1] << 8) + tcode[2]) == 0)
- {
- tcode += 5;
- try_next = TRUE;
- }
+ if (((tcode[1] << 8) + tcode[2]) == 0) tcode += 5;
+ else try_next = FALSE;
+ break;
+
+ default:
+ try_next = FALSE;
break;
}
}