@scriptc/cli-darwin-x64 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD_PARTY_NOTICES +1 -1
- package/dist/bin/scriptc +0 -0
- package/dist/bin/scriptc.json +1 -1
- package/dist/lib/declarations/scriptc-node-fallback.d.ts +972 -245
- package/dist/lib/declarations/scriptc-overrides.d.ts +5 -1
- package/dist/lib/declarations/scriptc.d.ts +22 -2
- package/dist/lib/llvm/bin/scriptc-llvm-codegen +0 -0
- package/dist/lib/llvm/package.json +1 -1
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_bigint_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_crypto_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_dc.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_dyn_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_ffi.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_ffi_queue.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_inspect.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_loop_epoll.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_loop_kqueue.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_loop_wsapoll.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_path.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_qs.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_test.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_tls_ca.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_url_params.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_util.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_util_style.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_watch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/default-workers/scr_zlib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_island.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/text-decoder-legacy-workers/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/workers/scr_mailbox.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/workers/scr_message.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/workers/scr_worker.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/dev/runtime/workers/scr_worker_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_inspect.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/default/scr_zlib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_inspect.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/default/scr_zlib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/library-thread-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_async_dyn.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_bigint.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_bigint_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_console_native.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_crypto_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_dc.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_dyn_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_dyn_invoke.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_fetch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_ffi.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_ffi_queue.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_grapheme.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_http.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_http2.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_inspect.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_loop_epoll.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_loop_kqueue.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_loop_wsapoll.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_net.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_node_builtin.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_path.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_qs.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_symbol.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_test.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_tls_ca.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_url.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_url_params.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_util.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_util_style.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_watch.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/default-workers/scr_zlib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_array.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_assert.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_async.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_bytes_io.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_child.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_closure.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_console.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_context.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_copying.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_cycle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_dgram.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_error.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_events_emitter.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_exception.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_file_handle.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_island.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_json.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_lib.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_map.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_number.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_object.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_readline.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_regex.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_shared.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_stream.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_string.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_tls.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_union.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic/scr_util_compare.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/text-decoder-legacy-workers/scr_bytes.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/workers/scr_mailbox.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/workers/scr_message.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/workers/scr_worker.o +0 -0
- package/dist/lib/runtime-darwin-x64/artifacts/release/runtime/workers/scr_worker_events.o +0 -0
- package/dist/lib/runtime-darwin-x64/package.json +1 -1
- package/dist/lib/runtime-darwin-x64/runtime-pack.json +3318 -790
- package/dist/lib/runtime-sources/package.json +1 -1
- package/dist/lib/runtime-sources/src/scr_array.c +479 -46
- package/dist/lib/runtime-sources/src/scr_assert.c +3 -3
- package/dist/lib/runtime-sources/src/scr_async.c +401 -71
- package/dist/lib/runtime-sources/src/scr_async.test.ts +16 -6
- package/dist/lib/runtime-sources/src/scr_async_dyn.c +30 -30
- package/dist/lib/runtime-sources/src/scr_bytes.c +487 -221
- package/dist/lib/runtime-sources/src/scr_bytes.test.c +85 -0
- package/dist/lib/runtime-sources/src/scr_bytes_io.c +45 -64
- package/dist/lib/runtime-sources/src/scr_child.c +48 -30
- package/dist/lib/runtime-sources/src/scr_closure.c +21 -11
- package/dist/lib/runtime-sources/src/scr_console.c +27 -5
- package/dist/lib/runtime-sources/src/scr_context.c +167 -0
- package/dist/lib/runtime-sources/src/scr_context.test.c +118 -0
- package/dist/lib/runtime-sources/src/scr_context.test.ts +47 -0
- package/dist/lib/runtime-sources/src/scr_copying.c +13 -2
- package/dist/lib/runtime-sources/src/scr_cycle.c +112 -12
- package/dist/lib/runtime-sources/src/scr_dc.c +8 -8
- package/dist/lib/runtime-sources/src/scr_dgram.c +10 -7
- package/dist/lib/runtime-sources/src/scr_error.c +26 -14
- package/dist/lib/runtime-sources/src/scr_events.c +45 -31
- package/dist/lib/runtime-sources/src/scr_events_emitter.c +34 -1
- package/dist/lib/runtime-sources/src/scr_exception.c +26 -7
- package/dist/lib/runtime-sources/src/scr_fetch.c +23 -20
- package/dist/lib/runtime-sources/src/scr_fetch_curl.c +1 -1
- package/dist/lib/runtime-sources/src/scr_ffi.c +3 -3
- package/dist/lib/runtime-sources/src/scr_file_handle.c +1 -0
- package/dist/lib/runtime-sources/src/scr_http.c +20 -16
- package/dist/lib/runtime-sources/src/scr_http2.c +10 -8
- package/dist/lib/runtime-sources/src/scr_inspect.c +1 -0
- package/dist/lib/runtime-sources/src/scr_island.c +1 -1
- package/dist/lib/runtime-sources/src/scr_json.c +652 -189
- package/dist/lib/runtime-sources/src/scr_json.test.c +339 -1
- package/dist/lib/runtime-sources/src/scr_json.test.ts +59 -25
- package/dist/lib/runtime-sources/src/scr_key.h +92 -0
- package/dist/lib/runtime-sources/src/scr_lib.c +256 -136
- package/dist/lib/runtime-sources/src/scr_mailbox.c +233 -0
- package/dist/lib/runtime-sources/src/scr_mailbox.h +28 -0
- package/dist/lib/runtime-sources/src/scr_mailbox.test.c +86 -0
- package/dist/lib/runtime-sources/src/scr_mailbox.test.ts +46 -0
- package/dist/lib/runtime-sources/src/scr_map.c +240 -107
- package/dist/lib/runtime-sources/src/scr_message.c +443 -0
- package/dist/lib/runtime-sources/src/scr_message.h +14 -0
- package/dist/lib/runtime-sources/src/scr_message.test.c +152 -0
- package/dist/lib/runtime-sources/src/scr_message.test.ts +44 -0
- package/dist/lib/runtime-sources/src/scr_net.c +14 -12
- package/dist/lib/runtime-sources/src/scr_number.c +36 -4
- package/dist/lib/runtime-sources/src/scr_numeric.h +25 -0
- package/dist/lib/runtime-sources/src/scr_numeric.test.c +37 -0
- package/dist/lib/runtime-sources/src/scr_numeric.test.ts +33 -0
- package/dist/lib/runtime-sources/src/scr_object.c +9 -4
- package/dist/lib/runtime-sources/src/scr_path.c +1 -1
- package/dist/lib/runtime-sources/src/scr_readline.c +8 -8
- package/dist/lib/runtime-sources/src/scr_regex.c +351 -167
- package/dist/lib/runtime-sources/src/scr_runtime.h +207 -34
- package/dist/lib/runtime-sources/src/scr_shared.c +280 -0
- package/dist/lib/runtime-sources/src/scr_shared.test.c +113 -0
- package/dist/lib/runtime-sources/src/scr_shared.test.ts +45 -0
- package/dist/lib/runtime-sources/src/scr_stream.c +9 -9
- package/dist/lib/runtime-sources/src/scr_string.c +365 -141
- package/dist/lib/runtime-sources/src/scr_test.c +8 -8
- package/dist/lib/runtime-sources/src/scr_tls.c +12 -12
- package/dist/lib/runtime-sources/src/scr_tls_ca.c +34 -12
- package/dist/lib/runtime-sources/src/scr_union.c +10 -5
- package/dist/lib/runtime-sources/src/scr_util_compare.c +1 -0
- package/dist/lib/runtime-sources/src/scr_util_style.c +11 -11
- package/dist/lib/runtime-sources/src/scr_watch.c +16 -6
- package/dist/lib/runtime-sources/src/scr_worker.c +232 -0
- package/dist/lib/runtime-sources/src/scr_worker.h +42 -0
- package/dist/lib/runtime-sources/src/scr_worker.test.c +115 -0
- package/dist/lib/runtime-sources/src/scr_worker.test.ts +49 -0
- package/dist/lib/runtime-sources/src/scr_worker_events.c +443 -0
- package/dist/lib/runtime-sources/src/scr_zlib.c +6 -0
- package/package.json +1 -1
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
* lre_compile rejects aborts with a clear
|
|
14
14
|
* message (Node throws SyntaxError at parse time — documented divergence;
|
|
15
15
|
* rare, since tsc's parser has already syntax-checked the literal).
|
|
16
|
-
* -
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* like Node. Correctness-first: the conversion is O(n) per call.
|
|
16
|
+
* - ASCII subjects borrow their existing bytes; other subjects use a
|
|
17
|
+
* per-call UTF-16 conversion. Both engine representations report UTF-16
|
|
18
|
+
* code-unit indices, matching .length/slice/charCodeAt.
|
|
20
19
|
* - Match loops mirror quickjs.c's own (JS_RegExpDelete /
|
|
21
20
|
* js_regexp_Symbol_replace): capture buffers are sized by
|
|
22
21
|
* lre_get_alloc_count (NOT capture_count*2 — the executor writes
|
|
@@ -304,6 +303,8 @@ ScrStr *scr_regex_to_string(ScrRegex *re) {
|
|
|
304
303
|
/* Subject as freshly-malloc'd UTF-16 code units (strings are well-formed
|
|
305
304
|
* UTF-8, so no validation). Unit count ≤ byte count. */
|
|
306
305
|
static uint16_t *scr_to_utf16(const ScrStr *s, int *plen) {
|
|
306
|
+
if (s->len > (size_t)INT32_MAX - 1 || s->len > SIZE_MAX / sizeof(uint16_t))
|
|
307
|
+
scr_regex_oom();
|
|
307
308
|
uint16_t *u = malloc((s->len ? s->len : 1) * sizeof(uint16_t));
|
|
308
309
|
if (!u) scr_regex_oom();
|
|
309
310
|
int n = 0;
|
|
@@ -339,53 +340,98 @@ static uint16_t *scr_to_utf16(const ScrStr *s, int *plen) {
|
|
|
339
340
|
return u;
|
|
340
341
|
}
|
|
341
342
|
|
|
342
|
-
/*
|
|
343
|
-
*
|
|
344
|
-
|
|
345
|
-
*
|
|
343
|
+
/* Decode one UTF-16 code point. A boundary that splits a surrogate pair
|
|
344
|
+
* produces U+FFFD, as in the runtime's string slicing contract. */
|
|
345
|
+
static uint32_t scr_regex_codepoint(const uint16_t *units, int *index, int end) {
|
|
346
|
+
uint32_t cp = units[(*index)++];
|
|
347
|
+
if (cp >= 0xD800 && cp < 0xDC00 && *index < end &&
|
|
348
|
+
units[*index] >= 0xDC00 && units[*index] < 0xE000)
|
|
349
|
+
return 0x10000 + ((cp - 0xD800) << 10) + (units[(*index)++] - 0xDC00);
|
|
350
|
+
return cp >= 0xD800 && cp < 0xE000 ? 0xFFFD : cp;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
static size_t scr_regex_encode(char *out, uint32_t cp) {
|
|
354
|
+
if (cp < 0x80) {
|
|
355
|
+
out[0] = (char)cp;
|
|
356
|
+
return 1;
|
|
357
|
+
}
|
|
358
|
+
if (cp < 0x800) {
|
|
359
|
+
out[0] = (char)(0xC0 | (cp >> 6));
|
|
360
|
+
out[1] = (char)(0x80 | (cp & 0x3F));
|
|
361
|
+
return 2;
|
|
362
|
+
}
|
|
363
|
+
if (cp < 0x10000) {
|
|
364
|
+
out[0] = (char)(0xE0 | (cp >> 12));
|
|
365
|
+
out[1] = (char)(0x80 | ((cp >> 6) & 0x3F));
|
|
366
|
+
out[2] = (char)(0x80 | (cp & 0x3F));
|
|
367
|
+
return 3;
|
|
368
|
+
}
|
|
369
|
+
out[0] = (char)(0xF0 | (cp >> 18));
|
|
370
|
+
out[1] = (char)(0x80 | ((cp >> 12) & 0x3F));
|
|
371
|
+
out[2] = (char)(0x80 | ((cp >> 6) & 0x3F));
|
|
372
|
+
out[3] = (char)(0x80 | (cp & 0x3F));
|
|
373
|
+
return 4;
|
|
374
|
+
}
|
|
375
|
+
|
|
346
376
|
static void scr_jb_put_utf16(ScrJsonBuf *b, const uint16_t *u, int start, int end) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
} else if (cp >= 0xD800 && cp < 0xE000) {
|
|
354
|
-
cp = 0xFFFD;
|
|
355
|
-
}
|
|
356
|
-
if (cp < 0x80) {
|
|
357
|
-
scr_jb_putc(b, (char)cp);
|
|
358
|
-
} else if (cp < 0x800) {
|
|
359
|
-
scr_jb_putc(b, (char)(0xC0 | (cp >> 6)));
|
|
360
|
-
scr_jb_putc(b, (char)(0x80 | (cp & 0x3F)));
|
|
361
|
-
} else if (cp < 0x10000) {
|
|
362
|
-
scr_jb_putc(b, (char)(0xE0 | (cp >> 12)));
|
|
363
|
-
scr_jb_putc(b, (char)(0x80 | ((cp >> 6) & 0x3F)));
|
|
364
|
-
scr_jb_putc(b, (char)(0x80 | (cp & 0x3F)));
|
|
365
|
-
} else {
|
|
366
|
-
scr_jb_putc(b, (char)(0xF0 | (cp >> 18)));
|
|
367
|
-
scr_jb_putc(b, (char)(0x80 | ((cp >> 12) & 0x3F)));
|
|
368
|
-
scr_jb_putc(b, (char)(0x80 | ((cp >> 6) & 0x3F)));
|
|
369
|
-
scr_jb_putc(b, (char)(0x80 | (cp & 0x3F)));
|
|
377
|
+
char bytes[256];
|
|
378
|
+
size_t used = 0;
|
|
379
|
+
for (int i = start; i < end;) {
|
|
380
|
+
if (used > sizeof bytes - 4) {
|
|
381
|
+
scr_jb_write(b, bytes, used);
|
|
382
|
+
used = 0;
|
|
370
383
|
}
|
|
384
|
+
used += scr_regex_encode(bytes + used, scr_regex_codepoint(u, &i, end));
|
|
371
385
|
}
|
|
386
|
+
scr_jb_write(b, bytes, used);
|
|
372
387
|
}
|
|
373
388
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
389
|
+
/* Matching owns only the converted subject and oversized register buffer.
|
|
390
|
+
* The caller keeps the original immutable string alive. ASCII bytes are
|
|
391
|
+
* already the engine's one-byte representation, even under /u or /i. */
|
|
392
|
+
typedef struct ScrRegexInput {
|
|
393
|
+
const uint8_t *data;
|
|
394
|
+
uint16_t *utf16;
|
|
395
|
+
int len;
|
|
396
|
+
int wide;
|
|
397
|
+
uint8_t **capture;
|
|
398
|
+
uint8_t *registers[32];
|
|
399
|
+
} ScrRegexInput;
|
|
400
|
+
|
|
401
|
+
static bool scr_text_ascii(const ScrStr *s) {
|
|
402
|
+
size_t i = 0;
|
|
403
|
+
for (; s->len - i >= sizeof(uint64_t); i += sizeof(uint64_t)) {
|
|
404
|
+
uint64_t word;
|
|
405
|
+
memcpy(&word, s->data + i, sizeof word);
|
|
406
|
+
if (word & UINT64_C(0x8080808080808080)) return false;
|
|
407
|
+
}
|
|
408
|
+
for (; i < s->len; i++) {
|
|
409
|
+
if ((unsigned char)s->data[i] >= 0x80) return false;
|
|
410
|
+
}
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
static void scr_regex_input_init(ScrRegexInput *input, const uint8_t *bc,
|
|
415
|
+
const ScrStr *s) {
|
|
416
|
+
if (s->len > (size_t)INT32_MAX - 1) scr_regex_oom();
|
|
417
|
+
input->wide = !scr_text_ascii(s);
|
|
418
|
+
input->utf16 = input->wide ? scr_to_utf16(s, &input->len) : NULL;
|
|
419
|
+
input->data = input->wide ? (const uint8_t *)input->utf16 : (const uint8_t *)s->data;
|
|
420
|
+
if (!input->wide) input->len = (int)s->len;
|
|
421
|
+
/* The executor writes temporary registers beyond the capture pairs. */
|
|
422
|
+
int count = lre_get_alloc_count(bc);
|
|
423
|
+
input->capture = count <= 32 ? input->registers : malloc((size_t)count * sizeof(uint8_t *));
|
|
424
|
+
if (!input->capture) scr_regex_oom();
|
|
379
425
|
}
|
|
380
426
|
|
|
381
|
-
|
|
427
|
+
static void scr_regex_input_dispose(ScrRegexInput *input) {
|
|
428
|
+
if (input->capture != input->registers) free(input->capture);
|
|
429
|
+
free(input->utf16);
|
|
430
|
+
}
|
|
382
431
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
static int scr_exec(uint8_t **capture, const uint8_t *bc, const uint16_t *u,
|
|
387
|
-
int index, int len) {
|
|
388
|
-
int rc = lre_exec(capture, bc, (const uint8_t *)u, index, len, 1, lre_opaque());
|
|
432
|
+
static int scr_exec(ScrRegexInput *input, const uint8_t *bc, int index) {
|
|
433
|
+
int rc = lre_exec(input->capture, bc, input->data, index, input->len,
|
|
434
|
+
input->wide, lre_opaque());
|
|
389
435
|
if (rc < 0) {
|
|
390
436
|
fflush(stdout);
|
|
391
437
|
scr_trap("scriptc: regular expression execution failed\n");
|
|
@@ -393,24 +439,43 @@ static int scr_exec(uint8_t **capture, const uint8_t *bc, const uint16_t *u,
|
|
|
393
439
|
return rc;
|
|
394
440
|
}
|
|
395
441
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
if (
|
|
403
|
-
|
|
442
|
+
static int scr_capture_index(const ScrRegexInput *input, const uint8_t *capture) {
|
|
443
|
+
return (int)((capture - input->data) >> input->wide);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
static void scr_regex_put_span(ScrJsonBuf *b, const ScrRegexInput *input,
|
|
447
|
+
int start, int end) {
|
|
448
|
+
if (input->wide) scr_jb_put_utf16(b, input->utf16, start, end);
|
|
449
|
+
else scr_jb_write(b, (const char *)input->data + start, (size_t)(end - start));
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
static ScrStr *scr_regex_span(const ScrRegexInput *input, int start, int end) {
|
|
453
|
+
if (!input->wide)
|
|
454
|
+
return scr_str_new((const char *)input->data + start, (size_t)(end - start));
|
|
455
|
+
/* Captures have a known span: allocate its exact UTF-8 length instead
|
|
456
|
+
* of inheriting a general builder's size hint from an earlier document. */
|
|
457
|
+
size_t bytes = 0;
|
|
458
|
+
for (int i = start; i < end;) {
|
|
459
|
+
uint32_t cp = scr_regex_codepoint(input->utf16, &i, end);
|
|
460
|
+
size_t width = cp < 0x80 ? 1 : cp < 0x800 ? 2 : cp < 0x10000 ? 3 : 4;
|
|
461
|
+
if (width > SIZE_MAX - sizeof(ScrStr) - 1 - bytes) scr_regex_oom();
|
|
462
|
+
bytes += width;
|
|
463
|
+
}
|
|
464
|
+
ScrStr *out = scr_str_alloc_raw(bytes, bytes);
|
|
465
|
+
size_t offset = 0;
|
|
466
|
+
for (int i = start; i < end;)
|
|
467
|
+
offset += scr_regex_encode(out->data + offset, scr_regex_codepoint(input->utf16, &i, end));
|
|
468
|
+
out->data[bytes] = '\0';
|
|
469
|
+
return out;
|
|
404
470
|
}
|
|
405
471
|
|
|
406
472
|
/* ECMA-262 AdvanceStringIndex: past a whole surrogate pair under /u, one
|
|
407
|
-
* code unit otherwise
|
|
408
|
-
*
|
|
409
|
-
|
|
410
|
-
if (unicode && i + 1 < len &&
|
|
411
|
-
u[i + 1] >= 0xDC00 && u[i + 1] < 0xE000)
|
|
473
|
+
* code unit otherwise. ASCII cannot contain a surrogate pair. */
|
|
474
|
+
static int scr_advance(const ScrRegexInput *input, int i, bool unicode) {
|
|
475
|
+
const uint16_t *u = input->utf16;
|
|
476
|
+
if (unicode && input->wide && i + 1 < input->len &&
|
|
477
|
+
u[i] >= 0xD800 && u[i] < 0xDC00 && u[i + 1] >= 0xDC00 && u[i + 1] < 0xE000)
|
|
412
478
|
return i + 2;
|
|
413
|
-
}
|
|
414
479
|
return i + 1;
|
|
415
480
|
}
|
|
416
481
|
|
|
@@ -427,40 +492,17 @@ static int scr_regex_start(ScrRegex *re, int len) {
|
|
|
427
492
|
return (int)floor(index);
|
|
428
493
|
}
|
|
429
494
|
|
|
430
|
-
/* A predicate needs only
|
|
431
|
-
* result metadata. Short ASCII subjects already have the engine's one-byte
|
|
432
|
-
* representation. Bound that scan so a long mixed-text subject does not
|
|
433
|
-
* traverse an ASCII prefix twice before matching. Other subjects use exec's
|
|
434
|
-
* UTF-16 conversion. Register storage is bounded by alloc_count, not captures. */
|
|
495
|
+
/* A predicate needs only boundaries; it never materializes result strings. */
|
|
435
496
|
bool scr_regex_test(ScrRegex *re, ScrStr *s) {
|
|
436
497
|
uint8_t *bc = scr_regex_bc(re);
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
for (; ascii && s->len - i >= sizeof(uint64_t); i += sizeof(uint64_t)) {
|
|
440
|
-
uint64_t word;
|
|
441
|
-
memcpy(&word, s->data + i, sizeof word);
|
|
442
|
-
if (word & UINT64_C(0x8080808080808080)) ascii = false;
|
|
443
|
-
}
|
|
444
|
-
for (; ascii && i < s->len; i++) {
|
|
445
|
-
if ((unsigned char)s->data[i] >= 0x80) ascii = false;
|
|
446
|
-
}
|
|
447
|
-
int len;
|
|
448
|
-
uint16_t *converted = ascii ? NULL : scr_to_utf16(s, &len);
|
|
449
|
-
const uint8_t *subject = ascii ? (const uint8_t *)s->data : (const uint8_t *)converted;
|
|
450
|
-
if (ascii) len = (int)s->len;
|
|
451
|
-
uint8_t *registers[32];
|
|
452
|
-
uint8_t **capture = lre_get_alloc_count(bc) <= 32 ? registers : scr_capture_alloc(bc);
|
|
498
|
+
ScrRegexInput input;
|
|
499
|
+
scr_regex_input_init(&input, bc, s);
|
|
453
500
|
bool stateful = (lre_get_flags(bc) & (LRE_FLAG_GLOBAL | LRE_FLAG_STICKY)) != 0;
|
|
454
|
-
int pos = stateful ? scr_regex_start(re, len) : 0;
|
|
455
|
-
int rc = pos < 0 ? 0 :
|
|
456
|
-
if (rc < 0) {
|
|
457
|
-
fflush(stdout);
|
|
458
|
-
scr_trap("scriptc: regular expression execution failed\n");
|
|
459
|
-
}
|
|
501
|
+
int pos = stateful ? scr_regex_start(re, input.len) : 0;
|
|
502
|
+
int rc = pos < 0 ? 0 : scr_exec(&input, bc, pos);
|
|
460
503
|
if (stateful) re->last_index = rc == 1
|
|
461
|
-
? (double)(
|
|
462
|
-
|
|
463
|
-
free(converted);
|
|
504
|
+
? (double)scr_capture_index(&input, input.capture[1]) : 0;
|
|
505
|
+
scr_regex_input_dispose(&input);
|
|
464
506
|
return rc == 1;
|
|
465
507
|
}
|
|
466
508
|
|
|
@@ -474,20 +516,20 @@ bool scr_regex_test(ScrRegex *re, ScrStr *s) {
|
|
|
474
516
|
ScrArr *scr_regex_exec(ScrStr *s, ScrRegex *re) {
|
|
475
517
|
uint8_t *bc = scr_regex_bc(re);
|
|
476
518
|
bool stateful = (lre_get_flags(bc) & (LRE_FLAG_GLOBAL | LRE_FLAG_STICKY)) != 0;
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
519
|
+
ScrRegexInput input;
|
|
520
|
+
scr_regex_input_init(&input, bc, s);
|
|
521
|
+
int len = input.len;
|
|
522
|
+
uint8_t **capture = input.capture;
|
|
480
523
|
int pos = stateful ? scr_regex_start(re, len) : 0;
|
|
481
|
-
int rc = pos < 0 ? 0 : scr_exec(
|
|
524
|
+
int rc = pos < 0 ? 0 : scr_exec(&input, bc, pos);
|
|
482
525
|
if (stateful) re->last_index = rc == 1
|
|
483
|
-
? (double)(
|
|
526
|
+
? (double)scr_capture_index(&input, capture[1]) : 0;
|
|
484
527
|
ScrArr *out = NULL;
|
|
485
528
|
if (rc == 1) {
|
|
486
|
-
const uint8_t *ubase = (const uint8_t *)u;
|
|
487
529
|
int count = lre_get_capture_count(bc);
|
|
488
530
|
out = scr_arr_new(SCR_ELEM_STR, (size_t)count);
|
|
489
531
|
out->metadata = scr_dyn_new_obj();
|
|
490
|
-
scr_dyn_obj_set(out->metadata, "index", 5, scr_dyn_new_num((double)(
|
|
532
|
+
scr_dyn_obj_set(out->metadata, "index", 5, scr_dyn_new_num((double)scr_capture_index(&input, capture[0])));
|
|
491
533
|
scr_dyn_obj_set(out->metadata, "input", 5, scr_dyn_new_str(s));
|
|
492
534
|
for (int k = 0; k < count; k++) {
|
|
493
535
|
const uint8_t *cs = capture[2 * k], *ce = capture[2 * k + 1];
|
|
@@ -495,12 +537,11 @@ ScrArr *scr_regex_exec(ScrStr *s, ScrRegex *re) {
|
|
|
495
537
|
scr_arr_set_undefined(out, (double)out->len);
|
|
496
538
|
} else {
|
|
497
539
|
scr_arr_push_ref(
|
|
498
|
-
out,
|
|
540
|
+
out, scr_regex_span(&input, scr_capture_index(&input, cs), scr_capture_index(&input, ce)));
|
|
499
541
|
}
|
|
500
542
|
}
|
|
501
543
|
}
|
|
502
|
-
|
|
503
|
-
free(u);
|
|
544
|
+
scr_regex_input_dispose(&input);
|
|
504
545
|
return out; /* +1, or NULL (no match) */
|
|
505
546
|
}
|
|
506
547
|
|
|
@@ -515,22 +556,21 @@ ScrArr *scr_regex_match(ScrStr *s, ScrRegex *re) {
|
|
|
515
556
|
if (!(flags & LRE_FLAG_GLOBAL)) return scr_regex_exec(s, re);
|
|
516
557
|
re->last_index = 0;
|
|
517
558
|
bool unicode = (flags & (LRE_FLAG_UNICODE | LRE_FLAG_UNICODE_SETS)) != 0;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
559
|
+
ScrRegexInput input;
|
|
560
|
+
scr_regex_input_init(&input, bc, s);
|
|
561
|
+
int len = input.len;
|
|
562
|
+
uint8_t **capture = input.capture;
|
|
522
563
|
ScrArr *out = NULL;
|
|
523
564
|
int pos = scr_regex_start(re, len);
|
|
524
565
|
if (pos < 0) pos = len + 1;
|
|
525
|
-
while (pos <= len && scr_exec(
|
|
526
|
-
int start = (
|
|
527
|
-
int end = (
|
|
566
|
+
while (pos <= len && scr_exec(&input, bc, pos) == 1) {
|
|
567
|
+
int start = scr_capture_index(&input, capture[0]);
|
|
568
|
+
int end = scr_capture_index(&input, capture[1]);
|
|
528
569
|
if (!out) out = scr_arr_new(SCR_ELEM_STR, 4);
|
|
529
|
-
scr_arr_push_ref(out,
|
|
530
|
-
pos = start == end ? scr_advance(
|
|
570
|
+
scr_arr_push_ref(out, scr_regex_span(&input, start, end));
|
|
571
|
+
pos = start == end ? scr_advance(&input, end, unicode) : end;
|
|
531
572
|
}
|
|
532
|
-
|
|
533
|
-
free(u);
|
|
573
|
+
scr_regex_input_dispose(&input);
|
|
534
574
|
return out;
|
|
535
575
|
}
|
|
536
576
|
|
|
@@ -543,14 +583,13 @@ ScrArr *scr_regex_match(ScrStr *s, ScrRegex *re) {
|
|
|
543
583
|
* bytecode omits the implicit forward scan) — exactly Node. */
|
|
544
584
|
double scr_regex_search(ScrStr *s, ScrRegex *re) {
|
|
545
585
|
uint8_t *bc = scr_regex_bc(re);
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
uint8_t **capture =
|
|
549
|
-
int rc = scr_exec(
|
|
586
|
+
ScrRegexInput input;
|
|
587
|
+
scr_regex_input_init(&input, bc, s);
|
|
588
|
+
uint8_t **capture = input.capture;
|
|
589
|
+
int rc = scr_exec(&input, bc, 0);
|
|
550
590
|
double out = -1;
|
|
551
|
-
if (rc == 1) out = (double)(
|
|
552
|
-
|
|
553
|
-
free(u);
|
|
591
|
+
if (rc == 1) out = (double)scr_capture_index(&input, capture[0]);
|
|
592
|
+
scr_regex_input_dispose(&input);
|
|
554
593
|
return out;
|
|
555
594
|
}
|
|
556
595
|
|
|
@@ -574,17 +613,17 @@ static ScrArr *scr_regex_match_all_core(ScrStr *s, ScrRegex *re, ScrArr *indices
|
|
|
574
613
|
}
|
|
575
614
|
bool unicode = (re_flags & (LRE_FLAG_UNICODE | LRE_FLAG_UNICODE_SETS)) != 0;
|
|
576
615
|
int capture_count = lre_get_capture_count(bc);
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
616
|
+
ScrRegexInput input;
|
|
617
|
+
scr_regex_input_init(&input, bc, s);
|
|
618
|
+
int len = input.len;
|
|
619
|
+
uint8_t **capture = input.capture;
|
|
581
620
|
ScrArr *out = scr_arr_new(SCR_ELEM_ARR, 4);
|
|
582
621
|
int pos = scr_regex_start(re, len);
|
|
583
622
|
if (pos < 0) pos = len + 1;
|
|
584
623
|
while (pos <= len) {
|
|
585
|
-
if (scr_exec(
|
|
586
|
-
int start = (
|
|
587
|
-
int end = (
|
|
624
|
+
if (scr_exec(&input, bc, pos) != 1) break;
|
|
625
|
+
int start = scr_capture_index(&input, capture[0]);
|
|
626
|
+
int end = scr_capture_index(&input, capture[1]);
|
|
588
627
|
ScrArr *row = scr_arr_new(SCR_ELEM_STR, (size_t)capture_count);
|
|
589
628
|
for (int k = 0; k < capture_count; k++) {
|
|
590
629
|
const uint8_t *cs = capture[2 * k], *ce = capture[2 * k + 1];
|
|
@@ -592,15 +631,14 @@ static ScrArr *scr_regex_match_all_core(ScrStr *s, ScrRegex *re, ScrArr *indices
|
|
|
592
631
|
scr_arr_set_undefined(row, (double)row->len);
|
|
593
632
|
} else {
|
|
594
633
|
scr_arr_push_ref(
|
|
595
|
-
row,
|
|
634
|
+
row, scr_regex_span(&input, scr_capture_index(&input, cs), scr_capture_index(&input, ce)));
|
|
596
635
|
}
|
|
597
636
|
}
|
|
598
637
|
scr_arr_push_ref(out, row);
|
|
599
638
|
if (indices != NULL) scr_arr_push_f64(indices, (double)start);
|
|
600
|
-
pos = end == start ? scr_advance(
|
|
639
|
+
pos = end == start ? scr_advance(&input, end, unicode) : end;
|
|
601
640
|
}
|
|
602
|
-
|
|
603
|
-
free(u);
|
|
641
|
+
scr_regex_input_dispose(&input);
|
|
604
642
|
return out; /* +1 (possibly empty — Node's no-match drain is []) */
|
|
605
643
|
}
|
|
606
644
|
|
|
@@ -628,17 +666,18 @@ ScrArr *scr_regex_match_all_into(ScrStr *s, ScrRegex *re, ScrArr *indices) {
|
|
|
628
666
|
* — also Node's unterminated-'$<name' answer either way. The template is
|
|
629
667
|
* scanned byte-wise: every '$' directive is ASCII, and UTF-8 continuation
|
|
630
668
|
* bytes can never alias it. */
|
|
631
|
-
static void scr_put_substitution(ScrJsonBuf *b, const
|
|
669
|
+
static void scr_put_substitution(ScrJsonBuf *b, const ScrRegexInput *input,
|
|
632
670
|
int start, int end, uint8_t **capture,
|
|
633
671
|
int capture_count, const char *groupnames,
|
|
634
672
|
const ScrStr *rep) {
|
|
635
|
-
const uint8_t *ubase = (const uint8_t *)u;
|
|
636
673
|
size_t i = 0;
|
|
637
674
|
while (i < rep->len) {
|
|
638
675
|
char c = rep->data[i];
|
|
639
676
|
if (c != '$' || i + 1 >= rep->len) {
|
|
640
|
-
|
|
641
|
-
|
|
677
|
+
const char *next = memchr(rep->data + i + 1, '$', rep->len - i - 1);
|
|
678
|
+
size_t end = next ? (size_t)(next - rep->data) : rep->len;
|
|
679
|
+
scr_jb_write(b, rep->data + i, end - i);
|
|
680
|
+
i = end;
|
|
642
681
|
continue;
|
|
643
682
|
}
|
|
644
683
|
char c1 = rep->data[i + 1];
|
|
@@ -646,13 +685,13 @@ static void scr_put_substitution(ScrJsonBuf *b, const uint16_t *u, int len,
|
|
|
646
685
|
scr_jb_putc(b, '$');
|
|
647
686
|
i += 2;
|
|
648
687
|
} else if (c1 == '&') {
|
|
649
|
-
|
|
688
|
+
scr_regex_put_span(b, input, start, end);
|
|
650
689
|
i += 2;
|
|
651
690
|
} else if (c1 == '`') {
|
|
652
|
-
|
|
691
|
+
scr_regex_put_span(b, input, 0, start);
|
|
653
692
|
i += 2;
|
|
654
693
|
} else if (c1 == '\'') {
|
|
655
|
-
|
|
694
|
+
scr_regex_put_span(b, input, end, input->len);
|
|
656
695
|
i += 2;
|
|
657
696
|
} else if (c1 >= '0' && c1 <= '9') {
|
|
658
697
|
int k = c1 - '0';
|
|
@@ -667,7 +706,7 @@ static void scr_put_substitution(ScrJsonBuf *b, const uint16_t *u, int len,
|
|
|
667
706
|
if (k >= 1 && k < capture_count) {
|
|
668
707
|
const uint8_t *cs = capture[2 * k], *ce = capture[2 * k + 1];
|
|
669
708
|
if (cs && ce) {
|
|
670
|
-
|
|
709
|
+
scr_regex_put_span(b, input, scr_capture_index(input, cs), scr_capture_index(input, ce));
|
|
671
710
|
}
|
|
672
711
|
i += adv;
|
|
673
712
|
} else {
|
|
@@ -693,7 +732,7 @@ static void scr_put_substitution(ScrJsonBuf *b, const uint16_t *u, int len,
|
|
|
693
732
|
if (glen == name_len && memcmp(p, name, name_len) == 0) {
|
|
694
733
|
const uint8_t *cs = capture[2 * k], *ce = capture[2 * k + 1];
|
|
695
734
|
if (cs && ce) {
|
|
696
|
-
|
|
735
|
+
scr_regex_put_span(b, input, scr_capture_index(input, cs), scr_capture_index(input, ce));
|
|
697
736
|
break; /* at most one duplicate participates */
|
|
698
737
|
}
|
|
699
738
|
}
|
|
@@ -718,37 +757,153 @@ static ScrStr *scr_replace_impl(ScrStr *s, ScrRegex *re, ScrStr *rep) {
|
|
|
718
757
|
bool unicode = (re_flags & (LRE_FLAG_UNICODE | LRE_FLAG_UNICODE_SETS)) != 0;
|
|
719
758
|
int capture_count = lre_get_capture_count(bc);
|
|
720
759
|
const char *groupnames = lre_get_groupnames(bc);
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
760
|
+
ScrRegexInput input;
|
|
761
|
+
scr_regex_input_init(&input, bc, s);
|
|
762
|
+
int len = input.len;
|
|
763
|
+
uint8_t **capture = input.capture;
|
|
725
764
|
ScrJsonBuf b;
|
|
726
765
|
scr_jb_init(&b);
|
|
727
766
|
if (global) re->last_index = 0;
|
|
728
767
|
int next = 0, pos = sticky ? scr_regex_start(re, len) : 0;
|
|
729
768
|
if (pos < 0) pos = len + 1;
|
|
730
769
|
if (sticky && !global) re->last_index = 0;
|
|
770
|
+
bool matched = false;
|
|
771
|
+
bool literal = memchr(rep->data, '$', rep->len) == NULL;
|
|
731
772
|
while (pos <= len) {
|
|
732
|
-
if (scr_exec(
|
|
733
|
-
|
|
734
|
-
int
|
|
773
|
+
if (scr_exec(&input, bc, pos) != 1) break;
|
|
774
|
+
matched = true;
|
|
775
|
+
int start = scr_capture_index(&input, capture[0]);
|
|
776
|
+
int end = scr_capture_index(&input, capture[1]);
|
|
735
777
|
if (sticky && !global) re->last_index = end;
|
|
736
|
-
|
|
737
|
-
|
|
778
|
+
scr_regex_put_span(&b, &input, next, start);
|
|
779
|
+
if (literal) scr_jb_put_str(&b, rep);
|
|
780
|
+
else scr_put_substitution(&b, &input, start, end, capture, capture_count, groupnames, rep);
|
|
738
781
|
next = end;
|
|
739
782
|
if (!global) break;
|
|
740
|
-
pos = end == start ? scr_advance(
|
|
783
|
+
pos = end == start ? scr_advance(&input, end, unicode) : end;
|
|
741
784
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
return scr_jb_finish(&b);
|
|
785
|
+
if (matched) scr_regex_put_span(&b, &input, next, len);
|
|
786
|
+
scr_regex_input_dispose(&input);
|
|
787
|
+
return matched ? scr_jb_finish(&b) : scr_str_retain(s);
|
|
746
788
|
}
|
|
747
789
|
|
|
748
790
|
ScrStr *scr_regex_replace(ScrStr *s, ScrRegex *re, ScrStr *rep) {
|
|
749
791
|
return scr_replace_impl(s, re, rep);
|
|
750
792
|
}
|
|
751
793
|
|
|
794
|
+
typedef struct {
|
|
795
|
+
ScrDyn *arguments;
|
|
796
|
+
int start, end;
|
|
797
|
+
} ScrReplacementMatch;
|
|
798
|
+
|
|
799
|
+
static ScrDyn *scr_regex_capture_value(const ScrRegexInput *input,
|
|
800
|
+
const uint8_t *start, const uint8_t *end) {
|
|
801
|
+
if (!start || !end) return scr_dyn_retain(scr_dyn_undefined());
|
|
802
|
+
ScrStr *span = scr_regex_span(input, scr_capture_index(input, start),
|
|
803
|
+
scr_capture_index(input, end));
|
|
804
|
+
ScrDyn *value = scr_dyn_new_str(span);
|
|
805
|
+
scr_str_release(span);
|
|
806
|
+
return value;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/* Symbol.replace collects matches before invoking any replacement. A callback
|
|
810
|
+
* can execute the same regex, change lastIndex, or throw; none of those actions
|
|
811
|
+
* may affect which matches were collected. Capture values and groups therefore
|
|
812
|
+
* belong to each snapshot, not to the engine's reused capture buffer. */
|
|
813
|
+
ScrStr *scr_regex_replace_callback(ScrStr *s, ScrRegex *re, ScrDyn *callback, bool all) {
|
|
814
|
+
uint8_t *bc = scr_regex_bc(re);
|
|
815
|
+
int flags = lre_get_flags(bc);
|
|
816
|
+
bool global = (flags & LRE_FLAG_GLOBAL) != 0;
|
|
817
|
+
if (all && !global) {
|
|
818
|
+
static const char message[] = "String.prototype.replaceAll called with a non-global RegExp argument";
|
|
819
|
+
scr_throw_error_msg(SCR_ERR_TYPE, message, sizeof message - 1);
|
|
820
|
+
return NULL;
|
|
821
|
+
}
|
|
822
|
+
if (!scr_dyn_is_callable(callback)) {
|
|
823
|
+
ScrStr *template = scr_dyn_string_coerce_js(callback);
|
|
824
|
+
if (!template) return NULL;
|
|
825
|
+
ScrStr *result = scr_replace_impl(s, re, template);
|
|
826
|
+
scr_str_release(template);
|
|
827
|
+
return result;
|
|
828
|
+
}
|
|
829
|
+
bool sticky = (flags & LRE_FLAG_STICKY) != 0;
|
|
830
|
+
bool unicode = (flags & (LRE_FLAG_UNICODE | LRE_FLAG_UNICODE_SETS)) != 0;
|
|
831
|
+
int capture_count = lre_get_capture_count(bc);
|
|
832
|
+
const char *groupnames = lre_get_groupnames(bc);
|
|
833
|
+
ScrRegexInput input;
|
|
834
|
+
scr_regex_input_init(&input, bc, s);
|
|
835
|
+
int len = input.len;
|
|
836
|
+
ScrReplacementMatch *matches = NULL;
|
|
837
|
+
size_t count = 0, capacity = 0;
|
|
838
|
+
ScrDyn *subject = scr_dyn_new_str(s);
|
|
839
|
+
if (global) re->last_index = 0;
|
|
840
|
+
int position = sticky ? scr_regex_start(re, len) : 0;
|
|
841
|
+
if (position < 0) position = len + 1;
|
|
842
|
+
if (sticky && !global) re->last_index = 0;
|
|
843
|
+
while (position <= len && scr_exec(&input, bc, position) == 1) {
|
|
844
|
+
uint8_t **capture = input.capture;
|
|
845
|
+
int start = scr_capture_index(&input, capture[0]);
|
|
846
|
+
int end = scr_capture_index(&input, capture[1]);
|
|
847
|
+
if (sticky && !global) re->last_index = end;
|
|
848
|
+
ScrDyn *arguments = scr_dyn_new_arr();
|
|
849
|
+
for (int group = 0; group < capture_count; group++)
|
|
850
|
+
scr_dyn_arr_push(arguments, scr_regex_capture_value(&input, capture[group * 2], capture[group * 2 + 1]));
|
|
851
|
+
scr_dyn_arr_push(arguments, scr_dyn_new_num((double)start));
|
|
852
|
+
scr_dyn_arr_push(arguments, scr_dyn_retain(subject));
|
|
853
|
+
if (groupnames) {
|
|
854
|
+
ScrDyn *groups = scr_dyn_new_obj_null_proto();
|
|
855
|
+
const char *name = groupnames;
|
|
856
|
+
for (int group = 1; group < capture_count; group++) {
|
|
857
|
+
size_t length = strlen(name);
|
|
858
|
+
if (length && (capture[group * 2] || !scr_dyn_obj_get(groups, name, length)))
|
|
859
|
+
scr_dyn_obj_set(groups, name, length,
|
|
860
|
+
scr_regex_capture_value(&input, capture[group * 2], capture[group * 2 + 1]));
|
|
861
|
+
name += length + LRE_GROUP_NAME_TRAILER_LEN;
|
|
862
|
+
}
|
|
863
|
+
scr_dyn_arr_push(arguments, groups);
|
|
864
|
+
}
|
|
865
|
+
if (count == capacity) {
|
|
866
|
+
size_t next = capacity ? capacity * 2 : 8;
|
|
867
|
+
if (next < capacity || next > SIZE_MAX / sizeof(*matches)) scr_regex_oom();
|
|
868
|
+
ScrReplacementMatch *grown = realloc(matches, next * sizeof(*matches));
|
|
869
|
+
if (!grown) scr_regex_oom();
|
|
870
|
+
matches = grown;
|
|
871
|
+
capacity = next;
|
|
872
|
+
}
|
|
873
|
+
matches[count++] = (ScrReplacementMatch){ arguments, start, end };
|
|
874
|
+
if (!global) break;
|
|
875
|
+
position = start == end ? scr_advance(&input, end, unicode) : end;
|
|
876
|
+
}
|
|
877
|
+
scr_dyn_release(subject);
|
|
878
|
+
ScrJsonBuf output;
|
|
879
|
+
scr_jb_init(&output);
|
|
880
|
+
int next = 0;
|
|
881
|
+
for (size_t i = 0; i < count; i++) {
|
|
882
|
+
ScrReplacementMatch *match = &matches[i];
|
|
883
|
+
ScrDyn *arguments = match->arguments;
|
|
884
|
+
scr_dyn_this_push_dyn(NULL);
|
|
885
|
+
ScrDyn *raw = scr_dyn_call(callback, arguments->v.arr.items, arguments->v.arr.len, "replacement");
|
|
886
|
+
scr_dyn_this_pop();
|
|
887
|
+
ScrStr *replacement = scr_exc_pending() ? NULL : scr_dyn_string_coerce_js(raw);
|
|
888
|
+
scr_dyn_release(raw);
|
|
889
|
+
if (!replacement) break;
|
|
890
|
+
scr_regex_put_span(&output, &input, next, match->start);
|
|
891
|
+
scr_jb_put_str(&output, replacement);
|
|
892
|
+
scr_str_release(replacement);
|
|
893
|
+
next = match->end;
|
|
894
|
+
}
|
|
895
|
+
for (size_t i = 0; i < count; i++) scr_dyn_release(matches[i].arguments);
|
|
896
|
+
free(matches);
|
|
897
|
+
if (scr_exc_pending()) {
|
|
898
|
+
free(output.data);
|
|
899
|
+
scr_regex_input_dispose(&input);
|
|
900
|
+
return NULL;
|
|
901
|
+
}
|
|
902
|
+
scr_regex_put_span(&output, &input, next, len);
|
|
903
|
+
scr_regex_input_dispose(&input);
|
|
904
|
+
return scr_jb_finish(&output);
|
|
905
|
+
}
|
|
906
|
+
|
|
752
907
|
|
|
753
908
|
/* The pinned Node ANSI matcher derives from ansi-regex, copyright (c)
|
|
754
909
|
* Sindre Sorhus <sindresorhus@gmail.com>, used under the MIT license:
|
|
@@ -825,10 +980,10 @@ ScrArr *scr_regex_split_limit(ScrStr *s, ScrRegex *re, double limit_num) {
|
|
|
825
980
|
int re_flags = lre_get_flags(bc);
|
|
826
981
|
bool unicode = (re_flags & (LRE_FLAG_UNICODE | LRE_FLAG_UNICODE_SETS)) != 0;
|
|
827
982
|
bool sticky = (re_flags & LRE_FLAG_STICKY) != 0;
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
983
|
+
ScrRegexInput input;
|
|
984
|
+
scr_regex_input_init(&input, bc, s);
|
|
985
|
+
int len = input.len;
|
|
986
|
+
uint8_t **capture = input.capture;
|
|
832
987
|
ScrArr *out = scr_arr_new(SCR_ELEM_STR, 0);
|
|
833
988
|
|
|
834
989
|
/* ECMA-262 22.2.6.14 (Symbol.split). The spec probes every
|
|
@@ -838,31 +993,30 @@ ScrArr *scr_regex_split_limit(ScrStr *s, ScrRegex *re, double limit_num) {
|
|
|
838
993
|
* loop. A genuinely sticky pattern keeps the spec's probe-and-advance. */
|
|
839
994
|
if (len == 0) {
|
|
840
995
|
/* Empty subject: one probe — a match yields [], no match yields [""]. */
|
|
841
|
-
if (scr_exec(
|
|
996
|
+
if (scr_exec(&input, bc, 0) != 1) {
|
|
842
997
|
scr_arr_push_ref(out, scr_str_new("", 0));
|
|
843
998
|
}
|
|
844
|
-
|
|
845
|
-
free(u);
|
|
999
|
+
scr_regex_input_dispose(&input);
|
|
846
1000
|
return out;
|
|
847
1001
|
}
|
|
848
1002
|
int p = 0, q = 0;
|
|
849
1003
|
while (q < len) {
|
|
850
|
-
if (scr_exec(
|
|
1004
|
+
if (scr_exec(&input, bc, q) != 1) {
|
|
851
1005
|
if (!sticky) break; /* no match anywhere right of q */
|
|
852
|
-
q = scr_advance(
|
|
1006
|
+
q = scr_advance(&input, q, unicode);
|
|
853
1007
|
continue;
|
|
854
1008
|
}
|
|
855
|
-
int start = (
|
|
856
|
-
int end = (
|
|
1009
|
+
int start = scr_capture_index(&input, capture[0]);
|
|
1010
|
+
int end = scr_capture_index(&input, capture[1]);
|
|
857
1011
|
/* The sticky algorithm never probes the position after the subject.
|
|
858
1012
|
* A forward search can find a zero-width match there; exclude it. */
|
|
859
1013
|
if (start == len) break;
|
|
860
1014
|
if (end == p) {
|
|
861
1015
|
/* Zero-length match adjacent to the previous split point: advance
|
|
862
1016
|
* (start == q == p here — the search cannot skip a match). */
|
|
863
|
-
q = scr_advance(
|
|
1017
|
+
q = scr_advance(&input, start, unicode);
|
|
864
1018
|
} else {
|
|
865
|
-
scr_arr_push_ref(out,
|
|
1019
|
+
scr_arr_push_ref(out, scr_regex_span(&input, p, start));
|
|
866
1020
|
if (out->len == limit) goto done;
|
|
867
1021
|
for (int group = 1; group < capture_count; group++) {
|
|
868
1022
|
const uint8_t *from = capture[2 * group];
|
|
@@ -872,8 +1026,8 @@ ScrArr *scr_regex_split_limit(ScrStr *s, ScrRegex *re, double limit_num) {
|
|
|
872
1026
|
// distinct from both empty strings and holes.
|
|
873
1027
|
scr_arr_set_undefined(out, (double)out->len);
|
|
874
1028
|
} else {
|
|
875
|
-
scr_arr_push_ref(out,
|
|
876
|
-
(
|
|
1029
|
+
scr_arr_push_ref(out, scr_regex_span(&input,
|
|
1030
|
+
scr_capture_index(&input, from), scr_capture_index(&input, to)));
|
|
877
1031
|
}
|
|
878
1032
|
if (out->len == limit) goto done;
|
|
879
1033
|
}
|
|
@@ -881,10 +1035,9 @@ ScrArr *scr_regex_split_limit(ScrStr *s, ScrRegex *re, double limit_num) {
|
|
|
881
1035
|
q = p;
|
|
882
1036
|
}
|
|
883
1037
|
}
|
|
884
|
-
scr_arr_push_ref(out,
|
|
1038
|
+
scr_arr_push_ref(out, scr_regex_span(&input, p, len));
|
|
885
1039
|
done:
|
|
886
|
-
|
|
887
|
-
free(u);
|
|
1040
|
+
scr_regex_input_dispose(&input);
|
|
888
1041
|
return out;
|
|
889
1042
|
}
|
|
890
1043
|
|
|
@@ -985,10 +1138,38 @@ static void scr_case_put_cp(ScrJsonBuf *b, uint32_t cp) {
|
|
|
985
1138
|
}
|
|
986
1139
|
|
|
987
1140
|
static ScrStr *scr_str_case_conv(const ScrStr *s, int to_lower) {
|
|
1141
|
+
unsigned char first = to_lower ? 'A' : 'a';
|
|
1142
|
+
unsigned char last = to_lower ? 'Z' : 'z';
|
|
1143
|
+
if (scr_text_ascii(s)) {
|
|
1144
|
+
size_t changed = 0;
|
|
1145
|
+
while (changed < s->len &&
|
|
1146
|
+
((unsigned char)s->data[changed] < first || (unsigned char)s->data[changed] > last))
|
|
1147
|
+
changed++;
|
|
1148
|
+
if (changed == s->len) return scr_str_retain((ScrStr *)s);
|
|
1149
|
+
ScrStr *out = scr_str_alloc_raw(s->len, s->len);
|
|
1150
|
+
memcpy(out->data, s->data, changed);
|
|
1151
|
+
for (size_t i = changed; i < s->len; i++) {
|
|
1152
|
+
unsigned char c = (unsigned char)s->data[i];
|
|
1153
|
+
out->data[i] = (char)(c >= first && c <= last ? c ^ 0x20 : c);
|
|
1154
|
+
}
|
|
1155
|
+
out->data[s->len] = '\0';
|
|
1156
|
+
return out;
|
|
1157
|
+
}
|
|
988
1158
|
ScrJsonBuf b;
|
|
989
1159
|
scr_jb_init(&b);
|
|
990
1160
|
uint32_t res[LRE_CC_RES_LEN_MAX];
|
|
991
1161
|
for (size_t i = 0; i < s->len;) {
|
|
1162
|
+
if ((unsigned char)s->data[i] < 0x80) {
|
|
1163
|
+
size_t start = i;
|
|
1164
|
+
while (i < s->len && (unsigned char)s->data[i] < 0x80) i++;
|
|
1165
|
+
size_t output = b.len;
|
|
1166
|
+
scr_jb_write(&b, s->data + start, i - start);
|
|
1167
|
+
for (size_t j = output; j < b.len; j++) {
|
|
1168
|
+
unsigned char c = (unsigned char)b.data[j];
|
|
1169
|
+
if (c >= first && c <= last) b.data[j] = (char)(c ^ 0x20);
|
|
1170
|
+
}
|
|
1171
|
+
continue;
|
|
1172
|
+
}
|
|
992
1173
|
size_t adv;
|
|
993
1174
|
uint32_t c = scr_case_decode(s->data + i, &adv);
|
|
994
1175
|
int l;
|
|
@@ -1024,6 +1205,9 @@ ScrStr *scr_str_normalize(const ScrStr *s, const ScrStr *form) {
|
|
|
1024
1205
|
scr_throw_error(SCR_ERR_RANGE, scr_str_new(message, sizeof message - 1));
|
|
1025
1206
|
return NULL;
|
|
1026
1207
|
}
|
|
1208
|
+
/* Every ASCII string is already normalized in all four forms. Validate
|
|
1209
|
+
* the form first: even an empty subject must reject an invalid form. */
|
|
1210
|
+
if (scr_text_ascii(s)) return scr_str_retain((ScrStr *)s);
|
|
1027
1211
|
if (s->len > INT32_MAX / sizeof(uint32_t)) scr_regex_oom();
|
|
1028
1212
|
uint32_t *input = malloc((s->len + 1) * sizeof(uint32_t));
|
|
1029
1213
|
if (!input) scr_regex_oom();
|