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

Method visitIdent

parser/parser.cc:1143–1163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1141}
1142
1143std::any ParserVisitor::visitIdent(CelParser::IdentContext* ctx) {
1144 std::string ident_name;
1145 if (ctx->leadingDot) {
1146 ident_name = ".";
1147 }
1148 if (!ctx->id) {
1149 return ExprToAny(factory_.NewUnspecified(
1150 factory_.NextId(SourceRangeFromParserRuleContext(ctx))));
1151 }
1152 // check if ID is in reserved identifiers
1153 if (cel::internal::LexisIsReserved(ctx->id->getText())) {
1154 return ExprToAny(factory_.ReportError(
1155 SourceRangeFromParserRuleContext(ctx),
1156 absl::StrFormat("reserved identifier: %s", ctx->id->getText())));
1157 }
1158
1159 ident_name += ctx->id->getText();
1160
1161 return ExprToAny(factory_.NewIdent(
1162 factory_.NextId(SourceRangeFromToken(ctx->id)), std::move(ident_name)));
1163}
1164
1165std::any ParserVisitor::visitGlobalCall(CelParser::GlobalCallContext* ctx) {
1166 std::string ident_name;

Callers

nothing calls this directly

Calls 9

ExprToAnyFunction · 0.85
LexisIsReservedFunction · 0.85
SourceRangeFromTokenFunction · 0.85
getTextMethod · 0.80
NewUnspecifiedMethod · 0.45
NextIdMethod · 0.45
ReportErrorMethod · 0.45
NewIdentMethod · 0.45

Tested by

no test coverage detected