|
|
| version 1.21, 2012/05/28 19:47:52 | version 1.22, 2012/05/29 21:57:01 |
|---|---|
| Line 389 static void _string(Request& r, MethodPa | Line 389 static void _string(Request& r, MethodPa |
| json.xdoc_options=new XDocOutputOptions(r, vvalue); | json.xdoc_options=new XDocOutputOptions(r, vvalue); |
| valid_options++; | valid_options++; |
| #endif | #endif |
| } else if(key == "default"){ | |
| Junction* junction=value->get_junction(); | |
| if(!junction || !junction->method || !junction->method->params_names || junction->method->params_names->count() != 3) | |
| throw Exception(PARSER_RUNTIME, 0, "$.%s must be parser method with 3 parameters", key.cstr()); | |
| json.default_method=value; | |
| valid_options++; | |
| } else if(Junction* junction=value->get_junction()){ | } else if(Junction* junction=value->get_junction()){ |
| if(!junction->method || !junction->method->params_names || junction->method->params_names->count() != 3) | if(!junction->method || !junction->method->params_names || junction->method->params_names->count() != 3) |
| throw Exception(PARSER_RUNTIME, 0, "$.%s must be parser method with 3 parameters", key.cstr()); | throw Exception(PARSER_RUNTIME, 0, "$.%s must be parser method with 3 parameters", key.cstr()); |
| Line 402 static void _string(Request& r, MethodPa | Line 396 static void _string(Request& r, MethodPa |
| valid_options++; | valid_options++; |
| } | } |
| } | } |
| if(valid_options!=options->count()) | if(valid_options!=options->count()) |
| throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); | throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); |
| // special handling for $._default | |
| if(VHash* vhash=static_cast<VHash*>(params[1].as(VHASH_TYPE))) | |
| if(Value* value=vhash->get_default()) { | |
| Junction* junction=value->get_junction(); | |
| if(!junction || !junction->method || !junction->method->params_names || junction->method->params_names->count() != 3) | |
| throw Exception(PARSER_RUNTIME, 0, "$.%s must be parser method with 3 parameters", HASH_DEFAULT_ELEMENT_NAME); | |
| json.default_method=value; | |
| } | |
| if(methods->count()) | if(methods->count()) |
| json.methods=methods; | json.methods=methods; |
| } | } |