xgo/ast/unary_expr.go

27 lines
425 B
Go
Raw Normal View History

2019-01-09 10:17:42 +03:00
package ast
import (
"github.com/d5/tengo/source"
2019-01-09 10:17:42 +03:00
"github.com/d5/tengo/token"
)
type UnaryExpr struct {
Expr Expr
Token token.Token
TokenPos source.Pos
2019-01-09 10:17:42 +03:00
}
func (e *UnaryExpr) exprNode() {}
func (e *UnaryExpr) Pos() source.Pos {
2019-01-09 10:17:42 +03:00
return e.Expr.Pos()
}
func (e *UnaryExpr) End() source.Pos {
2019-01-09 10:17:42 +03:00
return e.Expr.End()
}
func (e *UnaryExpr) String() string {
return "(" + e.Token.String() + e.Expr.String() + ")"
}