Implemented constant folding

This commit is contained in:
2024-07-29 14:44:16 +02:00
parent 8d4eb9935d
commit 5b1d456720
8 changed files with 118 additions and 1 deletions

View File

@ -38,6 +38,11 @@ func (t Token) IsKeyword() bool {
return t.Kind > _keywords && t.Kind < _keywordsEnd
}
// IsNumeric returns true if the token is a number or rune.
func (t Token) IsNumeric() bool {
return t.Kind == Number || t.Kind == Rune
}
// IsOperator returns true if the token is an operator.
func (t Token) IsOperator() bool {
return t.Kind > _operators && t.Kind < _operatorsEnd