mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 23:58:54 +02:00
Update the internal copy of PCRE to 7.4
2007-11-06 Matthias Clasen <mclasen@redhat.com> * glib/pcre/*: Update the internal copy of PCRE to 7.4 svn path=/trunk/; revision=5800
This commit is contained in:
committed by
Matthias Clasen
parent
9b79a12192
commit
5b81acfae2
@@ -44,6 +44,10 @@ FSM). This is NOT Perl- compatible, but it has advantages in certain
|
||||
applications. */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define NLBLOCK md /* Block containing newline information */
|
||||
#define PSSTART start_subject /* Field containing processed string start */
|
||||
#define PSEND end_subject /* Field containing processed string end */
|
||||
@@ -126,7 +130,9 @@ static uschar coptable[] = {
|
||||
0, /* CREF */
|
||||
0, /* RREF */
|
||||
0, /* DEF */
|
||||
0, 0 /* BRAZERO, BRAMINZERO */
|
||||
0, 0, /* BRAZERO, BRAMINZERO */
|
||||
0, 0, 0, 0, /* PRUNE, SKIP, THEN, COMMIT */
|
||||
0, 0 /* FAIL, ACCEPT */
|
||||
};
|
||||
|
||||
/* These 2 tables allow for compact code for testing for \D, \d, \S, \s, \W,
|
||||
@@ -1074,15 +1080,20 @@ for (;;)
|
||||
int ncount = 0;
|
||||
switch (c)
|
||||
{
|
||||
case 0x000d:
|
||||
if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
|
||||
/* Fall through */
|
||||
case 0x000a:
|
||||
case 0x000b:
|
||||
case 0x000c:
|
||||
case 0x0085:
|
||||
case 0x2028:
|
||||
case 0x2029:
|
||||
if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
|
||||
goto ANYNL01;
|
||||
|
||||
case 0x000d:
|
||||
if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
|
||||
/* Fall through */
|
||||
|
||||
ANYNL01:
|
||||
case 0x000a:
|
||||
if (count > 0 && codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSPLUS)
|
||||
{
|
||||
active_count--; /* Remove non-match possibility */
|
||||
@@ -1091,6 +1102,7 @@ for (;;)
|
||||
count++;
|
||||
ADD_NEW_DATA(-state_offset, count, ncount);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1307,15 +1319,20 @@ for (;;)
|
||||
int ncount = 0;
|
||||
switch (c)
|
||||
{
|
||||
case 0x000d:
|
||||
if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
|
||||
/* Fall through */
|
||||
case 0x000a:
|
||||
case 0x000b:
|
||||
case 0x000c:
|
||||
case 0x0085:
|
||||
case 0x2028:
|
||||
case 0x2029:
|
||||
if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
|
||||
goto ANYNL02;
|
||||
|
||||
case 0x000d:
|
||||
if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
|
||||
/* Fall through */
|
||||
|
||||
ANYNL02:
|
||||
case 0x000a:
|
||||
if (codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSSTAR ||
|
||||
codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSQUERY)
|
||||
{
|
||||
@@ -1324,6 +1341,7 @@ for (;;)
|
||||
}
|
||||
ADD_NEW_DATA(-(state_offset + count), 0, ncount);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1539,15 +1557,20 @@ for (;;)
|
||||
int ncount = 0;
|
||||
switch (c)
|
||||
{
|
||||
case 0x000d:
|
||||
if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
|
||||
/* Fall through */
|
||||
case 0x000a:
|
||||
case 0x000b:
|
||||
case 0x000c:
|
||||
case 0x0085:
|
||||
case 0x2028:
|
||||
case 0x2029:
|
||||
if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
|
||||
goto ANYNL03;
|
||||
|
||||
case 0x000d:
|
||||
if (ptr + 1 < end_subject && ptr[1] == 0x0a) ncount = 1;
|
||||
/* Fall through */
|
||||
|
||||
ANYNL03:
|
||||
case 0x000a:
|
||||
if (codevalue == OP_ANYNL_EXTRA + OP_TYPEPOSUPTO)
|
||||
{
|
||||
active_count--; /* Remove non-match possibility */
|
||||
@@ -1558,6 +1581,7 @@ for (;;)
|
||||
else
|
||||
{ ADD_NEW_DATA(-state_offset, count, ncount); }
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1738,14 +1762,17 @@ for (;;)
|
||||
case OP_ANYNL:
|
||||
if (clen > 0) switch(c)
|
||||
{
|
||||
case 0x000a:
|
||||
case 0x000b:
|
||||
case 0x000c:
|
||||
case 0x0085:
|
||||
case 0x2028:
|
||||
case 0x2029:
|
||||
if ((md->moptions & PCRE_BSR_ANYCRLF) != 0) break;
|
||||
|
||||
case 0x000a:
|
||||
ADD_NEW(state_offset + 1, 0);
|
||||
break;
|
||||
|
||||
case 0x000d:
|
||||
if (ptr + 1 < end_subject && ptr[1] == 0x0a)
|
||||
{
|
||||
@@ -2568,6 +2595,18 @@ md->end_subject = end_subject;
|
||||
md->moptions = options;
|
||||
md->poptions = re->options;
|
||||
|
||||
/* If the BSR option is not set at match time, copy what was set
|
||||
at compile time. */
|
||||
|
||||
if ((md->moptions & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) == 0)
|
||||
{
|
||||
if ((re->options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) != 0)
|
||||
md->moptions |= re->options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE);
|
||||
#ifdef BSR_ANYCRLF
|
||||
else md->moptions |= PCRE_BSR_ANYCRLF;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Handle different types of newline. The three bits give eight cases. If
|
||||
nothing is set at run time, whatever was used at compile time applies. */
|
||||
|
||||
@@ -2638,7 +2677,7 @@ if (md->tables == NULL) md->tables = _pcre_default_tables;
|
||||
used in a loop when finding where to start. */
|
||||
|
||||
lcc = md->tables + lcc_offset;
|
||||
startline = (re->options & PCRE_STARTLINE) != 0;
|
||||
startline = (re->flags & PCRE_STARTLINE) != 0;
|
||||
firstline = (re->options & PCRE_FIRSTLINE) != 0;
|
||||
|
||||
/* Set up the first character to match, if available. The first_byte value is
|
||||
@@ -2649,7 +2688,7 @@ studied, there may be a bitmap of possible first characters. */
|
||||
|
||||
if (!anchored)
|
||||
{
|
||||
if ((re->options & PCRE_FIRSTSET) != 0)
|
||||
if ((re->flags & PCRE_FIRSTSET) != 0)
|
||||
{
|
||||
first_byte = re->first_byte & 255;
|
||||
if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)
|
||||
@@ -2666,7 +2705,7 @@ if (!anchored)
|
||||
/* For anchored or unanchored matches, there may be a "last known required
|
||||
character" set. */
|
||||
|
||||
if ((re->options & PCRE_REQCHSET) != 0)
|
||||
if ((re->flags & PCRE_REQCHSET) != 0)
|
||||
{
|
||||
req_byte = re->req_byte & 255;
|
||||
req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;
|
||||
@@ -2836,16 +2875,17 @@ for (;;)
|
||||
}
|
||||
if (current_subject > end_subject) break;
|
||||
|
||||
/* If we have just passed a CR and the newline option is CRLF or ANY or
|
||||
ANYCRLF, and we are now at a LF, advance the match position by one more
|
||||
character. */
|
||||
/* If we have just passed a CR and we are now at a LF, and the pattern does
|
||||
not contain any explicit matches for \r or \n, and the newline option is CRLF
|
||||
or ANY or ANYCRLF, advance the match position by one more character. */
|
||||
|
||||
if (current_subject[-1] == '\r' &&
|
||||
(md->nltype == NLTYPE_ANY ||
|
||||
md->nltype == NLTYPE_ANYCRLF ||
|
||||
md->nllen == 2) &&
|
||||
current_subject < end_subject &&
|
||||
*current_subject == '\n')
|
||||
current_subject < end_subject &&
|
||||
*current_subject == '\n' &&
|
||||
(re->flags & PCRE_HASCRORLF) == 0 &&
|
||||
(md->nltype == NLTYPE_ANY ||
|
||||
md->nltype == NLTYPE_ANYCRLF ||
|
||||
md->nllen == 2))
|
||||
current_subject++;
|
||||
|
||||
} /* "Bumpalong" loop */
|
||||
|
Reference in New Issue
Block a user