MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / visitConditionalOr

Method visitConditionalOr

parser/parser.cc:899–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

897}
898
899std::any ParserVisitor::visitConditionalOr(
900 CelParser::ConditionalOrContext* ctx) {
901 auto result = ExprFromAny(visit(ctx->e));
902 if (ctx->ops.empty()) {
903 return ExprToAny(std::move(result));
904 }
905 ExpressionBalancer b(factory_, CelOperator::LOGICAL_OR, std::move(result));
906 for (size_t i = 0; i < ctx->ops.size(); ++i) {
907 auto op = ctx->ops[i];
908 if (i >= ctx->e1.size()) {
909 return ExprToAny(
910 factory_.ReportError(SourceRangeFromParserRuleContext(ctx),
911 "unexpected character, wanted '||'"));
912 }
913 auto next = ExprFromAny(visit(ctx->e1[i]));
914 int64_t op_id = factory_.NextId(SourceRangeFromToken(op));
915 b.AddTerm(op_id, std::move(next));
916 }
917 return ExprToAny(b.Balance());
918}
919
920std::any ParserVisitor::visitConditionalAnd(
921 CelParser::ConditionalAndContext* ctx) {

Callers

nothing calls this directly

Calls 10

ExprFromAnyFunction · 0.85
ExprToAnyFunction · 0.85
SourceRangeFromTokenFunction · 0.85
AddTermMethod · 0.80
BalanceMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
ReportErrorMethod · 0.45
NextIdMethod · 0.45

Tested by

no test coverage detected