Commit Graph
10 Commits
Author SHA1 Message Date
Zef Hemel 3fa9c82add Fixes #1598
Lua: Implements %u in os.date()
2025-10-10 09:11:14 +02:00
Zef Hemel 18e78e5006 Lua: fix key deletion in tables 2025-10-09 09:19:58 +02:00
Zef Hemel f9527c8238 Lua: allow passing in a number to tonumber 2025-10-07 09:07:12 +02:00
Zef Hemel 51e1eaf817 /.proxy enhancements
Now cleanly separates request and response headers for the request and
response of the http request from the ones that SB needs/serves itself.
2025-10-06 14:38:00 +02:00
Matouš Jan FialkaandGitHub e91bec71c0 Fix Lua arithmetic model (#1587)
This patch fixes the Lua arithmetic model at parser level only. Runtime
level fixtures are left for future work.

MOTIVATION

Space Lua treats all numbers as IEEE-754 doubles (JS semantics), so it
preserves negative zero. Lua uses integers and floats. The literal "-0"
in Lua is parsed as unary minus applied to the integer literal "0",
which yields the integer "0" (no sign). This difference flips the sign
of the divisor in "1/-0" and "-1/-0". Although it could be fixed without
touching the parser by changing only unary minus evaluation, this commit
goes a little further and provides integer vs float differenciating at
the parser level as well uses it to fix the unary minus evaluation.

Extensive tests are added to test this exact change works and the Space
Lua arithmetic model is aligned with Lua. Note that things like `-(expr)`
in general may still produce results inconsistent with Lua. This cannot
be fixed at parser level and must be fixed at runtime level which will
need far more complex change to the Space Lua interpreter code. Therefor
these cases we omitted from the tests.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-03 16:31:00 +02:00
Matouš Jan FialkaandGitHub 9967cf1fd1 Space Lua: Remove unary plus (#1585)
* Improve documentation on string to number conversion (plus minor fixes of typos)
* Update Lua grammar to disallow unary plus

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-03 08:28:36 +02:00
Zef Hemel df7eff1e3d make fmt 2025-10-01 17:14:54 +02:00
Matouš Jan FialkaandGitHub 80f31da16b Fix arithmetic coercion - refactored and enhanced (#1576)
The Lua 5.4 compatible `tonumber` implementation completely reworked

- custom char-by-char parser (no regexes)
- proper Lua space handling
- support for heximal integers and floats
- support for scientific float notation
- extended tests
- updated website docs

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2025-10-01 11:30:58 +02:00
Zef Hemel d63c7e49a7 Disable js.import tests for now 2025-09-29 15:56:41 +02:00
Zef Hemel f4336bf09f Code restructuring: eliminated the top-level lib/ directory 2025-09-23 17:00:34 +02:00