--- parser3/src/classes/op.C 2015/09/22 23:37:44 1.221 +++ parser3/src/classes/op.C 2015/10/09 11:42:38 1.223 @@ -18,7 +18,7 @@ #include "pa_vclass.h" #include "pa_charset.h" -volatile const char * IDENT_OP_C="$Id: op.C,v 1.221 2015/09/22 23:37:44 moko Exp $"; +volatile const char * IDENT_OP_C="$Id: op.C,v 1.223 2015/10/09 11:42:38 moko Exp $"; // limits @@ -61,8 +61,7 @@ static const String exception_var_name(E class Untaint_lang_name2enum: public HashString { public: Untaint_lang_name2enum() { - #define ULN(name, LANG) \ - put(String::Body(name), (value_type)(String::L_##LANG)); + #define ULN(name, LANG) put(name, (value_type)(String::L_##LANG)); ULN("clean", CLEAN); ULN("as-is", AS_IS); ULN("optimized-as-is", AS_IS|String::L_OPTIMIZE_BIT); @@ -585,6 +584,10 @@ static Try_catch_result try_catch(Reques return result; } +static StringOrValue process_try_body_code(Request& r, Value* body_code) { + return r.process(*body_code); +} + // cache-- // consts @@ -812,15 +815,16 @@ static void _cache(Request& r, MethodPar cache_delete(file_spec); } - // process without cacheing - const String& processed_body=r.process_to_string(body_code); - // write it out - r.write_assign_lang(processed_body); + // process without caching + if(catch_code){ + Try_catch_result result=try_catch(r, process_try_body_code, &body_code, catch_code); + r.write_assign_lang(result.processed_code); + } else { + const String& processed_body=r.process_to_string(body_code); + r.write_assign_lang(processed_body); + } } -static StringOrValue process_try_body_code(Request& r, Value* body_code) { - return r.process(*body_code); -} static void _try_operator(Request& r, MethodParams& params) { Value& body_code=params.as_junction(0, "body_code must be code"); Value& catch_code=params.as_junction(1, "catch_code must be code"); @@ -829,13 +833,7 @@ static void _try_operator(Request& r, Me Try_catch_result result; StringOrValue finally_result; try{ - result=try_catch(r, - process_try_body_code, &body_code, - &catch_code); - if(result.exception_should_be_handled) - throw Exception(PARSER_RUNTIME, - result.exception_should_be_handled, - "catch block must set $exception.handled to some boolean value, not string"); + result=try_catch(r, process_try_body_code, &body_code, &catch_code); } catch(...){ if(finally_code) finally_result=r.process(*finally_code);