diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index eb2dc91e..02d4c99e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -3,7 +3,7 @@ Any kind of contributions are welcome. ## Building GopherLua -GopherLua uses simple inlining tool for generate efficient codes. This tool requires python interpreter. Files name of which starts with `_` genarate files name of which does not starts with `_` . For instance, `_state.go` generate `state.go` . You do not edit generated sources. +GopherLua uses simple inlining tool for generate efficient codes. This tool requires python interpreter. Files name of which starts with `_` generate files name of which does not starts with `_` . For instance, `_state.go` generate `state.go` . You do not edit generated sources. To generate sources, some make target is available. ```bash diff --git a/README.rst b/README.rst index cc936311..6560dc13 100644 --- a/README.rst +++ b/README.rst @@ -847,7 +847,7 @@ Lua has an interpreter called ``lua`` . GopherLua has an interpreter called ``gl ---------------------------------------------------------------- How to Contribute ---------------------------------------------------------------- -See `Guidlines for contributors `_ . +See `Guidelines for contributors `_ . ---------------------------------------------------------------- Libraries for GopherLua @@ -868,7 +868,7 @@ Libraries for GopherLua - `gluacrypto `_ : A native Go implementation of crypto library for the GopherLua VM. - `gluasql `_ : A native Go implementation of SQL client for the GopherLua VM. - `purr `_ : A http mock testing tool. -- `vadv/gopher-lua-libs `_ : Some usefull libraries for GopherLua VM. +- `vadv/gopher-lua-libs `_ : Some useful libraries for GopherLua VM. - `gluaperiphery `_ : A periphery library for the GopherLua VM (GPIO, SPI, I2C, MMIO, and Serial peripheral I/O for Linux). - `glua-async `_ : An async/await implement for gopher-lua. - `gopherlua-debugger `_ : A debugger for gopher-lua diff --git a/_lua5.1-tests/README b/_lua5.1-tests/README index e2d4b285..34b5b028 100644 --- a/_lua5.1-tests/README +++ b/_lua5.1-tests/README @@ -1,7 +1,7 @@ This tarball contains the official test scripts for Lua 5.1. Unlike Lua itself, these tests do not aim portability, small footprint, or easy of use. (Their main goal is to try to crash Lua.) They are not -intended for general use. You are wellcome to use them, but expect to +intended for general use. You are welcome to use them, but expect to have to "dirt your hands". The tarball should expand in the following contents: diff --git a/_lua5.1-tests/api.lua b/_lua5.1-tests/api.lua index c2d262f0..2e8c5f04 100644 --- a/_lua5.1-tests/api.lua +++ b/_lua5.1-tests/api.lua @@ -17,7 +17,7 @@ function pack(...) return arg end print('testing C API') --- testing allignment +-- testing alignment a = T.d2s(12458954321123) assert(string.len(a) == 8) -- sizeof(double) assert(T.s2d(a) == 12458954321123) @@ -315,7 +315,7 @@ collectgarbage() assert(type(T.getref(a)) == 'table') --- colect in cl the `val' of all collected userdata +-- collect in cl the `val' of all collected userdata tt = {} cl = {n=0} A = nil; B = nil @@ -333,7 +333,7 @@ F = function (x) if A ~= nil then assert(type(A) == "userdata") assert(T.udataval(A) == B) - debug.getmetatable(A) -- just acess it + debug.getmetatable(A) -- just access it end A = x -- ressucita userdata B = udval @@ -341,7 +341,7 @@ F = function (x) end tt.__gc = F --- test whether udate collection frees memory in the right time +-- test whether update collection frees memory in the right time do collectgarbage(); collectgarbage(); diff --git a/_lua5.1-tests/closure.lua b/_lua5.1-tests/closure.lua index f01ad6ff..a90ed252 100644 --- a/_lua5.1-tests/closure.lua +++ b/_lua5.1-tests/closure.lua @@ -313,7 +313,7 @@ end assert(a == 5^4) --- access to locals of collected corroutines +-- access to locals of collected coroutines --[[ local C = {}; setmetatable(C, {__mode = "kv"}) local x = coroutine.wrap (function () diff --git a/_lua5.1-tests/db.lua b/_lua5.1-tests/db.lua index 09496f6f..8ab072a3 100644 --- a/_lua5.1-tests/db.lua +++ b/_lua5.1-tests/db.lua @@ -472,7 +472,7 @@ t[1] = "'error'" checktraceback(co, t) --- test acessing line numbers of a coroutine from a resume inside +-- test accessing line numbers of a coroutine from a resume inside -- a C function (this is a known bug in Lua 5.0) local function g(x) diff --git a/_lua5.1-tests/gc.lua b/_lua5.1-tests/gc.lua index 86a9f758..a33b4940 100644 --- a/_lua5.1-tests/gc.lua +++ b/_lua5.1-tests/gc.lua @@ -295,7 +295,7 @@ do assert(getmetatable(o) == tt) -- create new objects during GC local a = 'xuxu'..(10+3)..'joao', {} - ___Glob = o -- ressurect object! + ___Glob = o -- resurrect object! newproxy(o) -- creates a new one with same metatable print(">>> closing state " .. "<<<\n") end diff --git a/_lua5.1-tests/locals.lua b/_lua5.1-tests/locals.lua index b0fc556f..39c3dd31 100644 --- a/_lua5.1-tests/locals.lua +++ b/_lua5.1-tests/locals.lua @@ -115,7 +115,7 @@ if rawget(_G, "querytab") then local t = querytab(a) for k,_ in pairs(a) do a[k] = nil end - collectgarbage() -- restore GC and collect dead fiels in `a' + collectgarbage() -- restore GC and collect dead fields in `a' for i=0,t-1 do local k = querytab(a, i) assert(k == nil or type(k) == 'number' or k == 'alo') diff --git a/_lua5.1-tests/math.lua b/_lua5.1-tests/math.lua index 21429a6f..99098e0e 100644 --- a/_lua5.1-tests/math.lua +++ b/_lua5.1-tests/math.lua @@ -166,7 +166,7 @@ stat(a) a = nil --- testing implicit convertions +-- testing implicit conversions local a,b = '10', '20' assert(a*b == 200 and a+b == 30 and a-b == -10 and a/b == 0.5 and -b == -20) diff --git a/_lua5.1-tests/pm.lua b/_lua5.1-tests/pm.lua index 85b03846..830ec903 100644 --- a/_lua5.1-tests/pm.lua +++ b/_lua5.1-tests/pm.lua @@ -19,9 +19,9 @@ a,b = string.find('alo', '') assert(a == 1 and b == 0) a,b = string.find('a\0o a\0o a\0o', 'a', 1) -- first position assert(a == 1 and b == 1) -a,b = string.find('a\0o a\0o a\0o', 'a\0o', 2) -- starts in the midle +a,b = string.find('a\0o a\0o a\0o', 'a\0o', 2) -- starts in the middle assert(a == 5 and b == 7) -a,b = string.find('a\0o a\0o a\0o', 'a\0o', 9) -- starts in the midle +a,b = string.find('a\0o a\0o a\0o', 'a\0o', 9) -- starts in the middle assert(a == 9 and b == 11) a,b = string.find('a\0a\0a\0a\0\0ab', '\0ab', 2); -- finds at the end assert(a == 9 and b == 11); diff --git a/_state.go b/_state.go index 645589fe..27f0cbad 100644 --- a/_state.go +++ b/_state.go @@ -742,7 +742,7 @@ func (ls *LState) frameFuncName(fr *callFrame) (string, bool) { if ls.Parent == nil { return "main chunk", true } else { - return "corountine", true + return "coroutine", true } } if !frame.Fn.IsG { diff --git a/compile.go b/compile.go index c3736777..01b2c693 100644 --- a/compile.go +++ b/compile.go @@ -1827,7 +1827,7 @@ func patchCode(context *funcContext) { // {{{ } } - // bulk move optimization(reducing op dipatch costs) + // bulk move optimization(reducing op dispatch costs) if curop == OP_MOVE { moven++ } else { diff --git a/iolib.go b/iolib.go index b59e82b2..6a59e637 100644 --- a/iolib.go +++ b/iolib.go @@ -558,7 +558,7 @@ func ioInput(L *LState) int { } } - L.ArgError(1, "string or file expedted, but got "+L.Get(1).Type().String()) + L.ArgError(1, "string or file expected, but got "+L.Get(1).Type().String()) return 0 } @@ -613,7 +613,7 @@ func ioLines(L *LState) int { return 1 } -var ioOpenOpions = []string{"r", "rb", "w", "wb", "a", "ab", "r+", "rb+", "w+", "wb+", "a+", "ab+"} +var ioOpenOptions = []string{"r", "rb", "w", "wb", "a", "ab", "r+", "rb+", "w+", "wb+", "a+", "ab+"} func ioOpenFile(L *LState) int { path := L.CheckString(1) @@ -624,7 +624,7 @@ func ioOpenFile(L *LState) int { perm := 0600 writable := true readable := true - switch ioOpenOpions[L.CheckOption(2, ioOpenOpions)] { + switch ioOpenOptions[L.CheckOption(2, ioOpenOptions)] { case "r", "rb": mode = os.O_RDONLY writable = false @@ -735,7 +735,7 @@ func ioOutput(L *LState) int { } } - L.ArgError(1, "string or file expedted, but got "+L.Get(1).Type().String()) + L.ArgError(1, "string or file expected, but got "+L.Get(1).Type().String()) return 0 } diff --git a/parse/lexer.go b/parse/lexer.go index c20a0bdd..b63eef23 100644 --- a/parse/lexer.go +++ b/parse/lexer.go @@ -510,23 +510,23 @@ func dump(node interface{}, level int, s string) string { case reflect.Ptr: vt := rv.Elem() tt := rt.Elem() - indicies := []int{} + indices := []int{} for i := 0; i < tt.NumField(); i++ { if strings.Index(tt.Field(i).Name, "Base") > -1 { continue } - indicies = append(indicies, i) + indices = append(indices, i) } switch { - case len(indicies) == 0: + case len(indices) == 0: return strings.Repeat(s, level) + "" - case len(indicies) == 1 && isInlineDumpNode(vt.Field(indicies[0])): - for _, i := range indicies { + case len(indices) == 1 && isInlineDumpNode(vt.Field(indices[0])): + for _, i := range indices { buf = append(buf, strings.Repeat(s, level)+"- Node$"+tt.Name()+": "+dump(vt.Field(i).Interface(), 0, s)) } default: buf = append(buf, strings.Repeat(s, level)+"- Node$"+tt.Name()) - for _, i := range indicies { + for _, i := range indices { if isInlineDumpNode(vt.Field(i)) { inf := dump(vt.Field(i).Interface(), 0, s) buf = append(buf, strings.Repeat(s, level+1)+tt.Field(i).Name+": "+inf) diff --git a/parse/parser.go.y b/parse/parser.go.y index 52bcd55f..b4a70f4f 100644 --- a/parse/parser.go.y +++ b/parse/parser.go.y @@ -110,7 +110,7 @@ stat: $$ = &ast.AssignStmt{Lhs: $1, Rhs: $3} $$.SetLine($1[0].Line()) } | - /* 'stat = functioncal' causes a reduce/reduce conflict */ + /* 'stat = functioncall' causes a reduce/reduce conflict */ prefixexp { if _, ok := $1.(*ast.FuncCallExpr); !ok { yylex.(*Lexer).Error("parse error") diff --git a/pm/pm.go b/pm/pm.go index e5c651f9..626e81ab 100644 --- a/pm/pm.go +++ b/pm/pm.go @@ -40,7 +40,7 @@ func (e *Error) Error() string { type MatchData struct { // captured positions // layout - // xxxx xxxx xxxx xxx0 : caputured positions + // xxxx xxxx xxxx xxx0 : captured positions // xxxx xxxx xxxx xxx1 : position captured positions captures []uint32 } diff --git a/script_test.go b/script_test.go index 3c0675d6..b928acc8 100644 --- a/script_test.go +++ b/script_test.go @@ -84,17 +84,17 @@ func testScriptDir(t *testing.T, tests []string, directory string) { } } -var numActiveUserDatas int32 = 0 +var numActiveUserData int32 = 0 type finalizerStub struct{ x byte } func allocFinalizerUserData(L *LState) int { ud := L.NewUserData() - atomic.AddInt32(&numActiveUserDatas, 1) + atomic.AddInt32(&numActiveUserData, 1) a := finalizerStub{} ud.Value = &a runtime.SetFinalizer(&a, func(aa *finalizerStub) { - atomic.AddInt32(&numActiveUserDatas, -1) + atomic.AddInt32(&numActiveUserData, -1) }) L.Push(ud) return 1 @@ -106,11 +106,11 @@ func sleep(L *LState) int { } func countFinalizers(L *LState) int { - L.Push(LNumber(numActiveUserDatas)) + L.Push(LNumber(numActiveUserData)) return 1 } -// TestLocalVarFree verifies that tables and user user datas which are no longer referenced by the lua script are +// TestLocalVarFree verifies that tables and user data which are no longer referenced by the lua script are // correctly gc-ed. There was a bug in gopher lua where local vars were not being gc-ed in all circumstances. func TestLocalVarFree(t *testing.T) { s := ` @@ -127,7 +127,7 @@ func TestLocalVarFree(t *testing.T) { end sleep(100) end - error("user datas not finalized after 100 gcs") + error("user data not finalized after 100 gcs") ` L := NewState() L.SetGlobal("allocFinalizer", L.NewFunction(allocFinalizerUserData)) diff --git a/state.go b/state.go index 50e70ed6..78d958bf 100644 --- a/state.go +++ b/state.go @@ -788,7 +788,7 @@ func (ls *LState) frameFuncName(fr *callFrame) (string, bool) { if ls.Parent == nil { return "main chunk", true } else { - return "corountine", true + return "coroutine", true } } if !frame.Fn.IsG { diff --git a/state_test.go b/state_test.go index bfe93b93..df3e12c7 100644 --- a/state_test.go +++ b/state_test.go @@ -422,7 +422,7 @@ func TestContextCancel(t *testing.T) { errorIfFalse(t, strings.Contains(err.Error(), "context canceled"), "execution must be canceled") } -func TestContextWithCroutine(t *testing.T) { +func TestContextWithCoroutine(t *testing.T) { L := NewState() defer L.Close() ctx, cancel := context.WithCancel(context.Background()) @@ -469,7 +469,7 @@ func TestPCallAfterFail(t *testing.T) { }) L.Push(changeError) err := L.PCall(0, 0, nil) - errorIfFalse(t, strings.Contains(err.Error(), "A New Error"), "error not propogated correctly") + errorIfFalse(t, strings.Contains(err.Error(), "A New Error"), "error not propagated correctly") } func TestRegistryFixedOverflow(t *testing.T) { diff --git a/stringlib.go b/stringlib.go index f484c2b3..123edde4 100644 --- a/stringlib.go +++ b/stringlib.go @@ -174,8 +174,8 @@ func strGsub(L *LState) int { } type replaceInfo struct { - Indicies []int - String string + Indices []int + String string } func checkCaptureIndex(L *LState, m *pm.MatchData, idx int) { @@ -205,9 +205,9 @@ func strGsubDoReplace(str string, info []replaceInfo) string { buf := []byte(str) for _, replace := range info { oldlen := len(buf) - b1 := append([]byte(""), buf[0:offset+replace.Indicies[0]]...) + b1 := append([]byte(""), buf[0:offset+replace.Indices[0]]...) b2 := []byte("") - index2 := offset + replace.Indicies[1] + index2 := offset + replace.Indices[1] if index2 <= len(buf) { b2 = append(b2, buf[index2:len(buf)]...) }