--- parser3/src/main/pa_string.C 2001/10/05 14:48:58 1.105 +++ parser3/src/main/pa_string.C 2001/10/11 10:21:44 1.107 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_string.C,v 1.105 2001/10/05 14:48:58 parser Exp $ + $Id: pa_string.C,v 1.107 2001/10/11 10:21:44 parser Exp $ */ #include "pa_config_includes.h" @@ -357,12 +357,12 @@ const Origin& String::origin() const { #endif String& String::mid(size_t start, size_t finish) const { + String& result=*NEW String(pool()); + start=max(0, start); finish=min(size(), finish); if(start==finish) - return *empty_string; - - String& result=*NEW String(pool()); + return result; size_t pos=0; const Chunk *chunk=&head; @@ -654,8 +654,9 @@ break2: return result; } +/// @test restructure string to link pieces of same language together prior to this. String& String::replace(Pool& pool, Dictionary& dict) const { - + //_asm int 3; String& result=*new(pool) String(pool); const Chunk *chunk=&head; do { @@ -670,7 +671,7 @@ String& String::replace(Pool& pool, Dict char *dest=new_cstr; while(src_size) { // there is a row where first column starts 'src' - if(Table::Item *item=dict.first_that_starts(src)) { + if(Table::Item *item=dict.first_that_starts(src, src_size)) { // get a=>b values const String& a=*static_cast(item)->get_string(0); const String& b=*static_cast(item)->get_string(1);