| 926 | }; |
| 927 | |
| 928 | struct make_peg_parser { |
| 929 | common_chat_params params_; |
| 930 | common_peg_arena arena_; |
| 931 | bool detailed_debug_; |
| 932 | |
| 933 | make_peg_parser(common_chat_templates * tmpls, |
| 934 | const common_chat_templates_inputs & inputs, |
| 935 | bool detailed_debug = false) { |
| 936 | detailed_debug_ = detailed_debug; |
| 937 | params_ = common_chat_templates_apply(tmpls, inputs); |
| 938 | arena_.load(params_.parser); |
| 939 | } |
| 940 | |
| 941 | common_chat_msg parse(const std::string & msg, bool is_partial) const { |
| 942 | common_chat_parser_params parser_params(params_); |
| 943 | parser_params.debug = detailed_debug_; |
| 944 | return common_chat_peg_parse(arena_, msg, is_partial, parser_params); |
| 945 | } |
| 946 | }; |
| 947 | |
| 948 | // Global template filter for --template flag |
| 949 | static std::string g_template_filter; |
no outgoing calls