| 939 | } |
| 940 | |
| 941 | std::any ParserVisitor::visitRelation(CelParser::RelationContext* ctx) { |
| 942 | if (ctx->calc()) { |
| 943 | return visit(ctx->calc()); |
| 944 | } |
| 945 | std::string op_text; |
| 946 | if (ctx->op) { |
| 947 | op_text = ctx->op->getText(); |
| 948 | } |
| 949 | auto op = ReverseLookupOperator(op_text); |
| 950 | if (op) { |
| 951 | auto lhs = ExprFromAny(visit(ctx->relation(0))); |
| 952 | int64_t op_id = factory_.NextId(SourceRangeFromToken(ctx->op)); |
| 953 | auto rhs = ExprFromAny(visit(ctx->relation(1))); |
| 954 | return ExprToAny( |
| 955 | GlobalCallOrMacro(op_id, *op, std::move(lhs), std::move(rhs))); |
| 956 | } |
| 957 | return ExprToAny(factory_.ReportError(SourceRangeFromParserRuleContext(ctx), |
| 958 | "operator not found")); |
| 959 | } |
| 960 | |
| 961 | std::any ParserVisitor::visitCalc(CelParser::CalcContext* ctx) { |
| 962 | if (ctx->unary()) { |
nothing calls this directly
no test coverage detected