aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-04-23 11:36:09 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-04-23 11:36:09 -0300
commit9b014d4bcd4ebadb523f1c1a1d38148d8526e5ed (patch)
tree50d7ec68ff36d2fa017b970b11985c6cce5861aa
parent50fd8d03c33bbe52ac5b34c4eb748197b349cedd (diff)
downloadlua-9b014d4bcd4ebadb523f1c1a1d38148d8526e5ed.tar.gz
lua-9b014d4bcd4ebadb523f1c1a1d38148d8526e5ed.tar.bz2
lua-9b014d4bcd4ebadb523f1c1a1d38148d8526e5ed.zip
Details (typos in comments)
-rw-r--r--ldo.c2
-rw-r--r--lgc.c1
-rw-r--r--lparser.c2
-rw-r--r--lvm.c2
-rw-r--r--testes/api.lua6
-rw-r--r--testes/constructs.lua2
-rw-r--r--testes/db.lua12
-rw-r--r--testes/errors.lua2
-rw-r--r--testes/files.lua2
-rw-r--r--testes/gc.lua10
-rw-r--r--testes/locals.lua2
-rw-r--r--testes/main.lua4
-rw-r--r--testes/math.lua2
-rw-r--r--testes/nextvar.lua4
-rw-r--r--testes/pm.lua4
-rw-r--r--testes/utf8.lua2
16 files changed, 29 insertions, 30 deletions
diff --git a/ldo.c b/ldo.c
index 3e5c7504..820b5a9a 100644
--- a/ldo.c
+++ b/ldo.c
@@ -513,7 +513,7 @@ l_sinline void genmoveresults (lua_State *L, StkId res, int nres,
513** to 'res'. Handle most typical cases (zero results for commands, 513** to 'res'. Handle most typical cases (zero results for commands,
514** one result for expressions, multiple results for tail calls/single 514** one result for expressions, multiple results for tail calls/single
515** parameters) separated. The flag CIST_TBC in 'fwanted', if set, 515** parameters) separated. The flag CIST_TBC in 'fwanted', if set,
516** forces the swicth to go to the default case. 516** forces the switch to go to the default case.
517*/ 517*/
518l_sinline void moveresults (lua_State *L, StkId res, int nres, 518l_sinline void moveresults (lua_State *L, StkId res, int nres,
519 l_uint32 fwanted) { 519 l_uint32 fwanted) {
diff --git a/lgc.c b/lgc.c
index c0d68377..f0045dd6 100644
--- a/lgc.c
+++ b/lgc.c
@@ -126,7 +126,6 @@ static l_mem objsize (GCObject *o) {
126 CClosure *cl = gco2ccl(o); 126 CClosure *cl = gco2ccl(o);
127 res = sizeCclosure(cl->nupvalues); 127 res = sizeCclosure(cl->nupvalues);
128 break; 128 break;
129 break;
130 } 129 }
131 case LUA_VUSERDATA: { 130 case LUA_VUSERDATA: {
132 Udata *u = gco2u(o); 131 Udata *u = gco2u(o);
diff --git a/lparser.c b/lparser.c
index e71d7212..e7e05f48 100644
--- a/lparser.c
+++ b/lparser.c
@@ -561,7 +561,7 @@ static void closegoto (LexState *ls, int g, Labeldesc *label, int bup) {
561 561
562/* 562/*
563** Search for an active label with the given name, starting at 563** Search for an active label with the given name, starting at
564** index 'ilb' (so that it can searh for all labels in current block 564** index 'ilb' (so that it can search for all labels in current block
565** or all labels in current function). 565** or all labels in current function).
566*/ 566*/
567static Labeldesc *findlabel (LexState *ls, TString *name, int ilb) { 567static Labeldesc *findlabel (LexState *ls, TString *name, int ilb) {
diff --git a/lvm.c b/lvm.c
index e2c36ef5..97dfe5ee 100644
--- a/lvm.c
+++ b/lvm.c
@@ -327,7 +327,7 @@ lu_byte luaV_finishget (lua_State *L, const TValue *t, TValue *key,
327** Finish a table assignment 't[key] = val'. 327** Finish a table assignment 't[key] = val'.
328** About anchoring the table before the call to 'luaH_finishset': 328** About anchoring the table before the call to 'luaH_finishset':
329** This call may trigger an emergency collection. When loop>0, 329** This call may trigger an emergency collection. When loop>0,
330** the table being acessed is a field in some metatable. If this 330** the table being accessed is a field in some metatable. If this
331** metatable is weak and the table is not anchored, this collection 331** metatable is weak and the table is not anchored, this collection
332** could collect that table while it is being updated. 332** could collect that table while it is being updated.
333*/ 333*/
diff --git a/testes/api.lua b/testes/api.lua
index 49e3f9b9..b3791654 100644
--- a/testes/api.lua
+++ b/testes/api.lua
@@ -114,7 +114,7 @@ end
114 114
115-- testing warnings 115-- testing warnings
116T.testC([[ 116T.testC([[
117 warningC "#This shold be a" 117 warningC "#This should be a"
118 warningC " single " 118 warningC " single "
119 warning "warning" 119 warning "warning"
120 warningC "#This should be " 120 warningC "#This should be "
@@ -162,7 +162,7 @@ do -- test returning more results than fit in the caller stack
162end 162end
163 163
164 164
165do -- testing multipe returns 165do -- testing multiple returns
166 local function foo (n) 166 local function foo (n)
167 if n > 0 then return n, foo(n - 1) end 167 if n > 0 then return n, foo(n - 1) end
168 end 168 end
@@ -902,7 +902,7 @@ F = function (x)
902 assert(T.udataval(A) == B) 902 assert(T.udataval(A) == B)
903 debug.getmetatable(A) -- just access it 903 debug.getmetatable(A) -- just access it
904 end 904 end
905 A = x -- ressurect userdata 905 A = x -- resurrect userdata
906 B = udval 906 B = udval
907 return 1,2,3 907 return 1,2,3
908end 908end
diff --git a/testes/constructs.lua b/testes/constructs.lua
index 3f6d506f..94f670c7 100644
--- a/testes/constructs.lua
+++ b/testes/constructs.lua
@@ -60,7 +60,7 @@ assert((x>y) and x or y == 2);
60 60
61assert(1234567890 == tonumber('1234567890') and 1234567890+1 == 1234567891) 61assert(1234567890 == tonumber('1234567890') and 1234567890+1 == 1234567891)
62 62
63do -- testing operators with diffent kinds of constants 63do -- testing operators with different kinds of constants
64 -- operands to consider: 64 -- operands to consider:
65 -- * fit in register 65 -- * fit in register
66 -- * constant doesn't fit in register 66 -- * constant doesn't fit in register
diff --git a/testes/db.lua b/testes/db.lua
index 8e13373c..e4982c20 100644
--- a/testes/db.lua
+++ b/testes/db.lua
@@ -431,7 +431,7 @@ do
431 assert(a == nil and not b) 431 assert(a == nil and not b)
432end 432end
433 433
434-- testing iteraction between multiple values x hooks 434-- testing interaction between multiple values x hooks
435do 435do
436 local function f(...) return 3, ... end 436 local function f(...) return 3, ... end
437 local count = 0 437 local count = 0
@@ -587,7 +587,7 @@ t = getupvalues(foo2)
587assert(t.a == 1 and t.b == 2 and t.c == 3) 587assert(t.a == 1 and t.b == 2 and t.c == 3)
588assert(debug.setupvalue(foo1, 1, "xuxu") == "b") 588assert(debug.setupvalue(foo1, 1, "xuxu") == "b")
589assert(({debug.getupvalue(foo2, 3)})[2] == "xuxu") 589assert(({debug.getupvalue(foo2, 3)})[2] == "xuxu")
590-- upvalues of C functions are allways "called" "" (the empty string) 590-- upvalues of C functions are always named "" (the empty string)
591assert(debug.getupvalue(string.gmatch("x", "x"), 1) == "") 591assert(debug.getupvalue(string.gmatch("x", "x"), 1) == "")
592 592
593 593
@@ -839,7 +839,7 @@ t[1] = "'error'"
839checktraceback(co, t) 839checktraceback(co, t)
840 840
841 841
842-- test acessing line numbers of a coroutine from a resume inside 842-- test accessing line numbers of a coroutine from a resume inside
843-- a C function (this is a known bug in Lua 5.0) 843-- a C function (this is a known bug in Lua 5.0)
844 844
845local function g(x) 845local function g(x)
@@ -966,9 +966,9 @@ local debug = require'debug'
966local a = 12 -- a local variable 966local a = 12 -- a local variable
967 967
968local n, v = debug.getlocal(1, 1) 968local n, v = debug.getlocal(1, 1)
969assert(n == "(temporary)" and v == debug) -- unkown name but known value 969assert(n == "(temporary)" and v == debug) -- unknown name but known value
970n, v = debug.getlocal(1, 2) 970n, v = debug.getlocal(1, 2)
971assert(n == "(temporary)" and v == 12) -- unkown name but known value 971assert(n == "(temporary)" and v == 12) -- unknown name but known value
972 972
973-- a function with an upvalue 973-- a function with an upvalue
974local f = function () local x; return a end 974local f = function () local x; return a end
@@ -1018,7 +1018,7 @@ do -- bug in 5.4.0: line hooks in stripped code
1018 line = l 1018 line = l
1019 end, "l") 1019 end, "l")
1020 assert(s() == 2); debug.sethook(nil) 1020 assert(s() == 2); debug.sethook(nil)
1021 assert(line == nil) -- hook called withoug debug info for 1st instruction 1021 assert(line == nil) -- hook called without debug info for 1st instruction
1022end 1022end
1023 1023
1024do -- tests for 'source' in binary dumps 1024do -- tests for 'source' in binary dumps
diff --git a/testes/errors.lua b/testes/errors.lua
index c1c40fec..c80051fc 100644
--- a/testes/errors.lua
+++ b/testes/errors.lua
@@ -507,7 +507,7 @@ end
507 507
508 508
509if not _soft then 509if not _soft then
510 -- several tests that exaust the Lua stack 510 -- several tests that exhaust the Lua stack
511 collectgarbage() 511 collectgarbage()
512 print"testing stack overflow" 512 print"testing stack overflow"
513 local C = 0 513 local C = 0
diff --git a/testes/files.lua b/testes/files.lua
index 53edf314..a0ae661c 100644
--- a/testes/files.lua
+++ b/testes/files.lua
@@ -478,7 +478,7 @@ do print("testing flush")
478end 478end
479 479
480 480
481-- test for multipe arguments in 'lines' 481-- test for multiple arguments in 'lines'
482io.output(file); io.write"0123456789\n":close() 482io.output(file); io.write"0123456789\n":close()
483for a,b in io.lines(file, 1, 1) do 483for a,b in io.lines(file, 1, 1) do
484 if a == "\n" then assert(not b) 484 if a == "\n" then assert(not b)
diff --git a/testes/gc.lua b/testes/gc.lua
index 0693837c..ca8aa1bc 100644
--- a/testes/gc.lua
+++ b/testes/gc.lua
@@ -446,8 +446,8 @@ do -- tests for string keys in weak tables
446 local m = collectgarbage("count") -- current memory 446 local m = collectgarbage("count") -- current memory
447 local a = setmetatable({}, {__mode = "kv"}) 447 local a = setmetatable({}, {__mode = "kv"})
448 a[string.rep("a", 2^22)] = 25 -- long string key -> number value 448 a[string.rep("a", 2^22)] = 25 -- long string key -> number value
449 a[string.rep("b", 2^22)] = {} -- long string key -> colectable value 449 a[string.rep("b", 2^22)] = {} -- long string key -> collectable value
450 a[{}] = 14 -- colectable key 450 a[{}] = 14 -- collectable key
451 collectgarbage() 451 collectgarbage()
452 local k, v = next(a) -- string key with number value preserved 452 local k, v = next(a) -- string key with number value preserved
453 assert(k == string.rep("a", 2^22) and v == 25) 453 assert(k == string.rep("a", 2^22) and v == 25)
@@ -459,7 +459,7 @@ do -- tests for string keys in weak tables
459 assert(next(a) == nil) 459 assert(next(a) == nil)
460 -- make sure will not try to compare with dead key 460 -- make sure will not try to compare with dead key
461 assert(a[string.rep("b", 100)] == undef) 461 assert(a[string.rep("b", 100)] == undef)
462 assert(collectgarbage("count") <= m + 1) -- eveything collected 462 assert(collectgarbage("count") <= m + 1) -- everything collected
463end 463end
464 464
465 465
@@ -524,7 +524,7 @@ do
524 local co = coroutine.create(f) 524 local co = coroutine.create(f)
525 assert(coroutine.resume(co, co)) 525 assert(coroutine.resume(co, co))
526 end 526 end
527 -- Now, thread and closure are not reacheable any more. 527 -- Now, thread and closure are not reachable any more.
528 collectgarbage() 528 collectgarbage()
529 assert(collected) 529 assert(collected)
530 collectgarbage("restart") 530 collectgarbage("restart")
@@ -644,7 +644,7 @@ do
644 assert(getmetatable(o) == tt) 644 assert(getmetatable(o) == tt)
645 -- create new objects during GC 645 -- create new objects during GC
646 local a = 'xuxu'..(10+3)..'joao', {} 646 local a = 'xuxu'..(10+3)..'joao', {}
647 ___Glob = o -- ressurrect object! 647 ___Glob = o -- resurrect object!
648 setmetatable({}, tt) -- creates a new one with same metatable 648 setmetatable({}, tt) -- creates a new one with same metatable
649 print(">>> closing state " .. "<<<\n") 649 print(">>> closing state " .. "<<<\n")
650 end 650 end
diff --git a/testes/locals.lua b/testes/locals.lua
index ccea0a14..eeeb4338 100644
--- a/testes/locals.lua
+++ b/testes/locals.lua
@@ -1162,7 +1162,7 @@ do
1162 local function open (x) 1162 local function open (x)
1163 numopen = numopen + 1 1163 numopen = numopen + 1
1164 return 1164 return
1165 function () -- iteraction function 1165 function () -- iteration function
1166 x = x - 1 1166 x = x - 1
1167 if x > 0 then return x end 1167 if x > 0 then return x end
1168 end, 1168 end,
diff --git a/testes/main.lua b/testes/main.lua
index bf3c898e..eb63d588 100644
--- a/testes/main.lua
+++ b/testes/main.lua
@@ -226,7 +226,7 @@ RUN("lua -l 'str=string' '-lm=math' -e 'print(m.sin(0))' %s > %s", prog, out)
226checkout("0.0\nALO ALO\t20\n") 226checkout("0.0\nALO ALO\t20\n")
227 227
228 228
229-- test module names with version sufix ("libs/lib2-v2") 229-- test module names with version suffix ("libs/lib2-v2")
230RUN("env LUA_CPATH='./libs/?.so' lua -l lib2-v2 -e 'print(lib2.id())' > %s", 230RUN("env LUA_CPATH='./libs/?.so' lua -l lib2-v2 -e 'print(lib2.id())' > %s",
231 out) 231 out)
232checkout("true\n") 232checkout("true\n")
@@ -347,7 +347,7 @@ checkout("a\n")
347RUN([[lua "-eprint(1)" -ea=3 -e "print(a)" > %s]], out) 347RUN([[lua "-eprint(1)" -ea=3 -e "print(a)" > %s]], out)
348checkout("1\n3\n") 348checkout("1\n3\n")
349 349
350-- test iteractive mode 350-- test interactive mode
351prepfile[[ 351prepfile[[
352(6*2-6) -- === 352(6*2-6) -- ===
353a = 353a =
diff --git a/testes/math.lua b/testes/math.lua
index bad8bc5e..88a57ce7 100644
--- a/testes/math.lua
+++ b/testes/math.lua
@@ -1071,7 +1071,7 @@ do
1071 assert(x == tonumber(tostring(x))) 1071 assert(x == tonumber(tostring(x)))
1072 end 1072 end
1073 1073
1074 -- different numbers shold print differently. 1074 -- different numbers should print differently.
1075 -- check pairs of floats with minimum detectable difference 1075 -- check pairs of floats with minimum detectable difference
1076 local p = floatbits - 1 1076 local p = floatbits - 1
1077 for i = 1, maxexp - 1 do 1077 for i = 1, maxexp - 1 do
diff --git a/testes/nextvar.lua b/testes/nextvar.lua
index 031ad3fd..679cb1e4 100644
--- a/testes/nextvar.lua
+++ b/testes/nextvar.lua
@@ -227,7 +227,7 @@ for i = 1,lim do
227end 227end
228 228
229 229
230-- insert and delete elements until a rehash occurr. Caller must ensure 230-- insert and delete elements until a rehash occur. Caller must ensure
231-- that a rehash will change the shape of the table. Must repeat because 231-- that a rehash will change the shape of the table. Must repeat because
232-- the insertion may collide with the deleted element, and then there is 232-- the insertion may collide with the deleted element, and then there is
233-- no rehash. 233-- no rehash.
@@ -349,7 +349,7 @@ a,b,c = 1,2,3
349a,b,c = nil 349a,b,c = nil
350 350
351 351
352-- next uses always the same iteraction function 352-- next uses always the same iteration function
353assert(next{} == next{}) 353assert(next{} == next{})
354 354
355local function find (name) 355local function find (name)
diff --git a/testes/pm.lua b/testes/pm.lua
index 2a0cfb0b..ab19eb5d 100644
--- a/testes/pm.lua
+++ b/testes/pm.lua
@@ -23,9 +23,9 @@ a,b = string.find('alo', '')
23assert(a == 1 and b == 0) 23assert(a == 1 and b == 0)
24a,b = string.find('a\0o a\0o a\0o', 'a', 1) -- first position 24a,b = string.find('a\0o a\0o a\0o', 'a', 1) -- first position
25assert(a == 1 and b == 1) 25assert(a == 1 and b == 1)
26a,b = string.find('a\0o a\0o a\0o', 'a\0o', 2) -- starts in the midle 26a,b = string.find('a\0o a\0o a\0o', 'a\0o', 2) -- starts in the middle
27assert(a == 5 and b == 7) 27assert(a == 5 and b == 7)
28a,b = string.find('a\0o a\0o a\0o', 'a\0o', 9) -- starts in the midle 28a,b = string.find('a\0o a\0o a\0o', 'a\0o', 9) -- starts in the middle
29assert(a == 9 and b == 11) 29assert(a == 9 and b == 11)
30a,b = string.find('a\0a\0a\0a\0\0ab', '\0ab', 2); -- finds at the end 30a,b = string.find('a\0a\0a\0a\0\0ab', '\0ab', 2); -- finds at the end
31assert(a == 9 and b == 11); 31assert(a == 9 and b == 11);
diff --git a/testes/utf8.lua b/testes/utf8.lua
index 0704782c..d0c0184d 100644
--- a/testes/utf8.lua
+++ b/testes/utf8.lua
@@ -134,7 +134,7 @@ do
134 errorcodes("\xbfinvalid") 134 errorcodes("\xbfinvalid")
135 errorcodes("αλφ\xBFα") 135 errorcodes("αλφ\xBFα")
136 136
137 -- calling interation function with invalid arguments 137 -- calling iteration function with invalid arguments
138 local f = utf8.codes("") 138 local f = utf8.codes("")
139 assert(f("", 2) == nil) 139 assert(f("", 2) == nil)
140 assert(f("", -1) == nil) 140 assert(f("", -1) == nil)