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

Method visitRelation

parser/parser.cc:941–959  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939}
940
941std::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
961std::any ParserVisitor::visitCalc(CelParser::CalcContext* ctx) {
962 if (ctx->unary()) {

Callers

nothing calls this directly

Calls 8

ReverseLookupOperatorFunction · 0.85
ExprFromAnyFunction · 0.85
SourceRangeFromTokenFunction · 0.85
ExprToAnyFunction · 0.85
getTextMethod · 0.80
NextIdMethod · 0.45
ReportErrorMethod · 0.45

Tested by

no test coverage detected