mirror of
https://github.com/hanzoai/expr.git
synced 2026-09-24 16:58:58 +00:00
Use expr-lang/expr
This commit is contained in:
@@ -11,7 +11,7 @@ const exclude = [
|
||||
cd(path.resolve(__dirname, '..', '..'))
|
||||
|
||||
await spinner('Running tests', async () => {
|
||||
await $`go test -coverprofile=coverage.out -coverpkg=github.com/antonmedv/expr/... ./...`
|
||||
await $`go test -coverprofile=coverage.out -coverpkg=github.com/expr-lang/expr/... ./...`
|
||||
const coverage = fs.readFileSync('coverage.out').toString()
|
||||
.split('\n')
|
||||
.filter(line => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Expr
|
||||
[](https://github.com/antonmedv/expr/actions/workflows/test.yml)
|
||||
[](https://goreportcard.com/report/github.com/antonmedv/expr)
|
||||
[](https://github.com/expr-lang/expr/actions/workflows/test.yml)
|
||||
[](https://goreportcard.com/report/github.com/expr-lang/expr)
|
||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:expr)
|
||||
[](https://godoc.org/github.com/antonmedv/expr)
|
||||
[](https://godoc.org/github.com/expr-lang/expr)
|
||||
|
||||
**Expr** is a Go-centric expression language designed to deliver dynamic configurations with unparalleled accuracy, safety, and speed.
|
||||
|
||||
@@ -53,7 +53,7 @@ Here are its standout features:
|
||||
## Install
|
||||
|
||||
```
|
||||
go get github.com/antonmedv/expr
|
||||
go get github.com/expr-lang/expr
|
||||
```
|
||||
|
||||
## Documentation
|
||||
@@ -80,7 +80,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/expr-lang/expr"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -113,7 +113,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/expr-lang/expr"
|
||||
)
|
||||
|
||||
type Tweet struct {
|
||||
@@ -165,8 +165,8 @@ func main() {
|
||||
* [Visually.io](https://visually.io) employs Expr as a business rule engine for its personalization targeting algorithm.
|
||||
* [Akvorado](https://github.com/akvorado/akvorado) utilizes Expr to classify exporters and interfaces in network flows.
|
||||
|
||||
[Add your company too](https://github.com/antonmedv/expr/edit/master/README.md)
|
||||
[Add your company too](https://github.com/expr-lang/expr/edit/master/README.md)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/antonmedv/expr/blob/master/LICENSE)
|
||||
[MIT](https://github.com/expr-lang/expr/blob/master/LICENSE)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"reflect"
|
||||
"regexp"
|
||||
|
||||
"github.com/antonmedv/expr/file"
|
||||
"github.com/expr-lang/expr/file"
|
||||
)
|
||||
|
||||
// Node represents items of abstract syntax tree.
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/antonmedv/expr/parser/operator"
|
||||
"github.com/antonmedv/expr/parser/utils"
|
||||
"github.com/expr-lang/expr/parser/operator"
|
||||
"github.com/expr-lang/expr/parser/utils"
|
||||
)
|
||||
|
||||
func (n *NilNode) String() string {
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
)
|
||||
|
||||
func TestPrint(t *testing.T) {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package ast_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package expr_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/vm"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/vm/runtime"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/vm/runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -10,12 +10,12 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/builtin"
|
||||
"github.com/antonmedv/expr/checker"
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/antonmedv/expr/test/mock"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/builtin"
|
||||
"github.com/expr-lang/expr/checker"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
"github.com/expr-lang/expr/test/mock"
|
||||
)
|
||||
|
||||
func TestBuiltin(t *testing.T) {
|
||||
@@ -388,7 +388,7 @@ func TestBuiltin_type(t *testing.T) {
|
||||
{func() {}, "func"},
|
||||
{time.Now(), "time.Time"},
|
||||
{time.Second, "time.Duration"},
|
||||
{Foo{}, "github.com/antonmedv/expr/builtin_test.Foo"},
|
||||
{Foo{}, "github.com/expr-lang/expr/builtin_test.Foo"},
|
||||
{struct{}{}, "struct"},
|
||||
{a, "int"},
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
||||
"github.com/antonmedv/expr/vm/runtime"
|
||||
"github.com/expr-lang/expr/vm/runtime"
|
||||
)
|
||||
|
||||
func Len(x any) any {
|
||||
|
||||
+6
-6
@@ -5,12 +5,12 @@ import (
|
||||
"reflect"
|
||||
"regexp"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/builtin"
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/antonmedv/expr/file"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/builtin"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
"github.com/expr-lang/expr/file"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
"github.com/expr-lang/expr/vm"
|
||||
)
|
||||
|
||||
func Check(tree *parser.Tree, config *conf.Config) (t reflect.Type, err error) {
|
||||
|
||||
@@ -10,12 +10,12 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/checker"
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/antonmedv/expr/test/mock"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/checker"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
"github.com/expr-lang/expr/test/mock"
|
||||
)
|
||||
|
||||
func TestCheck(t *testing.T) {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/builtin"
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/antonmedv/expr/file"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
. "github.com/antonmedv/expr/vm"
|
||||
"github.com/antonmedv/expr/vm/runtime"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/builtin"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
"github.com/expr-lang/expr/file"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
. "github.com/expr-lang/expr/vm"
|
||||
"github.com/expr-lang/expr/vm/runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/test/playground"
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/antonmedv/expr/vm/runtime"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/test/playground"
|
||||
"github.com/expr-lang/expr/vm"
|
||||
"github.com/expr-lang/expr/vm/runtime"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/builtin"
|
||||
"github.com/antonmedv/expr/vm/runtime"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/builtin"
|
||||
"github.com/expr-lang/expr/vm/runtime"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package conf
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
// OperatorsTable maps binary operators to corresponding list of functions.
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
. "github.com/antonmedv/expr/vm"
|
||||
. "github.com/expr-lang/expr/vm"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/rivo/tview"
|
||||
)
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
module github.com/antonmedv/expr/debug
|
||||
module github.com/expr-lang/expr/debug
|
||||
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/antonmedv/expr v0.0.0
|
||||
github.com/expr-lang/expr v0.0.0
|
||||
github.com/gdamore/tcell/v2 v2.6.0
|
||||
github.com/rivo/tview v0.0.0-20230814110005-ccc2c8119703
|
||||
)
|
||||
@@ -18,4 +18,4 @@ require (
|
||||
golang.org/x/text v0.12.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/antonmedv/expr => ../
|
||||
replace github.com/expr-lang/expr => ../
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/antonmedv/expr/docgen"
|
||||
"github.com/expr-lang/expr/docgen"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -37,7 +37,7 @@ To generate markdown documentation:
|
||||
```go
|
||||
package main
|
||||
|
||||
import "github.com/antonmedv/expr/docgen"
|
||||
import "github.com/expr-lang/expr/docgen"
|
||||
|
||||
func main() {
|
||||
// TODO: Replace env with your own types.
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
)
|
||||
|
||||
// Kind can be any of array, map, struct, func, string, int, float, bool or any.
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/antonmedv/expr/docgen"
|
||||
. "github.com/expr-lang/expr/docgen"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -127,7 +127,7 @@ func TestCreateDoc(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
PkgPath: "github.com/antonmedv/expr/docgen_test",
|
||||
PkgPath: "github.com/expr-lang/expr/docgen_test",
|
||||
}
|
||||
|
||||
assert.EqualValues(t, expected, doc)
|
||||
@@ -194,7 +194,7 @@ func TestCreateDoc_Ambiguous(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
PkgPath: "github.com/antonmedv/expr/docgen_test",
|
||||
PkgPath: "github.com/expr-lang/expr/docgen_test",
|
||||
}
|
||||
|
||||
assert.EqualValues(t, expected, doc)
|
||||
|
||||
@@ -73,7 +73,7 @@ during the compile step.
|
||||
program, err := expr.Compile(`fib(42)`, expr.ConstExpr("fib"))
|
||||
```
|
||||
|
||||
[ConstExpr Example](https://pkg.go.dev/github.com/antonmedv/expr?tab=doc#ConstExpr)
|
||||
[ConstExpr Example](https://pkg.go.dev/github.com/expr-lang/expr?tab=doc#ConstExpr)
|
||||
|
||||
## Env()
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ To use `-` operator:
|
||||
Now() - CreatedAt
|
||||
```
|
||||
|
||||
To overload the operator use [Operator](https://pkg.go.dev/github.com/antonmedv/expr?tab=doc#Operator) option:
|
||||
To overload the operator use [Operator](https://pkg.go.dev/github.com/expr-lang/expr?tab=doc#Operator) option:
|
||||
|
||||
```go
|
||||
func main() {
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/vm"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Visitor and Patch
|
||||
|
||||
The [ast](https://pkg.go.dev/github.com/antonmedv/expr/ast?tab=doc) package
|
||||
The [ast](https://pkg.go.dev/github.com/expr-lang/expr/ast?tab=doc) package
|
||||
provides the `ast.Visitor` interface and the `ast.Walk` function. It can be
|
||||
used to customize the AST before compiling.
|
||||
|
||||
@@ -12,8 +12,8 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
)
|
||||
|
||||
type visitor struct {
|
||||
@@ -57,8 +57,8 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -4,15 +4,15 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/checker"
|
||||
"github.com/antonmedv/expr/compiler"
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/antonmedv/expr/file"
|
||||
"github.com/antonmedv/expr/optimizer"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/antonmedv/expr/patcher"
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/checker"
|
||||
"github.com/expr-lang/expr/compiler"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
"github.com/expr-lang/expr/file"
|
||||
"github.com/expr-lang/expr/optimizer"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
"github.com/expr-lang/expr/patcher"
|
||||
"github.com/expr-lang/expr/vm"
|
||||
)
|
||||
|
||||
// Option for configuring config.
|
||||
|
||||
+4
-4
@@ -11,10 +11,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/file"
|
||||
"github.com/antonmedv/expr/test/mock"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/file"
|
||||
"github.com/expr-lang/expr/test/mock"
|
||||
)
|
||||
|
||||
func ExampleEval() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/antonmedv/expr
|
||||
module github.com/expr-lang/expr
|
||||
|
||||
go 1.18
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/file"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/file"
|
||||
)
|
||||
|
||||
var errorType = reflect.TypeOf((*error)(nil)).Elem()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package optimizer
|
||||
|
||||
import (
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
type constRange struct{}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package optimizer
|
||||
|
||||
import (
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
type filterFirst struct{}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package optimizer
|
||||
|
||||
import (
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
type filterLast struct{}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package optimizer
|
||||
|
||||
import (
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
type filterLen struct{}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package optimizer
|
||||
|
||||
import (
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
type filterMap struct{}
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import (
|
||||
"math"
|
||||
"reflect"
|
||||
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/file"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/file"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -3,7 +3,7 @@ package optimizer
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
type inArray struct{}
|
||||
|
||||
@@ -3,7 +3,7 @@ package optimizer
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
type inRange struct{}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package optimizer
|
||||
|
||||
import (
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/conf"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
)
|
||||
|
||||
func Optimize(node *Node, config *conf.Config) error {
|
||||
|
||||
@@ -5,12 +5,12 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/checker"
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/antonmedv/expr/optimizer"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/checker"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
"github.com/expr-lang/expr/optimizer"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/antonmedv/expr/file"
|
||||
"github.com/expr-lang/expr/file"
|
||||
)
|
||||
|
||||
func Lex(source *file.Source) ([]Token, error) {
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/antonmedv/expr/file"
|
||||
. "github.com/antonmedv/expr/parser/lexer"
|
||||
"github.com/expr-lang/expr/file"
|
||||
. "github.com/expr-lang/expr/parser/lexer"
|
||||
)
|
||||
|
||||
func TestLex(t *testing.T) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package lexer
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/antonmedv/expr/parser/utils"
|
||||
"github.com/expr-lang/expr/parser/utils"
|
||||
)
|
||||
|
||||
type stateFn func(*lexer) stateFn
|
||||
|
||||
@@ -3,7 +3,7 @@ package lexer
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/antonmedv/expr/file"
|
||||
"github.com/expr-lang/expr/file"
|
||||
)
|
||||
|
||||
type Kind string
|
||||
|
||||
+7
-7
@@ -6,13 +6,13 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/builtin"
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/antonmedv/expr/file"
|
||||
. "github.com/antonmedv/expr/parser/lexer"
|
||||
"github.com/antonmedv/expr/parser/operator"
|
||||
"github.com/antonmedv/expr/parser/utils"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/builtin"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
"github.com/expr-lang/expr/file"
|
||||
. "github.com/expr-lang/expr/parser/lexer"
|
||||
"github.com/expr-lang/expr/parser/operator"
|
||||
"github.com/expr-lang/expr/parser/utils"
|
||||
)
|
||||
|
||||
var predicates = map[string]struct {
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
. "github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
. "github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package patcher
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
// WithContext adds WithContext.Name argument to all functions calls with a context.Context argument.
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/patcher"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/patcher"
|
||||
)
|
||||
|
||||
func TestWithContext(t *testing.T) {
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
module github.com/antonmedv/expr/repl
|
||||
module github.com/expr-lang/expr/repl
|
||||
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/antonmedv/expr v1.13.0
|
||||
github.com/antonmedv/expr/debug v0.0.0
|
||||
github.com/expr-lang/expr v1.13.0
|
||||
github.com/expr-lang/expr/debug v0.0.0
|
||||
github.com/bettercap/readline v0.0.0-20210228151553-655e48bcb7bf
|
||||
)
|
||||
|
||||
@@ -21,6 +21,6 @@ require (
|
||||
golang.org/x/text v0.12.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/antonmedv/expr => ../
|
||||
replace github.com/expr-lang/expr => ../
|
||||
|
||||
replace github.com/antonmedv/expr/debug => ../debug
|
||||
replace github.com/expr-lang/expr/debug => ../debug
|
||||
|
||||
+6
-5
@@ -2,16 +2,17 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/antonmedv/expr/test/fuzz"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/builtin"
|
||||
"github.com/antonmedv/expr/debug"
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/expr-lang/expr/test/fuzz"
|
||||
|
||||
"github.com/bettercap/readline"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/builtin"
|
||||
"github.com/expr-lang/expr/debug"
|
||||
"github.com/expr-lang/expr/vm"
|
||||
)
|
||||
|
||||
var keywords = []string{
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/test/coredns"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/test/coredns"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/test/crowdsec"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/test/crowdsec"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/expr-lang/expr"
|
||||
)
|
||||
|
||||
//go:embed fuzz_corpus.txt
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@ import (
|
||||
"reflect"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/builtin"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/builtin"
|
||||
)
|
||||
|
||||
var env = map[string]any{
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"math/rand"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
func maybe() bool {
|
||||
|
||||
@@ -3,7 +3,7 @@ package interface_method_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
type Env struct {
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/test/mock"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/test/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ package patch_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/test/mock"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/test/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
)
|
||||
|
||||
func TestPatch_SetType(t *testing.T) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/antonmedv/expr/docgen"
|
||||
"github.com/antonmedv/expr/test/real_world"
|
||||
"github.com/expr-lang/expr/docgen"
|
||||
"github.com/expr-lang/expr/test/real_world"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -5,12 +5,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/checker"
|
||||
"github.com/antonmedv/expr/compiler"
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/expr-lang/expr"
|
||||
"github.com/expr-lang/expr/checker"
|
||||
"github.com/expr-lang/expr/compiler"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
"github.com/expr-lang/expr/vm"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
+3
-3
@@ -9,9 +9,9 @@ import (
|
||||
"strings"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/antonmedv/expr/builtin"
|
||||
"github.com/antonmedv/expr/file"
|
||||
"github.com/antonmedv/expr/vm/runtime"
|
||||
"github.com/expr-lang/expr/builtin"
|
||||
"github.com/expr-lang/expr/file"
|
||||
"github.com/expr-lang/expr/vm/runtime"
|
||||
)
|
||||
|
||||
// Program represents a compiled expression.
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/expr-lang/expr/vm"
|
||||
)
|
||||
|
||||
func TestProgram_Disassemble(t *testing.T) {
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/antonmedv/expr/builtin"
|
||||
"github.com/antonmedv/expr/file"
|
||||
"github.com/antonmedv/expr/vm/runtime"
|
||||
"github.com/expr-lang/expr/builtin"
|
||||
"github.com/expr-lang/expr/file"
|
||||
"github.com/expr-lang/expr/vm/runtime"
|
||||
)
|
||||
|
||||
var MemoryBudget uint = 1e6
|
||||
|
||||
+6
-6
@@ -8,12 +8,12 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/antonmedv/expr/ast"
|
||||
"github.com/antonmedv/expr/checker"
|
||||
"github.com/antonmedv/expr/compiler"
|
||||
"github.com/antonmedv/expr/conf"
|
||||
"github.com/antonmedv/expr/parser"
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"github.com/expr-lang/expr/ast"
|
||||
"github.com/expr-lang/expr/checker"
|
||||
"github.com/expr-lang/expr/compiler"
|
||||
"github.com/expr-lang/expr/conf"
|
||||
"github.com/expr-lang/expr/parser"
|
||||
"github.com/expr-lang/expr/vm"
|
||||
)
|
||||
|
||||
func TestRun_NilProgram(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user