From e5709c5aec1caeeb8f23d50339445f63f80a313e Mon Sep 17 00:00:00 2001 From: giles Date: Sat, 9 May 2026 02:41:58 +0000 Subject: [PATCH] js-on-sx: lexer rejects bare backslash in source --- lib/js/lexer.sx | 2 ++ plans/js-on-sx.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/js/lexer.sx b/lib/js/lexer.sx index 13f82904..6bb37fc0 100644 --- a/lib/js/lexer.sx +++ b/lib/js/lexer.sx @@ -680,6 +680,8 @@ (do (js-emit! "op" "^" start) (advance! 1))) ((= ch "~") (do (js-emit! "op" "~" start) (advance! 1))) + ((= ch "\\") + (error "Unexpected char '\\' in source")) (else (advance! 1))))) (define scan! diff --git a/plans/js-on-sx.md b/plans/js-on-sx.md index d6b464ec..bf8f0d20 100644 --- a/plans/js-on-sx.md +++ b/plans/js-on-sx.md @@ -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 — **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. - 2026-05-09 — **`Object.getOwnPropertyDescriptor` now returns descriptors for arrays and strings, not just dicts.** Was: `(if (and (dict? o) ...) {...} :js-undefined)` — every list and string returned `undefined`. Extended: lists give `{value: arr[i], writable: true, enumerable: true, configurable: true}` for valid integer indices, plus `{value: arr.length, writable: true, enumerable: false, configurable: false}` for `"length"`. Strings give read-only descriptors for `"length"` and individual code units. The integer-index test reuses `js-int-key?` (added earlier for `__js_order__` integer-key sorting). Result: built-ins/Object/getOwnPropertyDescriptor 50/60 → 54/60, language/arguments-object 12/30 → 13/30. Array unchanged. conformance.sh: 148/148.