Commit graph

7 commits

Author SHA1 Message Date
kommander
2c721e5b69 feat(codemode): collate localeCompare like the reference's host
localeCompare used a case-folding heuristic that disagreed with the
reference on 634 of 4,841 sampled pairs (accents, punctuation, canonical
equivalence, scripts). It now uses ICU4X's root collation, which the
reference's host uses for its en-US default, and agrees on all of them.

Dependency: icu_collator 2.4 with compiled data (pure Rust, Unicode's
ICU4X). It adds 1,247,048 bytes to the stripped embed example
(4,785,968 -> 6,033,016; bench/RESULTS.md (d) updated); nearly all of that is the root collation table,
so generating data for the root locale alone saves under 1 KB.
2026-11-18 18:56:11 +01:00
kommander
aa0cd870b4 feat(codemode): add URL, URLSearchParams, Headers, crypto and structuredClone
URL with its readable and writable fields and a linked searchParams,
URL.canParse/parse; URLSearchParams from strings, records, pairs and
other params, with live iterators; Headers with name and value
validation, combined values and set-cookie kept apart in the host's
order; crypto.randomUUID and getRandomValues from /dev/urandom; and
structuredClone over the data kinds, rejecting the rest with
DataCloneError. Writing a read-only accessor (RegExp flags, Uint8Array
length, size, TextDecoder fields, URL origin) throws the reference's
TypeError.

Adds the url crate (pure Rust WHATWG URL parser) with idna_adapter pinned
to 1.1, which maps IDNA with the unicode-rs crates instead of ICU4X; the
stripped embed example grows from 3512936 to 3879376 bytes.

Built-in iterators over URLSearchParams and Headers report the reference's tags.
2026-11-18 18:56:09 +01:00
kommander
2a7c0b5296 feat(codemode): add Date
The Date constructor in every form, Date.now/parse/UTC, the local and UTC
getters and setters with the reference's coercion order and invalid-date
rules, and the string forms: deterministic ISO toString, en-US UTC locale
strings, host-local toDateString/toTimeString, toUTCString. Date.parse
follows JavaScriptCore: the ISO format first, then the legacy formats.
Dates take the string hint for default ToPrimitive and serialize through
toJSON.

Local time follows the host zone (TZ, else /etc/localtime) through the
tz-rs crate (pure Rust TZif reader, no dependencies); with this commit's
Date code the stripped embed example grows from 3178872 to 3262504 bytes.
2026-11-18 18:56:09 +01:00
kommander
7dd5025216 feat(codemode): add String normalize, raw, isWellFormed and toWellFormed
normalize uses the unicode-normalization crate (pure Rust, the standard
NFC/NFD/NFKC/NFKD tables); the stripped embed example grows from 3047304
to 3178872 bytes. Program strings are UTF-8, so isWellFormed is always
true and toWellFormed returns its receiver. repeat and padStart report the
reference's limit errors.
2026-11-18 18:56:09 +01:00
kommander
fccbad7d9e feat(codemode): add RegExp and regex-aware String methods
Regular expression literals, the RegExp constructor with flags, lastIndex,
exec/test, RegExp.escape, and match, matchAll, search, replace, replaceAll
and split with regex patterns, replacement templates and function
replacers.

Adds the regress crate (pure Rust, ECMAScript regex semantics, UTF-16
matching); the stripped embed example grows from 2139576 to 3047304 bytes.

The RegExp pattern, exec/test input and lastIndex convert without consulting program methods, as the reference's coerceToString/coerceToNumber do. test262: the files this fixes leave rust-skipped.txt, and the reference's skipped.txt drops Array lastIndexOf 15.4.4.15-5-21, which the reference passes since its Array arguments go through ToPrimitive.
2026-11-18 18:56:09 +01:00
Sebastian
ee90bf2aa2 test(codemode): add a test262 parity runner for the Rust port
Runs the reference's pinned test262 file set, synced by the reference's own
script, with the reference harness semantics. test262/rust-skipped.txt lists
the files that fail here but pass in the reference; the runner fails on an
unlisted failure and on a listed file that passes.
2026-11-18 18:53:57 +01:00
Sebastian
f71cdee242 feat(codemode): add embeddable Rust port 2026-11-18 18:53:56 +01:00