mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-15 00:19:24 +01:00
Update vendor d5/tengo (#1066)
This commit is contained in:
parent
54b3143a1d
commit
0f2d8a599c
2
go.mod
2
go.mod
@ -6,7 +6,7 @@ require (
|
||||
github.com/Jeffail/gabs v1.1.1 // indirect
|
||||
github.com/Philipp15b/go-steam v1.0.1-0.20190816133340-b04c5a83c1c0
|
||||
github.com/Rhymen/go-whatsapp v0.1.0
|
||||
github.com/d5/tengo/v2 v2.0.2
|
||||
github.com/d5/tengo/v2 v2.1.2
|
||||
github.com/dfordsoft/golib v0.0.0-20180902042739-76ee6ab99bec
|
||||
github.com/fsnotify/fsnotify v1.4.7
|
||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.5-0.20181225215658-ec221ba9ea45+incompatible
|
||||
|
4
go.sum
4
go.sum
@ -33,8 +33,8 @@ github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc
|
||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/d5/tengo/v2 v2.0.2 h1:3APkPZPc1FExaJoWrN5YzvDqc6GNkQH6ehmCRDmN83I=
|
||||
github.com/d5/tengo/v2 v2.0.2/go.mod h1:XRGjEs5I9jYIKTxly6HCF8oiiilk5E/RYXOZ5b0DZC8=
|
||||
github.com/d5/tengo/v2 v2.1.2 h1:JR5O6qJW2GW9lpv/MfEqK16a/Wpp2y8I0JZZ5fqNOL0=
|
||||
github.com/d5/tengo/v2 v2.1.2/go.mod h1:XRGjEs5I9jYIKTxly6HCF8oiiilk5E/RYXOZ5b0DZC8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
3
vendor/github.com/d5/tengo/v2/.goreleaser.yml
generated
vendored
3
vendor/github.com/d5/tengo/v2/.goreleaser.yml
generated
vendored
@ -11,7 +11,8 @@ builds:
|
||||
- darwin
|
||||
- linux
|
||||
- windows
|
||||
archive:
|
||||
archives:
|
||||
-
|
||||
files:
|
||||
- none*
|
||||
checksum:
|
||||
|
5
vendor/github.com/d5/tengo/v2/README.md
generated
vendored
5
vendor/github.com/d5/tengo/v2/README.md
generated
vendored
@ -7,7 +7,6 @@
|
||||
[![GoDoc](https://godoc.org/github.com/d5/tengo?status.svg)](https://godoc.org/github.com/d5/tengo)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/d5/tengo)](https://goreportcard.com/report/github.com/d5/tengo)
|
||||
[![CircleCI](https://circleci.com/gh/d5/tengo.svg?style=svg)](https://circleci.com/gh/d5/tengo)
|
||||
[![Sourcegraph](https://sourcegraph.com/github.com/d5/tengo/-/badge.svg)](https://sourcegraph.com/github.com/d5/tengo?badge)
|
||||
|
||||
**Tengo is a small, dynamic, fast, secure script language for Go.**
|
||||
|
||||
@ -75,6 +74,10 @@ _* See [here](https://github.com/d5/tengobench) for commands/codes used_
|
||||
|
||||
## Quick Start
|
||||
|
||||
```
|
||||
go get github.com/d5/tengo/v2
|
||||
```
|
||||
|
||||
A simple Go example code that compiles/runs Tengo script code with some input/output values:
|
||||
|
||||
```golang
|
||||
|
109
vendor/github.com/d5/tengo/v2/builtins.go
generated
vendored
109
vendor/github.com/d5/tengo/v2/builtins.go
generated
vendored
@ -13,6 +13,14 @@ var builtinFuncs = []*BuiltinFunction{
|
||||
Name: "append",
|
||||
Value: builtinAppend,
|
||||
},
|
||||
{
|
||||
Name: "delete",
|
||||
Value: builtinDelete,
|
||||
},
|
||||
{
|
||||
Name: "splice",
|
||||
Value: builtinSplice,
|
||||
},
|
||||
{
|
||||
Name: "string",
|
||||
Value: builtinString,
|
||||
@ -500,3 +508,104 @@ func builtinAppend(args ...Object) (Object, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// builtinDelete deletes Map keys
|
||||
// usage: delete(map, "key")
|
||||
// key must be a string
|
||||
func builtinDelete(args ...Object) (Object, error) {
|
||||
argsLen := len(args)
|
||||
if argsLen != 2 {
|
||||
return nil, ErrWrongNumArguments
|
||||
}
|
||||
switch arg := args[0].(type) {
|
||||
case *Map:
|
||||
if key, ok := args[1].(*String); ok {
|
||||
delete(arg.Value, key.Value)
|
||||
return UndefinedValue, nil
|
||||
}
|
||||
return nil, ErrInvalidArgumentType{
|
||||
Name: "second",
|
||||
Expected: "string",
|
||||
Found: args[1].TypeName(),
|
||||
}
|
||||
default:
|
||||
return nil, ErrInvalidArgumentType{
|
||||
Name: "first",
|
||||
Expected: "map",
|
||||
Found: arg.TypeName(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// builtinSplice deletes and changes given Array, returns deleted items.
|
||||
// usage:
|
||||
// deleted_items := splice(array[,start[,delete_count[,item1[,item2[,...]]]])
|
||||
func builtinSplice(args ...Object) (Object, error) {
|
||||
argsLen := len(args)
|
||||
if argsLen == 0 {
|
||||
return nil, ErrWrongNumArguments
|
||||
}
|
||||
|
||||
array, ok := args[0].(*Array)
|
||||
if !ok {
|
||||
return nil, ErrInvalidArgumentType{
|
||||
Name: "first",
|
||||
Expected: "array",
|
||||
Found: args[0].TypeName(),
|
||||
}
|
||||
}
|
||||
arrayLen := len(array.Value)
|
||||
|
||||
var startIdx int
|
||||
if argsLen > 1 {
|
||||
arg1, ok := args[1].(*Int)
|
||||
if !ok {
|
||||
return nil, ErrInvalidArgumentType{
|
||||
Name: "second",
|
||||
Expected: "int",
|
||||
Found: args[1].TypeName(),
|
||||
}
|
||||
}
|
||||
startIdx = int(arg1.Value)
|
||||
if startIdx < 0 || startIdx > arrayLen {
|
||||
return nil, ErrIndexOutOfBounds
|
||||
}
|
||||
}
|
||||
|
||||
delCount := len(array.Value)
|
||||
if argsLen > 2 {
|
||||
arg2, ok := args[2].(*Int)
|
||||
if !ok {
|
||||
return nil, ErrInvalidArgumentType{
|
||||
Name: "third",
|
||||
Expected: "int",
|
||||
Found: args[2].TypeName(),
|
||||
}
|
||||
}
|
||||
delCount = int(arg2.Value)
|
||||
if delCount < 0 {
|
||||
return nil, ErrIndexOutOfBounds
|
||||
}
|
||||
}
|
||||
// if count of to be deleted items is bigger than expected, truncate it
|
||||
if startIdx+delCount > arrayLen {
|
||||
delCount = arrayLen - startIdx
|
||||
}
|
||||
// delete items
|
||||
endIdx := startIdx + delCount
|
||||
deleted := append([]Object{}, array.Value[startIdx:endIdx]...)
|
||||
|
||||
head := array.Value[:startIdx]
|
||||
var items []Object
|
||||
if argsLen > 3 {
|
||||
items = make([]Object, 0, argsLen-3)
|
||||
for i := 3; i < argsLen; i++ {
|
||||
items = append(items, args[i])
|
||||
}
|
||||
}
|
||||
items = append(items, array.Value[endIdx:]...)
|
||||
array.Value = append(head, items...)
|
||||
|
||||
// return deleted items
|
||||
return &Array{Value: deleted}, nil
|
||||
}
|
||||
|
6
vendor/github.com/d5/tengo/v2/vm.go
generated
vendored
6
vendor/github.com/d5/tengo/v2/vm.go
generated
vendored
@ -80,14 +80,14 @@ func (v *VM) Run() (err error) {
|
||||
if err != nil {
|
||||
filePos := v.fileSet.Position(
|
||||
v.curFrame.fn.SourcePos(v.ip - 1))
|
||||
err = fmt.Errorf("Runtime Error: %s\n\tat %s",
|
||||
err.Error(), filePos)
|
||||
err = fmt.Errorf("Runtime Error: %w\n\tat %s",
|
||||
err, filePos)
|
||||
for v.framesIndex > 1 {
|
||||
v.framesIndex--
|
||||
v.curFrame = &v.frames[v.framesIndex-1]
|
||||
filePos = v.fileSet.Position(
|
||||
v.curFrame.fn.SourcePos(v.curFrame.ip - 1))
|
||||
err = fmt.Errorf("%s\n\tat %s", err.Error(), filePos)
|
||||
err = fmt.Errorf("%w\n\tat %s", err, filePos)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -23,7 +23,7 @@ github.com/Rhymen/go-whatsapp/binary/token
|
||||
github.com/Rhymen/go-whatsapp/crypto/cbc
|
||||
github.com/Rhymen/go-whatsapp/crypto/curve25519
|
||||
github.com/Rhymen/go-whatsapp/crypto/hkdf
|
||||
# github.com/d5/tengo/v2 v2.0.2
|
||||
# github.com/d5/tengo/v2 v2.1.2
|
||||
github.com/d5/tengo/v2
|
||||
github.com/d5/tengo/v2/parser
|
||||
github.com/d5/tengo/v2/stdlib
|
||||
|
Loading…
Reference in New Issue
Block a user