xgo/ast/array_lit.go
2019-01-11 01:16:34 -08:00

32 lines
479 B
Go

package ast
import (
"strings"
"github.com/d5/tengo/source"
)
type ArrayLit struct {
Elements []Expr
LBrack source.Pos
RBrack source.Pos
}
func (e *ArrayLit) exprNode() {}
func (e *ArrayLit) Pos() source.Pos {
return e.LBrack
}
func (e *ArrayLit) End() source.Pos {
return e.RBrack + 1
}
func (e *ArrayLit) String() string {
var elts []string
for _, m := range e.Elements {
elts = append(elts, m.String())
}
return "[" + strings.Join(elts, ", ") + "]"
}