summaryrefslogtreecommitdiff
path: root/pcre_compile.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-08-21 11:46:08 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-08-21 11:46:08 +0000
commitc6a88bf880d462c62e00d8d7c3eeeaad60ebab49 (patch)
tree7b948602c6a0645f32441bdf9dd602a73b4fc3e7 /pcre_compile.c
parent3fa5c170ee26c5a63c0efa62dc42fc9fb57ce76b (diff)
downloadpcre-c6a88bf880d462c62e00d8d7c3eeeaad60ebab49.tar.gz
Don't advance by 2 if explicit \r or \n in the pattern. Add
PCRE_INFO_HASCRORLF. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@226 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_compile.c')
-rw-r--r--pcre_compile.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/pcre_compile.c b/pcre_compile.c
index e344ad4..24f694e 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -3195,7 +3195,18 @@ for (;; ptr++)
*errorcodeptr = ERR6;
goto FAILED;
}
-
+
+ /* Remember whether \r or \n are in this class */
+
+ if (negate_class)
+ {
+ if ((classbits[1] & 0x24) != 0x24) cd->external_options |= PCRE_HASCRORLF;
+ }
+ else
+ {
+ if ((classbits[1] & 0x24) != 0) cd->external_options |= PCRE_HASCRORLF;
+ }
+
/* If class_charcount is 1, we saw precisely one character whose value is
less than 256. As long as there were no characters >= 128 and there was no
use of \p or \P, in other words, no use of any XCLASS features, we can
@@ -5050,6 +5061,11 @@ for (;; ptr++)
previous = code;
*code++ = ((options & PCRE_CASELESS) != 0)? OP_CHARNC : OP_CHAR;
for (c = 0; c < mclength; c++) *code++ = mcbuffer[c];
+
+ /* Remember if \r or \n were seen */
+
+ if (mcbuffer[0] == '\r' || mcbuffer[0] == '\n')
+ cd->external_options |= PCRE_HASCRORLF;
/* Set the first and required bytes appropriately. If no previous first
byte, set it from this character, but revert to none on a zero repeat.
@@ -5982,20 +5998,8 @@ case when building a production library. */
printf("Length = %d top_bracket = %d top_backref = %d\n",
length, re->top_bracket, re->top_backref);
-
-if (re->options != 0)
- {
- printf("%s%s%s%s%s%s%s%s%s\n",
- ((re->options & PCRE_NOPARTIAL) != 0)? "nopartial " : "",
- ((re->options & PCRE_ANCHORED) != 0)? "anchored " : "",
- ((re->options & PCRE_CASELESS) != 0)? "caseless " : "",
- ((re->options & PCRE_EXTENDED) != 0)? "extended " : "",
- ((re->options & PCRE_MULTILINE) != 0)? "multiline " : "",
- ((re->options & PCRE_DOTALL) != 0)? "dotall " : "",
- ((re->options & PCRE_DOLLAR_ENDONLY) != 0)? "endonly " : "",
- ((re->options & PCRE_EXTRA) != 0)? "extra " : "",
- ((re->options & PCRE_UNGREEDY) != 0)? "ungreedy " : "");
- }
+
+printf("Options=%08x\n", re->options);
if ((re->options & PCRE_FIRSTSET) != 0)
{