Simplified ast package

This commit is contained in:
Eduard Urbach 2025-02-20 14:12:25 +01:00
parent d26bf9d1a9
commit 35ee40988d
Signed by: eduard
GPG key ID: 49226B848C78F6C8
19 changed files with 151 additions and 168 deletions

21
src/ast/helpers.go Normal file
View file

@ -0,0 +1,21 @@
package ast
import (
"git.akyoto.dev/cli/q/src/expression"
"git.akyoto.dev/cli/q/src/token"
)
// IsAssignment returns true if the expression is an assignment.
func IsAssignment(expr *expression.Expression) bool {
return expr.Token.IsAssignment()
}
// IsFunctionCall returns true if the expression is a function call.
func IsFunctionCall(expr *expression.Expression) bool {
return expr.Token.Kind == token.Call
}
// IsVariableDefinition returns true if the expression is a variable definition.
func IsVariableDefinition(expr *expression.Expression) bool {
return expr.Token.Kind == token.Define
}