Move AST nodes to their own files.

Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
Mariano Uvalle 2025-01-05 13:05:35 -08:00
parent 4acc09faf9
commit 5367fbd29d
9 changed files with 164 additions and 134 deletions

View file

@ -0,0 +1,17 @@
package ast
import "code.jmug.me/jmug/interpreter-in-go/pkg/token"
type PrefixExpression struct {
Token token.Token // The operator token
Operator string
Right Expression
}
func (pe *PrefixExpression) expressionNode() {}
func (pe *PrefixExpression) TokenLiteral() string {
return pe.Token.Literal
}
func (pe *PrefixExpression) String() string {
return "(" + pe.Operator + pe.Right.String() + ")"
}