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

Method visitList

parser/parser.cc:1199–1219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1197}
1198
1199std::vector<ListExprElement> ParserVisitor::visitList(
1200 CelParser::ListInitContext* ctx) {
1201 std::vector<ListExprElement> rv;
1202 if (!ctx) return rv;
1203 rv.reserve(ctx->elems.size());
1204 for (size_t i = 0; i < ctx->elems.size(); ++i) {
1205 auto* expr_ctx = ctx->elems[i];
1206 if (expr_ctx == nullptr) {
1207 return rv;
1208 }
1209 if (!enable_optional_syntax_ && expr_ctx->opt != nullptr) {
1210 factory_.ReportError(SourceRangeFromParserRuleContext(ctx),
1211 "unsupported syntax '?'");
1212 rv.push_back(factory_.NewListElement(factory_.NewUnspecified(0), false));
1213 continue;
1214 }
1215 rv.push_back(factory_.NewListElement(ExprFromAny(visitExpr(expr_ctx->e)),
1216 expr_ctx->opt != nullptr));
1217 }
1218 return rv;
1219}
1220
1221std::vector<Expr> ParserVisitor::visitList(CelParser::ExprListContext* ctx) {
1222 std::vector<Expr> rv;

Callers

nothing calls this directly

Calls 8

ExprFromAnyFunction · 0.85
NewListElementMethod · 0.80
sizeMethod · 0.45
ReportErrorMethod · 0.45
NewUnspecifiedMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected