lua: string.byte(s,i,j) supports ranges, returns multi-values
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -990,10 +990,28 @@
|
|||||||
lua-string-byte
|
lua-string-byte
|
||||||
(fn (&rest args)
|
(fn (&rest args)
|
||||||
(let ((s (first args))
|
(let ((s (first args))
|
||||||
(i (if (> (len args) 1) (nth args 1) 1)))
|
(i-raw (if (> (len args) 1) (nth args 1) nil))
|
||||||
(cond
|
(j-raw (if (> (len args) 2) (nth args 2) nil)))
|
||||||
((or (< i 1) (> i (len s))) nil)
|
(let ((i (if (= i-raw nil) 1 i-raw)))
|
||||||
(else (char-code (char-at s (- i 1))))))))
|
(let ((j (if (= j-raw nil) i j-raw)))
|
||||||
|
(let ((slen (len s)))
|
||||||
|
(let ((ni (cond ((< i 0) (+ slen i 1)) ((= i 0) 1) (else i)))
|
||||||
|
(nj (cond ((< j 0) (+ slen j 1)) (else j))))
|
||||||
|
(cond
|
||||||
|
((or (< ni 1) (> ni slen) (< nj ni)) nil)
|
||||||
|
((= ni nj) (char-code (char-at s (- ni 1))))
|
||||||
|
(else
|
||||||
|
(let ((out (list (quote lua-multi))))
|
||||||
|
(begin
|
||||||
|
(define
|
||||||
|
b-loop
|
||||||
|
(fn (k)
|
||||||
|
(when (and (<= k nj) (<= k slen))
|
||||||
|
(begin
|
||||||
|
(set! out (append out (list (char-code (char-at s (- k 1))))))
|
||||||
|
(b-loop (+ k 1))))))
|
||||||
|
(b-loop ni)
|
||||||
|
out)))))))))))
|
||||||
|
|
||||||
(define
|
(define
|
||||||
lua-char-one
|
lua-char-one
|
||||||
|
|||||||
@@ -51,19 +51,19 @@
|
|||||||
"name": "attrib.lua",
|
"name": "attrib.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: module 'C' not found\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: module 'C' not found\\\\\\\"\\",
|
||||||
"ms": 6636
|
"ms": 6698
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "big.lua",
|
"name": "big.lua",
|
||||||
"status": "timeout",
|
"status": "timeout",
|
||||||
"reason": "per-test timeout",
|
"reason": "per-test timeout",
|
||||||
"ms": 8008
|
"ms": 8002
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "calls.lua",
|
"name": "calls.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "undefined symbol: fat\\",
|
"reason": "undefined symbol: fat\\",
|
||||||
"ms": 5129
|
"ms": 5168
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "checktable.lua",
|
"name": "checktable.lua",
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
"name": "constructs.lua",
|
"name": "constructs.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to compare incompat",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to compare incompat",
|
||||||
"ms": 6962
|
"ms": 7174
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "db.lua",
|
"name": "db.lua",
|
||||||
@@ -99,13 +99,13 @@
|
|||||||
"name": "errors.lua",
|
"name": "errors.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 3442
|
"ms": 3446
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "events.lua",
|
"name": "events.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 7474
|
"ms": 7749
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "files.lua",
|
"name": "files.lua",
|
||||||
@@ -123,13 +123,13 @@
|
|||||||
"name": "literals.lua",
|
"name": "literals.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 1965
|
"ms": 1931
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "locals.lua",
|
"name": "locals.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||||
"ms": 1784
|
"ms": 1767
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "main.lua",
|
"name": "main.lua",
|
||||||
@@ -141,43 +141,43 @@
|
|||||||
"name": "math.lua",
|
"name": "math.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||||
"ms": 4413
|
"ms": 4412
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nextvar.lua",
|
"name": "nextvar.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 7389
|
"ms": 7512
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pm.lua",
|
"name": "pm.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 6252
|
"ms": 6522
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sort.lua",
|
"name": "sort.lua",
|
||||||
"status": "timeout",
|
"status": "timeout",
|
||||||
"reason": "per-test timeout",
|
"reason": "per-test timeout",
|
||||||
"ms": 8004
|
"ms": 8008
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "strings.lua",
|
"name": "strings.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 4236
|
"ms": 4282
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "vararg.lua",
|
"name": "vararg.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 2348
|
"ms": 2373
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "verybig.lua",
|
"name": "verybig.lua",
|
||||||
"status": "pass",
|
"status": "pass",
|
||||||
"reason": "",
|
"reason": "",
|
||||||
"ms": 1074
|
"ms": 1080
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -18,25 +18,25 @@ fail=12 timeout=3 skip=8 total=24
|
|||||||
|---|---|---|---:|
|
|---|---|---|---:|
|
||||||
| all.lua | skip | driver uses dofile to chain other tests | 0 |
|
| all.lua | skip | driver uses dofile to chain other tests | 0 |
|
||||||
| api.lua | skip | requires testC (C debug library) | 0 |
|
| api.lua | skip | requires testC (C debug library) | 0 |
|
||||||
| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: module 'C' not found\\\"\ | 6636 |
|
| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: module 'C' not found\\\"\ | 6698 |
|
||||||
| big.lua | timeout | per-test timeout | 8008 |
|
| big.lua | timeout | per-test timeout | 8002 |
|
||||||
| calls.lua | fail | undefined symbol: fat\ | 5129 |
|
| calls.lua | fail | undefined symbol: fat\ | 5168 |
|
||||||
| checktable.lua | skip | internal debug helpers | 0 |
|
| checktable.lua | skip | internal debug helpers | 0 |
|
||||||
| closure.lua | timeout | per-test timeout | 8001 |
|
| closure.lua | timeout | per-test timeout | 8001 |
|
||||||
| code.lua | skip | bytecode inspection via debug library | 0 |
|
| code.lua | skip | bytecode inspection via debug library | 0 |
|
||||||
| constructs.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to compare incompat | 6962 |
|
| constructs.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to compare incompat | 7174 |
|
||||||
| db.lua | skip | debug library | 0 |
|
| db.lua | skip | debug library | 0 |
|
||||||
| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3442 |
|
| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3446 |
|
||||||
| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7474 |
|
| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7749 |
|
||||||
| files.lua | skip | io library | 0 |
|
| files.lua | skip | io library | 0 |
|
||||||
| gc.lua | skip | collectgarbage / finalisers | 0 |
|
| gc.lua | skip | collectgarbage / finalisers | 0 |
|
||||||
| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1965 |
|
| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1931 |
|
||||||
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1784 |
|
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1767 |
|
||||||
| main.lua | skip | standalone interpreter driver | 0 |
|
| main.lua | skip | standalone interpreter driver | 0 |
|
||||||
| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 4413 |
|
| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 4412 |
|
||||||
| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7389 |
|
| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7512 |
|
||||||
| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6252 |
|
| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6522 |
|
||||||
| sort.lua | timeout | per-test timeout | 8004 |
|
| sort.lua | timeout | per-test timeout | 8008 |
|
||||||
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4236 |
|
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4282 |
|
||||||
| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2348 |
|
| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2373 |
|
||||||
| verybig.lua | pass | - | 1074 |
|
| verybig.lua | pass | - | 1080 |
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ Each item: implement → tests → tick box → update progress log.
|
|||||||
|
|
||||||
_Newest first. Agent appends on every commit._
|
_Newest first. Agent appends on every commit._
|
||||||
|
|
||||||
|
- 2026-04-25: lua: scoreboard iteration — `string.byte(s, i, j)` now returns multi-values for ranges (was single byte only). 393/393 green; scoreboard unchanged.
|
||||||
- 2026-04-25: lua: scoreboard iteration — `math.sinh`/`cosh`/`tanh` (Lua 5.1 hyperbolic). 393/393 green; scoreboard unchanged.
|
- 2026-04-25: lua: scoreboard iteration — `math.sinh`/`cosh`/`tanh` (Lua 5.1 hyperbolic). 393/393 green; scoreboard unchanged.
|
||||||
- 2026-04-25: lua: scoreboard iteration — tried two-phase eval (extract top-level `function f` decls, evaluate them BEFORE the guard so they leak to top-level env, then run the rest inside guard). Broke method-decl tests because `function a:add(...)` requires `a` to exist, and `a = {...}` was in the deferred phase-2. Reverted. Real fix needs `_G` table or AST-level rewriting of top-level returns into chunk-result mutations. 393/393 green.
|
- 2026-04-25: lua: scoreboard iteration — tried two-phase eval (extract top-level `function f` decls, evaluate them BEFORE the guard so they leak to top-level env, then run the rest inside guard). Broke method-decl tests because `function a:add(...)` requires `a` to exist, and `a = {...}` was in the deferred phase-2. Reverted. Real fix needs `_G` table or AST-level rewriting of top-level returns into chunk-result mutations. 393/393 green.
|
||||||
- 2026-04-25: lua: scoreboard iteration — `string.dump` stub (returns string-of-fn). Diagnosed calls.lua: file ENDS with `return deep` (line 295), which makes my `lua-has-top-return?` correctly return true, triggering the guard, which scopes user defines and breaks loadstring's lexical capture of `fat`. The fix would require either rewriting top-level returns into a different mechanism (post-processing the AST) or implementing a real `_G` global table for global assignment/lookup. Both larger.
|
- 2026-04-25: lua: scoreboard iteration — `string.dump` stub (returns string-of-fn). Diagnosed calls.lua: file ENDS with `return deep` (line 295), which makes my `lua-has-top-return?` correctly return true, triggering the guard, which scopes user defines and breaks loadstring's lexical capture of `fat`. The fix would require either rewriting top-level returns into a different mechanism (post-processing the AST) or implementing a real `_G` global table for global assignment/lookup. Both larger.
|
||||||
|
|||||||
Reference in New Issue
Block a user