js-on-sx: parseFloat recognises Infinity prefix
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
This commit is contained in:
@@ -4505,11 +4505,33 @@
|
||||
js-parse-float-prefix
|
||||
(fn
|
||||
(s)
|
||||
(let
|
||||
((end (js-float-prefix-end s 0 false false false)))
|
||||
(cond
|
||||
((= end 0) (js-nan-value))
|
||||
(else (js-parse-num-safe (js-string-slice s 0 end)))))))
|
||||
(cond
|
||||
((js-float-has-infinity-prefix? s 0)
|
||||
(js-infinity-value))
|
||||
((and
|
||||
(>= (len s) 1)
|
||||
(= (char-at s 0) "+")
|
||||
(js-float-has-infinity-prefix? s 1))
|
||||
(js-infinity-value))
|
||||
((and
|
||||
(>= (len s) 1)
|
||||
(= (char-at s 0) "-")
|
||||
(js-float-has-infinity-prefix? s 1))
|
||||
(- 0 (js-infinity-value)))
|
||||
(else
|
||||
(let
|
||||
((end (js-float-prefix-end s 0 false false false)))
|
||||
(cond
|
||||
((= end 0) (js-nan-value))
|
||||
(else (js-parse-num-safe (js-string-slice s 0 end)))))))))
|
||||
|
||||
(define
|
||||
js-float-has-infinity-prefix?
|
||||
(fn
|
||||
(s i)
|
||||
(and
|
||||
(>= (len s) (+ i 8))
|
||||
(= (js-string-slice s i (+ i 8)) "Infinity"))))
|
||||
|
||||
(define
|
||||
js-float-prefix-end
|
||||
|
||||
@@ -158,6 +158,8 @@ Each item: implement → tests → update progress. Mark `[x]` when tests green.
|
||||
|
||||
Append-only record of completed iterations. Loop writes one line per iteration: date, what was done, test count delta.
|
||||
|
||||
- 2026-05-09 — **`parseFloat` recognises `"Infinity"` / `"±Infinity"` prefixes (not just exact matches).** Per spec, parseFloat parses the longest StrDecimalLiteral prefix — `Infinity` is one — so `parseFloat("Infinity1")`, `parseFloat("Infinityx")`, `parseFloat("Infinity+1")` should all return `Infinity`. Was only matching `s === "Infinity"` / `"+Infinity"` / `"-Infinity"` exactly. Added `js-float-has-infinity-prefix?` helper and three new branches at the top of `js-parse-float-prefix`. Result: built-ins/parseFloat 17/30 → 20/30. conformance.sh: 148/148.
|
||||
|
||||
- 2026-05-09 — **JS lexer rejects bare `\` in source (e.g. `{` outside an identifier-escape context).** Was silently advancing past unknown chars in the punctuator-fallback branch, so `{` became `\` (skipped) + ident `u007B`, and `((1))` parsed as something close to `(1)` after our SX-string layer pre-converted half of them. Now `(else (advance! 1))` is a `(error "Unexpected char '\\' in source")` for `\` specifically (other unknown chars still advance — keeps multi-byte UTF-8 idents working at the byte level). Result: language/punctuators 1/11 → 11/11 (full pass), language/literals 25/30 → 28/30, language/identifiers 11/30 → 13/30. Object/Map unchanged. conformance.sh: 148/148.
|
||||
|
||||
- 2026-05-09 — **Negative-test classifier maps `js-transpile-assign` and any `js-transpile-*` error to SyntaxError.** `language/types/boolean/S8.3_A2.{1,2}.js` (testing `true=1`/`false=0` reject) raises `js-transpile-assign: unsupported target` at our transpile pass — that's a parse-phase error in test262's sense (the source is structurally invalid before any runtime evaluation), but the runner's classifier didn't recognise the prefix and reported the test as failing. Added `js-transpile-assign` and the broader `js-transpile` prefix to the SyntaxError-mappable patterns in `classify_negative_result`. Result: language/types 26/30 → 28/30 (the two `true = 1` / `false = 0` tests). conformance.sh: 148/148.
|
||||
|
||||
Reference in New Issue
Block a user