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

Method visitPrimaryExpr

parser/parser.cc:776–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

774}
775
776std::any ParserVisitor::visitPrimaryExpr(CelParser::PrimaryExprContext* pctx) {
777 CelParser::PrimaryContext* primary = pctx->primary();
778 if (auto* ctx = tree_as<CelParser::NestedContext>(primary)) {
779 return visitNested(ctx);
780 } else if (auto* ctx = tree_as<CelParser::IdentContext>(primary)) {
781 return visitIdent(ctx);
782 } else if (auto* ctx = tree_as<CelParser::GlobalCallContext>(primary)) {
783 return visitGlobalCall(ctx);
784 } else if (auto* ctx = tree_as<CelParser::CreateListContext>(primary)) {
785 return visitCreateList(ctx);
786 } else if (auto* ctx = tree_as<CelParser::CreateMapContext>(primary)) {
787 return visitCreateMap(ctx);
788 } else if (auto* ctx = tree_as<CelParser::CreateMessageContext>(primary)) {
789 return visitCreateMessage(ctx);
790 } else if (auto* ctx = tree_as<CelParser::ConstantLiteralContext>(primary)) {
791 return visitConstantLiteral(ctx);
792 }
793 if (factory_.HasErrors()) {
794 // ANTLR creates PrimaryContext rather than a derived class during certain
795 // error conditions. This is odd, but we ignore it as we already have errors
796 // that occurred.
797 return ExprToAny(factory_.NewUnspecified(factory_.NextId({})));
798 }
799 return ExprToAny(factory_.ReportError(SourceRangeFromParserRuleContext(pctx),
800 "invalid primary expression"));
801}
802
803std::any ParserVisitor::visitMemberExpr(CelParser::MemberExprContext* mctx) {
804 CelParser::MemberContext* member = mctx->member();

Callers

nothing calls this directly

Calls 6

ExprToAnyFunction · 0.85
HasErrorsMethod · 0.80
NewUnspecifiedMethod · 0.45
NextIdMethod · 0.45
ReportErrorMethod · 0.45

Tested by

no test coverage detected