--- parser3/src/main/pa_string.C 2003/03/24 11:22:48 1.172.2.21.2.20 +++ parser3/src/main/pa_string.C 2003/03/24 11:52:57 1.172.2.21.2.22 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_STRING_C="$Date: 2003/03/24 11:22:48 $"; +static const char* IDENT_STRING_C="$Date: 2003/03/24 11:52:57 $"; #include "pcre.h" @@ -137,7 +137,7 @@ String& String::mid(size_t substr_begin, size_t String::pos(const StringBody substr, size_t this_offset, Language lang) const { // first: letters themselves - size_t substr_begin=body.pos(this_offset, substr); + size_t substr_begin=body.pos(substr, this_offset); if(substr_begin==CORD_NOT_FOUND) return STRING_NOT_FOUND; @@ -169,7 +169,7 @@ size_t String::pos(const StringBody subs return substr_begin; else { // bad lang... /// WARNING: this possibly skips assert (*), but it's fast - substr_begin=body.pos(fragment_end/*...search AFTER for more*/, substr); + substr_begin=body.pos(substr, fragment_end/*...search AFTER for more*/); if(substr_begin==CORD_NOT_FOUND) return STRING_NOT_FOUND; @@ -189,7 +189,7 @@ size_t String::pos(const String& substr, void String::split(ArrayString& result, size_t& pos_after, const char* delim, - Language lang, int limit) { + Language lang, int limit) const { size_t self_length=length(); if(size_t delim_length=strlen(delim)) { int pos_before; @@ -231,7 +231,7 @@ void String::split(ArrayString& result, } } -static void regex_options(const String& options, int *result, bool& need_pre_post_match){ +static void regex_options(const String* options, int *result, bool& need_pre_post_match){ struct Regex_option { const char* keyL; const char* keyU; @@ -250,10 +250,10 @@ static void regex_options(const String& result[0]=PCRE_EXTRA | PCRE_DOTALL | PCRE_DOLLAR_ENDONLY; result[1]=0; - if(!options.is_empty()) + if(options && !options->is_empty()) for(Regex_option *o=regex_option; o->keyL; o++) - if(options.pos(o->keyL)>=0 - || (o->keyU && options.pos(o->keyU)>=0)) { + if(options->pos(o->keyL)>=0 + || (o->keyU && options->pos(o->keyU)>=0)) { if(o->flag) *o->flag=true; else { // result @@ -265,7 +265,7 @@ static void regex_options(const String& Table* String::match(Charset& source_charset, const String& regexp, - const String& options, + const String* options, Row_action row_action, void *info, bool& just_matched) const { if(regexp.is_empty()) @@ -303,7 +303,7 @@ Table* String::match(Charset& source_cha int ovector[oveclength]; // create table - Table* table=new Table(string_match_table_template); + Table& table=*new Table(string_match_table_template); int exec_option_bits=0; int prestart=0; @@ -318,7 +318,7 @@ Table* String::match(Charset& source_cha pcre_free(code); row_action(table, 0/*last time, no raw*/, 0, 0, poststart, postfinish, info); if(global || subpatterns) - return table; // global or with subpatterns=true+result + return &table; // global or with subpatterns=true+result else { just_matched=false; return 0; // not global=no result } @@ -355,7 +355,7 @@ Table* String::match(Charset& source_cha if(!global || prestart==poststart) { // not global | going to hang pcre_free(code); row_action(table, 0/*last time, no row*/, 0, 0, poststart, postfinish, info); - return table; + return &table; } prestart=poststart;