MCPcopy Create free account
hub / github.com/cel-expr/cel-go / EscapeIdent

Method EscapeIdent

parser/gen/cel_parser.go:5252–5308  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5250}
5251
5252func (p *CELParser) EscapeIdent() (localctx IEscapeIdentContext) {
5253 localctx = NewEscapeIdentContext(p, p.GetParserRuleContext(), p.GetState())
5254 p.EnterRule(localctx, 28, CELParserRULE_escapeIdent)
5255 p.SetState(235)
5256 p.GetErrorHandler().Sync(p)
5257 if p.HasError() {
5258 goto errorExit
5259 }
5260
5261 switch p.GetTokenStream().LA(1) {
5262 case CELParserIDENTIFIER:
5263 localctx = NewSimpleIdentifierContext(p, localctx)
5264 p.EnterOuterAlt(localctx, 1)
5265 {
5266 p.SetState(233)
5267
5268 var _m = p.Match(CELParserIDENTIFIER)
5269
5270 localctx.(*SimpleIdentifierContext).id = _m
5271 if p.HasError() {
5272 // Recognition error - abort rule
5273 goto errorExit
5274 }
5275 }
5276
5277 case CELParserESC_IDENTIFIER:
5278 localctx = NewEscapedIdentifierContext(p, localctx)
5279 p.EnterOuterAlt(localctx, 2)
5280 {
5281 p.SetState(234)
5282
5283 var _m = p.Match(CELParserESC_IDENTIFIER)
5284
5285 localctx.(*EscapedIdentifierContext).id = _m
5286 if p.HasError() {
5287 // Recognition error - abort rule
5288 goto errorExit
5289 }
5290 }
5291
5292 default:
5293 p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
5294 goto errorExit
5295 }
5296
5297errorExit:
5298 if p.HasError() {
5299 v := p.GetError()
5300 localctx.SetException(v)
5301 p.GetErrorHandler().ReportError(p, v)
5302 p.GetErrorHandler().Recover(p, v)
5303 p.SetError(nil)
5304 }
5305 p.ExitRule()
5306 return localctx
5307 goto errorExit // Trick to prevent compiler error if the label is not used
5308}
5309

Callers 2

memberMethod · 0.95
OptFieldMethod · 0.95

Calls 10

LAMethod · 0.80
ReportErrorMethod · 0.80
RecoverMethod · 0.80
NewEscapeIdentContextFunction · 0.70
GetStateMethod · 0.65
MatchMethod · 0.65
EnterRuleMethod · 0.45
ExitRuleMethod · 0.45

Tested by

no test coverage detected