| 373 | } |
| 374 | |
| 375 | Rv<Expr> |
| 376 | Config::parse_scalar_expr(YAML::Node node) |
| 377 | { |
| 378 | Rv<Expr> zret; |
| 379 | TextView text{node.Scalar()}; |
| 380 | if (node.IsNull()) { |
| 381 | return Expr{}; |
| 382 | } else if (node.Tag() == "?"_tv) { // unquoted, must be extractor. |
| 383 | zret = this->parse_unquoted_expr(text); |
| 384 | } else { |
| 385 | zret = this->parse_composite_expr(text); |
| 386 | } |
| 387 | |
| 388 | if (zret.is_ok()) { |
| 389 | auto &expr = zret.result(); |
| 390 | if (expr._max_arg_idx >= 0) { |
| 391 | if (_active_capture._count == 0) { |
| 392 | return Errata(S_ERROR, R"(Regular expression capture group used at {} but no regular expression is active.)", node.Mark()); |
| 393 | } else if (expr._max_arg_idx >= int(_active_capture._count)) { |
| 394 | return Errata( |
| 395 | S_ERROR, |
| 396 | R"(Regular expression capture group {} used at {} but the maximum capture group is {} in the active regular expression from line {}.)", |
| 397 | expr._max_arg_idx, node.Mark(), _active_capture._count - 1, _active_capture._line); |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | return zret; |
| 402 | } |
| 403 | |
| 404 | Rv<Expr> |
| 405 | Config::parse_expr_with_mods(YAML::Node node) |
no test coverage detected