Date: 05/29/99
- Next message: andrey: "[PHP-DEV] CVS update: php3/functions"
- Previous message: Chad Cunningham: "Re: [PHP-DEV] Re: qsort fix"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Saturday May 29, 1999 @ 17:05
Author: andrey
Update of /repository/php3/pcrelib
In directory php:/tmp/cvs-serv16290/pcrelib
Modified Files:
internal.h pcre.c pcre.h
Log Message:
Updated PCRE to properly handle \b assertions.
Index: php3/pcrelib/internal.h
diff -u php3/pcrelib/internal.h:1.1 php3/pcrelib/internal.h:1.2
--- php3/pcrelib/internal.h:1.1 Thu May 27 16:21:55 1999
+++ php3/pcrelib/internal.h Sat May 29 17:05:27 1999
@@ -307,6 +307,7 @@
const uschar *end_subject; /* End of the subject string */
const uschar *end_match_ptr; /* Subject position at end match */
int end_offset_top; /* Highwater mark at end of match */
+ char regprev; /* Character previous to subject string (Andrey Zmievski) */
} match_data;
/* Bit definitions for entries in the pcre_ctypes table. */
Index: php3/pcrelib/pcre.c
diff -u php3/pcrelib/pcre.c:1.2 php3/pcrelib/pcre.c:1.3
--- php3/pcrelib/pcre.c:1.2 Fri May 28 17:12:43 1999
+++ php3/pcrelib/pcre.c Sat May 29 17:05:28 1999
@@ -3321,8 +3321,12 @@
case OP_NOT_WORD_BOUNDARY:
case OP_WORD_BOUNDARY:
{
- BOOL prev_is_word = (eptr != md->start_subject) &&
- ((md->ctypes[eptr[-1]] & ctype_word) != 0);
+ /* Modified the next line to check previous character
+ in case we're not at the beginning of the whole string
+ (Andrey Zmievski) */
+ BOOL prev_is_word = (eptr != md->start_subject) ?
+ ((md->ctypes[eptr[-1]] & ctype_word) != 0) :
+ ((md->ctypes[md->regprev] & ctype_word) != 0);
BOOL cur_is_word = (eptr < md->end_subject) &&
((md->ctypes[*eptr] & ctype_word) != 0);
if ((*ecode++ == OP_WORD_BOUNDARY)?
@@ -4125,7 +4129,8 @@
int
pcre_exec(const pcre *external_re, const pcre_extra *external_extra,
- const char *subject, int length, int options, int *offsets, int offsetcount, int minlen)
+ const char *subject, int length, const char *strbeg, int options,
+ int *offsets, int offsetcount, int minlen)
{
int resetcount, ocount;
int first_char = -1;
@@ -4159,6 +4164,15 @@
match_block.lcc = re->tables + lcc_offset;
match_block.ctypes = re->tables + ctypes_offset;
+
+/* Setup previous character (Andrey Zmievski) */
+if (subject == strbeg)
+ match_block.regprev = '\n';
+else {
+ match_block.regprev = subject[-1];
+ if (!(re->options & PCRE_MULTILINE) && match_block.regprev == '\n')
+ match_block.regprev = '\0';
+}
/* The ims options can vary during the matching as a result of the presence
of (?ims) items in the pattern. They are kept in a local variable so that
Index: php3/pcrelib/pcre.h
diff -u php3/pcrelib/pcre.h:1.2 php3/pcrelib/pcre.h:1.3
--- php3/pcrelib/pcre.h:1.2 Fri May 28 17:12:43 1999
+++ php3/pcrelib/pcre.h Sat May 29 17:05:28 1999
@@ -59,7 +59,7 @@
const unsigned char *);
extern int pcre_copy_substring(const char *, int *, int, int, char *, int);
extern int pcre_exec(const pcre *, const pcre_extra *, const char *,
- int, int, int *, int, int);
+ int, const char *, int, int *, int, int);
extern int pcre_get_substring(const char *, int *, int, int, const char **);
extern int pcre_get_substring_list(const char *, int *, int, const char ***);
extern int pcre_info(const pcre *, int *, int *);
-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>
- Next message: andrey: "[PHP-DEV] CVS update: php3/functions"
- Previous message: Chad Cunningham: "Re: [PHP-DEV] Re: qsort fix"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

