expectOneOf consumes the next token and guarantees it has one of the required types.
(expected1, expected2 lex.TokenType, context string)
| 235 | |
| 236 | // expectOneOf consumes the next token and guarantees it has one of the required types. |
| 237 | func (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. |
| 246 | func (t *tree) unexpected(token lex.Token, msg string) { |
nothing calls this directly
no test coverage detected