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

Method visitConditionalAnd

parser/parser.cc:920–939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

918}
919
920std::any ParserVisitor::visitConditionalAnd(
921 CelParser::ConditionalAndContext* ctx) {
922 auto result = ExprFromAny(visit(ctx->e));
923 if (ctx->ops.empty()) {
924 return ExprToAny(std::move(result));
925 }
926 ExpressionBalancer b(factory_, CelOperator::LOGICAL_AND, std::move(result));
927 for (size_t i = 0; i < ctx->ops.size(); ++i) {
928 auto op = ctx->ops[i];
929 if (i >= ctx->e1.size()) {
930 return ExprToAny(
931 factory_.ReportError(SourceRangeFromParserRuleContext(ctx),
932 "unexpected character, wanted '&&'"));
933 }
934 auto next = ExprFromAny(visit(ctx->e1[i]));
935 int64_t op_id = factory_.NextId(SourceRangeFromToken(op));
936 b.AddTerm(op_id, std::move(next));
937 }
938 return ExprToAny(b.Balance());
939}
940
941std::any ParserVisitor::visitRelation(CelParser::RelationContext* ctx) {
942 if (ctx->calc()) {

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