2019-01-09 10:17:42 +03:00
|
|
|
package ast
|
|
|
|
|
|
|
|
import (
|
2019-01-11 12:16:34 +03:00
|
|
|
"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
|
2019-01-11 12:16:34 +03:00
|
|
|
TokenPos source.Pos
|
2019-01-09 10:17:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *BinaryExpr) exprNode() {}
|
|
|
|
|
2019-01-11 12:16:34 +03:00
|
|
|
func (e *BinaryExpr) Pos() source.Pos {
|
2019-01-09 10:17:42 +03:00
|
|
|
return e.Lhs.Pos()
|
|
|
|
}
|
|
|
|
|
2019-01-11 12:16:34 +03:00
|
|
|
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() + ")"
|
|
|
|
}
|