|
|
| version 1.190, 2009/09/10 09:40:34 | version 1.192, 2010/04/05 00:57:01 |
|---|---|
| Line 424 static void _match(Request& r, MethodPar | Line 424 static void _match(Request& r, MethodPar |
| 0, | 0, |
| "replacement option should be junction or string"); | "replacement option should be junction or string"); |
| Value* default_code=(params_count==4)?¶ms.as_junction(3, "default value must be code"):0; | |
| String result; | String result; |
| VTable* vtable=new VTable; | VTable* vtable=new VTable; |
| Replace_action_info info={ | Replace_action_info info={ |
| Line 434 static void _match(Request& r, MethodPar | Line 436 static void _match(Request& r, MethodPar |
| replacement_code | replacement_code |
| }; | }; |
| Temp_value_element* temp_match_var=0; | if(is_junction){ |
| Temp_value_element temp( *replacement_code->get_junction()->method_frame, match_var_name, vtable); | |
| if(is_junction) | src.match(vregex, replace_action, &info, matches_count); |
| temp_match_var=new Temp_value_element( | } else { |
| *replacement_code->get_junction()->method_frame, | src.match(vregex, replace_action, &info, matches_count); |
| match_var_name, vtable); | } |
| src.match(vregex, | |
| replace_action, &info, | |
| matches_count); | |
| if(temp_match_var) | |
| delete temp_match_var; | |
| r.write_assign_lang(result); | if(!matches_count && default_code) |
| r.process_write(*default_code); | |
| else | |
| r.write_assign_lang(result); | |
| } | } |
| } | } |
| Line 781 MString::MString(): Methoded("string") { | Line 779 MString::MString(): Methoded("string") { |
| // ^string.match[regexp][options] | // ^string.match[regexp][options] |
| // ^string.match[regexp][options]{replacement-code} | // ^string.match[regexp][options]{replacement-code} |
| add_native_method("match", Method::CT_DYNAMIC, _match, 1, 3); | // ^string.match[regexp][options]{replacement-code}{code-if-nothing-is-found} |
| add_native_method("match", Method::CT_DYNAMIC, _match, 1, 4); | |
| // ^string.upper[] | // ^string.upper[] |
| add_native_method("upper", Method::CT_DYNAMIC, _upper, 0, 0); | add_native_method("upper", Method::CT_DYNAMIC, _upper, 0, 0); |