Diff for /parser3/src/classes/string.C between versions 1.104 and 1.105

version 1.104, 2002/04/19 08:28:35 version 1.105, 2002/04/19 08:54:35
Line 181  static void search_action(Table& table, Line 181  static void search_action(Table& table,
 struct Replace_action_info {  struct Replace_action_info {
         Request *request;  const String *origin;          Request *request;  const String *origin;
         const String *src;  String *dest;          const String *src;  String *dest;
           VTable *vtable;
         Value *replacement_code;          Value *replacement_code;
 };  };
 #endif  #endif
   /// @todo they can do $global[$result] there, getting pointer to later-invalid local var, kill this
 static void replace_action(Table& table, Array *row,   static void replace_action(Table& table, Array *row, 
                                                    int prestart, int prefinish,                                                      int prestart, int prefinish, 
                                                    int poststart, int postfinish,                                                     int poststart, int postfinish,
Line 199  static void replace_action(Table& table, Line 201  static void replace_action(Table& table,
                 else // begin                  else // begin
                         table+=row;                          table+=row;
                 { // execute 'replacement_code' in 'table' context                  { // execute 'replacement_code' in 'table' context
                         VTable& vtable=*new(table.pool()) VTable(table.pool(), &table);                          ai.vtable->set_table(table);
   
                         Junction *junction=ai.replacement_code->get_junction();                          *ai.dest << ai.request->process_to_string(*ai.replacement_code);
                         Value *saved_match_var_value=junction->root->get_element(*match_var_name);  
                         junction->root->put_element(*match_var_name, &vtable);  
                         const String& replaced=ai.request->process_to_string(*ai.replacement_code);  
                         junction->root->put_element(*match_var_name, saved_match_var_value);  
   
                         /*  
                         ai.dest->APPEND_CONST("(");  
                                 *ai.dest << *(String *)row->get(1/*match* /);  
                         ai.dest->APPEND_CONST(")");  
                         */  
                         *ai.dest << replaced;  
                 }                  }
         } else // end          } else // end
                 *ai.dest << ai.src->mid(poststart, postfinish);                  *ai.dest << ai.src->mid(poststart, postfinish);
Line 243  static void _match(Request& r, const Str Line 234  static void _match(Request& r, const Str
                 // matched                  // matched
                 // not (just matched[3=pre/match/post], no substrings) or Global search                  // not (just matched[3=pre/match/post], no substrings) or Global search
                 if(table->columns()->size()>3 || was_global)                   if(table->columns()->size()>3 || was_global) 
                         result=new(pool) VTable(pool, table); // table of pre/match/post+substrings                          result=new(pool) VTable(pool, table/*TODO: clone this when table would be stacked!*/); // table of pre/match/post+substrings
                 else                   else 
                         result=new(pool) VBool(pool, matched);                                            result=new(pool) VBool(pool, matched);                  
                 r.write_assign_lang(*result);                  r.write_assign_lang(*result);
Line 251  static void _match(Request& r, const Str Line 242  static void _match(Request& r, const Str
                 Value& replacement_code=params->as_junction(2, "replacement param must be code");                  Value& replacement_code=params->as_junction(2, "replacement param must be code");
   
                 String& result=*new(pool) String(pool);                  String& result=*new(pool) String(pool);
                   VTable vtable(pool);
                 Replace_action_info replace_action_info={                  Replace_action_info replace_action_info={
                         &r, &method_name,                          &r, &method_name,
                         &src, &result,                          &src, &result,
                           &vtable,
                         &replacement_code                          &replacement_code
                 };                  };
                   Temp_value_element temp_match_var(
                           *replacement_code.get_junction()->root, 
                           *match_var_name, &vtable);
                 src.match(                  src.match(
                         &method_name,                           &method_name, 
                         r.process_to_string(regexp), options,                          r.process_to_string(regexp), options,

Removed from v.1.104  
changed lines
  Added in v.1.105


E-mail: