| 229 | |
| 230 | template<typename Context, typename Iter> |
| 231 | void diagnose( |
| 232 | diagnostic_kind kind, |
| 233 | std::string_view message, |
| 234 | Context const & context, |
| 235 | Iter it) const |
| 236 | { |
| 237 | callback_type const & cb = |
| 238 | kind == diagnostic_kind::error ? error_ : warning_; |
| 239 | if (!cb) |
| 240 | return; |
| 241 | std::stringstream ss; |
| 242 | parser::write_formatted_message( |
| 243 | ss, |
| 244 | filename_, |
| 245 | parser::_begin(context), |
| 246 | it, |
| 247 | parser::_end(context), |
| 248 | message); |
| 249 | cb(ss.str()); |
| 250 | } |
| 251 | |
| 252 | template<typename Context> |
| 253 | void diagnose( |