validateTokenAndSkip - Check if current token type is appearing in provided expectedTokens array then move to the next token
(parser *Parser, expectedTokens []token.Type)
| 35 | |
| 36 | // validateTokenAndSkip - Check if current token type is appearing in provided expectedTokens array then move to the next token |
| 37 | func validateTokenAndSkip(parser *Parser, expectedTokens []token.Type) error { |
| 38 | err := validateToken(parser.currentToken.Type, expectedTokens) |
| 39 | |
| 40 | if err != nil { |
| 41 | return err |
| 42 | } |
| 43 | |
| 44 | // Ignore validated token |
| 45 | parser.nextToken() |
| 46 | return nil |
| 47 | } |
| 48 | |
| 49 | // validateToken - Check if current token type is appearing in provided expectedTokens array |
| 50 | func validateToken(tokenType token.Type, expectedTokens []token.Type) error { |
no test coverage detected