MCPcopy Create free account
hub / github.com/apache/trafficserver / parse_scalar_expr

Method parse_scalar_expr

plugins/experimental/txn_box/plugin/src/Config.cc:375–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373}
374
375Rv<Expr>
376Config::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
404Rv<Expr>
405Config::parse_expr_with_mods(YAML::Node node)

Callers 1

parse_exprMethod · 0.95

Calls 8

parse_unquoted_exprMethod · 0.95
parse_composite_exprMethod · 0.95
ErrataClass · 0.85
ScalarMethod · 0.80
TagMethod · 0.80
resultMethod · 0.80
is_okMethod · 0.45
MarkMethod · 0.45

Tested by

no test coverage detected