diff options
author | Wim <wim@42.be> | 2019-10-27 01:45:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-27 01:45:57 +0200 |
commit | 0bc159341dbb4aece685ce373e9bc0b6b32984e7 (patch) | |
tree | ed67d8e03541b2cb61ab161771f1c6e41070d372 /vendor/github.com/d5/tengo | |
parent | 45bf1fd63a62b46fc80fe5143e667f6779705a0d (diff) | |
download | matterbridge-msglm-0bc159341dbb4aece685ce373e9bc0b6b32984e7.tar.gz matterbridge-msglm-0bc159341dbb4aece685ce373e9bc0b6b32984e7.tar.bz2 matterbridge-msglm-0bc159341dbb4aece685ce373e9bc0b6b32984e7.zip |
Update vendor (#932)
* Update vendor
* Fix godiscord api change
Diffstat (limited to 'vendor/github.com/d5/tengo')
-rw-r--r-- | vendor/github.com/d5/tengo/.goreleaser.yml | 6 | ||||
-rw-r--r-- | vendor/github.com/d5/tengo/go.sum | 0 | ||||
-rw-r--r-- | vendor/github.com/d5/tengo/objects/immutable_array.go (renamed from vendor/github.com/d5/tengo/objects/immautable_array.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/d5/tengo/stdlib/base64.go | 20 | ||||
-rw-r--r-- | vendor/github.com/d5/tengo/stdlib/builtin_modules.go | 2 | ||||
-rw-r--r-- | vendor/github.com/d5/tengo/stdlib/func_typedefs.go | 53 | ||||
-rw-r--r-- | vendor/github.com/d5/tengo/stdlib/hex.go | 11 |
7 files changed, 92 insertions, 0 deletions
diff --git a/vendor/github.com/d5/tengo/.goreleaser.yml b/vendor/github.com/d5/tengo/.goreleaser.yml index f7e2bd0e..9b1dffec 100644 --- a/vendor/github.com/d5/tengo/.goreleaser.yml +++ b/vendor/github.com/d5/tengo/.goreleaser.yml @@ -1,3 +1,8 @@ +env: + - GO111MODULE=on +before: + hooks: + - go mod tidy builds: - env: - CGO_ENABLED=0 @@ -9,6 +14,7 @@ builds: - env: - CGO_ENABLED=0 main: ./cmd/tengomin/main.go + id: tengomin binary: tengomin goos: - darwin diff --git a/vendor/github.com/d5/tengo/go.sum b/vendor/github.com/d5/tengo/go.sum new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/github.com/d5/tengo/go.sum diff --git a/vendor/github.com/d5/tengo/objects/immautable_array.go b/vendor/github.com/d5/tengo/objects/immutable_array.go index f3621e29..f3621e29 100644 --- a/vendor/github.com/d5/tengo/objects/immautable_array.go +++ b/vendor/github.com/d5/tengo/objects/immutable_array.go diff --git a/vendor/github.com/d5/tengo/stdlib/base64.go b/vendor/github.com/d5/tengo/stdlib/base64.go new file mode 100644 index 00000000..40a746ce --- /dev/null +++ b/vendor/github.com/d5/tengo/stdlib/base64.go @@ -0,0 +1,20 @@ +package stdlib + +import ( + "encoding/base64" + "github.com/d5/tengo/objects" +) + +var base64Module = map[string]objects.Object{ + "encode": &objects.UserFunction{Value: FuncAYRS(base64.StdEncoding.EncodeToString)}, + "decode": &objects.UserFunction{Value: FuncASRYE(base64.StdEncoding.DecodeString)}, + + "raw_encode": &objects.UserFunction{Value: FuncAYRS(base64.RawStdEncoding.EncodeToString)}, + "raw_decode": &objects.UserFunction{Value: FuncASRYE(base64.RawStdEncoding.DecodeString)}, + + "url_encode": &objects.UserFunction{Value: FuncAYRS(base64.URLEncoding.EncodeToString)}, + "url_decode": &objects.UserFunction{Value: FuncASRYE(base64.URLEncoding.DecodeString)}, + + "raw_url_encode": &objects.UserFunction{Value: FuncAYRS(base64.RawURLEncoding.EncodeToString)}, + "raw_url_decode": &objects.UserFunction{Value: FuncASRYE(base64.RawURLEncoding.DecodeString)}, +} diff --git a/vendor/github.com/d5/tengo/stdlib/builtin_modules.go b/vendor/github.com/d5/tengo/stdlib/builtin_modules.go index cc2796f9..722461b2 100644 --- a/vendor/github.com/d5/tengo/stdlib/builtin_modules.go +++ b/vendor/github.com/d5/tengo/stdlib/builtin_modules.go @@ -11,4 +11,6 @@ var BuiltinModules = map[string]map[string]objects.Object{ "rand": randModule, "fmt": fmtModule, "json": jsonModule, + "base64": base64Module, + "hex": hexModule, } diff --git a/vendor/github.com/d5/tengo/stdlib/func_typedefs.go b/vendor/github.com/d5/tengo/stdlib/func_typedefs.go index 26c7ddd9..c7bd11fa 100644 --- a/vendor/github.com/d5/tengo/stdlib/func_typedefs.go +++ b/vendor/github.com/d5/tengo/stdlib/func_typedefs.go @@ -1036,6 +1036,29 @@ func FuncAYRIE(fn func([]byte) (int, error)) objects.CallableFunc { } } +// FuncAYRS transform a function of 'func([]byte) string' signature +// into CallableFunc type. +func FuncAYRS(fn func([]byte) string) objects.CallableFunc { + return func(args ...objects.Object) (ret objects.Object, err error) { + if len(args) != 1 { + return nil, objects.ErrWrongNumArguments + } + + y1, ok := objects.ToByteSlice(args[0]) + if !ok { + return nil, objects.ErrInvalidArgumentType{ + Name: "first", + Expected: "bytes(compatible)", + Found: args[0].TypeName(), + } + } + + res := fn(y1) + + return &objects.String{Value: res}, nil + } +} + // FuncASRIE transform a function of 'func(string) (int, error)' signature // into CallableFunc type. func FuncASRIE(fn func(string) (int, error)) objects.CallableFunc { @@ -1062,6 +1085,36 @@ func FuncASRIE(fn func(string) (int, error)) objects.CallableFunc { } } +// FuncASRYE transform a function of 'func(string) ([]byte, error)' signature +// into CallableFunc type. +func FuncASRYE(fn func(string) ([]byte, error)) objects.CallableFunc { + return func(args ...objects.Object) (ret objects.Object, err error) { + if len(args) != 1 { + return nil, objects.ErrWrongNumArguments + } + + s1, ok := objects.ToString(args[0]) + if !ok { + return nil, objects.ErrInvalidArgumentType{ + Name: "first", + Expected: "string(compatible)", + Found: args[0].TypeName(), + } + } + + res, err := fn(s1) + if err != nil { + return wrapError(err), nil + } + + if len(res) > tengo.MaxBytesLen { + return nil, objects.ErrBytesLimit + } + + return &objects.Bytes{Value: res}, nil + } +} + // FuncAIRSsE transform a function of 'func(int) ([]string, error)' signature // into CallableFunc type. func FuncAIRSsE(fn func(int) ([]string, error)) objects.CallableFunc { diff --git a/vendor/github.com/d5/tengo/stdlib/hex.go b/vendor/github.com/d5/tengo/stdlib/hex.go new file mode 100644 index 00000000..acc29e6a --- /dev/null +++ b/vendor/github.com/d5/tengo/stdlib/hex.go @@ -0,0 +1,11 @@ +package stdlib + +import ( + "encoding/hex" + "github.com/d5/tengo/objects" +) + +var hexModule = map[string]objects.Object{ + "encode": &objects.UserFunction{Value: FuncAYRS(hex.EncodeToString)}, + "decode": &objects.UserFunction{Value: FuncASRYE(hex.DecodeString)}, +} |