Loading internal/gopher-lua/.travis.ymldeleted 100644 → 0 +0 −18 Original line number Diff line number Diff line language: go go: - "1.9.x" - "1.10.x" - "1.11.x" env: global: GO111MODULE=off before_install: - go get github.com/axw/gocov/gocov - go get github.com/mattn/goveralls - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi install: - go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep '\.' | grep -v gopher-lua) script: - $HOME/gopath/bin/goveralls -service=travis-ci internal/gopher-lua/README.rst +9 −7 Original line number Diff line number Diff line Loading @@ -3,14 +3,14 @@ GopherLua: VM and compiler for Lua in Go. =============================================================================== .. image:: https://godoc.org/github.com/yuin/gopher-lua?status.svg :target: http://godoc.org/github.com/yuin/gopher-lua .. image:: https://pkg.go.dev/badge/github.com/yuin/gopher-lua.svg :target: https://pkg.go.dev/github.com/yuin/gopher-lua .. image:: https://travis-ci.org/yuin/gopher-lua.svg :target: https://travis-ci.org/yuin/gopher-lua .. image:: https://github.com/yuin/gopher-lua/workflows/test/badge.svg?branch=master&event=push :target: https://github.com/yuin/gopher-lua/actions?query=workflow:test .. image:: https://coveralls.io/repos/yuin/gopher-lua/badge.svg :target: https://coveralls.io/r/yuin/gopher-lua .. image:: https://coveralls.io/repos/github/yuin/gopher-lua/badge.svg?branch=master :target: https://coveralls.io/github/yuin/gopher-lua .. image:: https://badges.gitter.im/Join%20Chat.svg :alt: Join the chat at https://gitter.im/yuin/gopher-lua Loading @@ -19,7 +19,7 @@ GopherLua: VM and compiler for Lua in Go. | GopherLua is a Lua5.1 VM and compiler written in Go. GopherLua has a same goal GopherLua is a Lua5.1(+ `goto` statement in Lua5.2) VM and compiler written in Go. GopherLua has a same goal with Lua: **Be a scripting language with extensible semantics** . It provides Go APIs that allow you to easily embed a scripting language to your Go host programs. Loading Loading @@ -830,6 +830,8 @@ Miscellaneous notes - ``file:setvbuf`` does not support a line buffering. - Daylight saving time is not supported. - GopherLua has a function to set an environment variable : ``os.setenv(name, value)`` - GopherLua support ``goto`` and ``::label::`` statement in Lua5.2. - `goto` is a keyword and not a valid variable name. ---------------------------------------------------------------- Standalone interpreter Loading internal/gopher-lua/_glua-tests/issues.lua +70 −0 Original line number Diff line number Diff line Loading @@ -389,3 +389,73 @@ function test() assert(a == 1 and b == nil and c == nil) end test() -- issue #412 -- issue #418 -- Conversion from symmetric modulo is incorrect. function test() assert(-2 % -2 == 0) assert(-1 % -2 == -1) assert(0 % -2 == 0) assert(1 % -2 == -1) assert(2 % -2 == 0) assert(-2 % 2 == 0) assert(-1 % 2 == 1) assert(0 % 2 == 0) assert(1 % 2 == 1) assert(2 % 2 == 0) end test() -- issue #355 function test() local x = "valid" assert(x == "valid") assert(zzz == nil) x = zzz and "not-valid" or x assert(x == "valid") end test() function test() local x = "valid" local z = nil assert(x == "valid") assert(z == nil) x = z and "not-valid" or x assert(x == "valid") end test() function test() local x = "valid" assert(x == "valid") assert(zzz == nil) x = zzz and "not-valid" or "still " .. x assert(x == "still valid") end test() -- issue #315 function test() local a = {} local d = 'e' local f = 1 f, a.d = f, d assert(f..", "..a.d == "1, e") end test() -- issue #423 function test() local a, b, c = "1", "3", "1" a, b, c= tonumber(a), tonumber(b) or a, tonumber(c) assert(a == 1) assert(type(a) == "number") assert(b == 3) assert(type(b) == "number") assert(c == 1) assert(type(c) == "number") end internal/gopher-lua/_vm.go +1 −1 Original line number Diff line number Diff line Loading @@ -840,7 +840,7 @@ func luaModulo(lhs, rhs LNumber) LNumber { flhs := float64(lhs) frhs := float64(rhs) v := math.Mod(flhs, frhs) if flhs < 0 || frhs < 0 && !(flhs < 0 && frhs < 0) { if frhs > 0 && v < 0 || frhs < 0 && v > 0 { v += frhs } return LNumber(v) Loading internal/gopher-lua/ast/stmt.go +12 −0 Original line number Diff line number Diff line Loading @@ -93,3 +93,15 @@ type ReturnStmt struct { type BreakStmt struct { StmtBase } type LabelStmt struct { StmtBase Name string } type GotoStmt struct { StmtBase Label string } Loading
internal/gopher-lua/.travis.ymldeleted 100644 → 0 +0 −18 Original line number Diff line number Diff line language: go go: - "1.9.x" - "1.10.x" - "1.11.x" env: global: GO111MODULE=off before_install: - go get github.com/axw/gocov/gocov - go get github.com/mattn/goveralls - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi install: - go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep '\.' | grep -v gopher-lua) script: - $HOME/gopath/bin/goveralls -service=travis-ci
internal/gopher-lua/README.rst +9 −7 Original line number Diff line number Diff line Loading @@ -3,14 +3,14 @@ GopherLua: VM and compiler for Lua in Go. =============================================================================== .. image:: https://godoc.org/github.com/yuin/gopher-lua?status.svg :target: http://godoc.org/github.com/yuin/gopher-lua .. image:: https://pkg.go.dev/badge/github.com/yuin/gopher-lua.svg :target: https://pkg.go.dev/github.com/yuin/gopher-lua .. image:: https://travis-ci.org/yuin/gopher-lua.svg :target: https://travis-ci.org/yuin/gopher-lua .. image:: https://github.com/yuin/gopher-lua/workflows/test/badge.svg?branch=master&event=push :target: https://github.com/yuin/gopher-lua/actions?query=workflow:test .. image:: https://coveralls.io/repos/yuin/gopher-lua/badge.svg :target: https://coveralls.io/r/yuin/gopher-lua .. image:: https://coveralls.io/repos/github/yuin/gopher-lua/badge.svg?branch=master :target: https://coveralls.io/github/yuin/gopher-lua .. image:: https://badges.gitter.im/Join%20Chat.svg :alt: Join the chat at https://gitter.im/yuin/gopher-lua Loading @@ -19,7 +19,7 @@ GopherLua: VM and compiler for Lua in Go. | GopherLua is a Lua5.1 VM and compiler written in Go. GopherLua has a same goal GopherLua is a Lua5.1(+ `goto` statement in Lua5.2) VM and compiler written in Go. GopherLua has a same goal with Lua: **Be a scripting language with extensible semantics** . It provides Go APIs that allow you to easily embed a scripting language to your Go host programs. Loading Loading @@ -830,6 +830,8 @@ Miscellaneous notes - ``file:setvbuf`` does not support a line buffering. - Daylight saving time is not supported. - GopherLua has a function to set an environment variable : ``os.setenv(name, value)`` - GopherLua support ``goto`` and ``::label::`` statement in Lua5.2. - `goto` is a keyword and not a valid variable name. ---------------------------------------------------------------- Standalone interpreter Loading
internal/gopher-lua/_glua-tests/issues.lua +70 −0 Original line number Diff line number Diff line Loading @@ -389,3 +389,73 @@ function test() assert(a == 1 and b == nil and c == nil) end test() -- issue #412 -- issue #418 -- Conversion from symmetric modulo is incorrect. function test() assert(-2 % -2 == 0) assert(-1 % -2 == -1) assert(0 % -2 == 0) assert(1 % -2 == -1) assert(2 % -2 == 0) assert(-2 % 2 == 0) assert(-1 % 2 == 1) assert(0 % 2 == 0) assert(1 % 2 == 1) assert(2 % 2 == 0) end test() -- issue #355 function test() local x = "valid" assert(x == "valid") assert(zzz == nil) x = zzz and "not-valid" or x assert(x == "valid") end test() function test() local x = "valid" local z = nil assert(x == "valid") assert(z == nil) x = z and "not-valid" or x assert(x == "valid") end test() function test() local x = "valid" assert(x == "valid") assert(zzz == nil) x = zzz and "not-valid" or "still " .. x assert(x == "still valid") end test() -- issue #315 function test() local a = {} local d = 'e' local f = 1 f, a.d = f, d assert(f..", "..a.d == "1, e") end test() -- issue #423 function test() local a, b, c = "1", "3", "1" a, b, c= tonumber(a), tonumber(b) or a, tonumber(c) assert(a == 1) assert(type(a) == "number") assert(b == 3) assert(type(b) == "number") assert(c == 1) assert(type(c) == "number") end
internal/gopher-lua/_vm.go +1 −1 Original line number Diff line number Diff line Loading @@ -840,7 +840,7 @@ func luaModulo(lhs, rhs LNumber) LNumber { flhs := float64(lhs) frhs := float64(rhs) v := math.Mod(flhs, frhs) if flhs < 0 || frhs < 0 && !(flhs < 0 && frhs < 0) { if frhs > 0 && v < 0 || frhs < 0 && v > 0 { v += frhs } return LNumber(v) Loading
internal/gopher-lua/ast/stmt.go +12 −0 Original line number Diff line number Diff line Loading @@ -93,3 +93,15 @@ type ReturnStmt struct { type BreakStmt struct { StmtBase } type LabelStmt struct { StmtBase Name string } type GotoStmt struct { StmtBase Label string }