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

Method NormalizeIdentifier

parser/parser.cc:1006–1023  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1004}
1005
1006std::string ParserVisitor::NormalizeIdentifier(
1007 CelParser::EscapeIdentContext* ctx) {
1008 if (auto* raw_id = tree_as<CelParser::SimpleIdentifierContext>(ctx); raw_id) {
1009 return raw_id->id->getText();
1010 }
1011 if (auto* escaped_id = tree_as<CelParser::EscapedIdentifierContext>(ctx);
1012 escaped_id) {
1013 if (!enable_quoted_identifiers_) {
1014 factory_.ReportError(SourceRangeFromParserRuleContext(ctx),
1015 "unsupported syntax '`'");
1016 }
1017 auto escaped_id_text = escaped_id->id->getText();
1018 return escaped_id_text.substr(1, escaped_id_text.size() - 2);
1019 }
1020
1021 // Fallthrough might occur if the parser is in an error state.
1022 return "";
1023}
1024
1025std::any ParserVisitor::visitSelect(CelParser::SelectContext* ctx) {
1026 auto operand = ExprFromAny(visit(ctx->member()));

Callers

nothing calls this directly

Calls 4

getTextMethod · 0.80
ReportErrorMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected