xgo/compiler/ast/paren_expr.go

27 lines
573 B
Go
Raw Normal View History

2019-01-09 10:17:42 +03:00
package ast
2019-01-11 13:27:28 +03:00
import "github.com/d5/tengo/compiler/source"
2019-01-09 10:17:42 +03:00
// ParenExpr represents a parenthesis wrapped expression.
2019-01-09 10:17:42 +03:00
type ParenExpr struct {
Expr Expr
LParen source.Pos
RParen source.Pos
2019-01-09 10:17:42 +03:00
}
func (e *ParenExpr) exprNode() {}
// Pos returns the position of first character belonging to the node.
func (e *ParenExpr) Pos() source.Pos {
2019-01-09 10:17:42 +03:00
return e.LParen
}
// End returns the position of first character immediately after the node.
func (e *ParenExpr) End() source.Pos {
2019-01-09 10:17:42 +03:00
return e.RParen + 1
}
func (e *ParenExpr) String() string {
return "(" + e.Expr.String() + ")"
}