currentTokenIs checks if the Parser's currentToken is any of the given token types
(tokens ...token.Type)
| 111 | |
| 112 | // currentTokenIs checks if the Parser's currentToken is any of the given token types |
| 113 | func (p *Parser) currentTokenIs(tokens ...token.Type) bool { |
| 114 | // iterate through the given token types and check if any of them match the currentToken's type |
| 115 | for _, t := range tokens { |
| 116 | if p.currentToken.Type == t { |
| 117 | // if a match is found, return true |
| 118 | return true |
| 119 | } |
| 120 | } |
| 121 | // if no match is found, return false |
| 122 | return false |
| 123 | } |
| 124 | |
| 125 | // previousTokenIs checks if the Parser's previousToken type matches any of the given types |
| 126 | func (p *Parser) previousTokenIs(tokens ...token.Type) bool { // Check if previous token matches any type |
no outgoing calls
no test coverage detected