Move AST nodes to their own files.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
4acc09faf9
commit
5367fbd29d
9 changed files with 164 additions and 134 deletions
17
pkg/ast/prefix_expression.go
Normal file
17
pkg/ast/prefix_expression.go
Normal 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() + ")"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue