|
|
| version 1.66, 2001/04/03 15:35:24 | version 1.68, 2001/04/03 17:01:03 |
|---|---|
| Line 505 bool String::match(const String *aorigin | Line 505 bool String::match(const String *aorigin |
| tables=pcre_maketables(); | tables=pcre_maketables(); |
| } | } |
| } | } |
| const char *pattern=regexp.cstr(); | const char *pattern=regexp.cstr(UL_AS_IS); |
| const char *errptr; | const char *errptr; |
| int erroffset; | int erroffset; |
| int option_bits[2]; regex_options(options?options->cstr():0, option_bits); | int option_bits[2]; regex_options(options?options->cstr():0, option_bits); |
| Line 513 bool String::match(const String *aorigin | Line 513 bool String::match(const String *aorigin |
| &errptr, &erroffset, | &errptr, &erroffset, |
| tables); | tables); |
| if(!code) { | if(!code) |
| THROW(0, 0, | THROW(0, 0, |
| ®exp.piece(erroffset, regexp.size()), | ®exp.piece(erroffset, regexp.size()), |
| errptr); | "match error - %s", errptr); |
| } | |
| int info_substrings=pcre_info(code, 0, 0); | int info_substrings=pcre_info(code, 0, 0); |
| if(info_substrings<0) { | if(info_substrings<0) { |
| Line 529 bool String::match(const String *aorigin | Line 528 bool String::match(const String *aorigin |
| } | } |
| int startoffset=0; | int startoffset=0; |
| const char *subject=cstr(); | const char *subject=cstr(UL_AS_IS); |
| int length=strlen(subject); | int length=strlen(subject); |
| int ovecsize; | int ovecsize; |
| int *ovector=(int *)malloc(sizeof(int)* | int *ovector=(int *)malloc(sizeof(int)* |
| Line 556 bool String::match(const String *aorigin | Line 555 bool String::match(const String *aorigin |
| if(exec_substrings==PCRE_ERROR_NOMATCH) { | if(exec_substrings==PCRE_ERROR_NOMATCH) { |
| (*pcre_free)(code); | (*pcre_free)(code); |
| (*row_action)(**table, 0/*last time, no row*/, info); | (*row_action)(**table, 0/*last time, no row*/, 0, 0, info); |
| return option_bits[1]!=0; // global=true+table, not global=false | return option_bits[1]!=0; // global=true+table, not global=false |
| } | } |
| Line 578 bool String::match(const String *aorigin | Line 577 bool String::match(const String *aorigin |
| row+=&piece(ovector[i*2+0], ovector[i*2+1]); // .i column value | row+=&piece(ovector[i*2+0], ovector[i*2+1]); // .i column value |
| } | } |
| (*row_action)(**table, &row, info); | (*row_action)(**table, &row, startoffset, ovector[0], info); |
| if(!option_bits[1]) { // not global | if(!option_bits[1] || !(startoffset=ovector[1])) { // not global | going to hang |
| (*pcre_free)(code); | (*pcre_free)(code); |
| (*row_action)(**table, 0/*last time, no row*/, info); | (*row_action)(**table, 0/*last time, no row*/, 0, 0, info); |
| return true; | return true; |
| } | } |
| startoffset=ovector[1]; | |
| /* | /* |
| if(option_bits[0] & PCRE_MULTILINE) | if(option_bits[0] & PCRE_MULTILINE) |
| exec_option_bits|=PCRE_NOTBOL; // start of subject+startoffset not BOL | exec_option_bits|=PCRE_NOTBOL; // start of subject+startoffset not BOL |