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

Method expect

parser/pratt_parser.go:269–290  ·  view source on GitHub ↗
(kind tokenKind, msg string)

Source from the content-addressed store, hash-verified

267}
268
269func (p *prattParserWorker) expect(kind tokenKind, msg string) bool {
270 if p.peekTok.kind == kind {
271 p.nextToken()
272 return true
273 }
274 if p.recursionLimitExceeded || p.isRecoveryLimitExceeded() {
275 return false
276 }
277 if p.peekTok.kind != tokError {
278 if msg == "" {
279 tokText := p.tokenText(p.peekTok)
280 formattedTok := fmt.Sprintf("'%s'", tokText)
281 if p.peekTok.kind == tokEnd {
282 formattedTok = "<EOF>"
283 }
284 msg = fmt.Sprintf("mismatched input %s expecting '%s'", formattedTok, kind.String())
285 }
286 p.reportSyntaxError(p.peekTok, "%s", msg)
287 }
288 p.synchronizeOnDelimiter()
289 return false
290}
291
292func (p *prattParserWorker) synchronizeOnDelimiter() {
293 if p.recursionLimitExceeded || p.isRecoveryLimitExceeded() {

Callers 7

parseTernaryMethod · 0.95
parseStructMethod · 0.95
parsePrimaryMethod · 0.95
parseListMethod · 0.95
parseMapMethod · 0.95
parseArgumentsMethod · 0.95

Calls 6

nextTokenMethod · 0.95
tokenTextMethod · 0.95
reportSyntaxErrorMethod · 0.95
StringMethod · 0.65

Tested by

no test coverage detected