MCPcopy Create free account
hub / github.com/araddon/qlbridge / expectOneOf

Method expectOneOf

expr/parse.go:237–243  ·  view source on GitHub ↗

expectOneOf consumes the next token and guarantees it has one of the required types.

(expected1, expected2 lex.TokenType, context string)

Source from the content-addressed store, hash-verified

235
236// expectOneOf consumes the next token and guarantees it has one of the required types.
237func (t *tree) expectOneOf(expected1, expected2 lex.TokenType, context string) lex.Token {
238 token := t.Cur()
239 if token.T != expected1 && token.T != expected2 {
240 t.unexpected(token, context)
241 }
242 return token
243}
244
245// unexpected complains about the token and terminates processing.
246func (t *tree) unexpected(token lex.Token, msg string) {

Callers

nothing calls this directly

Calls 2

unexpectedMethod · 0.95
CurMethod · 0.65

Tested by

no test coverage detected