--- parser3/src/main/pa_string.C 2001/04/03 15:07:34 1.64 +++ parser3/src/main/pa_string.C 2001/04/03 16:34:28 1.67 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_string.C,v 1.64 2001/04/03 15:07:34 paf Exp $ + $Id: pa_string.C,v 1.67 2001/04/03 16:34:28 paf Exp $ */ #include "pa_config_includes.h" @@ -485,7 +485,14 @@ static void regex_options(char *options, } } -/// @test setlocale param to auto.p +/** + returns true if fills table. + table format is defined and fixed[can be used by others]: + @verbatim + pre-match/match/post-match/1/2/3/... + @endverbatim + @test setlocale param to auto.p +*/ bool String::match(const String *aorigin, const String& regexp, const String *options, @@ -506,11 +513,10 @@ bool String::match(const String *aorigin &errptr, &erroffset, tables); - if(!code) { + if(!code) THROW(0, 0, ®exp.piece(erroffset, regexp.size()), - errptr); - } + "match error - %s", errptr); int info_substrings=pcre_info(code, 0, 0); if(info_substrings<0) { @@ -526,7 +532,7 @@ bool String::match(const String *aorigin int length=strlen(subject); int ovecsize; int *ovector=(int *)malloc(sizeof(int)* - (ovecsize=(3/*pre/match/post*/+info_substrings)*3)); + (ovecsize=(1/*match*/+info_substrings)*3)); { // create table Array& columns=*NEW Array(pool()); @@ -549,6 +555,7 @@ bool String::match(const String *aorigin if(exec_substrings==PCRE_ERROR_NOMATCH) { (*pcre_free)(code); + (*row_action)(**table, 0/*last time, no row*/, 0, 0, info); return option_bits[1]!=0; // global=true+table, not global=false } @@ -561,23 +568,23 @@ bool String::match(const String *aorigin } Array& row=*NEW Array(pool()); - row+=&piece(0, ovector[0]); // pre-match - row+=&piece(ovector[0], ovector[1]); // match - row+=&piece(ovector[1], size()); // post-match + row+=&piece(0, ovector[0]); // .pre-match column value + row+=&piece(ovector[0], ovector[1]); // .match + row+=&piece(ovector[1], size()); // .post-match for(int i=1; i