From 9d84d6dd643c4017074e81465671cd9b25f9539a Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 9 Jan 2020 21:52:19 +0100 Subject: Update to tengo v2 (#976) --- .../github.com/d5/tengo/compiler/ast/array_lit.go | 35 ------------ .../d5/tengo/compiler/ast/assign_stmt.go | 40 -------------- vendor/github.com/d5/tengo/compiler/ast/ast.go | 5 -- .../github.com/d5/tengo/compiler/ast/bad_expr.go | 25 --------- .../github.com/d5/tengo/compiler/ast/bad_stmt.go | 25 --------- .../d5/tengo/compiler/ast/binary_expr.go | 30 ----------- .../github.com/d5/tengo/compiler/ast/block_stmt.go | 35 ------------ .../github.com/d5/tengo/compiler/ast/bool_lit.go | 26 --------- .../d5/tengo/compiler/ast/branch_stmt.go | 38 ------------- .../github.com/d5/tengo/compiler/ast/call_expr.go | 36 ------------- .../github.com/d5/tengo/compiler/ast/char_lit.go | 26 --------- .../github.com/d5/tengo/compiler/ast/cond_expr.go | 30 ----------- .../github.com/d5/tengo/compiler/ast/empty_stmt.go | 29 ---------- .../github.com/d5/tengo/compiler/ast/error_expr.go | 29 ---------- .../d5/tengo/compiler/ast/export_stmt.go | 27 ---------- vendor/github.com/d5/tengo/compiler/ast/expr.go | 7 --- .../github.com/d5/tengo/compiler/ast/expr_stmt.go | 24 --------- vendor/github.com/d5/tengo/compiler/ast/file.go | 32 ----------- .../github.com/d5/tengo/compiler/ast/float_lit.go | 26 --------- .../d5/tengo/compiler/ast/for_in_stmt.go | 32 ----------- .../github.com/d5/tengo/compiler/ast/for_stmt.go | 43 --------------- .../github.com/d5/tengo/compiler/ast/func_lit.go | 25 --------- .../github.com/d5/tengo/compiler/ast/func_type.go | 25 --------- vendor/github.com/d5/tengo/compiler/ast/ident.go | 29 ---------- .../github.com/d5/tengo/compiler/ast/ident_list.go | 63 ---------------------- vendor/github.com/d5/tengo/compiler/ast/if_stmt.go | 40 -------------- .../d5/tengo/compiler/ast/immutable_expr.go | 29 ---------- .../d5/tengo/compiler/ast/import_expr.go | 29 ---------- .../d5/tengo/compiler/ast/inc_dec_stmt.go | 29 ---------- .../github.com/d5/tengo/compiler/ast/index_expr.go | 32 ----------- vendor/github.com/d5/tengo/compiler/ast/int_lit.go | 26 --------- .../d5/tengo/compiler/ast/map_element_lit.go | 27 ---------- vendor/github.com/d5/tengo/compiler/ast/map_lit.go | 35 ------------ vendor/github.com/d5/tengo/compiler/ast/node.go | 13 ----- .../github.com/d5/tengo/compiler/ast/paren_expr.go | 26 --------- .../d5/tengo/compiler/ast/return_stmt.go | 35 ------------ .../d5/tengo/compiler/ast/selector_expr.go | 25 --------- .../github.com/d5/tengo/compiler/ast/slice_expr.go | 36 ------------- vendor/github.com/d5/tengo/compiler/ast/stmt.go | 7 --- .../github.com/d5/tengo/compiler/ast/string_lit.go | 26 --------- .../github.com/d5/tengo/compiler/ast/unary_expr.go | 29 ---------- .../d5/tengo/compiler/ast/undefined_lit.go | 24 --------- 42 files changed, 1210 deletions(-) delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/array_lit.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/assign_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/ast.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/bad_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/bad_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/binary_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/block_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/bool_lit.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/branch_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/call_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/char_lit.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/cond_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/empty_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/error_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/export_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/expr_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/file.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/float_lit.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/for_in_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/for_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/func_lit.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/func_type.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/ident.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/ident_list.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/if_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/immutable_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/import_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/inc_dec_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/index_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/int_lit.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/map_element_lit.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/map_lit.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/node.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/paren_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/return_stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/selector_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/slice_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/stmt.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/string_lit.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/unary_expr.go delete mode 100644 vendor/github.com/d5/tengo/compiler/ast/undefined_lit.go (limited to 'vendor/github.com/d5/tengo/compiler/ast') diff --git a/vendor/github.com/d5/tengo/compiler/ast/array_lit.go b/vendor/github.com/d5/tengo/compiler/ast/array_lit.go deleted file mode 100644 index 9fb4ed67..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/array_lit.go +++ /dev/null @@ -1,35 +0,0 @@ -package ast - -import ( - "strings" - - "github.com/d5/tengo/compiler/source" -) - -// ArrayLit represents an array literal. -type ArrayLit struct { - Elements []Expr - LBrack source.Pos - RBrack source.Pos -} - -func (e *ArrayLit) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *ArrayLit) Pos() source.Pos { - return e.LBrack -} - -// End returns the position of first character immediately after the node. -func (e *ArrayLit) End() source.Pos { - return e.RBrack + 1 -} - -func (e *ArrayLit) String() string { - var elements []string - for _, m := range e.Elements { - elements = append(elements, m.String()) - } - - return "[" + strings.Join(elements, ", ") + "]" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/assign_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/assign_stmt.go deleted file mode 100644 index e129114e..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/assign_stmt.go +++ /dev/null @@ -1,40 +0,0 @@ -package ast - -import ( - "strings" - - "github.com/d5/tengo/compiler/source" - "github.com/d5/tengo/compiler/token" -) - -// AssignStmt represents an assignment statement. -type AssignStmt struct { - LHS []Expr - RHS []Expr - Token token.Token - TokenPos source.Pos -} - -func (s *AssignStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *AssignStmt) Pos() source.Pos { - return s.LHS[0].Pos() -} - -// End returns the position of first character immediately after the node. -func (s *AssignStmt) End() source.Pos { - return s.RHS[len(s.RHS)-1].End() -} - -func (s *AssignStmt) String() string { - var lhs, rhs []string - for _, e := range s.LHS { - lhs = append(lhs, e.String()) - } - for _, e := range s.RHS { - rhs = append(rhs, e.String()) - } - - return strings.Join(lhs, ", ") + " " + s.Token.String() + " " + strings.Join(rhs, ", ") -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/ast.go b/vendor/github.com/d5/tengo/compiler/ast/ast.go deleted file mode 100644 index 9fd06728..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/ast.go +++ /dev/null @@ -1,5 +0,0 @@ -package ast - -const ( - nullRep = "" -) diff --git a/vendor/github.com/d5/tengo/compiler/ast/bad_expr.go b/vendor/github.com/d5/tengo/compiler/ast/bad_expr.go deleted file mode 100644 index 771f26fd..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/bad_expr.go +++ /dev/null @@ -1,25 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// BadExpr represents a bad expression. -type BadExpr struct { - From source.Pos - To source.Pos -} - -func (e *BadExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *BadExpr) Pos() source.Pos { - return e.From -} - -// End returns the position of first character immediately after the node. -func (e *BadExpr) End() source.Pos { - return e.To -} - -func (e *BadExpr) String() string { - return "" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/bad_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/bad_stmt.go deleted file mode 100644 index c2d0ae9a..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/bad_stmt.go +++ /dev/null @@ -1,25 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// BadStmt represents a bad statement. -type BadStmt struct { - From source.Pos - To source.Pos -} - -func (s *BadStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *BadStmt) Pos() source.Pos { - return s.From -} - -// End returns the position of first character immediately after the node. -func (s *BadStmt) End() source.Pos { - return s.To -} - -func (s *BadStmt) String() string { - return "" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/binary_expr.go b/vendor/github.com/d5/tengo/compiler/ast/binary_expr.go deleted file mode 100644 index 0cc5bba8..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/binary_expr.go +++ /dev/null @@ -1,30 +0,0 @@ -package ast - -import ( - "github.com/d5/tengo/compiler/source" - "github.com/d5/tengo/compiler/token" -) - -// BinaryExpr represents a binary operator expression. -type BinaryExpr struct { - LHS Expr - RHS Expr - Token token.Token - TokenPos source.Pos -} - -func (e *BinaryExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *BinaryExpr) Pos() source.Pos { - return e.LHS.Pos() -} - -// End returns the position of first character immediately after the node. -func (e *BinaryExpr) End() source.Pos { - return e.RHS.End() -} - -func (e *BinaryExpr) String() string { - return "(" + e.LHS.String() + " " + e.Token.String() + " " + e.RHS.String() + ")" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/block_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/block_stmt.go deleted file mode 100644 index 9bde9fa3..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/block_stmt.go +++ /dev/null @@ -1,35 +0,0 @@ -package ast - -import ( - "strings" - - "github.com/d5/tengo/compiler/source" -) - -// BlockStmt represents a block statement. -type BlockStmt struct { - Stmts []Stmt - LBrace source.Pos - RBrace source.Pos -} - -func (s *BlockStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *BlockStmt) Pos() source.Pos { - return s.LBrace -} - -// End returns the position of first character immediately after the node. -func (s *BlockStmt) End() source.Pos { - return s.RBrace + 1 -} - -func (s *BlockStmt) String() string { - var list []string - for _, e := range s.Stmts { - list = append(list, e.String()) - } - - return "{" + strings.Join(list, "; ") + "}" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/bool_lit.go b/vendor/github.com/d5/tengo/compiler/ast/bool_lit.go deleted file mode 100644 index e667a5c8..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/bool_lit.go +++ /dev/null @@ -1,26 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// BoolLit represents a boolean literal. -type BoolLit struct { - Value bool - ValuePos source.Pos - Literal string -} - -func (e *BoolLit) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *BoolLit) Pos() source.Pos { - return e.ValuePos -} - -// End returns the position of first character immediately after the node. -func (e *BoolLit) End() source.Pos { - return source.Pos(int(e.ValuePos) + len(e.Literal)) -} - -func (e *BoolLit) String() string { - return e.Literal -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/branch_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/branch_stmt.go deleted file mode 100644 index f6c7fdea..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/branch_stmt.go +++ /dev/null @@ -1,38 +0,0 @@ -package ast - -import ( - "github.com/d5/tengo/compiler/source" - "github.com/d5/tengo/compiler/token" -) - -// BranchStmt represents a branch statement. -type BranchStmt struct { - Token token.Token - TokenPos source.Pos - Label *Ident -} - -func (s *BranchStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *BranchStmt) Pos() source.Pos { - return s.TokenPos -} - -// End returns the position of first character immediately after the node. -func (s *BranchStmt) End() source.Pos { - if s.Label != nil { - return s.Label.End() - } - - return source.Pos(int(s.TokenPos) + len(s.Token.String())) -} - -func (s *BranchStmt) String() string { - var label string - if s.Label != nil { - label = " " + s.Label.Name - } - - return s.Token.String() + label -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/call_expr.go b/vendor/github.com/d5/tengo/compiler/ast/call_expr.go deleted file mode 100644 index 0219d7c9..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/call_expr.go +++ /dev/null @@ -1,36 +0,0 @@ -package ast - -import ( - "strings" - - "github.com/d5/tengo/compiler/source" -) - -// CallExpr represents a function call expression. -type CallExpr struct { - Func Expr - LParen source.Pos - Args []Expr - RParen source.Pos -} - -func (e *CallExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *CallExpr) Pos() source.Pos { - return e.Func.Pos() -} - -// End returns the position of first character immediately after the node. -func (e *CallExpr) End() source.Pos { - return e.RParen + 1 -} - -func (e *CallExpr) String() string { - var args []string - for _, e := range e.Args { - args = append(args, e.String()) - } - - return e.Func.String() + "(" + strings.Join(args, ", ") + ")" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/char_lit.go b/vendor/github.com/d5/tengo/compiler/ast/char_lit.go deleted file mode 100644 index 592f8744..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/char_lit.go +++ /dev/null @@ -1,26 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// CharLit represents a character literal. -type CharLit struct { - Value rune - ValuePos source.Pos - Literal string -} - -func (e *CharLit) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *CharLit) Pos() source.Pos { - return e.ValuePos -} - -// End returns the position of first character immediately after the node. -func (e *CharLit) End() source.Pos { - return source.Pos(int(e.ValuePos) + len(e.Literal)) -} - -func (e *CharLit) String() string { - return e.Literal -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/cond_expr.go b/vendor/github.com/d5/tengo/compiler/ast/cond_expr.go deleted file mode 100644 index bb1db849..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/cond_expr.go +++ /dev/null @@ -1,30 +0,0 @@ -package ast - -import ( - "github.com/d5/tengo/compiler/source" -) - -// CondExpr represents a ternary conditional expression. -type CondExpr struct { - Cond Expr - True Expr - False Expr - QuestionPos source.Pos - ColonPos source.Pos -} - -func (e *CondExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *CondExpr) Pos() source.Pos { - return e.Cond.Pos() -} - -// End returns the position of first character immediately after the node. -func (e *CondExpr) End() source.Pos { - return e.False.End() -} - -func (e *CondExpr) String() string { - return "(" + e.Cond.String() + " ? " + e.True.String() + " : " + e.False.String() + ")" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/empty_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/empty_stmt.go deleted file mode 100644 index a2ac6ffe..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/empty_stmt.go +++ /dev/null @@ -1,29 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// EmptyStmt represents an empty statement. -type EmptyStmt struct { - Semicolon source.Pos - Implicit bool -} - -func (s *EmptyStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *EmptyStmt) Pos() source.Pos { - return s.Semicolon -} - -// End returns the position of first character immediately after the node. -func (s *EmptyStmt) End() source.Pos { - if s.Implicit { - return s.Semicolon - } - - return s.Semicolon + 1 -} - -func (s *EmptyStmt) String() string { - return ";" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/error_expr.go b/vendor/github.com/d5/tengo/compiler/ast/error_expr.go deleted file mode 100644 index 7ce5667e..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/error_expr.go +++ /dev/null @@ -1,29 +0,0 @@ -package ast - -import ( - "github.com/d5/tengo/compiler/source" -) - -// ErrorExpr represents an error expression -type ErrorExpr struct { - Expr Expr - ErrorPos source.Pos - LParen source.Pos - RParen source.Pos -} - -func (e *ErrorExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *ErrorExpr) Pos() source.Pos { - return e.ErrorPos -} - -// End returns the position of first character immediately after the node. -func (e *ErrorExpr) End() source.Pos { - return e.RParen -} - -func (e *ErrorExpr) String() string { - return "error(" + e.Expr.String() + ")" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/export_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/export_stmt.go deleted file mode 100644 index 64eb7606..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/export_stmt.go +++ /dev/null @@ -1,27 +0,0 @@ -package ast - -import ( - "github.com/d5/tengo/compiler/source" -) - -// ExportStmt represents an export statement. -type ExportStmt struct { - ExportPos source.Pos - Result Expr -} - -func (s *ExportStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *ExportStmt) Pos() source.Pos { - return s.ExportPos -} - -// End returns the position of first character immediately after the node. -func (s *ExportStmt) End() source.Pos { - return s.Result.End() -} - -func (s *ExportStmt) String() string { - return "export " + s.Result.String() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/expr.go b/vendor/github.com/d5/tengo/compiler/ast/expr.go deleted file mode 100644 index 764bacec..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/expr.go +++ /dev/null @@ -1,7 +0,0 @@ -package ast - -// Expr represents an expression node in the AST. -type Expr interface { - Node - exprNode() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/expr_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/expr_stmt.go deleted file mode 100644 index 095a3ad5..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/expr_stmt.go +++ /dev/null @@ -1,24 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// ExprStmt represents an expression statement. -type ExprStmt struct { - Expr Expr -} - -func (s *ExprStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *ExprStmt) Pos() source.Pos { - return s.Expr.Pos() -} - -// End returns the position of first character immediately after the node. -func (s *ExprStmt) End() source.Pos { - return s.Expr.End() -} - -func (s *ExprStmt) String() string { - return s.Expr.String() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/file.go b/vendor/github.com/d5/tengo/compiler/ast/file.go deleted file mode 100644 index fc18b2d7..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/file.go +++ /dev/null @@ -1,32 +0,0 @@ -package ast - -import ( - "strings" - - "github.com/d5/tengo/compiler/source" -) - -// File represents a file unit. -type File struct { - InputFile *source.File - Stmts []Stmt -} - -// Pos returns the position of first character belonging to the node. -func (n *File) Pos() source.Pos { - return source.Pos(n.InputFile.Base) -} - -// End returns the position of first character immediately after the node. -func (n *File) End() source.Pos { - return source.Pos(n.InputFile.Base + n.InputFile.Size) -} - -func (n *File) String() string { - var stmts []string - for _, e := range n.Stmts { - stmts = append(stmts, e.String()) - } - - return strings.Join(stmts, "; ") -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/float_lit.go b/vendor/github.com/d5/tengo/compiler/ast/float_lit.go deleted file mode 100644 index 670f744b..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/float_lit.go +++ /dev/null @@ -1,26 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// FloatLit represents a floating point literal. -type FloatLit struct { - Value float64 - ValuePos source.Pos - Literal string -} - -func (e *FloatLit) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *FloatLit) Pos() source.Pos { - return e.ValuePos -} - -// End returns the position of first character immediately after the node. -func (e *FloatLit) End() source.Pos { - return source.Pos(int(e.ValuePos) + len(e.Literal)) -} - -func (e *FloatLit) String() string { - return e.Literal -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/for_in_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/for_in_stmt.go deleted file mode 100644 index 18020b56..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/for_in_stmt.go +++ /dev/null @@ -1,32 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// ForInStmt represents a for-in statement. -type ForInStmt struct { - ForPos source.Pos - Key *Ident - Value *Ident - Iterable Expr - Body *BlockStmt -} - -func (s *ForInStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *ForInStmt) Pos() source.Pos { - return s.ForPos -} - -// End returns the position of first character immediately after the node. -func (s *ForInStmt) End() source.Pos { - return s.Body.End() -} - -func (s *ForInStmt) String() string { - if s.Value != nil { - return "for " + s.Key.String() + ", " + s.Value.String() + " in " + s.Iterable.String() + " " + s.Body.String() - } - - return "for " + s.Key.String() + " in " + s.Iterable.String() + " " + s.Body.String() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/for_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/for_stmt.go deleted file mode 100644 index 4b5a0a17..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/for_stmt.go +++ /dev/null @@ -1,43 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// ForStmt represents a for statement. -type ForStmt struct { - ForPos source.Pos - Init Stmt - Cond Expr - Post Stmt - Body *BlockStmt -} - -func (s *ForStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *ForStmt) Pos() source.Pos { - return s.ForPos -} - -// End returns the position of first character immediately after the node. -func (s *ForStmt) End() source.Pos { - return s.Body.End() -} - -func (s *ForStmt) String() string { - var init, cond, post string - if s.Init != nil { - init = s.Init.String() - } - if s.Cond != nil { - cond = s.Cond.String() + " " - } - if s.Post != nil { - post = s.Post.String() - } - - if init != "" || post != "" { - return "for " + init + " ; " + cond + " ; " + post + s.Body.String() - } - - return "for " + cond + s.Body.String() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/func_lit.go b/vendor/github.com/d5/tengo/compiler/ast/func_lit.go deleted file mode 100644 index 2e90ed2b..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/func_lit.go +++ /dev/null @@ -1,25 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// FuncLit represents a function literal. -type FuncLit struct { - Type *FuncType - Body *BlockStmt -} - -func (e *FuncLit) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *FuncLit) Pos() source.Pos { - return e.Type.Pos() -} - -// End returns the position of first character immediately after the node. -func (e *FuncLit) End() source.Pos { - return e.Body.End() -} - -func (e *FuncLit) String() string { - return "func" + e.Type.Params.String() + " " + e.Body.String() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/func_type.go b/vendor/github.com/d5/tengo/compiler/ast/func_type.go deleted file mode 100644 index 2afaabb1..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/func_type.go +++ /dev/null @@ -1,25 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// FuncType represents a function type definition. -type FuncType struct { - FuncPos source.Pos - Params *IdentList -} - -func (e *FuncType) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *FuncType) Pos() source.Pos { - return e.FuncPos -} - -// End returns the position of first character immediately after the node. -func (e *FuncType) End() source.Pos { - return e.Params.End() -} - -func (e *FuncType) String() string { - return "func" + e.Params.String() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/ident.go b/vendor/github.com/d5/tengo/compiler/ast/ident.go deleted file mode 100644 index 33b7ff76..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/ident.go +++ /dev/null @@ -1,29 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// Ident represents an identifier. -type Ident struct { - Name string - NamePos source.Pos -} - -func (e *Ident) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *Ident) Pos() source.Pos { - return e.NamePos -} - -// End returns the position of first character immediately after the node. -func (e *Ident) End() source.Pos { - return source.Pos(int(e.NamePos) + len(e.Name)) -} - -func (e *Ident) String() string { - if e != nil { - return e.Name - } - - return nullRep -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/ident_list.go b/vendor/github.com/d5/tengo/compiler/ast/ident_list.go deleted file mode 100644 index 8dd6d307..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/ident_list.go +++ /dev/null @@ -1,63 +0,0 @@ -package ast - -import ( - "strings" - - "github.com/d5/tengo/compiler/source" -) - -// IdentList represents a list of identifiers. -type IdentList struct { - LParen source.Pos - VarArgs bool - List []*Ident - RParen source.Pos -} - -// Pos returns the position of first character belonging to the node. -func (n *IdentList) Pos() source.Pos { - if n.LParen.IsValid() { - return n.LParen - } - - if len(n.List) > 0 { - return n.List[0].Pos() - } - - return source.NoPos -} - -// End returns the position of first character immediately after the node. -func (n *IdentList) End() source.Pos { - if n.RParen.IsValid() { - return n.RParen + 1 - } - - if l := len(n.List); l > 0 { - return n.List[l-1].End() - } - - return source.NoPos -} - -// NumFields returns the number of fields. -func (n *IdentList) NumFields() int { - if n == nil { - return 0 - } - - return len(n.List) -} - -func (n *IdentList) String() string { - var list []string - for i, e := range n.List { - if n.VarArgs && i == len(n.List)-1 { - list = append(list, "..."+e.String()) - } else { - list = append(list, e.String()) - } - } - - return "(" + strings.Join(list, ", ") + ")" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/if_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/if_stmt.go deleted file mode 100644 index b3d65606..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/if_stmt.go +++ /dev/null @@ -1,40 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// IfStmt represents an if statement. -type IfStmt struct { - IfPos source.Pos - Init Stmt - Cond Expr - Body *BlockStmt - Else Stmt // else branch; or nil -} - -func (s *IfStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *IfStmt) Pos() source.Pos { - return s.IfPos -} - -// End returns the position of first character immediately after the node. -func (s *IfStmt) End() source.Pos { - if s.Else != nil { - return s.Else.End() - } - - return s.Body.End() -} - -func (s *IfStmt) String() string { - var initStmt, elseStmt string - if s.Init != nil { - initStmt = s.Init.String() + "; " - } - if s.Else != nil { - elseStmt = " else " + s.Else.String() - } - - return "if " + initStmt + s.Cond.String() + " " + s.Body.String() + elseStmt -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/immutable_expr.go b/vendor/github.com/d5/tengo/compiler/ast/immutable_expr.go deleted file mode 100644 index f9843b50..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/immutable_expr.go +++ /dev/null @@ -1,29 +0,0 @@ -package ast - -import ( - "github.com/d5/tengo/compiler/source" -) - -// ImmutableExpr represents an immutable expression -type ImmutableExpr struct { - Expr Expr - ErrorPos source.Pos - LParen source.Pos - RParen source.Pos -} - -func (e *ImmutableExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *ImmutableExpr) Pos() source.Pos { - return e.ErrorPos -} - -// End returns the position of first character immediately after the node. -func (e *ImmutableExpr) End() source.Pos { - return e.RParen -} - -func (e *ImmutableExpr) String() string { - return "immutable(" + e.Expr.String() + ")" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/import_expr.go b/vendor/github.com/d5/tengo/compiler/ast/import_expr.go deleted file mode 100644 index 6eff74a9..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/import_expr.go +++ /dev/null @@ -1,29 +0,0 @@ -package ast - -import ( - "github.com/d5/tengo/compiler/source" - "github.com/d5/tengo/compiler/token" -) - -// ImportExpr represents an import expression -type ImportExpr struct { - ModuleName string - Token token.Token - TokenPos source.Pos -} - -func (e *ImportExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *ImportExpr) Pos() source.Pos { - return e.TokenPos -} - -// End returns the position of first character immediately after the node. -func (e *ImportExpr) End() source.Pos { - return source.Pos(int(e.TokenPos) + 10 + len(e.ModuleName)) // import("moduleName") -} - -func (e *ImportExpr) String() string { - return `import("` + e.ModuleName + `")"` -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/inc_dec_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/inc_dec_stmt.go deleted file mode 100644 index e4e7f92c..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/inc_dec_stmt.go +++ /dev/null @@ -1,29 +0,0 @@ -package ast - -import ( - "github.com/d5/tengo/compiler/source" - "github.com/d5/tengo/compiler/token" -) - -// IncDecStmt represents increment or decrement statement. -type IncDecStmt struct { - Expr Expr - Token token.Token - TokenPos source.Pos -} - -func (s *IncDecStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *IncDecStmt) Pos() source.Pos { - return s.Expr.Pos() -} - -// End returns the position of first character immediately after the node. -func (s *IncDecStmt) End() source.Pos { - return source.Pos(int(s.TokenPos) + 2) -} - -func (s *IncDecStmt) String() string { - return s.Expr.String() + s.Token.String() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/index_expr.go b/vendor/github.com/d5/tengo/compiler/ast/index_expr.go deleted file mode 100644 index bc0992a3..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/index_expr.go +++ /dev/null @@ -1,32 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// IndexExpr represents an index expression. -type IndexExpr struct { - Expr Expr - LBrack source.Pos - Index Expr - RBrack source.Pos -} - -func (e *IndexExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *IndexExpr) Pos() source.Pos { - return e.Expr.Pos() -} - -// End returns the position of first character immediately after the node. -func (e *IndexExpr) End() source.Pos { - return e.RBrack + 1 -} - -func (e *IndexExpr) String() string { - var index string - if e.Index != nil { - index = e.Index.String() - } - - return e.Expr.String() + "[" + index + "]" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/int_lit.go b/vendor/github.com/d5/tengo/compiler/ast/int_lit.go deleted file mode 100644 index 3e1fd98b..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/int_lit.go +++ /dev/null @@ -1,26 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// IntLit represents an integer literal. -type IntLit struct { - Value int64 - ValuePos source.Pos - Literal string -} - -func (e *IntLit) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *IntLit) Pos() source.Pos { - return e.ValuePos -} - -// End returns the position of first character immediately after the node. -func (e *IntLit) End() source.Pos { - return source.Pos(int(e.ValuePos) + len(e.Literal)) -} - -func (e *IntLit) String() string { - return e.Literal -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/map_element_lit.go b/vendor/github.com/d5/tengo/compiler/ast/map_element_lit.go deleted file mode 100644 index 3d7fca9e..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/map_element_lit.go +++ /dev/null @@ -1,27 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// MapElementLit represents a map element. -type MapElementLit struct { - Key string - KeyPos source.Pos - ColonPos source.Pos - Value Expr -} - -func (e *MapElementLit) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *MapElementLit) Pos() source.Pos { - return e.KeyPos -} - -// End returns the position of first character immediately after the node. -func (e *MapElementLit) End() source.Pos { - return e.Value.End() -} - -func (e *MapElementLit) String() string { - return e.Key + ": " + e.Value.String() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/map_lit.go b/vendor/github.com/d5/tengo/compiler/ast/map_lit.go deleted file mode 100644 index a228224d..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/map_lit.go +++ /dev/null @@ -1,35 +0,0 @@ -package ast - -import ( - "strings" - - "github.com/d5/tengo/compiler/source" -) - -// MapLit represents a map literal. -type MapLit struct { - LBrace source.Pos - Elements []*MapElementLit - RBrace source.Pos -} - -func (e *MapLit) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *MapLit) Pos() source.Pos { - return e.LBrace -} - -// End returns the position of first character immediately after the node. -func (e *MapLit) End() source.Pos { - return e.RBrace + 1 -} - -func (e *MapLit) String() string { - var elements []string - for _, m := range e.Elements { - elements = append(elements, m.String()) - } - - return "{" + strings.Join(elements, ", ") + "}" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/node.go b/vendor/github.com/d5/tengo/compiler/ast/node.go deleted file mode 100644 index 44677b47..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/node.go +++ /dev/null @@ -1,13 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// Node represents a node in the AST. -type Node interface { - // Pos returns the position of first character belonging to the node. - Pos() source.Pos - // End returns the position of first character immediately after the node. - End() source.Pos - // String returns a string representation of the node. - String() string -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/paren_expr.go b/vendor/github.com/d5/tengo/compiler/ast/paren_expr.go deleted file mode 100644 index 8db4ac02..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/paren_expr.go +++ /dev/null @@ -1,26 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// ParenExpr represents a parenthesis wrapped expression. -type ParenExpr struct { - Expr Expr - LParen source.Pos - RParen source.Pos -} - -func (e *ParenExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *ParenExpr) Pos() source.Pos { - return e.LParen -} - -// End returns the position of first character immediately after the node. -func (e *ParenExpr) End() source.Pos { - return e.RParen + 1 -} - -func (e *ParenExpr) String() string { - return "(" + e.Expr.String() + ")" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/return_stmt.go b/vendor/github.com/d5/tengo/compiler/ast/return_stmt.go deleted file mode 100644 index 592d45b8..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/return_stmt.go +++ /dev/null @@ -1,35 +0,0 @@ -package ast - -import ( - "github.com/d5/tengo/compiler/source" -) - -// ReturnStmt represents a return statement. -type ReturnStmt struct { - ReturnPos source.Pos - Result Expr -} - -func (s *ReturnStmt) stmtNode() {} - -// Pos returns the position of first character belonging to the node. -func (s *ReturnStmt) Pos() source.Pos { - return s.ReturnPos -} - -// End returns the position of first character immediately after the node. -func (s *ReturnStmt) End() source.Pos { - if s.Result != nil { - return s.Result.End() - } - - return s.ReturnPos + 6 -} - -func (s *ReturnStmt) String() string { - if s.Result != nil { - return "return " + s.Result.String() - } - - return "return" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/selector_expr.go b/vendor/github.com/d5/tengo/compiler/ast/selector_expr.go deleted file mode 100644 index 31d2e6d1..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/selector_expr.go +++ /dev/null @@ -1,25 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// SelectorExpr represents a selector expression. -type SelectorExpr struct { - Expr Expr - Sel Expr -} - -func (e *SelectorExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *SelectorExpr) Pos() source.Pos { - return e.Expr.Pos() -} - -// End returns the position of first character immediately after the node. -func (e *SelectorExpr) End() source.Pos { - return e.Sel.End() -} - -func (e *SelectorExpr) String() string { - return e.Expr.String() + "." + e.Sel.String() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/slice_expr.go b/vendor/github.com/d5/tengo/compiler/ast/slice_expr.go deleted file mode 100644 index e7e2e05b..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/slice_expr.go +++ /dev/null @@ -1,36 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// SliceExpr represents a slice expression. -type SliceExpr struct { - Expr Expr - LBrack source.Pos - Low Expr - High Expr - RBrack source.Pos -} - -func (e *SliceExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *SliceExpr) Pos() source.Pos { - return e.Expr.Pos() -} - -// End returns the position of first character immediately after the node. -func (e *SliceExpr) End() source.Pos { - return e.RBrack + 1 -} - -func (e *SliceExpr) String() string { - var low, high string - if e.Low != nil { - low = e.Low.String() - } - if e.High != nil { - high = e.High.String() - } - - return e.Expr.String() + "[" + low + ":" + high + "]" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/stmt.go b/vendor/github.com/d5/tengo/compiler/ast/stmt.go deleted file mode 100644 index 6b26ba88..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/stmt.go +++ /dev/null @@ -1,7 +0,0 @@ -package ast - -// Stmt represents a statement in the AST. -type Stmt interface { - Node - stmtNode() -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/string_lit.go b/vendor/github.com/d5/tengo/compiler/ast/string_lit.go deleted file mode 100644 index 2119d34b..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/string_lit.go +++ /dev/null @@ -1,26 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// StringLit represents a string literal. -type StringLit struct { - Value string - ValuePos source.Pos - Literal string -} - -func (e *StringLit) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *StringLit) Pos() source.Pos { - return e.ValuePos -} - -// End returns the position of first character immediately after the node. -func (e *StringLit) End() source.Pos { - return source.Pos(int(e.ValuePos) + len(e.Literal)) -} - -func (e *StringLit) String() string { - return e.Literal -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/unary_expr.go b/vendor/github.com/d5/tengo/compiler/ast/unary_expr.go deleted file mode 100644 index 53236146..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/unary_expr.go +++ /dev/null @@ -1,29 +0,0 @@ -package ast - -import ( - "github.com/d5/tengo/compiler/source" - "github.com/d5/tengo/compiler/token" -) - -// UnaryExpr represents an unary operator expression. -type UnaryExpr struct { - Expr Expr - Token token.Token - TokenPos source.Pos -} - -func (e *UnaryExpr) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *UnaryExpr) Pos() source.Pos { - return e.Expr.Pos() -} - -// End returns the position of first character immediately after the node. -func (e *UnaryExpr) End() source.Pos { - return e.Expr.End() -} - -func (e *UnaryExpr) String() string { - return "(" + e.Token.String() + e.Expr.String() + ")" -} diff --git a/vendor/github.com/d5/tengo/compiler/ast/undefined_lit.go b/vendor/github.com/d5/tengo/compiler/ast/undefined_lit.go deleted file mode 100644 index 8e51b113..00000000 --- a/vendor/github.com/d5/tengo/compiler/ast/undefined_lit.go +++ /dev/null @@ -1,24 +0,0 @@ -package ast - -import "github.com/d5/tengo/compiler/source" - -// UndefinedLit represents an undefined literal. -type UndefinedLit struct { - TokenPos source.Pos -} - -func (e *UndefinedLit) exprNode() {} - -// Pos returns the position of first character belonging to the node. -func (e *UndefinedLit) Pos() source.Pos { - return e.TokenPos -} - -// End returns the position of first character immediately after the node. -func (e *UndefinedLit) End() source.Pos { - return e.TokenPos + 9 // len(undefined) == 9 -} - -func (e *UndefinedLit) String() string { - return "undefined" -} -- cgit v1.2.3