update directory package structure
This commit is contained in:
parent
d954348e75
commit
27438eea6f
126 changed files with 178 additions and 178 deletions
|
@ -8,9 +8,9 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/d5/tengo/compiler"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
"github.com/d5/tengo/objects"
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/token"
|
||||
)
|
||||
|
||||
func NoError(t *testing.T, err error, msg ...interface{}) bool {
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/compiler"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/parser"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/objects"
|
||||
"github.com/d5/tengo/parser"
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/vm"
|
||||
"github.com/d5/tengo/runtime"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -156,11 +156,11 @@ func compileFile(file *ast.File) (time.Duration, *compiler.Bytecode, error) {
|
|||
}
|
||||
|
||||
func runVM(bytecode *compiler.Bytecode) (time.Duration, objects.Object, error) {
|
||||
globals := make([]*objects.Object, vm.GlobalsSize)
|
||||
globals := make([]*objects.Object, runtime.GlobalsSize)
|
||||
|
||||
start := time.Now()
|
||||
|
||||
v := vm.NewVM(bytecode, globals)
|
||||
v := runtime.NewVM(bytecode, globals)
|
||||
if err := v.Run(); err != nil {
|
||||
return time.Since(start), nil, err
|
||||
}
|
||||
|
|
|
@ -7,12 +7,12 @@ import (
|
|||
"os"
|
||||
"os/user"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/compiler"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/parser"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/objects"
|
||||
"github.com/d5/tengo/parser"
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/vm"
|
||||
"github.com/d5/tengo/runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -34,7 +34,7 @@ func startRepl(in io.Reader, out io.Writer) {
|
|||
stdin := bufio.NewScanner(in)
|
||||
|
||||
fileSet := source.NewFileSet()
|
||||
globals := make([]*objects.Object, vm.GlobalsSize)
|
||||
globals := make([]*objects.Object, runtime.GlobalsSize)
|
||||
symbolTable := compiler.NewSymbolTable()
|
||||
|
||||
for {
|
||||
|
@ -61,7 +61,7 @@ func startRepl(in io.Reader, out io.Writer) {
|
|||
continue
|
||||
}
|
||||
|
||||
machine := vm.NewVM(c.Bytecode(), globals)
|
||||
machine := runtime.NewVM(c.Bytecode(), globals)
|
||||
if err != nil {
|
||||
_, _ = fmt.Fprintf(out, "VM error:\n %s\n", err.Error())
|
||||
continue
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
"github.com/d5/tengo"
|
||||
"github.com/d5/tengo/compiler"
|
||||
"github.com/d5/tengo/vm"
|
||||
"github.com/d5/tengo/runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -113,7 +113,7 @@ func doRun(data []byte, _, _ string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
machine := vm.NewVM(bytecode, nil)
|
||||
machine := runtime.NewVM(bytecode, nil)
|
||||
|
||||
err = machine.Run()
|
||||
if err != nil {
|
||||
|
|
|
@ -3,7 +3,7 @@ package ast
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
)
|
||||
|
||||
type ArrayLit struct {
|
|
@ -3,8 +3,8 @@ package ast
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type AssignStmt struct {
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type BadExpr struct {
|
||||
From source.Pos
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type BadStmt struct {
|
||||
From source.Pos
|
|
@ -1,8 +1,8 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type BinaryExpr struct {
|
|
@ -3,7 +3,7 @@ package ast
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
)
|
||||
|
||||
type BlockStmt struct {
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type BoolLit struct {
|
||||
Value bool
|
|
@ -1,8 +1,8 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type BranchStmt struct {
|
|
@ -3,7 +3,7 @@ package ast
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
)
|
||||
|
||||
type CallExpr struct {
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type CharLit struct {
|
||||
Value rune
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type EmptyStmt struct {
|
||||
Semicolon source.Pos
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type ExprStmt struct {
|
||||
Expr Expr
|
|
@ -3,7 +3,7 @@ package ast
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
)
|
||||
|
||||
type File struct {
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type FloatLit struct {
|
||||
Value float64
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type ForInStmt struct {
|
||||
ForPos source.Pos
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type ForStmt struct {
|
||||
ForPos source.Pos
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type FuncLit struct {
|
||||
Type *FuncType
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type FuncType struct {
|
||||
FuncPos source.Pos
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type Ident struct {
|
||||
Name string
|
|
@ -3,7 +3,7 @@ package ast
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
)
|
||||
|
||||
type IdentList struct {
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type IfStmt struct {
|
||||
IfPos source.Pos
|
|
@ -1,8 +1,8 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type IncDecStmt struct {
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type IndexExpr struct {
|
||||
Expr Expr
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type IntLit struct {
|
||||
Value int64
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type MapElementLit struct {
|
||||
Key string
|
|
@ -3,7 +3,7 @@ package ast
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
)
|
||||
|
||||
type MapLit struct {
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type Node interface {
|
||||
Pos() source.Pos
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type ParenExpr struct {
|
||||
Expr Expr
|
|
@ -3,7 +3,7 @@ package ast
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
)
|
||||
|
||||
type ReturnStmt struct {
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type SelectorExpr struct {
|
||||
Expr Expr
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type SliceExpr struct {
|
||||
Expr Expr
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type StringLit struct {
|
||||
Value string
|
|
@ -1,8 +1,8 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type UnaryExpr struct {
|
|
@ -1,6 +1,6 @@
|
|||
package ast
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type UndefinedLit struct {
|
||||
TokenPos source.Pos
|
|
@ -5,9 +5,9 @@ import (
|
|||
"io"
|
||||
"reflect"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
"github.com/d5/tengo/objects"
|
||||
"github.com/d5/tengo/token"
|
||||
)
|
||||
|
||||
type Compiler struct {
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func (c *Compiler) compileAssign(lhs, rhs []ast.Expr, op token.Token) error {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package compiler
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
)
|
||||
|
||||
func (c *Compiler) compileForStmt(stmt *ast.ForStmt) error {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package compiler
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func (c *Compiler) compileLogical(node *ast.BinaryExpr) error {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
|
||||
"github.com/d5/tengo/assert"
|
||||
"github.com/d5/tengo/compiler"
|
||||
"github.com/d5/tengo/compiler/parser"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/objects"
|
||||
"github.com/d5/tengo/parser"
|
||||
"github.com/d5/tengo/source"
|
||||
)
|
||||
|
||||
func TestCompiler_Compile(t *testing.T) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package parser
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type Error struct {
|
||||
Pos source.FilePos
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
)
|
||||
|
||||
type ErrorList []*Error
|
|
@ -3,8 +3,8 @@ package parser
|
|||
import (
|
||||
"io"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
)
|
||||
|
||||
func ParseFile(file *source.File, src []byte, trace io.Writer) (res *ast.File, err error) {
|
|
@ -3,8 +3,8 @@ package parser
|
|||
import (
|
||||
"io"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
)
|
||||
|
||||
// ParseSource parses source code 'src' and builds an AST.
|
|
@ -5,10 +5,10 @@ import (
|
|||
"io"
|
||||
"strconv"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/scanner"
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/scanner"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type bailout struct{}
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestArray(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestAssignment(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestBoolean(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestCall(t *testing.T) {
|
|
@ -3,7 +3,7 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
)
|
||||
|
||||
func TestChar(t *testing.T) {
|
|
@ -3,7 +3,7 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
)
|
||||
|
||||
func TestForIn(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestFor(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestFunction(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestIf(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestIndex(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestLogical(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestMap(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestSelector(t *testing.T) {
|
|
@ -3,7 +3,7 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
)
|
||||
|
||||
func TestSemicolon(t *testing.T) {
|
|
@ -3,8 +3,8 @@ package parser_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
func TestString(t *testing.T) {
|
|
@ -7,10 +7,10 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/d5/tengo/assert"
|
||||
"github.com/d5/tengo/ast"
|
||||
"github.com/d5/tengo/parser"
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/ast"
|
||||
"github.com/d5/tengo/compiler/parser"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type pfn func(int, int) source.Pos // position conversion function
|
|
@ -1,6 +1,6 @@
|
|||
package parser
|
||||
|
||||
import "github.com/d5/tengo/token"
|
||||
import "github.com/d5/tengo/compiler/token"
|
||||
|
||||
var stmtStart = map[token.Token]bool{
|
||||
token.Break: true,
|
|
@ -1,5 +1,5 @@
|
|||
package scanner
|
||||
|
||||
import "github.com/d5/tengo/source"
|
||||
import "github.com/d5/tengo/compiler/source"
|
||||
|
||||
type ErrorHandler func(pos source.FilePos, msg string)
|
|
@ -5,8 +5,8 @@ import (
|
|||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
// byte order mark
|
|
@ -8,9 +8,9 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/d5/tengo/assert"
|
||||
"github.com/d5/tengo/scanner"
|
||||
"github.com/d5/tengo/source"
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/scanner"
|
||||
"github.com/d5/tengo/compiler/source"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
var testFileSet = source.NewFileSet()
|
|
@ -5,7 +5,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type Array struct {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package objects
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type Bool struct {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package objects
|
||||
|
||||
import "github.com/d5/tengo/token"
|
||||
import "github.com/d5/tengo/compiler/token"
|
||||
|
||||
type Break struct{}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package objects
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type BuiltinFunction struct {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package objects
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type Char struct {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package objects
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type Closure struct {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package objects
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type CompiledFunction struct {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package objects
|
||||
|
||||
import "github.com/d5/tengo/token"
|
||||
import "github.com/d5/tengo/compiler/token"
|
||||
|
||||
type Continue struct {
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"math"
|
||||
"strconv"
|
||||
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type Float struct {
|
||||
|
|
|
@ -3,7 +3,7 @@ package objects
|
|||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type Int struct {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package objects
|
||||
|
||||
import "github.com/d5/tengo/token"
|
||||
import "github.com/d5/tengo/compiler/token"
|
||||
|
||||
type Iterator interface {
|
||||
Object
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type Map struct {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package objects
|
||||
|
||||
import "github.com/d5/tengo/token"
|
||||
import "github.com/d5/tengo/compiler/token"
|
||||
|
||||
type Object interface {
|
||||
TypeName() string
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package objects
|
||||
|
||||
import "github.com/d5/tengo/token"
|
||||
import "github.com/d5/tengo/compiler/token"
|
||||
|
||||
type ReturnValue struct {
|
||||
Value Object
|
||||
|
|
|
@ -3,7 +3,7 @@ package objects
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/d5/tengo/token"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
)
|
||||
|
||||
type String struct {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package objects
|
||||
|
||||
import "github.com/d5/tengo/token"
|
||||
import "github.com/d5/tengo/compiler/token"
|
||||
|
||||
var undefined = &Undefined{}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package vm
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"errors"
|
|
@ -1,4 +1,4 @@
|
|||
package vm
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"github.com/d5/tengo/objects"
|
|
@ -1,11 +1,11 @@
|
|||
package vm
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/d5/tengo/compiler"
|
||||
"github.com/d5/tengo/compiler/token"
|
||||
"github.com/d5/tengo/objects"
|
||||
"github.com/d5/tengo/token"
|
||||
)
|
||||
|
||||
const (
|
|
@ -1,4 +1,4 @@
|
|||
package vm_test
|
||||
package runtime_test
|
||||
|
||||
import (
|
||||
"testing"
|
|
@ -1,4 +1,4 @@
|
|||
package vm_test
|
||||
package runtime_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
@ -193,8 +193,8 @@ out = func() {
|
|||
`, 136)
|
||||
|
||||
// assigning different type value
|
||||
expect(t, `a := 1; a = "foo"; out = a`, "foo") // global
|
||||
expect(t, `func() { a := 1; a = "foo"; out = a }()`, "foo") // local
|
||||
expect(t, `a := 1; a = "foo"; out = a`, "foo") // global
|
||||
expect(t, `func() { a := 1; a = "foo"; out = a }()`, "foo") // local
|
||||
expect(t, `
|
||||
out = func() {
|
||||
a := 5
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue