xgo/ast/binary_expr.go

28 lines
471 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 BinaryExpr struct {
Lhs Expr
Rhs Expr
Token token.Token
TokenPos source.Pos
2019-01-09 10:17:42 +03:00
}
func (e *BinaryExpr) exprNode() {}
func (e *BinaryExpr) Pos() source.Pos {
2019-01-09 10:17:42 +03:00
return e.Lhs.Pos()
}
func (e *BinaryExpr) End() source.Pos {
2019-01-09 10:17:42 +03:00
return e.Rhs.End()
}
func (e *BinaryExpr) String() string {
return "(" + e.Lhs.String() + " " + e.Token.String() + " " + e.Rhs.String() + ")"
}