matchType checks if the current token's Type matches the expected type and advances if so.
(expected models.TokenType)
| 885 | |
| 886 | // matchType checks if the current token's Type matches the expected type and advances if so. |
| 887 | func (p *Parser) matchType(expected models.TokenType) bool { |
| 888 | if p.currentToken.Token.Type == expected { |
| 889 | p.advance() |
| 890 | return true |
| 891 | } |
| 892 | return false |
| 893 | } |
| 894 | |
| 895 | // isAnyType checks if the current token's Type matches any of the given types. |
| 896 | // More efficient than multiple isType calls when checking many alternatives. |