| 918 | } |
| 919 | |
| 920 | std::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 | |
| 941 | std::any ParserVisitor::visitRelation(CelParser::RelationContext* ctx) { |
| 942 | if (ctx->calc()) { |
nothing calls this directly
no test coverage detected