peekError adds an error message to the parser's error list indicating that the next token in the input did not match the expected type(s). It takes one or more token types as arguments that indicate the expected types.
(t ...token.Type)
| 872 | // did not match the expected type(s). |
| 873 | // It takes one or more token types as arguments that indicate the expected types. |
| 874 | func (p *Parser) peekError(t ...token.Type) { |
| 875 | expected := strings.Join(tokenTypesToStrings(t), ", ") |
| 876 | msg := fmt.Sprintf("%v:%v:expected next token to be %s, got %s instead", p.l.GetLinePosition(), p.l.GetColumnPosition(), expected, p.peekToken.Type) |
| 877 | p.errors = append(p.errors, msg) |
| 878 | } |
| 879 | |
| 880 | // currentError adds an error message to the parser's error list indicating that the current token in the input |
| 881 | // did not match the expected type(s). |
no test coverage detected