expect verifies the current token and guarantees it has the required type
(expected lex.TokenType, context string)
| 226 | |
| 227 | // expect verifies the current token and guarantees it has the required type |
| 228 | func (t *tree) expect(expected lex.TokenType, context string) lex.Token { |
| 229 | token := t.Cur() |
| 230 | if token.T != expected { |
| 231 | t.unexpected(token, context) |
| 232 | } |
| 233 | return token |
| 234 | } |
| 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 { |