aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.docker/unit-tests.sh5
-rw-r--r--Dockerfile44
-rw-r--r--Makefile18
-rw-r--r--build.zig58
-rw-r--r--src/alloc.zig197
-rw-r--r--src/allocators.zig4
-rw-r--r--src/analytics/analytics_thread.zig7
-rw-r--r--src/bun_js.zig1
-rw-r--r--src/bundler.zig1
-rw-r--r--src/cli.zig1
-rw-r--r--src/cli/build_command.zig2
-rw-r--r--src/cli/bun_command.zig2
-rw-r--r--src/cli/create_command.zig2
-rw-r--r--src/cli/install_completions_command.zig2
-rw-r--r--src/cli/run_command.zig2
-rw-r--r--src/cli/upgrade_command.zig2
-rw-r--r--src/css_scanner.zig7
-rw-r--r--src/defines.zig34
-rw-r--r--src/deps/picohttp.zig34
-rw-r--r--src/deps/zig-clap/clap.zig79
-rw-r--r--src/deps/zig-clap/clap/comptime.zig29
-rw-r--r--src/exports.zig5
-rw-r--r--src/fs.zig101
-rw-r--r--src/global.zig7
-rw-r--r--src/http.zig6
-rw-r--r--src/http/url_path.zig1
-rw-r--r--src/http_client_async.zig346
-rw-r--r--src/install/install.zig2
-rw-r--r--src/javascript/jsc/javascript.zig13
-rw-r--r--src/javascript/jsc/webcore/response.zig21
-rw-r--r--src/js_ast.zig232
-rw-r--r--src/js_lexer.zig1
-rw-r--r--src/js_lexer/range_table.zig136
-rw-r--r--src/js_lexer/unicode.zig4104
-rw-r--r--src/js_lexer_tables.zig4
-rw-r--r--src/js_parser/imports.zig1
-rw-r--r--src/js_printer.zig117
-rw-r--r--src/json_parser.zig80
-rw-r--r--src/linker.zig1
-rw-r--r--src/main.zig12
-rw-r--r--src/main_api.zig3
-rw-r--r--src/main_javascript.zig6
-rw-r--r--src/main_wasi.zig31
-rw-r--r--src/main_wasm.zig40
-rw-r--r--src/open.zig4
-rw-r--r--src/options.zig2
-rw-r--r--src/resolver/package_json.zig3
-rw-r--r--src/resolver/resolve_path.zig185
-rw-r--r--src/resolver/resolver.zig14
-rw-r--r--src/resolver/tsconfig_json.zig5
-rw-r--r--src/router.zig653
-rw-r--r--src/test/fixtures/tsconfig.json2
-rw-r--r--src/watcher.zig2
53 files changed, 1074 insertions, 5597 deletions
diff --git a/.docker/unit-tests.sh b/.docker/unit-tests.sh
new file mode 100644
index 000000000..2917a5ef0
--- /dev/null
+++ b/.docker/unit-tests.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+set -euxo pipefail
+
+docker container run --security-opt seccomp=.docker/chrome.json --env GITHUB_WORKSPACE=$GITHUB_WORKSPACE --ulimit memlock=-1:-1 --init --rm bun-unit-tests:latest
diff --git a/Dockerfile b/Dockerfile
index 9ee6d5b6d..40647a73d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -132,7 +132,7 @@ COPY src/node-fallbacks ${BUN_DIR}/src/node-fallbacks
RUN cd $BUN_DIR && \
make node-fallbacks && rm -rf src/node-fallbacks/node_modules Makefile
-FROM bunbunbunbun/bun-base-with-zig-and-webkit:latest as build_release
+FROM bunbunbunbun/bun-base-with-zig-and-webkit:latest as prepare_release
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
@@ -162,6 +162,22 @@ COPY --from=boringssl ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/
COPY --from=zlib ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/
COPY --from=identifier_cache ${BUN_DIR}/src/js_lexer/*.blob ${BUN_DIR}/src/js_lexer
+WORKDIR ${BUN_DIR}
+
+
+FROM prepare_release as build_release
+
+ARG DEBIAN_FRONTEND=noninteractive
+ARG GITHUB_WORKSPACE=/build
+ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
+# Directory extracts to "bun-webkit"
+ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
+ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
+ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
+ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
+
+WORKDIR $BUN_DIR
+
RUN cd $BUN_DIR && rm -rf $HOME/.cache zig-cache && make \
jsc-bindings-headers \
api \
@@ -172,6 +188,32 @@ RUN cd $BUN_DIR && rm -rf $HOME/.cache zig-cache && make \
make release copy-to-bun-release-dir && \
rm -rf $HOME/.cache zig-cache misctools package.json build-id completions build.zig
+FROM prepare_release as build_unit
+
+ARG DEBIAN_FRONTEND=noninteractive
+ARG GITHUB_WORKSPACE=/build
+ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
+# Directory extracts to "bun-webkit"
+ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
+ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
+ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
+ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
+
+WORKDIR $BUN_DIR
+
+ENTRYPOINT [ "/bin/bash" ]
+
+CMD cd $BUN_DIR && \
+ make \
+ jsc-bindings-headers \
+ api \
+ analytics \
+ bun_error \
+ fallback_decoder \
+ jsc-bindings-mac && \
+ make \
+ run-all-unit-tests
+
FROM bunbunbunbun/bun-base-with-zig-and-webkit:latest as bun.devcontainer
ARG DEBIAN_FRONTEND=noninteractive
diff --git a/Makefile b/Makefile
index e01415224..6e54cfee7 100644
--- a/Makefile
+++ b/Makefile
@@ -794,6 +794,22 @@ build-unit:
$(ARCHIVE_FILES) $(ICU_FLAGS) && \
cp zig-out/bin/$(testname) $(testbinpath)
+run-all-unit-tests:
+ @rm -rf zig-out/bin/__main_test
+ @mkdir -p zig-out/bin
+ zig test src/main.zig \
+ $(PACKAGE_MAP) \
+ --main-pkg-path $(BUN_DIR) \
+ --test-no-exec \
+ -fPIC \
+ -femit-bin=zig-out/bin/__main_test \
+ -fcompiler-rt \
+ -lc -lc++ \
+ --cache-dir /tmp/zig-cache-bun-__main_test \
+ -fallow-shlib-undefined \
+ $(ARCHIVE_FILES) $(ICU_FLAGS) $(JSC_FILES) $(OBJ_FILES) && \
+ zig-out/bin/__main_test notARealParam
+
run-unit:
@zig-out/bin/$(testname) -- fake
@@ -811,4 +827,4 @@ copy-to-bun-release-dir:
cp -r $(PACKAGE_DIR)/bun $(BUN_RELEASE_DIR)/bun
cp -r $(PACKAGE_DIR)/bun-profile $(BUN_RELEASE_DIR)/bun-profile
-PACKAGE_MAP = --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-end --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin clap $(BUN_DIR)/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-end --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end \ No newline at end of file
+PACKAGE_MAP = --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-end --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin clap $(BUN_DIR)/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-end --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end \ No newline at end of file
diff --git a/build.zig b/build.zig
index 334082b99..84abf5428 100644
--- a/build.zig
+++ b/build.zig
@@ -27,6 +27,19 @@ pub fn addPicoHTTP(step: *std.build.LibExeObjStep, comptime with_obj: bool) void
// homebrew-provided icu4c
}
+const color_map = std.ComptimeStringMap([]const u8, .{
+ &.{ "black", "30m" },
+ &.{ "blue", "34m" },
+ &.{ "b", "1m" },
+ &.{ "d", "2m" },
+ &.{ "cyan", "36m" },
+ &.{ "green", "32m" },
+ &.{ "magenta", "35m" },
+ &.{ "red", "31m" },
+ &.{ "white", "37m" },
+ &.{ "yellow", "33m" },
+});
+
fn addInternalPackages(step: *std.build.LibExeObjStep, allocator: *std.mem.Allocator, target: anytype) !void {
var boringssl: std.build.Pkg = .{
.name = "boringssl",
@@ -95,6 +108,7 @@ fn addInternalPackages(step: *std.build.LibExeObjStep, allocator: *std.mem.Alloc
step.addPackage(clap);
step.addPackage(http);
step.addPackage(network_thread);
+ step.addPackage(boringssl);
}
var output_dir: []const u8 = "";
fn panicIfNotFound(comptime filepath: []const u8) []const u8 {
@@ -341,21 +355,45 @@ pub fn build(b: *std.build.Builder) !void {
{
const headers_step = b.step("test", "Build test");
- var test_file_ = b.option([]const u8, "test-file", "Input file for test");
+ var test_file = b.option([]const u8, "test-file", "Input file for test");
var test_bin_ = b.option([]const u8, "test-bin", "Emit bin to");
var test_filter = b.option([]const u8, "test-filter", "Filter for test");
- if (test_file_) |test_file| {
- var headers_obj: *std.build.LibExeObjStep = b.addTest(test_file);
- headers_obj.setFilter(test_filter);
- if (test_bin_) |test_bin| {
- headers_obj.name = std.fs.path.basename(test_bin);
- if (std.fs.path.dirname(test_bin)) |dir| headers_obj.setOutputDir(dir);
- }
+ var headers_obj: *std.build.LibExeObjStep = b.addTest(test_file orelse "src/main.zig");
+ headers_obj.setFilter(test_filter);
+ if (test_bin_) |test_bin| {
+ headers_obj.name = std.fs.path.basename(test_bin);
+ if (std.fs.path.dirname(test_bin)) |dir| headers_obj.setOutputDir(dir);
+ }
- try configureObjectStep(headers_obj, target, obj.main_pkg_path.?);
- try linkObjectFiles(b, headers_obj, target);
+ try configureObjectStep(headers_obj, target, obj.main_pkg_path.?);
+ try linkObjectFiles(b, headers_obj, target);
+ {
+ var before = b.addLog("\x1b[" ++ color_map.get("magenta").? ++ "\x1b[" ++ color_map.get("b").? ++ "[{s} tests]" ++ "\x1b[" ++ color_map.get("d").? ++ " ----\n\n" ++ "\x1b[0m", .{"bun"});
+ var after = b.addLog("\x1b[" ++ color_map.get("d").? ++ "–––---\n\n" ++ "\x1b[0m", .{});
+ headers_step.dependOn(&before.step);
headers_step.dependOn(&headers_obj.step);
+ headers_step.dependOn(&after.step);
+ }
+
+ for (headers_obj.packages.items) |pkg_| {
+ const pkg: std.build.Pkg = pkg_;
+ if (std.mem.eql(u8, pkg.name, "clap")) continue;
+ var test_ = b.addTestSource(pkg.path);
+
+ test_.setMainPkgPath(obj.main_pkg_path.?);
+ test_.setTarget(target);
+ try linkObjectFiles(b, test_, target);
+ if (pkg.dependencies) |children| {
+ test_.packages = std.ArrayList(std.build.Pkg).init(b.allocator);
+ try test_.packages.appendSlice(children);
+ }
+
+ var before = b.addLog("\x1b[" ++ color_map.get("magenta").? ++ "\x1b[" ++ color_map.get("b").? ++ "[{s} tests]" ++ "\x1b[" ++ color_map.get("d").? ++ " ----\n\n" ++ "\x1b[0m", .{pkg.name});
+ var after = b.addLog("\x1b[" ++ color_map.get("d").? ++ "–––---\n\n" ++ "\x1b[0m", .{});
+ headers_step.dependOn(&before.step);
+ headers_step.dependOn(&test_.step);
+ headers_step.dependOn(&after.step);
}
}
diff --git a/src/alloc.zig b/src/alloc.zig
deleted file mode 100644
index 774671727..000000000
--- a/src/alloc.zig
+++ /dev/null
@@ -1,197 +0,0 @@
-const std = @import("std");
-const builtin = @import("builtin");
-
-const STATIC_MEMORY_SIZE = 256000;
-pub var static_manager: ?std.heap.ArenaAllocator = null;
-pub var root_manager: ?RootAlloc = null;
-pub var needs_setup: bool = true;
-pub var static: *std.mem.Allocator = undefined;
-pub var dynamic: *std.mem.Allocator = undefined;
-
-pub fn setup(root: *std.mem.Allocator) !void {
- needs_setup = false;
- static = root;
- dynamic = root;
- // static = @ptrCast(*std.mem.Allocator, &stat.allocator);
-}
-
-test "GlobalAllocator" {
- try setup(std.heap.page_allocator);
- var testType = try static.alloc(u8, 10);
- testType[1] = 1;
-}
-
-pub const HunkSide = struct {
- pub const VTable = struct {
- alloc: fn (self: *Hunk, n: usize, alignment: u29) std.mem.Allocator.Error![]u8,
- getMark: fn (self: *Hunk) usize,
- freeToMark: fn (self: *Hunk, pos: usize) void,
- };
-
- hunk: *Hunk,
- vtable: *const VTable,
- allocator: std.mem.Allocator,
-
- pub fn init(hunk: *Hunk, vtable: *const VTable) HunkSide {
- return .{
- .hunk = hunk,
- .vtable = vtable,
- .allocator = .{
- .allocFn = allocFn,
- .resizeFn = resizeFn,
- },
- };
- }
-
- pub fn getMark(self: HunkSide) usize {
- return self.vtable.getMark(self.hunk);
- }
-
- pub fn freeToMark(self: HunkSide, pos: usize) void {
- self.vtable.freeToMark(self.hunk, pos);
- }
-
- fn allocFn(allocator: *std.mem.Allocator, len: usize, ptr_align: u29, len_align: u29, ret_addr: usize) std.mem.Allocator.Error![]u8 {
- const self = @fieldParentPtr(HunkSide, "allocator", allocator);
-
- return try self.vtable.alloc(self.hunk, len, ptr_align);
- }
-
- fn resizeFn(allocator: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, len_align: u29, ret_addr: usize) std.mem.Allocator.Error!usize {
- if (new_size > old_mem.len) {
- return error.OutOfMemory;
- }
- if (new_size == 0) {
- return 0;
- }
- return std.mem.alignAllocLen(old_mem.len, new_size, len_align);
- }
-};
-
-pub const Hunk = struct {
- low_used: usize,
- high_used: usize,
- buffer: []u8,
-
- pub fn init(buffer: []u8) Hunk {
- return .{
- .low_used = 0,
- .high_used = 0,
- .buffer = buffer,
- };
- }
-
- pub fn low(self: *Hunk) HunkSide {
- const GlobalStorage = struct {
- const vtable: HunkSide.VTable = .{
- .alloc = allocLow,
- .getMark = getLowMark,
- .freeToMark = freeToLowMark,
- };
- };
- return HunkSide.init(self, &GlobalStorage.vtable);
- }
-
- pub fn high(self: *Hunk) HunkSide {
- const GlobalStorage = struct {
- const vtable: HunkSide.VTable = .{
- .alloc = allocHigh,
- .getMark = getHighMark,
- .freeToMark = freeToHighMark,
- };
- };
- return HunkSide.init(self, &GlobalStorage.vtable);
- }
-
- pub fn allocLow(self: *Hunk, n: usize, alignment: u29) ![]u8 {
- const start = @ptrToInt(self.buffer.ptr);
- const adjusted_index = std.mem.alignForward(start + self.low_used, alignment) - start;
- const new_low_used = adjusted_index + n;
- if (new_low_used > self.buffer.len - self.high_used) {
- return error.OutOfMemory;
- }
- const result = self.buffer[adjusted_index..new_low_used];
- self.low_used = new_low_used;
- return result;
- }
-
- pub fn allocHigh(self: *Hunk, n: usize, alignment: u29) ![]u8 {
- const addr = @ptrToInt(self.buffer.ptr) + self.buffer.len - self.high_used;
- const rem = @rem(addr, alignment);
- const march_backward_bytes = rem;
- const adjusted_index = self.high_used + march_backward_bytes;
- const new_high_used = adjusted_index + n;
- if (new_high_used > self.buffer.len - self.low_used) {
- return error.OutOfMemory;
- }
- const start = self.buffer.len - adjusted_index - n;
- const result = self.buffer[start .. start + n];
- self.high_used = new_high_used;
- return result;
- }
-
- pub fn getLowMark(self: *Hunk) usize {
- return self.low_used;
- }
-
- pub fn getHighMark(self: *Hunk) usize {
- return self.high_used;
- }
-
- pub fn freeToLowMark(self: *Hunk, pos: usize) void {
- std.debug.assert(pos <= self.low_used);
- if (pos < self.low_used) {
- if (std.builtin.mode == std.builtin.Mode.Debug) {
- std.mem.set(u8, self.buffer[pos..self.low_used], 0xcc);
- }
- self.low_used = pos;
- }
- }
-
- pub fn freeToHighMark(self: *Hunk, pos: usize) void {
- std.debug.assert(pos <= self.high_used);
- if (pos < self.high_used) {
- if (std.builtin.mode == std.builtin.Mode.Debug) {
- const i = self.buffer.len - self.high_used;
- const n = self.high_used - pos;
- std.mem.set(u8, self.buffer[i .. i + n], 0xcc);
- }
- self.high_used = pos;
- }
- }
-};
-
-// WASM only
-// test "Hunk" {
-// // test a few random operations. very low coverage. write more later
-// var buf: [100]u8 = undefined;
-// var hunk = Hunk.init(buf[0..]);
-
-// const high_mark = hunk.getHighMark();
-
-// _ = try hunk.low().allocator.alloc(u8, 7);
-// _ = try hunk.high().allocator.alloc(u8, 8);
-
-// std.testing.expectEqual(@as(usize, 7), hunk.low_used);
-// std.testing.expectEqual(@as(usize, 8), hunk.high_used);
-
-// _ = try hunk.high().allocator.alloc(u8, 8);
-
-// std.testing.expectEqual(@as(usize, 16), hunk.high_used);
-
-// const low_mark = hunk.getLowMark();
-
-// _ = try hunk.low().allocator.alloc(u8, 100 - 7 - 16);
-
-// std.testing.expectEqual(@as(usize, 100 - 16), hunk.low_used);
-
-// std.testing.expectError(error.OutOfMemory, hunk.high().allocator.alloc(u8, 1));
-
-// hunk.freeToLowMark(low_mark);
-
-// _ = try hunk.high().allocator.alloc(u8, 1);
-
-// hunk.freeToHighMark(high_mark);
-
-// std.testing.expectEqual(@as(usize, 0), hunk.high_used);
-// }
diff --git a/src/allocators.zig b/src/allocators.zig
index e06e45561..254827ad0 100644
--- a/src/allocators.zig
+++ b/src/allocators.zig
@@ -62,7 +62,7 @@ pub fn BSSSectionAllocator(comptime size: usize) type {
}
pub fn isSliceInBuffer(slice: anytype, buffer: anytype) bool {
- return (@ptrToInt(buffer) <= @ptrToInt(slice.ptr) and (@ptrToInt(slice.ptr) + slice.len) <= (@ptrToInt(buffer) + buffer.len));
+ return (@ptrToInt(&buffer) <= @ptrToInt(slice.ptr) and (@ptrToInt(slice.ptr) + slice.len) <= (@ptrToInt(buffer) + buffer.len));
}
pub fn sliceRange(slice: []const u8, buffer: []const u8) ?[2]u32 {
@@ -413,7 +413,7 @@ pub fn BSSStringList(comptime _count: usize, comptime _item_length: usize) type
}
pub fn remove(self: *Self, index: IndexType) void {
- @compileError("Not implemented yet.");
+ // @compileError("Not implemented yet.");
// switch (index) {
// Unassigned.index => {
// self.index.remove(_key);
diff --git a/src/analytics/analytics_thread.zig b/src/analytics/analytics_thread.zig
index 2c778d589..bd35aa422 100644
--- a/src/analytics/analytics_thread.zig
+++ b/src/analytics/analytics_thread.zig
@@ -422,8 +422,11 @@ pub const EventList = struct {
var in_buffer = &this.in_buffer;
var buffer_writer = in_buffer.writer();
var analytics_writer = AnalyticsWriter.init(&buffer_writer);
-
- const start_time = @import("root").start_time;
+ const Root = @import("root");
+ const start_time: i128 = if (@hasDecl(Root, "start_time"))
+ Root.start_time
+ else
+ 0;
const now = std.time.nanoTimestamp();
this.header.session_length = @truncate(u32, @intCast(u64, (now - start_time)) / std.time.ns_per_ms);
diff --git a/src/bun_js.zig b/src/bun_js.zig
index cb1d6c219..985faf6c9 100644
--- a/src/bun_js.zig
+++ b/src/bun_js.zig
@@ -3,7 +3,6 @@ const std = @import("std");
const lex = @import("js_lexer.zig");
const logger = @import("logger.zig");
-const alloc = @import("alloc.zig");
const options = @import("options.zig");
const js_parser = @import("js_parser.zig");
const json_parser = @import("json_parser.zig");
diff --git a/src/bundler.zig b/src/bundler.zig
index 905eafc81..26f3aeb24 100644
--- a/src/bundler.zig
+++ b/src/bundler.zig
@@ -3,7 +3,6 @@ usingnamespace @import("global.zig");
const std = @import("std");
const lex = @import("js_lexer.zig");
const logger = @import("logger.zig");
-const alloc = @import("alloc.zig");
const options = @import("options.zig");
const js_parser = @import("js_parser.zig");
const json_parser = @import("json_parser.zig");
diff --git a/src/cli.zig b/src/cli.zig
index 553bfbc49..949cb058a 100644
--- a/src/cli.zig
+++ b/src/cli.zig
@@ -4,7 +4,6 @@ usingnamespace @import("./http.zig");
const std = @import("std");
const lex = @import("js_lexer.zig");
const logger = @import("logger.zig");
-const alloc = @import("alloc.zig");
const options = @import("options.zig");
const js_parser = @import("js_parser.zig");
const json_parser = @import("json_parser.zig");
diff --git a/src/cli/build_command.zig b/src/cli/build_command.zig
index c82ef99e2..b1acb357c 100644
--- a/src/cli/build_command.zig
+++ b/src/cli/build_command.zig
@@ -3,7 +3,7 @@ const std = @import("std");
const lex = @import("../js_lexer.zig");
const logger = @import("../logger.zig");
-const alloc = @import("../alloc.zig");
+
const options = @import("../options.zig");
const js_parser = @import("../js_parser.zig");
const js_ast = @import("../js_ast.zig");
diff --git a/src/cli/bun_command.zig b/src/cli/bun_command.zig
index b8d7d3484..33508ffdd 100644
--- a/src/cli/bun_command.zig
+++ b/src/cli/bun_command.zig
@@ -4,7 +4,7 @@ usingnamespace @import("../global.zig");
const lex = @import("../js_lexer.zig");
const logger = @import("../logger.zig");
-const alloc = @import("../alloc.zig");
+
const options = @import("../options.zig");
const js_parser = @import("../js_parser.zig");
const json_parser = @import("../json_parser.zig");
diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig
index 908b1c615..7672ce9b9 100644
--- a/src/cli/create_command.zig
+++ b/src/cli/create_command.zig
@@ -3,7 +3,7 @@ const std = @import("std");
const lex = @import("../js_lexer.zig");
const logger = @import("../logger.zig");
-const alloc = @import("../alloc.zig");
+
const options = @import("../options.zig");
const js_parser = @import("../js_parser.zig");
const js_ast = @import("../js_ast.zig");
diff --git a/src/cli/install_completions_command.zig b/src/cli/install_completions_command.zig
index d4e9fc5b9..0af95827c 100644
--- a/src/cli/install_completions_command.zig
+++ b/src/cli/install_completions_command.zig
@@ -3,7 +3,7 @@ const std = @import("std");
const lex = @import("../js_lexer.zig");
const logger = @import("../logger.zig");
-const alloc = @import("../alloc.zig");
+
const options = @import("../options.zig");
const js_parser = @import("../js_parser.zig");
const js_ast = @import("../js_ast.zig");
diff --git a/src/cli/run_command.zig b/src/cli/run_command.zig
index 5ae842674..ce4b9fcc7 100644
--- a/src/cli/run_command.zig
+++ b/src/cli/run_command.zig
@@ -3,7 +3,7 @@ const std = @import("std");
const lex = @import("../js_lexer.zig");
const logger = @import("../logger.zig");
-const alloc = @import("../alloc.zig");
+
const options = @import("../options.zig");
const js_parser = @import("../js_parser.zig");
const json_parser = @import("../json_parser.zig");
diff --git a/src/cli/upgrade_command.zig b/src/cli/upgrade_command.zig
index 345876b55..801461a03 100644
--- a/src/cli/upgrade_command.zig
+++ b/src/cli/upgrade_command.zig
@@ -3,7 +3,7 @@ const std = @import("std");
const lex = @import("../js_lexer.zig");
const logger = @import("../logger.zig");
-const alloc = @import("../alloc.zig");
+
const options = @import("../options.zig");
const js_parser = @import("../js_parser.zig");
const js_ast = @import("../js_ast.zig");
diff --git a/src/css_scanner.zig b/src/css_scanner.zig
index ee2881d4e..b92397214 100644
--- a/src/css_scanner.zig
+++ b/src/css_scanner.zig
@@ -7,7 +7,6 @@ const logger = @import("./logger.zig");
const Options = options;
const resolver = @import("./resolver/resolver.zig");
const _linker = @import("./linker.zig");
-const alloc = @import("./alloc.zig");
const replacementCharacter: CodePoint = 0xFFFD;
pub const Chunk = struct {
@@ -1160,9 +1159,9 @@ pub fn NewBundler(
linker: Linker,
) !CodeCount {
if (!has_set_global_queue) {
- global_queued = QueuedList.init(alloc.static);
- global_import_queud = ImportQueueFifo.init(alloc.static);
- global_bundle_queud = QueuedList.init(alloc.static);
+ global_queued = QueuedList.init(default_allocator);
+ global_import_queud = ImportQueueFifo.init(default_allocator);
+ global_bundle_queud = QueuedList.init(default_allocator);
has_set_global_queue = true;
} else {
global_queued.clearRetainingCapacity();
diff --git a/src/defines.zig b/src/defines.zig
index 141dbc309..e2f7b3378 100644
--- a/src/defines.zig
+++ b/src/defines.zig
@@ -1,6 +1,5 @@
const std = @import("std");
const js_ast = @import("./js_ast.zig");
-const alloc = @import("alloc.zig");
const logger = @import("logger.zig");
const js_lexer = @import("js_lexer.zig");
const json_parser = @import("json_parser.zig");
@@ -354,40 +353,19 @@ pub const Define = struct {
const expect = std.testing.expect;
test "UserDefines" {
- try alloc.setup(std.heap.page_allocator);
- var orig = RawDefines.init(alloc.dynamic);
+ js_ast.Stmt.Data.Store.create(default_allocator);
+ js_ast.Expr.Data.Store.create(default_allocator);
+ var orig = RawDefines.init(default_allocator);
try orig.put("process.env.NODE_ENV", "\"development\"");
try orig.put("globalThis", "window");
- var log = logger.Log.init(alloc.dynamic);
- var data = try DefineData.from_input(orig, &log, alloc.dynamic);
+ var log = logger.Log.init(default_allocator);
+ var data = try DefineData.from_input(orig, &log, default_allocator);
try expect(data.contains("process.env.NODE_ENV"));
try expect(data.contains("globalThis"));
const globalThis = data.get("globalThis");
const val = data.get("process.env.NODE_ENV");
try expect(val != null);
- try expect(strings.utf16EqlString(val.?.value.e_string.value, "development"));
+ try expect(val.?.value.e_string.eql([]const u8, "development"));
try std.testing.expectEqualStrings(globalThis.?.original_name.?, "window");
}
-
-// 396,000ns was upper end of last time this was checked how long it took
-// => 0.396ms
-test "Defines" {
- try alloc.setup(std.heap.page_allocator);
- const start = std.time.nanoTimestamp();
- var orig = RawDefines.init(alloc.dynamic);
- try orig.put("process.env.NODE_ENV", "\"development\"");
- var log = logger.Log.init(alloc.dynamic);
- var data = try DefineData.from_input(orig, &log, alloc.dynamic);
- var defines = try Define.init(alloc.dynamic, data);
- Output.print("Time: {d}", .{std.time.nanoTimestamp() - start});
- const node_env_dots = defines.dots.get("NODE_ENV");
- try expect(node_env_dots != null);
- try expect(node_env_dots.?.len > 0);
- const node_env = node_env_dots.?[0];
- try std.testing.expectEqual(node_env.parts.len, 2);
- try std.testing.expectEqualStrings("process", node_env.parts[0]);
- try std.testing.expectEqualStrings("env", node_env.parts[1]);
- try expect(node_env.data.original_name == null);
- try expect(strings.utf16EqlString(node_env.data.value.e_string.value, "development"));
-}
diff --git a/src/deps/picohttp.zig b/src/deps/picohttp.zig
index 2d549b3f0..ef00436f0 100644
--- a/src/deps/picohttp.zig
+++ b/src/deps/picohttp.zig
@@ -87,37 +87,6 @@ pub const Request = struct {
}
};
-test "pico_http: parse request" {
- const REQ = "GET /wp-content/uploads/2010/03/hello-kitty-darth-vader-pink.jpg HTTP/1.1\r\n" ++
- "Host: www.kittyhell.com\r\n" ++
- "User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; ja-JP-mac; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 " ++
- "Pathtraq/0.9\r\n" ++
- "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" ++
- "Accept-Language: ja,en-us;q=0.7,en;q=0.3\r\n" ++
- "Accept-Encoding: gzip,deflate\r\n" ++
- "Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7\r\n" ++
- "Keep-Alive: 115\r\n" ++
- "Connection: keep-alive\r\n" ++
- "TestMultiline: Hello world\r\n" ++
- " This is a second line in the header!\r\n" ++
- "Cookie: wp_ozh_wsa_visits=2; wp_ozh_wsa_visit_lasttime=xxxxxxxxxx; " ++
- "__utma=xxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.x; " ++
- "__utmz=xxxxxxxxx.xxxxxxxxxx.x.x.utmccn=(referral)|utmcsr=reader.livedoor.com|utmcct=/reader/|utmcmd=referral\r\n" ++
- "\r\n";
-
- var headers: [32]Header = undefined;
-
- const req = try Request.parse(REQ, &headers);
-
- std.debug.print("Method: {s}\n", .{req.method});
- std.debug.print("Path: {s}\n", .{req.path});
- std.debug.print("Minor Version: {}\n", .{req.minor_version});
-
- for (req.headers) |header| {
- std.debug.print("{}\n", .{header});
- }
-}
-
pub const Response = struct {
minor_version: usize,
status_code: usize,
@@ -170,7 +139,8 @@ pub const Response = struct {
pub fn parse(buf: []const u8, src: []Header) !Response {
var offset: usize = 0;
- return try parseParts(buf, src, &offset);
+ const response = try parseParts(buf, src, &offset);
+ return response;
}
};
diff --git a/src/deps/zig-clap/clap.zig b/src/deps/zig-clap/clap.zig
index a3a55b811..5fb6cb7de 100644
--- a/src/deps/zig-clap/clap.zig
+++ b/src/deps/zig-clap/clap.zig
@@ -236,19 +236,6 @@ fn testDiag(diag: Diagnostic, err: anyerror, expected: []const u8) void {
testing.expectEqualStrings(expected, slice_stream.getWritten());
}
-test "Diagnostic.report" {
- testDiag(.{ .arg = "c" }, error.InvalidArgument, "Invalid argument 'c'\n");
- testDiag(.{ .name = .{ .long = "cc" } }, error.InvalidArgument, "Invalid argument '--cc'\n");
- testDiag(.{ .name = .{ .short = 'c' } }, error.DoesntTakeValue, "The argument '-c' does not take a value\n");
- testDiag(.{ .name = .{ .long = "cc" } }, error.DoesntTakeValue, "The argument '--cc' does not take a value\n");
- testDiag(.{ .name = .{ .short = 'c' } }, error.MissingValue, "The argument '-c' requires a value but none was supplied\n");
- testDiag(.{ .name = .{ .long = "cc" } }, error.MissingValue, "The argument '--cc' requires a value but none was supplied\n");
- testDiag(.{ .name = .{ .short = 'c' } }, error.InvalidArgument, "Invalid argument '-c'\n");
- testDiag(.{ .name = .{ .long = "cc" } }, error.InvalidArgument, "Invalid argument '--cc'\n");
- testDiag(.{ .name = .{ .short = 'c' } }, error.SomethingElse, "Error while parsing arguments: SomethingElse\n");
- testDiag(.{ .name = .{ .long = "cc" } }, error.SomethingElse, "Error while parsing arguments: SomethingElse\n");
-}
-
pub fn Args(comptime Id: type, comptime params: []const Param(Id)) type {
return struct {
arena: std.heap.ArenaAllocator,
@@ -445,37 +432,6 @@ fn getValueSimple(param: Param(Help)) []const u8 {
return param.id.value;
}
-test "clap.help" {
- var buf: [1024]u8 = undefined;
- var slice_stream = io.fixedBufferStream(&buf);
-
- @setEvalBranchQuota(10000);
- try help(
- slice_stream.writer(),
- comptime &[_]Param(Help){
- parseParam("-a Short flag.") catch unreachable,
- parseParam("-b <V1> Short option.") catch unreachable,
- parseParam("--aa Long flag.") catch unreachable,
- parseParam("--bb <V2> Long option.") catch unreachable,
- parseParam("-c, --cc Both flag.") catch unreachable,
- parseParam("-d, --dd <V3> Both option.") catch unreachable,
- parseParam("-d, --dd <V3>... Both repeated option.") catch unreachable,
- parseParam("<P> Positional. This should not appear in the help message.") catch unreachable,
- },
- );
-
- const expected = "" ++
- "\t-a \tShort flag.\n" ++
- "\t-b <V1> \tShort option.\n" ++
- "\t --aa \tLong flag.\n" ++
- "\t --bb <V2> \tLong option.\n" ++
- "\t-c, --cc \tBoth flag.\n" ++
- "\t-d, --dd <V3> \tBoth option.\n" ++
- "\t-d, --dd <V3>...\tBoth repeated option.\n";
-
- testing.expectEqualStrings(expected, slice_stream.getWritten());
-}
-
/// Will print a usage message in the following format:
/// [-abc] [--longa] [-d <valueText>] [--longb <valueText>] <valueText>
///
@@ -573,38 +529,3 @@ fn testUsage(expected: []const u8, params: []const Param(Help)) !void {
try usage(fbs.writer(), params);
testing.expectEqualStrings(expected, fbs.getWritten());
}
-
-test "usage" {
- @setEvalBranchQuota(100000);
- try testUsage("[-ab]", comptime &[_]Param(Help){
- parseParam("-a") catch unreachable,
- parseParam("-b") catch unreachable,
- });
- try testUsage("[-a <value>] [-b <v>]", comptime &[_]Param(Help){
- parseParam("-a <value>") catch unreachable,
- parseParam("-b <v>") catch unreachable,
- });
- try testUsage("[--a] [--b]", comptime &[_]Param(Help){
- parseParam("--a") catch unreachable,
- parseParam("--b") catch unreachable,
- });
- try testUsage("[--a <value>] [--b <v>]", comptime &[_]Param(Help){
- parseParam("--a <value>") catch unreachable,
- parseParam("--b <v>") catch unreachable,
- });
- try testUsage("<file>", comptime &[_]Param(Help){
- parseParam("<file>") catch unreachable,
- });
- try testUsage("[-ab] [-c <value>] [-d <v>] [--e] [--f] [--g <value>] [--h <v>] [-i <v>...] <file>", comptime &[_]Param(Help){
- parseParam("-a") catch unreachable,
- parseParam("-b") catch unreachable,
- parseParam("-c <value>") catch unreachable,
- parseParam("-d <v>") catch unreachable,
- parseParam("--e") catch unreachable,
- parseParam("--f") catch unreachable,
- parseParam("--g <value>") catch unreachable,
- parseParam("--h <v>") catch unreachable,
- parseParam("-i <v>...") catch unreachable,
- parseParam("<file>") catch unreachable,
- });
-}
diff --git a/src/deps/zig-clap/clap/comptime.zig b/src/deps/zig-clap/clap/comptime.zig
index deb4b3466..a61d12aef 100644
--- a/src/deps/zig-clap/clap/comptime.zig
+++ b/src/deps/zig-clap/clap/comptime.zig
@@ -148,32 +148,3 @@ pub fn ComptimeClap(
}
};
}
-
-test "" {
- const Clap = ComptimeClap(clap.Help, comptime &[_]clap.Param(clap.Help){
- clap.parseParam("-a, --aa ") catch unreachable,
- clap.parseParam("-b, --bb ") catch unreachable,
- clap.parseParam("-c, --cc <V>") catch unreachable,
- clap.parseParam("-d, --dd <V>...") catch unreachable,
- clap.parseParam("<P>") catch unreachable,
- });
-
- var iter = clap.args.SliceIterator{
- .args = &[_][]const u8{
- "-a", "-c", "0", "something", "-d", "a", "--dd", "b",
- },
- };
- var args = try Clap.parse(&iter, .{ .allocator = testing.allocator });
- defer args.deinit();
-
- testing.expect(args.flag("-a"));
- testing.expect(args.flag("--aa"));
- testing.expect(!args.flag("-b"));
- testing.expect(!args.flag("--bb"));
- testing.expectEqualStrings("0", args.option("-c").?);
- testing.expectEqualStrings("0", args.option("--cc").?);
- testing.expectEqual(@as(usize, 1), args.positionals().len);
- testing.expectEqualStrings("something", args.positionals()[0]);
- testing.expectEqualSlices([]const u8, &[_][]const u8{ "a", "b" }, args.options("-d"));
- testing.expectEqualSlices([]const u8, &[_][]const u8{ "a", "b" }, args.options("--dd"));
-}
diff --git a/src/exports.zig b/src/exports.zig
index 132b52a84..fb1f021aa 100644
--- a/src/exports.zig
+++ b/src/exports.zig
@@ -1,12 +1,11 @@
const std = @import("std");
-const alloc = @import("alloc.zig");
usingnamespace @import("global.zig");
const Root = @import("main_wasm.zig").Root;
pub extern fn init() void {
- alloc.dynamic = default_allocator;
- alloc.static = default_allocator;
+ default_allocator = default_allocator;
+ default_allocator = default_allocator;
}
/// Convert a slice into known memory representation -- enables C ABI
diff --git a/src/fs.zig b/src/fs.zig
index ede653a76..ea5602b32 100644
--- a/src/fs.zig
+++ b/src/fs.zig
@@ -1,8 +1,6 @@
const std = @import("std");
usingnamespace @import("global.zig");
const sync = @import("sync.zig");
-const alloc = @import("alloc.zig");
-const expect = std.testing.expect;
const Mutex = @import("./lock.zig").Lock;
const Semaphore = sync.Semaphore;
const Fs = @This();
@@ -97,7 +95,7 @@ pub const FileSystem = struct {
return;
}
- max_fd = std.math.max(fd, max_fd);
+ max_fd = @maximum(fd, max_fd);
}
pub var instance_loaded: bool = false;
pub var instance: FileSystem = undefined;
@@ -116,6 +114,14 @@ pub const FileSystem = struct {
allocator: *std.mem.Allocator,
top_level_dir: ?string,
) !*FileSystem {
+ return init1WithForce(allocator, top_level_dir, false);
+ }
+
+ pub fn init1WithForce(
+ allocator: *std.mem.Allocator,
+ top_level_dir: ?string,
+ comptime force: bool,
+ ) !*FileSystem {
var _top_level_dir = top_level_dir orelse (if (isBrowser) "/project/" else try std.process.getCwdAlloc(allocator));
// Ensure there's a trailing separator in the top level directory
@@ -130,7 +136,7 @@ pub const FileSystem = struct {
_top_level_dir = tld;
}
- if (!instance_loaded) {
+ if (!instance_loaded or force) {
instance = FileSystem{
.allocator = allocator,
.top_level_dir = _top_level_dir,
@@ -158,9 +164,9 @@ pub const FileSystem = struct {
fd: StoredFileDescriptorType = 0,
data: EntryMap,
- pub fn removeEntry(dir: *DirEntry, name: string) !void {
- dir.data.remove(name);
- }
+ // pub fn removeEntry(dir: *DirEntry, name: string) !void {
+ // // dir.data.remove(name);
+ // }
pub fn addEntry(dir: *DirEntry, entry: std.fs.Dir.Entry) !void {
var _kind: Entry.Kind = undefined;
@@ -220,14 +226,6 @@ pub const FileSystem = struct {
}
}
- pub fn updateDir(i: *DirEntry, dir: string) void {
- var iter = i.data.iterator();
- i.dir = dir;
- while (iter.next()) |entry| {
- entry.value_ptr.dir = dir;
- }
- }
-
pub fn empty(dir: string, allocator: *std.mem.Allocator) DirEntry {
return DirEntry{ .dir = dir, .data = EntryMap.init(allocator) };
}
@@ -424,14 +422,6 @@ pub const FileSystem = struct {
});
}
- pub fn relativeAlloc(f: *@This(), allocator: *std.mem.Allocator, from: string, to: string) string {
- return @call(.{ .modifier = .always_inline }, path_handler.relativeAlloc, .{
- alloc,
- from,
- to,
- });
- }
-
pub fn relativeTo(f: *@This(), to: string) string {
return @call(.{ .modifier = .always_inline }, path_handler.relative, .{
f.top_level_dir,
@@ -446,14 +436,6 @@ pub const FileSystem = struct {
});
}
- pub fn relativeToAlloc(f: *@This(), allocator: *std.mem.Allocator, to: string) string {
- return @call(.{ .modifier = .always_inline }, path_handler.relativeAlloc, .{
- allocator,
- f.top_level_dir,
- to,
- });
- }
-
pub fn absAlloc(f: *@This(), allocator: *std.mem.Allocator, parts: anytype) !string {
const joined = path_handler.joinAbsString(
f.top_level_dir,
@@ -502,7 +484,6 @@ pub const FileSystem = struct {
entries_mutex: Mutex = Mutex.init(),
entries: *EntriesOption.Map,
allocator: *std.mem.Allocator,
- // limiter: *Limiter,
cwd: string,
parent_fs: *FileSystem = undefined,
file_limit: usize = 32,
@@ -719,8 +700,6 @@ pub const FileSystem = struct {
}
pub fn modKey(fs: *RealFS, path: string) anyerror!ModKey {
- // fs.limiter.before();
- // defer fs.limiter.after();
var file = try std.fs.openFileAbsolute(path, std.fs.File.OpenFlags{ .read = true });
defer {
if (fs.needToCloseFiles()) {
@@ -745,33 +724,6 @@ pub const FileSystem = struct {
pub const Map = allocators.BSSMap(EntriesOption, Preallocate.Counts.dir_entry, false, 128, true);
};
- // Limit the number of files open simultaneously to avoid ulimit issues
- pub const Limiter = struct {
- semaphore: Semaphore,
- pub fn init(allocator: *std.mem.Allocator, limit: usize) Limiter {
- return Limiter{
- .semaphore = Semaphore.init(limit),
- // .counter = std.atomic.Int(u8).init(0),
- // .lock = std.Thread.Mutex.init(),
- };
- }
-
- // This will block if the number of open files is already at the limit
- pub fn before(limiter: *Limiter) void {
- limiter.semaphore.wait();
- // var added = limiter.counter.fetchAdd(1);
- }
-
- pub fn after(limiter: *Limiter) void {
- limiter.semaphore.post();
- // limiter.counter.decr();
- // if (limiter.held) |hold| {
- // hold.release();
- // limiter.held = null;
- // }
- }
- };
-
pub fn openDir(fs: *RealFS, unsafe_dir_string: string) std.fs.File.OpenError!std.fs.Dir {
return try std.fs.openDirAbsolute(unsafe_dir_string, std.fs.Dir.OpenDirOptions{ .iterate = true, .access_sub_paths = true, .no_follow = false });
}
@@ -781,9 +733,6 @@ pub const FileSystem = struct {
_dir: string,
handle: std.fs.Dir,
) !DirEntry {
- // fs.limiter.before();
- // defer fs.limiter.after();
-
var iter: std.fs.Dir.Iterator = handle.iterate();
var dir = DirEntry.init(_dir, fs.allocator);
errdefer dir.deinit();
@@ -940,26 +889,6 @@ pub const FileSystem = struct {
return File{ .path = Path.init(path), .contents = file_contents };
}
- pub fn readFile(
- fs: *RealFS,
- path: string,
- _size: ?usize,
- ) !File {
- fs.limiter.before();
- defer fs.limiter.after();
- const file: std.fs.File = std.fs.openFileAbsolute(path, std.fs.File.OpenFlags{ .read = true, .write = false }) catch |err| {
- fs.readFileError(path, err);
- return err;
- };
- defer {
- if (fs.needToCloseFiles()) {
- file.close();
- }
- }
-
- return try fs.readFileWithHandle(path, _size, file);
- }
-
pub fn kind(fs: *RealFS, _dir: string, base: string, existing_fd: StoredFileDescriptorType) !Entry.Cache {
var dir = _dir;
var combo = [2]string{ dir, base };
@@ -1283,3 +1212,7 @@ test "PathName.init" {
try std.testing.expectEqualStrings(res.base, "file");
try std.testing.expectEqualStrings(res.ext, ".ext");
}
+
+test "" {
+ @import("std").testing.refAllDecls(FileSystem);
+}
diff --git a/src/global.zig b/src/global.zig
index 536b55be7..abee056f5 100644
--- a/src/global.zig
+++ b/src/global.zig
@@ -84,7 +84,7 @@ pub const Output = struct {
if (source_set) return;
configureThread();
- // On Linux, thread may be undefined
+ // On Linux, thread may be undefined
// Fortunately, we can use a different syscall that only affects the current thread
if (Environment.isLinux) {
_ = std.os.linux.prctl(std.os.PR_SET_NAME, @ptrToInt(name.ptr), 0, 0, 0);
@@ -490,6 +490,11 @@ pub const Global = struct {
else
std.fmt.comptimePrint("0.0.{d}", .{build_id});
+ pub inline fn getStartTime() i128 {
+ if (Environment.isTest) return 0;
+ return @import("root").start_time;
+ }
+
pub const AllocatorConfiguration = struct {
verbose: bool = false,
long_running: bool = false,
diff --git a/src/http.zig b/src/http.zig
index 275dbb022..8bbc434bb 100644
--- a/src/http.zig
+++ b/src/http.zig
@@ -36,7 +36,7 @@ const IPv6 = std.x.os.IPv6;
const Socket = std.x.os.Socket;
const os = std.os;
-const picohttp = @import("./deps/picohttp.zig");
+const picohttp = @import("picohttp");
const Header = picohttp.Header;
const Request = picohttp.Request;
const Response = picohttp.Response;
@@ -2682,7 +2682,7 @@ pub const Server = struct {
server.bundler.options.origin.port = try std.fmt.allocPrint(server.allocator, "{d}", .{addr.ipv4.port});
}
}
- const start_time = @import("root").start_time;
+ const start_time = Global.getStartTime();
const now = std.time.nanoTimestamp();
Output.printStartEnd(start_time, now);
// This is technically imprecise.
@@ -2996,7 +2996,7 @@ pub const Server = struct {
pub fn initWatcher(server: *Server) !void {
server.watcher = try Watcher.init(server, server.bundler.fs, server.allocator);
- if (comptime FeatureFlags.watch_directories) {
+ if (comptime FeatureFlags.watch_directories and !Environment.isTest) {
server.bundler.resolver.onStartWatchingDirectoryCtx = server.watcher;
server.bundler.resolver.onStartWatchingDirectory = onMaybeWatchDirectory;
}
diff --git a/src/http/url_path.zig b/src/http/url_path.zig
index e36ea9d93..6945119c0 100644
--- a/src/http/url_path.zig
+++ b/src/http/url_path.zig
@@ -126,3 +126,4 @@ pub fn parse(possibly_encoded_pathname_: string) !URLPath {
.needs_redirect = needs_redirect,
};
}
+
diff --git a/src/http_client_async.zig b/src/http_client_async.zig
index de8f8068a..57b24e841 100644
--- a/src/http_client_async.zig
+++ b/src/http_client_async.zig
@@ -2041,176 +2041,176 @@ pub fn sendHTTPS(this: *HTTPClient, body_str: []const u8, body_out_str: *Mutable
}
}
-// zig test src/http_client.zig --test-filter "sendHTTP - only" -lc -lc++ /Users/jarred/Code/bun/src/deps/zlib/libz.a /Users/jarred/Code/bun/src/deps/picohttpparser.o --cache-dir /Users/jarred/Code/bun/zig-cache --global-cache-dir /Users/jarred/.cache/zig --name bun --pkg-begin clap /Users/jarred/Code/bun/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin picohttp /Users/jarred/Code/bun/src/deps/picohttp.zig --pkg-end --pkg-begin iguanaTLS /Users/jarred/Code/bun/src/deps/iguanaTLS/src/main.zig --pkg-end -I /Users/jarred/Code/bun/src/deps -I /Users/jarred/Code/bun/src/deps/mimalloc -I /usr/local/opt/icu4c/include -L src/deps/mimalloc -L /usr/local/opt/icu4c/lib --main-pkg-path /Users/jarred/Code/bun --enable-cache -femit-bin=zig-out/bin/test --test-no-exec
-test "sendHTTP - only" {
- Output.initTest();
- defer Output.flush();
-
- var headers = try std.heap.c_allocator.create(Headers);
- headers.* = Headers{
- .entries = @TypeOf(headers.entries){},
- .buf = @TypeOf(headers.buf){},
- .used = 0,
- .allocator = std.heap.c_allocator,
- };
-
- // headers.appendHeader("X-What", "ok", true, true, false);
- headers.appendHeader("Accept-Encoding", "identity", true, true, false);
-
- var client = HTTPClient.init(
- std.heap.c_allocator,
- .GET,
- URL.parse("http://example.com/"),
- headers.entries,
- headers.buf.items,
- );
- var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
- var response = try client.sendHTTP("", &body_out_str);
- try std.testing.expectEqual(response.status_code, 200);
- try std.testing.expectEqual(body_out_str.list.items.len, 1256);
- try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
-}
-
-// zig test src/http_client.zig --test-filter "sendHTTP - gzip" -lc -lc++ /Users/jarred/Code/bun/src/deps/zlib/libz.a /Users/jarred/Code/bun/src/deps/picohttpparser.o --cache-dir /Users/jarred/Code/bun/zig-cache --global-cache-dir /Users/jarred/.cache/zig --name bun --pkg-begin clap /Users/jarred/Code/bun/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin picohttp /Users/jarred/Code/bun/src/deps/picohttp.zig --pkg-end --pkg-begin iguanaTLS /Users/jarred/Code/bun/src/deps/iguanaTLS/src/main.zig --pkg-end -I /Users/jarred/Code/bun/src/deps -I /Users/jarred/Code/bun/src/deps/mimalloc -I /usr/local/opt/icu4c/include -L src/deps/mimalloc -L /usr/local/opt/icu4c/lib --main-pkg-path /Users/jarred/Code/bun --enable-cache -femit-bin=zig-out/bin/test --test-no-exec
-test "sendHTTP - gzip" {
- Output.initTest();
- defer Output.flush();
-
- var headers = try std.heap.c_allocator.create(Headers);
- headers.* = Headers{
- .entries = @TypeOf(headers.entries){},
- .buf = @TypeOf(headers.buf){},
- .used = 0,
- .allocator = std.heap.c_allocator,
- };
-
- // headers.appendHeader("X-What", "ok", true, true, false);
- headers.appendHeader("Accept-Encoding", "gzip", true, true, false);
-
- var client = HTTPClient.init(
- std.heap.c_allocator,
- .GET,
- URL.parse("http://example.com/"),
- headers.entries,
- headers.buf.items,
- );
- var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
- var response = try client.sendHTTP("", &body_out_str);
- try std.testing.expectEqual(response.status_code, 200);
- try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
-}
-
-// zig test src/http_client.zig --test-filter "sendHTTPS - identity" -lc -lc++ /Users/jarred/Code/bun/src/deps/zlib/libz.a /Users/jarred/Code/bun/src/deps/picohttpparser.o --cache-dir /Users/jarred/Code/bun/zig-cache --global-cache-dir /Users/jarred/.cache/zig --name bun --pkg-begin clap /Users/jarred/Code/bun/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin picohttp /Users/jarred/Code/bun/src/deps/picohttp.zig --pkg-end --pkg-begin iguanaTLS /Users/jarred/Code/bun/src/deps/iguanaTLS/src/main.zig --pkg-end -I /Users/jarred/Code/bun/src/deps -I /Users/jarred/Code/bun/src/deps/mimalloc -I /usr/local/opt/icu4c/include -L src/deps/mimalloc -L /usr/local/opt/icu4c/lib --main-pkg-path /Users/jarred/Code/bun --enable-cache -femit-bin=zig-out/bin/test --test-no-exec
-test "sendHTTPS - identity" {
- Output.initTest();
- defer Output.flush();
-
- var headers = try std.heap.c_allocator.create(Headers);
- headers.* = Headers{
- .entries = @TypeOf(headers.entries){},
- .buf = @TypeOf(headers.buf){},
- .used = 0,
- .allocator = std.heap.c_allocator,
- };
-
- headers.appendHeader("X-What", "ok", true, true, false);
- headers.appendHeader("Accept-Encoding", "identity", true, true, false);
-
- var client = HTTPClient.init(
- std.heap.c_allocator,
- .GET,
- URL.parse("https://example.com/"),
- headers.entries,
- headers.buf.items,
- );
- var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
- var response = try client.sendHTTPS("", &body_out_str);
- try std.testing.expectEqual(response.status_code, 200);
- try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
-}
-
-test "sendHTTPS - gzip" {
- Output.initTest();
- defer Output.flush();
-
- var headers = try std.heap.c_allocator.create(Headers);
- headers.* = Headers{
- .entries = @TypeOf(headers.entries){},
- .buf = @TypeOf(headers.buf){},
- .used = 0,
- .allocator = std.heap.c_allocator,
- };
-
- headers.appendHeader("Accept-Encoding", "gzip", false, false, false);
-
- var client = HTTPClient.init(
- std.heap.c_allocator,
- .GET,
- URL.parse("https://example.com/"),
- headers.entries,
- headers.buf.items,
- );
- var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
- var response = try client.sendHTTPS("", &body_out_str);
- try std.testing.expectEqual(response.status_code, 200);
- try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
-}
-
-// zig test src/http_client.zig --test-filter "sendHTTPS - deflate" -lc -lc++ /Users/jarred/Code/bun/src/deps/zlib/libz.a /Users/jarred/Code/bun/src/deps/picohttpparser.o --cache-dir /Users/jarred/Code/bun/zig-cache --global-cache-dir /Users/jarred/.cache/zig --name bun --pkg-begin clap /Users/jarred/Code/bun/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin picohttp /Users/jarred/Code/bun/src/deps/picohttp.zig --pkg-end --pkg-begin iguanaTLS /Users/jarred/Code/bun/src/deps/iguanaTLS/src/main.zig --pkg-end -I /Users/jarred/Code/bun/src/deps -I /Users/jarred/Code/bun/src/deps/mimalloc -I /usr/local/opt/icu4c/include -L src/deps/mimalloc -L /usr/local/opt/icu4c/lib --main-pkg-path /Users/jarred/Code/bun --enable-cache -femit-bin=zig-out/bin/test
-test "sendHTTPS - deflate" {
- Output.initTest();
- defer Output.flush();
-
- var headers = try std.heap.c_allocator.create(Headers);
- headers.* = Headers{
- .entries = @TypeOf(headers.entries){},
- .buf = @TypeOf(headers.buf){},
- .used = 0,
- .allocator = std.heap.c_allocator,
- };
-
- headers.appendHeader("Accept-Encoding", "deflate", false, false, false);
-
- var client = HTTPClient.init(
- std.heap.c_allocator,
- .GET,
- URL.parse("https://example.com/"),
- headers.entries,
- headers.buf.items,
- );
- var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
- var response = try client.sendHTTPS("", &body_out_str);
- try std.testing.expectEqual(response.status_code, 200);
- try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
-}
-
-// zig test src/http_client.zig --test-filter "sendHTTP" -lc -lc++ /Users/jarred/Code/bun/src/deps/zlib/libz.a /Users/jarred/Code/bun/src/deps/picohttpparser.o --cache-dir /Users/jarred/Code/bun/zig-cache --global-cache-dir /Users/jarred/.cache/zig --name bun --pkg-begin clap /Users/jarred/Code/bun/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin picohttp /Users/jarred/Code/bun/src/deps/picohttp.zig --pkg-end --pkg-begin iguanaTLS /Users/jarred/Code/bun/src/deps/iguanaTLS/src/main.zig --pkg-end -I /Users/jarred/Code/bun/src/deps -I /Users/jarred/Code/bun/src/deps/mimalloc -I /usr/local/opt/icu4c/include -L src/deps/mimalloc -L /usr/local/opt/icu4c/lib --main-pkg-path /Users/jarred/Code/bun --enable-cache -femit-bin=zig-out/bin/test
-
-test "send - redirect" {
- Output.initTest();
- defer Output.flush();
-
- var headers = try std.heap.c_allocator.create(Headers);
- headers.* = Headers{
- .entries = @TypeOf(headers.entries){},
- .buf = @TypeOf(headers.buf){},
- .used = 0,
- .allocator = std.heap.c_allocator,
- };
-
- headers.appendHeader("Accept-Encoding", "gzip", false, false, false);
-
- var client = HTTPClient.init(
- std.heap.c_allocator,
- .GET,
- URL.parse("https://www.bun.sh/"),
- headers.entries,
- headers.buf.items,
- );
- try std.testing.expectEqualStrings(client.url.hostname, "www.bun.sh");
- var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
- var response = try client.send("", &body_out_str);
- try std.testing.expectEqual(response.status_code, 200);
- try std.testing.expectEqual(client.url.hostname, "bun.sh");
- try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
-}
+// // zig test src/http_client.zig --test-filter "sendHTTP - only" -lc -lc++ /Users/jarred/Code/bun/src/deps/zlib/libz.a /Users/jarred/Code/bun/src/deps/picohttpparser.o --cache-dir /Users/jarred/Code/bun/zig-cache --global-cache-dir /Users/jarred/.cache/zig --name bun --pkg-begin clap /Users/jarred/Code/bun/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin picohttp /Users/jarred/Code/bun/src/deps/picohttp.zig --pkg-end --pkg-begin iguanaTLS /Users/jarred/Code/bun/src/deps/iguanaTLS/src/main.zig --pkg-end -I /Users/jarred/Code/bun/src/deps -I /Users/jarred/Code/bun/src/deps/mimalloc -I /usr/local/opt/icu4c/include -L src/deps/mimalloc -L /usr/local/opt/icu4c/lib --main-pkg-path /Users/jarred/Code/bun --enable-cache -femit-bin=zig-out/bin/test --test-no-exec
+// test "sendHTTP - only" {
+// Output.initTest();
+// defer Output.flush();
+
+// var headers = try std.heap.c_allocator.create(Headers);
+// headers.* = Headers{
+// .entries = @TypeOf(headers.entries){},
+// .buf = @TypeOf(headers.buf){},
+// .used = 0,
+// .allocator = std.heap.c_allocator,
+// };
+
+// // headers.appendHeader("X-What", "ok", true, true, false);
+// headers.appendHeader("Accept-Encoding", "identity", true, true, false);
+
+// var client = HTTPClient.init(
+// std.heap.c_allocator,
+// .GET,
+// URL.parse("http://example.com/"),
+// headers.entries,
+// headers.buf.items,
+// );
+// var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
+// var response = try client.sendHTTP("", &body_out_str);
+// try std.testing.expectEqual(response.status_code, 200);
+// try std.testing.expectEqual(body_out_str.list.items.len, 1256);
+// try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
+// }
+
+// // zig test src/http_client.zig --test-filter "sendHTTP - gzip" -lc -lc++ /Users/jarred/Code/bun/src/deps/zlib/libz.a /Users/jarred/Code/bun/src/deps/picohttpparser.o --cache-dir /Users/jarred/Code/bun/zig-cache --global-cache-dir /Users/jarred/.cache/zig --name bun --pkg-begin clap /Users/jarred/Code/bun/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin picohttp /Users/jarred/Code/bun/src/deps/picohttp.zig --pkg-end --pkg-begin iguanaTLS /Users/jarred/Code/bun/src/deps/iguanaTLS/src/main.zig --pkg-end -I /Users/jarred/Code/bun/src/deps -I /Users/jarred/Code/bun/src/deps/mimalloc -I /usr/local/opt/icu4c/include -L src/deps/mimalloc -L /usr/local/opt/icu4c/lib --main-pkg-path /Users/jarred/Code/bun --enable-cache -femit-bin=zig-out/bin/test --test-no-exec
+// test "sendHTTP - gzip" {
+// Output.initTest();
+// defer Output.flush();
+
+// var headers = try std.heap.c_allocator.create(Headers);
+// headers.* = Headers{
+// .entries = @TypeOf(headers.entries){},
+// .buf = @TypeOf(headers.buf){},
+// .used = 0,
+// .allocator = std.heap.c_allocator,
+// };
+
+// // headers.appendHeader("X-What", "ok", true, true, false);
+// headers.appendHeader("Accept-Encoding", "gzip", true, true, false);
+
+// var client = HTTPClient.init(
+// std.heap.c_allocator,
+// .GET,
+// URL.parse("http://example.com/"),
+// headers.entries,
+// headers.buf.items,
+// );
+// var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
+// var response = try client.sendHTTP("", &body_out_str);
+// try std.testing.expectEqual(response.status_code, 200);
+// try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
+// }
+
+// // zig test src/http_client.zig --test-filter "sendHTTPS - identity" -lc -lc++ /Users/jarred/Code/bun/src/deps/zlib/libz.a /Users/jarred/Code/bun/src/deps/picohttpparser.o --cache-dir /Users/jarred/Code/bun/zig-cache --global-cache-dir /Users/jarred/.cache/zig --name bun --pkg-begin clap /Users/jarred/Code/bun/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin picohttp /Users/jarred/Code/bun/src/deps/picohttp.zig --pkg-end --pkg-begin iguanaTLS /Users/jarred/Code/bun/src/deps/iguanaTLS/src/main.zig --pkg-end -I /Users/jarred/Code/bun/src/deps -I /Users/jarred/Code/bun/src/deps/mimalloc -I /usr/local/opt/icu4c/include -L src/deps/mimalloc -L /usr/local/opt/icu4c/lib --main-pkg-path /Users/jarred/Code/bun --enable-cache -femit-bin=zig-out/bin/test --test-no-exec
+// test "sendHTTPS - identity" {
+// Output.initTest();
+// defer Output.flush();
+
+// var headers = try std.heap.c_allocator.create(Headers);
+// headers.* = Headers{
+// .entries = @TypeOf(headers.entries){},
+// .buf = @TypeOf(headers.buf){},
+// .used = 0,
+// .allocator = std.heap.c_allocator,
+// };
+
+// headers.appendHeader("X-What", "ok", true, true, false);
+// headers.appendHeader("Accept-Encoding", "identity", true, true, false);
+
+// var client = HTTPClient.init(
+// std.heap.c_allocator,
+// .GET,
+// URL.parse("https://example.com/"),
+// headers.entries,
+// headers.buf.items,
+// );
+// var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
+// var response = try client.sendHTTPS("", &body_out_str);
+// try std.testing.expectEqual(response.status_code, 200);
+// try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
+// }
+
+// test "sendHTTPS - gzip" {
+// Output.initTest();
+// defer Output.flush();
+
+// var headers = try std.heap.c_allocator.create(Headers);
+// headers.* = Headers{
+// .entries = @TypeOf(headers.entries){},
+// .buf = @TypeOf(headers.buf){},
+// .used = 0,
+// .allocator = std.heap.c_allocator,
+// };
+
+// headers.appendHeader("Accept-Encoding", "gzip", false, false, false);
+
+// var client = HTTPClient.init(
+// std.heap.c_allocator,
+// .GET,
+// URL.parse("https://example.com/"),
+// headers.entries,
+// headers.buf.items,
+// );
+// var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
+// var response = try client.sendHTTPS("", &body_out_str);
+// try std.testing.expectEqual(response.status_code, 200);
+// try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
+// }
+
+// // zig test src/http_client.zig --test-filter "sendHTTPS - deflate" -lc -lc++ /Users/jarred/Code/bun/src/deps/zlib/libz.a /Users/jarred/Code/bun/src/deps/picohttpparser.o --cache-dir /Users/jarred/Code/bun/zig-cache --global-cache-dir /Users/jarred/.cache/zig --name bun --pkg-begin clap /Users/jarred/Code/bun/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin picohttp /Users/jarred/Code/bun/src/deps/picohttp.zig --pkg-end --pkg-begin iguanaTLS /Users/jarred/Code/bun/src/deps/iguanaTLS/src/main.zig --pkg-end -I /Users/jarred/Code/bun/src/deps -I /Users/jarred/Code/bun/src/deps/mimalloc -I /usr/local/opt/icu4c/include -L src/deps/mimalloc -L /usr/local/opt/icu4c/lib --main-pkg-path /Users/jarred/Code/bun --enable-cache -femit-bin=zig-out/bin/test
+// test "sendHTTPS - deflate" {
+// Output.initTest();
+// defer Output.flush();
+
+// var headers = try std.heap.c_allocator.create(Headers);
+// headers.* = Headers{
+// .entries = @TypeOf(headers.entries){},
+// .buf = @TypeOf(headers.buf){},
+// .used = 0,
+// .allocator = std.heap.c_allocator,
+// };
+
+// headers.appendHeader("Accept-Encoding", "deflate", false, false, false);
+
+// var client = HTTPClient.init(
+// std.heap.c_allocator,
+// .GET,
+// URL.parse("https://example.com/"),
+// headers.entries,
+// headers.buf.items,
+// );
+// var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
+// var response = try client.sendHTTPS("", &body_out_str);
+// try std.testing.expectEqual(response.status_code, 200);
+// try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
+// }
+
+// // zig test src/http_client.zig --test-filter "sendHTTP" -lc -lc++ /Users/jarred/Code/bun/src/deps/zlib/libz.a /Users/jarred/Code/bun/src/deps/picohttpparser.o --cache-dir /Users/jarred/Code/bun/zig-cache --global-cache-dir /Users/jarred/.cache/zig --name bun --pkg-begin clap /Users/jarred/Code/bun/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin picohttp /Users/jarred/Code/bun/src/deps/picohttp.zig --pkg-end --pkg-begin iguanaTLS /Users/jarred/Code/bun/src/deps/iguanaTLS/src/main.zig --pkg-end -I /Users/jarred/Code/bun/src/deps -I /Users/jarred/Code/bun/src/deps/mimalloc -I /usr/local/opt/icu4c/include -L src/deps/mimalloc -L /usr/local/opt/icu4c/lib --main-pkg-path /Users/jarred/Code/bun --enable-cache -femit-bin=zig-out/bin/test
+
+// test "send - redirect" {
+// Output.initTest();
+// defer Output.flush();
+
+// var headers = try std.heap.c_allocator.create(Headers);
+// headers.* = Headers{
+// .entries = @TypeOf(headers.entries){},
+// .buf = @TypeOf(headers.buf){},
+// .used = 0,
+// .allocator = std.heap.c_allocator,
+// };
+
+// headers.appendHeader("Accept-Encoding", "gzip", false, false, false);
+
+// var client = HTTPClient.init(
+// std.heap.c_allocator,
+// .GET,
+// URL.parse("https://www.bun.sh/"),
+// headers.entries,
+// headers.buf.items,
+// );
+// try std.testing.expectEqualStrings(client.url.hostname, "www.bun.sh");
+// var body_out_str = try MutableString.init(std.heap.c_allocator, 0);
+// var response = try client.send("", &body_out_str);
+// try std.testing.expectEqual(response.status_code, 200);
+// try std.testing.expectEqual(client.url.hostname, "bun.sh");
+// try std.testing.expectEqualStrings(body_out_str.list.items, @embedFile("fixtures_example.com.html"));
+// }
diff --git a/src/install/install.zig b/src/install/install.zig
index df57adf06..2db6b49ce 100644
--- a/src/install/install.zig
+++ b/src/install/install.zig
@@ -3,7 +3,7 @@ const std = @import("std");
const JSLexer = @import("../js_lexer.zig");
const logger = @import("../logger.zig");
-const alloc = @import("../alloc.zig");
+
const js_parser = @import("../js_parser.zig");
const json_parser = @import("../json_parser.zig");
const JSPrinter = @import("../js_printer.zig");
diff --git a/src/javascript/jsc/javascript.zig b/src/javascript/jsc/javascript.zig
index d233fddd5..a0efe4a54 100644
--- a/src/javascript/jsc/javascript.zig
+++ b/src/javascript/jsc/javascript.zig
@@ -721,11 +721,6 @@ pub const Performance = struct {
};
const bun_file_import_path = "/node_modules.server.bun";
-pub const LazyClasses = [_]type{};
-
-pub const Module = struct {
- reload_pending: bool = false,
-};
const FetchTasklet = Fetch.FetchTasklet;
const TaggedPointerUnion = @import("../../tagged_pointer.zig").TaggedPointerUnion;
@@ -738,14 +733,12 @@ pub const Task = TaggedPointerUnion(.{
// We can see that it's sort of like std.mem.Allocator but for JSGlobalContextRef, to support Automatic Reference Counting
// Its unavailable on Linux
pub const VirtualMachine = struct {
- const RequireCacheType = std.AutoHashMap(u32, *Module);
global: *JSGlobalObject,
allocator: *std.mem.Allocator,
node_modules: ?*NodeModuleBundle = null,
bundler: Bundler,
watcher: ?*http.Watcher = null,
console: *ZigConsoleClient,
- require_cache: RequireCacheType,
log: *logger.Log,
event_listeners: EventListenerMixin.Map,
main: string = "",
@@ -867,7 +860,6 @@ pub const VirtualMachine = struct {
.global = undefined,
.allocator = allocator,
.entry_point = ServerEntryPoint{},
- .require_cache = RequireCacheType.init(allocator),
.event_listeners = EventListenerMixin.Map.init(allocator),
.bundler = bundler,
.console = console,
@@ -1871,10 +1863,6 @@ pub const VirtualMachine = struct {
}
};
-pub const Object = struct {
- ref: js.jsObjectRef,
-};
-
const GetterFn = fn (
this: anytype,
ctx: js.JSContextRef,
@@ -2390,3 +2378,4 @@ pub const BuildError = struct {
};
pub const JSPrivateDataTag = JSPrivateDataPtr.Tag;
+
diff --git a/src/javascript/jsc/webcore/response.zig b/src/javascript/jsc/webcore/response.zig
index 065ab9884..565843423 100644
--- a/src/javascript/jsc/webcore/response.zig
+++ b/src/javascript/jsc/webcore/response.zig
@@ -1,7 +1,8 @@
usingnamespace @import("../base.zig");
const std = @import("std");
const Api = @import("../../../api/schema.zig").Api;
-const http = @import("../../../http.zig");
+const RequestContext = @import("../../../http.zig").RequestContext;
+const MimeType = @import("../../../http.zig").MimeType;
usingnamespace @import("../javascript.zig");
usingnamespace @import("../bindings/bindings.zig");
const ZigURL = @import("../../../query_string_map.zig").URL;
@@ -263,7 +264,7 @@ pub const Response = struct {
this.allocator.destroy(this);
}
- pub fn mimeType(response: *const Response, request_ctx: *const http.RequestContext) string {
+ pub fn mimeType(response: *const Response, request_ctx: *const RequestContext) string {
if (response.body.init.headers) |headers| {
// Remember, we always lowercase it
// hopefully doesn't matter here tho
@@ -273,7 +274,7 @@ pub const Response = struct {
}
if (request_ctx.url.extname.len > 0) {
- return http.MimeType.byExtension(request_ctx.url.extname).value;
+ return MimeType.byExtension(request_ctx.url.extname).value;
}
switch (response.body.value) {
@@ -283,10 +284,10 @@ pub const Response = struct {
.String => |body| {
// poor man's mimetype sniffing
if (body.len > 0 and (body[0] == '{' or body[0] == '[')) {
- return http.MimeType.json.value;
+ return MimeType.json.value;
}
- return http.MimeType.html.value;
+ return MimeType.html.value;
},
.Unconsumed, .ArrayBuffer => {
return "application/octet-stream";
@@ -1092,7 +1093,7 @@ pub const Headers = struct {
}
// TODO: is it worth making this lazy? instead of copying all the request headers, should we just do it on get/put/iterator?
- pub fn fromRequestCtx(allocator: *std.mem.Allocator, request: *http.RequestContext) !Headers {
+ pub fn fromRequestCtx(allocator: *std.mem.Allocator, request: *RequestContext) !Headers {
return fromPicoHeaders(allocator, request.request.headers);
}
@@ -1486,7 +1487,7 @@ pub const Body = struct {
// https://developer.mozilla.org/en-US/docs/Web/API/Request
pub const Request = struct {
- request_context: *http.RequestContext,
+ request_context: *RequestContext,
url_string_ref: js.JSStringRef = null,
headers: ?Headers = null,
@@ -1673,7 +1674,7 @@ pub const Request = struct {
pub const FetchEvent = struct {
started_waiting_at: u64 = 0,
response: ?*Response = null,
- request_context: *http.RequestContext,
+ request_context: *RequestContext,
request: Request,
pending_promise: ?*JSInternalPromise = null,
@@ -1980,3 +1981,7 @@ pub const FetchEvent = struct {
// },
// );
// };
+
+test "" {
+ std.testing.refAllDecls(Api);
+}
diff --git a/src/js_ast.zig b/src/js_ast.zig
index cebad7115..5986e0dcc 100644
--- a/src/js_ast.zig
+++ b/src/js_ast.zig
@@ -7120,122 +7120,122 @@ pub const Macro = struct {
};
};
-test "Binding.init" {
- var binding = Binding.alloc(
- std.heap.page_allocator,
- B.Identifier{ .ref = Ref{ .source_index = 0, .inner_index = 10 } },
- logger.Loc{ .start = 1 },
- );
- std.testing.expect(binding.loc.start == 1);
- std.testing.expect(@as(Binding.Tag, binding.data) == Binding.Tag.b_identifier);
-
- printmem("-------Binding: {d} bits\n", .{@bitSizeOf(Binding)});
- printmem("B.Identifier: {d} bits\n", .{@bitSizeOf(B.Identifier)});
- printmem("B.Array: {d} bits\n", .{@bitSizeOf(B.Array)});
- printmem("B.Property: {d} bits\n", .{@bitSizeOf(B.Property)});
- printmem("B.Object: {d} bits\n", .{@bitSizeOf(B.Object)});
- printmem("B.Missing: {d} bits\n", .{@bitSizeOf(B.Missing)});
- printmem("-------Binding: {d} bits\n", .{@bitSizeOf(Binding)});
-}
-
-test "Stmt.init" {
- var stmt = Stmt.alloc(
- std.heap.page_allocator,
- S.Continue{},
- logger.Loc{ .start = 1 },
- );
- std.testing.expect(stmt.loc.start == 1);
- std.testing.expect(@as(Stmt.Tag, stmt.data) == Stmt.Tag.s_continue);
-
- printmem("-----Stmt {d} bits\n", .{@bitSizeOf(Stmt)});
- printmem("StmtNodeList: {d} bits\n", .{@bitSizeOf(StmtNodeList)});
- printmem("StmtOrExpr: {d} bits\n", .{@bitSizeOf(StmtOrExpr)});
- printmem("S.Block {d} bits\n", .{@bitSizeOf(S.Block)});
- printmem("S.Comment {d} bits\n", .{@bitSizeOf(S.Comment)});
- printmem("S.Directive {d} bits\n", .{@bitSizeOf(S.Directive)});
- printmem("S.ExportClause {d} bits\n", .{@bitSizeOf(S.ExportClause)});
- printmem("S.Empty {d} bits\n", .{@bitSizeOf(S.Empty)});
- printmem("S.TypeScript {d} bits\n", .{@bitSizeOf(S.TypeScript)});
- printmem("S.Debugger {d} bits\n", .{@bitSizeOf(S.Debugger)});
- printmem("S.ExportFrom {d} bits\n", .{@bitSizeOf(S.ExportFrom)});
- printmem("S.ExportDefault {d} bits\n", .{@bitSizeOf(S.ExportDefault)});
- printmem("S.Enum {d} bits\n", .{@bitSizeOf(S.Enum)});
- printmem("S.Namespace {d} bits\n", .{@bitSizeOf(S.Namespace)});
- printmem("S.Function {d} bits\n", .{@bitSizeOf(S.Function)});
- printmem("S.Class {d} bits\n", .{@bitSizeOf(S.Class)});
- printmem("S.If {d} bits\n", .{@bitSizeOf(S.If)});
- printmem("S.For {d} bits\n", .{@bitSizeOf(S.For)});
- printmem("S.ForIn {d} bits\n", .{@bitSizeOf(S.ForIn)});
- printmem("S.ForOf {d} bits\n", .{@bitSizeOf(S.ForOf)});
- printmem("S.DoWhile {d} bits\n", .{@bitSizeOf(S.DoWhile)});
- printmem("S.While {d} bits\n", .{@bitSizeOf(S.While)});
- printmem("S.With {d} bits\n", .{@bitSizeOf(S.With)});
- printmem("S.Try {d} bits\n", .{@bitSizeOf(S.Try)});
- printmem("S.Switch {d} bits\n", .{@bitSizeOf(S.Switch)});
- printmem("S.Import {d} bits\n", .{@bitSizeOf(S.Import)});
- printmem("S.Return {d} bits\n", .{@bitSizeOf(S.Return)});
- printmem("S.Throw {d} bits\n", .{@bitSizeOf(S.Throw)});
- printmem("S.Local {d} bits\n", .{@bitSizeOf(S.Local)});
- printmem("S.Break {d} bits\n", .{@bitSizeOf(S.Break)});
- printmem("S.Continue {d} bits\n", .{@bitSizeOf(S.Continue)});
- printmem("-----Stmt {d} bits\n", .{@bitSizeOf(Stmt)});
-}
-
-test "Expr.init" {
- var allocator = std.heap.page_allocator;
- const ident = Expr.init(E.Identifier, E.Identifier{}, logger.Loc{ .start = 100 });
- var list = [_]Expr{ident};
- var expr = Expr.init(
- E.Array,
- E.Array{ .items = list[0..] },
- logger.Loc{ .start = 1 },
- );
- try std.testing.expect(expr.loc.start == 1);
- try std.testing.expect(@as(Expr.Tag, expr.data) == Expr.Tag.e_array);
- try std.testing.expect(expr.data.e_array.items[0].loc.start == 100);
-
- printmem("--Ref {d} bits\n", .{@bitSizeOf(Ref)});
- printmem("--LocRef {d} bits\n", .{@bitSizeOf(LocRef)});
- printmem("--logger.Loc {d} bits\n", .{@bitSizeOf(logger.Loc)});
- printmem("--logger.Range {d} bits\n", .{@bitSizeOf(logger.Range)});
- printmem("----------Expr: {d} bits\n", .{@bitSizeOf(Expr)});
- printmem("ExprNodeList: {d} bits\n", .{@bitSizeOf(ExprNodeList)});
- printmem("E.Array: {d} bits\n", .{@bitSizeOf(E.Array)});
-
- printmem("E.Unary: {d} bits\n", .{@bitSizeOf(E.Unary)});
- printmem("E.Binary: {d} bits\n", .{@bitSizeOf(E.Binary)});
- printmem("E.Boolean: {d} bits\n", .{@bitSizeOf(E.Boolean)});
- printmem("E.Super: {d} bits\n", .{@bitSizeOf(E.Super)});
- printmem("E.Null: {d} bits\n", .{@bitSizeOf(E.Null)});
- printmem("E.Undefined: {d} bits\n", .{@bitSizeOf(E.Undefined)});
- printmem("E.New: {d} bits\n", .{@bitSizeOf(E.New)});
- printmem("E.NewTarget: {d} bits\n", .{@bitSizeOf(E.NewTarget)});
- printmem("E.Function: {d} bits\n", .{@bitSizeOf(E.Function)});
- printmem("E.ImportMeta: {d} bits\n", .{@bitSizeOf(E.ImportMeta)});
- printmem("E.Call: {d} bits\n", .{@bitSizeOf(E.Call)});
- printmem("E.Dot: {d} bits\n", .{@bitSizeOf(E.Dot)});
- printmem("E.Index: {d} bits\n", .{@bitSizeOf(E.Index)});
- printmem("E.Arrow: {d} bits\n", .{@bitSizeOf(E.Arrow)});
- printmem("E.Identifier: {d} bits\n", .{@bitSizeOf(E.Identifier)});
- printmem("E.ImportIdentifier: {d} bits\n", .{@bitSizeOf(E.ImportIdentifier)});
- printmem("E.PrivateIdentifier: {d} bits\n", .{@bitSizeOf(E.PrivateIdentifier)});
- printmem("E.JSXElement: {d} bits\n", .{@bitSizeOf(E.JSXElement)});
- printmem("E.Missing: {d} bits\n", .{@bitSizeOf(E.Missing)});
- printmem("E.Number: {d} bits\n", .{@bitSizeOf(E.Number)});
- printmem("E.BigInt: {d} bits\n", .{@bitSizeOf(E.BigInt)});
- printmem("E.Object: {d} bits\n", .{@bitSizeOf(E.Object)});
- printmem("E.Spread: {d} bits\n", .{@bitSizeOf(E.Spread)});
- printmem("E.String: {d} bits\n", .{@bitSizeOf(E.String)});
- printmem("E.TemplatePart: {d} bits\n", .{@bitSizeOf(E.TemplatePart)});
- printmem("E.Template: {d} bits\n", .{@bitSizeOf(E.Template)});
- printmem("E.RegExp: {d} bits\n", .{@bitSizeOf(E.RegExp)});
- printmem("E.Await: {d} bits\n", .{@bitSizeOf(E.Await)});
- printmem("E.Yield: {d} bits\n", .{@bitSizeOf(E.Yield)});
- printmem("E.If: {d} bits\n", .{@bitSizeOf(E.If)});
- printmem("E.RequireOrRequireResolve: {d} bits\n", .{@bitSizeOf(E.RequireOrRequireResolve)});
- printmem("E.Import: {d} bits\n", .{@bitSizeOf(E.Import)});
- printmem("----------Expr: {d} bits\n", .{@bitSizeOf(Expr)});
-}
+// test "Binding.init" {
+// var binding = Binding.alloc(
+// std.heap.page_allocator,
+// B.Identifier{ .ref = Ref{ .source_index = 0, .inner_index = 10 } },
+// logger.Loc{ .start = 1 },
+// );
+// std.testing.expect(binding.loc.start == 1);
+// std.testing.expect(@as(Binding.Tag, binding.data) == Binding.Tag.b_identifier);
+
+// printmem("-------Binding: {d} bits\n", .{@bitSizeOf(Binding)});
+// printmem("B.Identifier: {d} bits\n", .{@bitSizeOf(B.Identifier)});
+// printmem("B.Array: {d} bits\n", .{@bitSizeOf(B.Array)});
+// printmem("B.Property: {d} bits\n", .{@bitSizeOf(B.Property)});
+// printmem("B.Object: {d} bits\n", .{@bitSizeOf(B.Object)});
+// printmem("B.Missing: {d} bits\n", .{@bitSizeOf(B.Missing)});
+// printmem("-------Binding: {d} bits\n", .{@bitSizeOf(Binding)});
+// }
+
+// test "Stmt.init" {
+// var stmt = Stmt.alloc(
+// std.heap.page_allocator,
+// S.Continue{},
+// logger.Loc{ .start = 1 },
+// );
+// std.testing.expect(stmt.loc.start == 1);
+// std.testing.expect(@as(Stmt.Tag, stmt.data) == Stmt.Tag.s_continue);
+
+// printmem("-----Stmt {d} bits\n", .{@bitSizeOf(Stmt)});
+// printmem("StmtNodeList: {d} bits\n", .{@bitSizeOf(StmtNodeList)});
+// printmem("StmtOrExpr: {d} bits\n", .{@bitSizeOf(StmtOrExpr)});
+// printmem("S.Block {d} bits\n", .{@bitSizeOf(S.Block)});
+// printmem("S.Comment {d} bits\n", .{@bitSizeOf(S.Comment)});
+// printmem("S.Directive {d} bits\n", .{@bitSizeOf(S.Directive)});
+// printmem("S.ExportClause {d} bits\n", .{@bitSizeOf(S.ExportClause)});
+// printmem("S.Empty {d} bits\n", .{@bitSizeOf(S.Empty)});
+// printmem("S.TypeScript {d} bits\n", .{@bitSizeOf(S.TypeScript)});
+// printmem("S.Debugger {d} bits\n", .{@bitSizeOf(S.Debugger)});
+// printmem("S.ExportFrom {d} bits\n", .{@bitSizeOf(S.ExportFrom)});
+// printmem("S.ExportDefault {d} bits\n", .{@bitSizeOf(S.ExportDefault)});
+// printmem("S.Enum {d} bits\n", .{@bitSizeOf(S.Enum)});
+// printmem("S.Namespace {d} bits\n", .{@bitSizeOf(S.Namespace)});
+// printmem("S.Function {d} bits\n", .{@bitSizeOf(S.Function)});
+// printmem("S.Class {d} bits\n", .{@bitSizeOf(S.Class)});
+// printmem("S.If {d} bits\n", .{@bitSizeOf(S.If)});
+// printmem("S.For {d} bits\n", .{@bitSizeOf(S.For)});
+// printmem("S.ForIn {d} bits\n", .{@bitSizeOf(S.ForIn)});
+// printmem("S.ForOf {d} bits\n", .{@bitSizeOf(S.ForOf)});
+// printmem("S.DoWhile {d} bits\n", .{@bitSizeOf(S.DoWhile)});
+// printmem("S.While {d} bits\n", .{@bitSizeOf(S.While)});
+// printmem("S.With {d} bits\n", .{@bitSizeOf(S.With)});
+// printmem("S.Try {d} bits\n", .{@bitSizeOf(S.Try)});
+// printmem("S.Switch {d} bits\n", .{@bitSizeOf(S.Switch)});
+// printmem("S.Import {d} bits\n", .{@bitSizeOf(S.Import)});
+// printmem("S.Return {d} bits\n", .{@bitSizeOf(S.Return)});
+// printmem("S.Throw {d} bits\n", .{@bitSizeOf(S.Throw)});
+// printmem("S.Local {d} bits\n", .{@bitSizeOf(S.Local)});
+// printmem("S.Break {d} bits\n", .{@bitSizeOf(S.Break)});
+// printmem("S.Continue {d} bits\n", .{@bitSizeOf(S.Continue)});
+// printmem("-----Stmt {d} bits\n", .{@bitSizeOf(Stmt)});
+// }
+
+// test "Expr.init" {
+// var allocator = std.heap.page_allocator;
+// const ident = Expr.init(E.Identifier, E.Identifier{}, logger.Loc{ .start = 100 });
+// var list = [_]Expr{ident};
+// var expr = Expr.init(
+// E.Array,
+// E.Array{ .items = list[0..] },
+// logger.Loc{ .start = 1 },
+// );
+// try std.testing.expect(expr.loc.start == 1);
+// try std.testing.expect(@as(Expr.Tag, expr.data) == Expr.Tag.e_array);
+// try std.testing.expect(expr.data.e_array.items[0].loc.start == 100);
+
+// printmem("--Ref {d} bits\n", .{@bitSizeOf(Ref)});
+// printmem("--LocRef {d} bits\n", .{@bitSizeOf(LocRef)});
+// printmem("--logger.Loc {d} bits\n", .{@bitSizeOf(logger.Loc)});
+// printmem("--logger.Range {d} bits\n", .{@bitSizeOf(logger.Range)});
+// printmem("----------Expr: {d} bits\n", .{@bitSizeOf(Expr)});
+// printmem("ExprNodeList: {d} bits\n", .{@bitSizeOf(ExprNodeList)});
+// printmem("E.Array: {d} bits\n", .{@bitSizeOf(E.Array)});
+
+// printmem("E.Unary: {d} bits\n", .{@bitSizeOf(E.Unary)});
+// printmem("E.Binary: {d} bits\n", .{@bitSizeOf(E.Binary)});
+// printmem("E.Boolean: {d} bits\n", .{@bitSizeOf(E.Boolean)});
+// printmem("E.Super: {d} bits\n", .{@bitSizeOf(E.Super)});
+// printmem("E.Null: {d} bits\n", .{@bitSizeOf(E.Null)});
+// printmem("E.Undefined: {d} bits\n", .{@bitSizeOf(E.Undefined)});
+// printmem("E.New: {d} bits\n", .{@bitSizeOf(E.New)});
+// printmem("E.NewTarget: {d} bits\n", .{@bitSizeOf(E.NewTarget)});
+// printmem("E.Function: {d} bits\n", .{@bitSizeOf(E.Function)});
+// printmem("E.ImportMeta: {d} bits\n", .{@bitSizeOf(E.ImportMeta)});
+// printmem("E.Call: {d} bits\n", .{@bitSizeOf(E.Call)});
+// printmem("E.Dot: {d} bits\n", .{@bitSizeOf(E.Dot)});
+// printmem("E.Index: {d} bits\n", .{@bitSizeOf(E.Index)});
+// printmem("E.Arrow: {d} bits\n", .{@bitSizeOf(E.Arrow)});
+// printmem("E.Identifier: {d} bits\n", .{@bitSizeOf(E.Identifier)});
+// printmem("E.ImportIdentifier: {d} bits\n", .{@bitSizeOf(E.ImportIdentifier)});
+// printmem("E.PrivateIdentifier: {d} bits\n", .{@bitSizeOf(E.PrivateIdentifier)});
+// printmem("E.JSXElement: {d} bits\n", .{@bitSizeOf(E.JSXElement)});
+// printmem("E.Missing: {d} bits\n", .{@bitSizeOf(E.Missing)});
+// printmem("E.Number: {d} bits\n", .{@bitSizeOf(E.Number)});
+// printmem("E.BigInt: {d} bits\n", .{@bitSizeOf(E.BigInt)});
+// printmem("E.Object: {d} bits\n", .{@bitSizeOf(E.Object)});
+// printmem("E.Spread: {d} bits\n", .{@bitSizeOf(E.Spread)});
+// printmem("E.String: {d} bits\n", .{@bitSizeOf(E.String)});
+// printmem("E.TemplatePart: {d} bits\n", .{@bitSizeOf(E.TemplatePart)});
+// printmem("E.Template: {d} bits\n", .{@bitSizeOf(E.Template)});
+// printmem("E.RegExp: {d} bits\n", .{@bitSizeOf(E.RegExp)});
+// printmem("E.Await: {d} bits\n", .{@bitSizeOf(E.Await)});
+// printmem("E.Yield: {d} bits\n", .{@bitSizeOf(E.Yield)});
+// printmem("E.If: {d} bits\n", .{@bitSizeOf(E.If)});
+// printmem("E.RequireOrRequireResolve: {d} bits\n", .{@bitSizeOf(E.RequireOrRequireResolve)});
+// printmem("E.Import: {d} bits\n", .{@bitSizeOf(E.Import)});
+// printmem("----------Expr: {d} bits\n", .{@bitSizeOf(Expr)});
+// }
// -- ESBuild bit sizes
// EArray | 256
diff --git a/src/js_lexer.zig b/src/js_lexer.zig
index 00344d5fd..92acc0dd1 100644
--- a/src/js_lexer.zig
+++ b/src/js_lexer.zig
@@ -1,7 +1,6 @@
const std = @import("std");
const logger = @import("logger.zig");
const tables = @import("js_lexer_tables.zig");
-const alloc = @import("alloc.zig");
const build_options = @import("build_options");
const js_ast = @import("js_ast.zig");
diff --git a/src/js_lexer/range_table.zig b/src/js_lexer/range_table.zig
deleted file mode 100644
index 72a9d842a..000000000
--- a/src/js_lexer/range_table.zig
+++ /dev/null
@@ -1,136 +0,0 @@
-const std = @import("std");
-
-const RangeTable = @This();
-
-pub const R16Range = [2]u16;
-pub const R32Range = [2]u32;
-
-latin_offset: u8 = 0,
-
-r16_max: u16 = 0xFFFF,
-r16_min: u16 = 256,
-r16: []const R16Range = &[_]R16Range{},
-r32: []const R32Range = &[_]R32Range{},
-r32_max: u32 = std.math.maxInt(u32),
-r32_min: u32 = std.math.maxInt(u16) + 1,
-
-pub fn init(
- comptime latin_offset: u8,
- comptime r16: []const R16Range,
- comptime r32: []const R32Range,
-) RangeTable {
- return comptime brk: {
- @setEvalBranchQuota(9999);
- var min_16: u16 = std.math.maxInt(u16);
- var max_16: u16 = 0;
-
- var min_32: u32 = std.math.maxInt(u32);
- var max_32: u32 = 0;
-
- for (r16) |group, i| {
- min_16 = std.math.max(std.math.min(min_16, group[0]), latin_offset);
- max_16 = std.math.max(max_16, group[1]);
- }
-
- for (r32) |group, i| {
- min_32 = std.math.min(min_32, group[0]);
- max_32 = std.math.max(max_32, group[1]);
- }
-
- break :brk RangeTable{
- .latin_offset = latin_offset,
- .r16_min = min_16,
-
- .r16_max = max_16,
- .r16 = r16,
- .r32 = r32,
- .r32_min = min_32,
- .r32_max = max_32,
- };
- };
-}
-
-pub fn inRange16(this: *const RangeTable, value: u16) bool {
- const slice = this.r16[this.latin_offset..];
- var lo: u16 = 0;
- var hi: u16 = @intCast(u16, slice.len);
- while (lo < hi) {
- const mid = (lo + hi) / 2;
- const range = slice[mid];
- if (value <= range[0] and value <= range[1]) {
- return true;
- }
- hi = if (value < range[0]) mid else hi;
- lo = if (!(value < range[0])) mid else lo;
- }
-
- return false;
-}
-
-pub fn inRange32(this: *const RangeTable, value: u32) bool {
- const slice = this.r32;
- var lo: u16 = 0;
- var hi: u16 = @intCast(u16, slice.len);
- while (lo < hi) {
- const mid = (lo + hi) / 2;
- const range = slice[mid];
- if (value <= range[0] and value <= range[1]) {
- return true;
- }
- hi = if (value < range[0]) mid else hi;
- lo = if (!(value < range[0])) mid else lo;
- }
-
- return false;
-}
-
-pub fn includes(this: *const RangeTable, comptime width: u3, comptime ValueType: type, value: ValueType) bool {
- switch (comptime width) {
- 0 => @compileError("dont use this"),
- 1 => @compileError("dont use this"),
- 2 => {
- if (value < this.r16_min or value > this.r16_max) return false;
- return this.inRange16(@intCast(u16, value));
- },
- else => {
- if (value < this.r32_min or value > this.r32_max) return false;
-
- return this.inRange32(@intCast(u32, value));
- },
- }
-}
-
-test "in16" {
- const u16range: []const R16Range = &[_]R16Range{
- R16Range{ 0x2c6, 0x2d1 },
- R16Range{ 0x2e0, 0x2e4 },
- R16Range{ 0x2ec, 0x2ec },
- R16Range{ 0x2ee, 0x2ee },
- R16Range{ 0x370, 0x374 },
- R16Range{ 0x376, 0x377 },
- R16Range{ 0x37a, 0x37d },
- R16Range{ 0x37f, 0x37f },
- R16Range{ 0x386, 0x386 },
- R16Range{ 0x388, 0x38a },
- R16Range{ 0x38c, 0x38c },
- R16Range{ 0x38e, 0x3a1 },
- R16Range{ 0x3a3, 0x3f5 },
- R16Range{ 0x3f7, 0x481 },
- R16Range{ 0x48a, 0x52f },
- R16Range{ 0x531, 0x556 },
- R16Range{ 0x559, 0x559 },
- };
- const table = init(
- 0,
- u16range,
- &.{},
- );
-
- const bytes: []const u8 = &[_]u8{ 205, 189 };
- var decoded = try std.unicode.utf8Decode(bytes);
- try std.testing.expect(table.includes(2, @TypeOf(decoded), decoded));
-
- const bytes2: []const u8 = &[_]u8{ 213, 153 };
- decoded = try std.unicode.utf8Decode(bytes2);
- try std.testing.expect(!table.includes(3, @TypeOf(decoded), decoded));
-}
diff --git a/src/js_lexer/unicode.zig b/src/js_lexer/unicode.zig
deleted file mode 100644
index 2331620f0..000000000
--- a/src/js_lexer/unicode.zig
+++ /dev/null
@@ -1,4104 +0,0 @@
-// This file was automatically generated by gen-unicode-table.js. Do not edit.
-
-const RangeTable = @import("./range_table.zig");
-
-// ES5 || ESNext
-pub const id_start = RangeTable.init(
- 117,
- &[_]R16Range{
- .{ 0x41, 0x5a },
- .{ 0x61, 0x7a },
- .{ 0xaa, 0xaa },
- .{ 0xb5, 0xb5 },
- .{ 0xba, 0xba },
- .{ 0xc0, 0xd6 },
- .{ 0xd8, 0xf6 },
- .{ 0xf8, 0x2c1 },
- .{ 0x2c6, 0x2d1 },
- .{ 0x2e0, 0x2e4 },
- .{ 0x2ec, 0x2ec },
- .{ 0x2ee, 0x2ee },
- .{ 0x370, 0x374 },
- .{ 0x376, 0x377 },
- .{ 0x37a, 0x37d },
- .{ 0x37f, 0x37f },
- .{ 0x386, 0x386 },
- .{ 0x388, 0x38a },
- .{ 0x38c, 0x38c },
- .{ 0x38e, 0x3a1 },
- .{ 0x3a3, 0x3f5 },
- .{ 0x3f7, 0x481 },
- .{ 0x48a, 0x52f },
- .{ 0x531, 0x556 },
- .{ 0x559, 0x559 },
- .{ 0x560, 0x588 },
- .{ 0x5d0, 0x5ea },
- .{ 0x5ef, 0x5f2 },
- .{ 0x620, 0x64a },
- .{ 0x66e, 0x66f },
- .{ 0x671, 0x6d3 },
- .{ 0x6d5, 0x6d5 },
- .{ 0x6e5, 0x6e6 },
- .{ 0x6ee, 0x6ef },
- .{ 0x6fa, 0x6fc },
- .{ 0x6ff, 0x6ff },
- .{ 0x710, 0x710 },
- .{ 0x712, 0x72f },
- .{ 0x74d, 0x7a5 },
- .{ 0x7b1, 0x7b1 },
- .{ 0x7ca, 0x7ea },
- .{ 0x7f4, 0x7f5 },
- .{ 0x7fa, 0x7fa },
- .{ 0x800, 0x815 },
- .{ 0x81a, 0x81a },
- .{ 0x824, 0x824 },
- .{ 0x828, 0x828 },
- .{ 0x840, 0x858 },
- .{ 0x860, 0x86a },
- .{ 0x8a0, 0x8b4 },
- .{ 0x8b6, 0x8c7 },
- .{ 0x904, 0x939 },
- .{ 0x93d, 0x93d },
- .{ 0x950, 0x950 },
- .{ 0x958, 0x961 },
- .{ 0x971, 0x980 },
- .{ 0x985, 0x98c },
- .{ 0x98f, 0x990 },
- .{ 0x993, 0x9a8 },
- .{ 0x9aa, 0x9b0 },
- .{ 0x9b2, 0x9b2 },
- .{ 0x9b6, 0x9b9 },
- .{ 0x9bd, 0x9bd },
- .{ 0x9ce, 0x9ce },
- .{ 0x9dc, 0x9dd },
- .{ 0x9df, 0x9e1 },
- .{ 0x9f0, 0x9f1 },
- .{ 0x9fc, 0x9fc },
- .{ 0xa05, 0xa0a },
- .{ 0xa0f, 0xa10 },
- .{ 0xa13, 0xa28 },
- .{ 0xa2a, 0xa30 },
- .{ 0xa32, 0xa33 },
- .{ 0xa35, 0xa36 },
- .{ 0xa38, 0xa39 },
- .{ 0xa59, 0xa5c },
- .{ 0xa5e, 0xa5e },
- .{ 0xa72, 0xa74 },
- .{ 0xa85, 0xa8d },
- .{ 0xa8f, 0xa91 },
- .{ 0xa93, 0xaa8 },
- .{ 0xaaa, 0xab0 },
- .{ 0xab2, 0xab3 },
- .{ 0xab5, 0xab9 },
- .{ 0xabd, 0xabd },
- .{ 0xad0, 0xad0 },
- .{ 0xae0, 0xae1 },
- .{ 0xaf9, 0xaf9 },
- .{ 0xb05, 0xb0c },
- .{ 0xb0f, 0xb10 },
- .{ 0xb13, 0xb28 },
- .{ 0xb2a, 0xb30 },
- .{ 0xb32, 0xb33 },
- .{ 0xb35, 0xb39 },
- .{ 0xb3d, 0xb3d },
- .{ 0xb5c, 0xb5d },
- .{ 0xb5f, 0xb61 },
- .{ 0xb71, 0xb71 },
- .{ 0xb83, 0xb83 },
- .{ 0xb85, 0xb8a },
- .{ 0xb8e, 0xb90 },
- .{ 0xb92, 0xb95 },
- .{ 0xb99, 0xb9a },
- .{ 0xb9c, 0xb9c },
- .{ 0xb9e, 0xb9f },
- .{ 0xba3, 0xba4 },
- .{ 0xba8, 0xbaa },
- .{ 0xbae, 0xbb9 },
- .{ 0xbd0, 0xbd0 },
- .{ 0xc05, 0xc0c },
- .{ 0xc0e, 0xc10 },
- .{ 0xc12, 0xc28 },
- .{ 0xc2a, 0xc39 },
- .{ 0xc3d, 0xc3d },
- .{ 0xc58, 0xc5a },
- .{ 0xc60, 0xc61 },
- .{ 0xc80, 0xc80 },
- .{ 0xc85, 0xc8c },
- .{ 0xc8e, 0xc90 },
- .{ 0xc92, 0xca8 },
- .{ 0xcaa, 0xcb3 },
- .{ 0xcb5, 0xcb9 },
- .{ 0xcbd, 0xcbd },
- .{ 0xcde, 0xcde },
- .{ 0xce0, 0xce1 },
- .{ 0xcf1, 0xcf2 },
- .{ 0xd04, 0xd0c },
- .{ 0xd0e, 0xd10 },
- .{ 0xd12, 0xd3a },
- .{ 0xd3d, 0xd3d },
- .{ 0xd4e, 0xd4e },
- .{ 0xd54, 0xd56 },
- .{ 0xd5f, 0xd61 },
- .{ 0xd7a, 0xd7f },
- .{ 0xd85, 0xd96 },
- .{ 0xd9a, 0xdb1 },
- .{ 0xdb3, 0xdbb },
- .{ 0xdbd, 0xdbd },
- .{ 0xdc0, 0xdc6 },
- .{ 0xe01, 0xe30 },
- .{ 0xe32, 0xe33 },
- .{ 0xe40, 0xe46 },
- .{ 0xe81, 0xe82 },
- .{ 0xe84, 0xe84 },
- .{ 0xe86, 0xe8a },
- .{ 0xe8c, 0xea3 },
- .{ 0xea5, 0xea5 },
- .{ 0xea7, 0xeb0 },
- .{ 0xeb2, 0xeb3 },
- .{ 0xebd, 0xebd },
- .{ 0xec0, 0xec4 },
- .{ 0xec6, 0xec6 },
- .{ 0xedc, 0xedf },
- .{ 0xf00, 0xf00 },
- .{ 0xf40, 0xf47 },
- .{ 0xf49, 0xf6c },
- .{ 0xf88, 0xf8c },
- },
- &[_]R32Range{
- .{ 0x1000, 0x102a },
- .{ 0x103f, 0x103f },
- .{ 0x1050, 0x1055 },
- .{ 0x105a, 0x105d },
- .{ 0x1061, 0x1061 },
- .{ 0x1065, 0x1066 },
- .{ 0x106e, 0x1070 },
- .{ 0x1075, 0x1081 },
- .{ 0x108e, 0x108e },
- .{ 0x10a0, 0x10c5 },
- .{ 0x10c7, 0x10c7 },
- .{ 0x10cd, 0x10cd },
- .{ 0x10d0, 0x10fa },
- .{ 0x10fc, 0x1248 },
- .{ 0x124a, 0x124d },
- .{ 0x1250, 0x1256 },
- .{ 0x1258, 0x1258 },
- .{ 0x125a, 0x125d },
- .{ 0x1260, 0x1288 },
- .{ 0x128a, 0x128d },
- .{ 0x1290, 0x12b0 },
- .{ 0x12b2, 0x12b5 },
- .{ 0x12b8, 0x12be },
- .{ 0x12c0, 0x12c0 },
- .{ 0x12c2, 0x12c5 },
- .{ 0x12c8, 0x12d6 },
- .{ 0x12d8, 0x1310 },
- .{ 0x1312, 0x1315 },
- .{ 0x1318, 0x135a },
- .{ 0x1380, 0x138f },
- .{ 0x13a0, 0x13f5 },
- .{ 0x13f8, 0x13fd },
- .{ 0x1401, 0x166c },
- .{ 0x166f, 0x167f },
- .{ 0x1681, 0x169a },
- .{ 0x16a0, 0x16ea },
- .{ 0x16ee, 0x16f8 },
- .{ 0x1700, 0x170c },
- .{ 0x170e, 0x1711 },
- .{ 0x1720, 0x1731 },
- .{ 0x1740, 0x1751 },
- .{ 0x1760, 0x176c },
- .{ 0x176e, 0x1770 },
- .{ 0x1780, 0x17b3 },
- .{ 0x17d7, 0x17d7 },
- .{ 0x17dc, 0x17dc },
- .{ 0x1820, 0x1878 },
- .{ 0x1880, 0x18a8 },
- .{ 0x18aa, 0x18aa },
- .{ 0x18b0, 0x18f5 },
- .{ 0x1900, 0x191e },
- .{ 0x1950, 0x196d },
- .{ 0x1970, 0x1974 },
- .{ 0x1980, 0x19ab },
- .{ 0x19b0, 0x19c9 },
- .{ 0x1a00, 0x1a16 },
- .{ 0x1a20, 0x1a54 },
- .{ 0x1aa7, 0x1aa7 },
- .{ 0x1b05, 0x1b33 },
- .{ 0x1b45, 0x1b4b },
- .{ 0x1b83, 0x1ba0 },
- .{ 0x1bae, 0x1baf },
- .{ 0x1bba, 0x1be5 },
- .{ 0x1c00, 0x1c23 },
- .{ 0x1c4d, 0x1c4f },
- .{ 0x1c5a, 0x1c7d },
- .{ 0x1c80, 0x1c88 },
- .{ 0x1c90, 0x1cba },
- .{ 0x1cbd, 0x1cbf },
- .{ 0x1ce9, 0x1cec },
- .{ 0x1cee, 0x1cf3 },
- .{ 0x1cf5, 0x1cf6 },
- .{ 0x1cfa, 0x1cfa },
- .{ 0x1d00, 0x1dbf },
- .{ 0x1e00, 0x1f15 },
- .{ 0x1f18, 0x1f1d },
- .{ 0x1f20, 0x1f45 },
- .{ 0x1f48, 0x1f4d },
- .{ 0x1f50, 0x1f57 },
- .{ 0x1f59, 0x1f59 },
- .{ 0x1f5b, 0x1f5b },
- .{ 0x1f5d, 0x1f5d },
- .{ 0x1f5f, 0x1f7d },
- .{ 0x1f80, 0x1fb4 },
- .{ 0x1fb6, 0x1fbc },
- .{ 0x1fbe, 0x1fbe },
- .{ 0x1fc2, 0x1fc4 },
- .{ 0x1fc6, 0x1fcc },
- .{ 0x1fd0, 0x1fd3 },
- .{ 0x1fd6, 0x1fdb },
- .{ 0x1fe0, 0x1fec },
- .{ 0x1ff2, 0x1ff4 },
- .{ 0x1ff6, 0x1ffc },
- .{ 0x2071, 0x2071 },
- .{ 0x207f, 0x207f },
- .{ 0x2090, 0x209c },
- .{ 0x2102, 0x2102 },
- .{ 0x2107, 0x2107 },
- .{ 0x210a, 0x2113 },
- .{ 0x2115, 0x2115 },
- .{ 0x2118, 0x211d },
- .{ 0x2124, 0x2124 },
- .{ 0x2126, 0x2126 },
- .{ 0x2128, 0x2128 },
- .{ 0x212a, 0x2139 },
- .{ 0x213c, 0x213f },
- .{ 0x2145, 0x2149 },
- .{ 0x214e, 0x214e },
- .{ 0x2160, 0x2188 },
- .{ 0x2c00, 0x2c2e },
- .{ 0x2c30, 0x2c5e },
- .{ 0x2c60, 0x2ce4 },
- .{ 0x2ceb, 0x2cee },
- .{ 0x2cf2, 0x2cf3 },
- .{ 0x2d00, 0x2d25 },
- .{ 0x2d27, 0x2d27 },
- .{ 0x2d2d, 0x2d2d },
- .{ 0x2d30, 0x2d67 },
- .{ 0x2d6f, 0x2d6f },
- .{ 0x2d80, 0x2d96 },
- .{ 0x2da0, 0x2da6 },
- .{ 0x2da8, 0x2dae },
- .{ 0x2db0, 0x2db6 },
- .{ 0x2db8, 0x2dbe },
- .{ 0x2dc0, 0x2dc6 },
- .{ 0x2dc8, 0x2dce },
- .{ 0x2dd0, 0x2dd6 },
- .{ 0x2dd8, 0x2dde },
- .{ 0x3005, 0x3007 },
- .{ 0x3021, 0x3029 },
- .{ 0x3031, 0x3035 },
- .{ 0x3038, 0x303c },
- .{ 0x3041, 0x3096 },
- .{ 0x309b, 0x309f },
- .{ 0x30a1, 0x30fa },
- .{ 0x30fc, 0x30ff },
- .{ 0x3105, 0x312f },
- .{ 0x3131, 0x318e },
- .{ 0x31a0, 0x31bf },
- .{ 0x31f0, 0x31ff },
- .{ 0x3400, 0x4dbf },
- .{ 0x4e00, 0x9ffc },
- .{ 0xa000, 0xa48c },
- .{ 0xa4d0, 0xa4fd },
- .{ 0xa500, 0xa60c },
- .{ 0xa610, 0xa61f },
- .{ 0xa62a, 0xa62b },
- .{ 0xa640, 0xa66e },
- .{ 0xa67f, 0xa69d },
- .{ 0xa6a0, 0xa6ef },
- .{ 0xa717, 0xa71f },
- .{ 0xa722, 0xa788 },
- .{ 0xa78b, 0xa7bf },
- .{ 0xa7c2, 0xa7ca },
- .{ 0xa7f5, 0xa801 },
- .{ 0xa803, 0xa805 },
- .{ 0xa807, 0xa80a },
- .{ 0xa80c, 0xa822 },
- .{ 0xa840, 0xa873 },
- .{ 0xa882, 0xa8b3 },
- .{ 0xa8f2, 0xa8f7 },
- .{ 0xa8fb, 0xa8fb },
- .{ 0xa8fd, 0xa8fe },
- .{ 0xa90a, 0xa925 },
- .{ 0xa930, 0xa946 },
- .{ 0xa960, 0xa97c },
- .{ 0xa984, 0xa9b2 },
- .{ 0xa9cf, 0xa9cf },
- .{ 0xa9e0, 0xa9e4 },
- .{ 0xa9e6, 0xa9ef },
- .{ 0xa9fa, 0xa9fe },
- .{ 0xaa00, 0xaa28 },
- .{ 0xaa40, 0xaa42 },
- .{ 0xaa44, 0xaa4b },
- .{ 0xaa60, 0xaa76 },
- .{ 0xaa7a, 0xaa7a },
- .{ 0xaa7e, 0xaaaf },
- .{ 0xaab1, 0xaab1 },
- .{ 0xaab5, 0xaab6 },
- .{ 0xaab9, 0xaabd },
- .{ 0xaac0, 0xaac0 },
- .{ 0xaac2, 0xaac2 },
- .{ 0xaadb, 0xaadd },
- .{ 0xaae0, 0xaaea },
- .{ 0xaaf2, 0xaaf4 },
- .{ 0xab01, 0xab06 },
- .{ 0xab09, 0xab0e },
- .{ 0xab11, 0xab16 },
- .{ 0xab20, 0xab26 },
- .{ 0xab28, 0xab2e },
- .{ 0xab30, 0xab5a },
- .{ 0xab5c, 0xab69 },
- .{ 0xab70, 0xabe2 },
- .{ 0xac00, 0xd7a3 },
- .{ 0xd7b0, 0xd7c6 },
- .{ 0xd7cb, 0xd7fb },
- .{ 0xf900, 0xfa6d },
- .{ 0xfa70, 0xfad9 },
- .{ 0xfb00, 0xfb06 },
- .{ 0xfb13, 0xfb17 },
- .{ 0xfb1d, 0xfb1d },
- .{ 0xfb1f, 0xfb28 },
- .{ 0xfb2a, 0xfb36 },
- .{ 0xfb38, 0xfb3c },
- .{ 0xfb3e, 0xfb3e },
- .{ 0xfb40, 0xfb41 },
- .{ 0xfb43, 0xfb44 },
- .{ 0xfb46, 0xfbb1 },
- .{ 0xfbd3, 0xfd3d },
- .{ 0xfd50, 0xfd8f },
- .{ 0xfd92, 0xfdc7 },
- .{ 0xfdf0, 0xfdfb },
- .{ 0xfe70, 0xfe74 },
- .{ 0xfe76, 0xfefc },
- .{ 0xff21, 0xff3a },
- .{ 0xff41, 0xff5a },
- .{ 0xff66, 0xffbe },
- .{ 0xffc2, 0xffc7 },
- .{ 0xffca, 0xffcf },
- .{ 0xffd2, 0xffd7 },
- .{ 0xffda, 0xffdc },
- .{ 0x10000, 0x1000b },
- .{ 0x1000d, 0x10026 },
- .{ 0x10028, 0x1003a },
- .{ 0x1003c, 0x1003d },
- .{ 0x1003f, 0x1004d },
- .{ 0x10050, 0x1005d },
- .{ 0x10080, 0x100fa },
- .{ 0x10140, 0x10174 },
- .{ 0x10280, 0x1029c },
- .{ 0x102a0, 0x102d0 },
- .{ 0x10300, 0x1031f },
- .{ 0x1032d, 0x1034a },
- .{ 0x10350, 0x10375 },
- .{ 0x10380, 0x1039d },
- .{ 0x103a0, 0x103c3 },
- .{ 0x103c8, 0x103cf },
- .{ 0x103d1, 0x103d5 },
- .{ 0x10400, 0x1049d },
- .{ 0x104b0, 0x104d3 },
- .{ 0x104d8, 0x104fb },
- .{ 0x10500, 0x10527 },
- .{ 0x10530, 0x10563 },
- .{ 0x10600, 0x10736 },
- .{ 0x10740, 0x10755 },
- .{ 0x10760, 0x10767 },
- .{ 0x10800, 0x10805 },
- .{ 0x10808, 0x10808 },
- .{ 0x1080a, 0x10835 },
- .{ 0x10837, 0x10838 },
- .{ 0x1083c, 0x1083c },
- .{ 0x1083f, 0x10855 },
- .{ 0x10860, 0x10876 },
- .{ 0x10880, 0x1089e },
- .{ 0x108e0, 0x108f2 },
- .{ 0x108f4, 0x108f5 },
- .{ 0x10900, 0x10915 },
- .{ 0x10920, 0x10939 },
- .{ 0x10980, 0x109b7 },
- .{ 0x109be, 0x109bf },
- .{ 0x10a00, 0x10a00 },
- .{ 0x10a10, 0x10a13 },
- .{ 0x10a15, 0x10a17 },
- .{ 0x10a19, 0x10a35 },
- .{ 0x10a60, 0x10a7c },
- .{ 0x10a80, 0x10a9c },
- .{ 0x10ac0, 0x10ac7 },
- .{ 0x10ac9, 0x10ae4 },
- .{ 0x10b00, 0x10b35 },
- .{ 0x10b40, 0x10b55 },
- .{ 0x10b60, 0x10b72 },
- .{ 0x10b80, 0x10b91 },
- .{ 0x10c00, 0x10c48 },
- .{ 0x10c80, 0x10cb2 },
- .{ 0x10cc0, 0x10cf2 },
- .{ 0x10d00, 0x10d23 },
- .{ 0x10e80, 0x10ea9 },
- .{ 0x10eb0, 0x10eb1 },
- .{ 0x10f00, 0x10f1c },
- .{ 0x10f27, 0x10f27 },
- .{ 0x10f30, 0x10f45 },
- .{ 0x10fb0, 0x10fc4 },
- .{ 0x10fe0, 0x10ff6 },
- .{ 0x11003, 0x11037 },
- .{ 0x11083, 0x110af },
- .{ 0x110d0, 0x110e8 },
- .{ 0x11103, 0x11126 },
- .{ 0x11144, 0x11144 },
- .{ 0x11147, 0x11147 },
- .{ 0x11150, 0x11172 },
- .{ 0x11176, 0x11176 },
- .{ 0x11183, 0x111b2 },
- .{ 0x111c1, 0x111c4 },
- .{ 0x111da, 0x111da },
- .{ 0x111dc, 0x111dc },
- .{ 0x11200, 0x11211 },
- .{ 0x11213, 0x1122b },
- .{ 0x11280, 0x11286 },
- .{ 0x11288, 0x11288 },
- .{ 0x1128a, 0x1128d },
- .{ 0x1128f, 0x1129d },
- .{ 0x1129f, 0x112a8 },
- .{ 0x112b0, 0x112de },
- .{ 0x11305, 0x1130c },
- .{ 0x1130f, 0x11310 },
- .{ 0x11313, 0x11328 },
- .{ 0x1132a, 0x11330 },
- .{ 0x11332, 0x11333 },
- .{ 0x11335, 0x11339 },
- .{ 0x1133d, 0x1133d },
- .{ 0x11350, 0x11350 },
- .{ 0x1135d, 0x11361 },
- .{ 0x11400, 0x11434 },
- .{ 0x11447, 0x1144a },
- .{ 0x1145f, 0x11461 },
- .{ 0x11480, 0x114af },
- .{ 0x114c4, 0x114c5 },
- .{ 0x114c7, 0x114c7 },
- .{ 0x11580, 0x115ae },
- .{ 0x115d8, 0x115db },
- .{ 0x11600, 0x1162f },
- .{ 0x11644, 0x11644 },
- .{ 0x11680, 0x116aa },
- .{ 0x116b8, 0x116b8 },
- .{ 0x11700, 0x1171a },
- .{ 0x11800, 0x1182b },
- .{ 0x118a0, 0x118df },
- .{ 0x118ff, 0x11906 },
- .{ 0x11909, 0x11909 },
- .{ 0x1190c, 0x11913 },
- .{ 0x11915, 0x11916 },
- .{ 0x11918, 0x1192f },
- .{ 0x1193f, 0x1193f },
- .{ 0x11941, 0x11941 },
- .{ 0x119a0, 0x119a7 },
- .{ 0x119aa, 0x119d0 },
- .{ 0x119e1, 0x119e1 },
- .{ 0x119e3, 0x119e3 },
- .{ 0x11a00, 0x11a00 },
- .{ 0x11a0b, 0x11a32 },
- .{ 0x11a3a, 0x11a3a },
- .{ 0x11a50, 0x11a50 },
- .{ 0x11a5c, 0x11a89 },
- .{ 0x11a9d, 0x11a9d },
- .{ 0x11ac0, 0x11af8 },
- .{ 0x11c00, 0x11c08 },
- .{ 0x11c0a, 0x11c2e },
- .{ 0x11c40, 0x11c40 },
- .{ 0x11c72, 0x11c8f },
- .{ 0x11d00, 0x11d06 },
- .{ 0x11d08, 0x11d09 },
- .{ 0x11d0b, 0x11d30 },
- .{ 0x11d46, 0x11d46 },
- .{ 0x11d60, 0x11d65 },
- .{ 0x11d67, 0x11d68 },
- .{ 0x11d6a, 0x11d89 },
- .{ 0x11d98, 0x11d98 },
- .{ 0x11ee0, 0x11ef2 },
- .{ 0x11fb0, 0x11fb0 },
- .{ 0x12000, 0x12399 },
- .{ 0x12400, 0x1246e },
- .{ 0x12480, 0x12543 },
- .{ 0x13000, 0x1342e },
- .{ 0x14400, 0x14646 },
- .{ 0x16800, 0x16a38 },
- .{ 0x16a40, 0x16a5e },
- .{ 0x16ad0, 0x16aed },
- .{ 0x16b00, 0x16b2f },
- .{ 0x16b40, 0x16b43 },
- .{ 0x16b63, 0x16b77 },
- .{ 0x16b7d, 0x16b8f },
- .{ 0x16e40, 0x16e7f },
- .{ 0x16f00, 0x16f4a },
- .{ 0x16f50, 0x16f50 },
- .{ 0x16f93, 0x16f9f },
- .{ 0x16fe0, 0x16fe1 },
- .{ 0x16fe3, 0x16fe3 },
- .{ 0x17000, 0x187f7 },
- .{ 0x18800, 0x18cd5 },
- .{ 0x18d00, 0x18d08 },
- .{ 0x1b000, 0x1b11e },
- .{ 0x1b150, 0x1b152 },
- .{ 0x1b164, 0x1b167 },
- .{ 0x1b170, 0x1b2fb },
- .{ 0x1bc00, 0x1bc6a },
- .{ 0x1bc70, 0x1bc7c },
- .{ 0x1bc80, 0x1bc88 },
- .{ 0x1bc90, 0x1bc99 },
- .{ 0x1d400, 0x1d454 },
- .{ 0x1d456, 0x1d49c },
- .{ 0x1d49e, 0x1d49f },
- .{ 0x1d4a2, 0x1d4a2 },
- .{ 0x1d4a5, 0x1d4a6 },
- .{ 0x1d4a9, 0x1d4ac },
- .{ 0x1d4ae, 0x1d4b9 },
- .{ 0x1d4bb, 0x1d4bb },
- .{ 0x1d4bd, 0x1d4c3 },
- .{ 0x1d4c5, 0x1d505 },
- .{ 0x1d507, 0x1d50a },
- .{ 0x1d50d, 0x1d514 },
- .{ 0x1d516, 0x1d51c },
- .{ 0x1d51e, 0x1d539 },
- .{ 0x1d53b, 0x1d53e },
- .{ 0x1d540, 0x1d544 },
- .{ 0x1d546, 0x1d546 },
- .{ 0x1d54a, 0x1d550 },
- .{ 0x1d552, 0x1d6a5 },
- .{ 0x1d6a8, 0x1d6c0 },
- .{ 0x1d6c2, 0x1d6da },
- .{ 0x1d6dc, 0x1d6fa },
- .{ 0x1d6fc, 0x1d714 },
- .{ 0x1d716, 0x1d734 },
- .{ 0x1d736, 0x1d74e },
- .{ 0x1d750, 0x1d76e },
- .{ 0x1d770, 0x1d788 },
- .{ 0x1d78a, 0x1d7a8 },
- .{ 0x1d7aa, 0x1d7c2 },
- .{ 0x1d7c4, 0x1d7cb },
- .{ 0x1e100, 0x1e12c },
- .{ 0x1e137, 0x1e13d },
- .{ 0x1e14e, 0x1e14e },
- .{ 0x1e2c0, 0x1e2eb },
- .{ 0x1e800, 0x1e8c4 },
- .{ 0x1e900, 0x1e943 },
- .{ 0x1e94b, 0x1e94b },
- .{ 0x1ee00, 0x1ee03 },
- .{ 0x1ee05, 0x1ee1f },
- .{ 0x1ee21, 0x1ee22 },
- .{ 0x1ee24, 0x1ee24 },
- .{ 0x1ee27, 0x1ee27 },
- .{ 0x1ee29, 0x1ee32 },
- .{ 0x1ee34, 0x1ee37 },
- .{ 0x1ee39, 0x1ee39 },
- .{ 0x1ee3b, 0x1ee3b },
- .{ 0x1ee42, 0x1ee42 },
- .{ 0x1ee47, 0x1ee47 },
- .{ 0x1ee49, 0x1ee49 },
- .{ 0x1ee4b, 0x1ee4b },
- .{ 0x1ee4d, 0x1ee4f },
- .{ 0x1ee51, 0x1ee52 },
- .{ 0x1ee54, 0x1ee54 },
- .{ 0x1ee57, 0x1ee57 },
- .{ 0x1ee59, 0x1ee59 },
- .{ 0x1ee5b, 0x1ee5b },
- .{ 0x1ee5d, 0x1ee5d },
- .{ 0x1ee5f, 0x1ee5f },
- .{ 0x1ee61, 0x1ee62 },
- .{ 0x1ee64, 0x1ee64 },
- .{ 0x1ee67, 0x1ee6a },
- .{ 0x1ee6c, 0x1ee72 },
- .{ 0x1ee74, 0x1ee77 },
- .{ 0x1ee79, 0x1ee7c },
- .{ 0x1ee7e, 0x1ee7e },
- .{ 0x1ee80, 0x1ee89 },
- .{ 0x1ee8b, 0x1ee9b },
- .{ 0x1eea1, 0x1eea3 },
- .{ 0x1eea5, 0x1eea9 },
- .{ 0x1eeab, 0x1eebb },
- .{ 0x20000, 0x2a6dd },
- .{ 0x2a700, 0x2b734 },
- .{ 0x2b740, 0x2b81d },
- .{ 0x2b820, 0x2cea1 },
- .{ 0x2ceb0, 0x2ebe0 },
- .{ 0x2f800, 0x2fa1d },
- .{ 0x30000, 0x3134a },
- },
-);
-
-// ES5 || ESNext
-pub const id_continue = RangeTable.init(
- 129,
- &[_]R16Range{
- .{ 0x30, 0x39 },
- .{ 0x41, 0x5a },
- .{ 0x5f, 0x5f },
- .{ 0x61, 0x7a },
- .{ 0xaa, 0xaa },
- .{ 0xb5, 0xb5 },
- .{ 0xb7, 0xb7 },
- .{ 0xba, 0xba },
- .{ 0xc0, 0xd6 },
- .{ 0xd8, 0xf6 },
- .{ 0xf8, 0x2c1 },
- .{ 0x2c6, 0x2d1 },
- .{ 0x2e0, 0x2e4 },
- .{ 0x2ec, 0x2ec },
- .{ 0x2ee, 0x2ee },
- .{ 0x300, 0x374 },
- .{ 0x376, 0x377 },
- .{ 0x37a, 0x37d },
- .{ 0x37f, 0x37f },
- .{ 0x386, 0x38a },
- .{ 0x38c, 0x38c },
- .{ 0x38e, 0x3a1 },
- .{ 0x3a3, 0x3f5 },
- .{ 0x3f7, 0x481 },
- .{ 0x483, 0x487 },
- .{ 0x48a, 0x52f },
- .{ 0x531, 0x556 },
- .{ 0x559, 0x559 },
- .{ 0x560, 0x588 },
- .{ 0x591, 0x5bd },
- .{ 0x5bf, 0x5bf },
- .{ 0x5c1, 0x5c2 },
- .{ 0x5c4, 0x5c5 },
- .{ 0x5c7, 0x5c7 },
- .{ 0x5d0, 0x5ea },
- .{ 0x5ef, 0x5f2 },
- .{ 0x610, 0x61a },
- .{ 0x620, 0x669 },
- .{ 0x66e, 0x6d3 },
- .{ 0x6d5, 0x6dc },
- .{ 0x6df, 0x6e8 },
- .{ 0x6ea, 0x6fc },
- .{ 0x6ff, 0x6ff },
- .{ 0x710, 0x74a },
- .{ 0x74d, 0x7b1 },
- .{ 0x7c0, 0x7f5 },
- .{ 0x7fa, 0x7fa },
- .{ 0x7fd, 0x7fd },
- .{ 0x800, 0x82d },
- .{ 0x840, 0x85b },
- .{ 0x860, 0x86a },
- .{ 0x8a0, 0x8b4 },
- .{ 0x8b6, 0x8c7 },
- .{ 0x8d3, 0x8e1 },
- .{ 0x8e3, 0x963 },
- .{ 0x966, 0x96f },
- .{ 0x971, 0x983 },
- .{ 0x985, 0x98c },
- .{ 0x98f, 0x990 },
- .{ 0x993, 0x9a8 },
- .{ 0x9aa, 0x9b0 },
- .{ 0x9b2, 0x9b2 },
- .{ 0x9b6, 0x9b9 },
- .{ 0x9bc, 0x9c4 },
- .{ 0x9c7, 0x9c8 },
- .{ 0x9cb, 0x9ce },
- .{ 0x9d7, 0x9d7 },
- .{ 0x9dc, 0x9dd },
- .{ 0x9df, 0x9e3 },
- .{ 0x9e6, 0x9f1 },
- .{ 0x9fc, 0x9fc },
- .{ 0x9fe, 0x9fe },
- .{ 0xa01, 0xa03 },
- .{ 0xa05, 0xa0a },
- .{ 0xa0f, 0xa10 },
- .{ 0xa13, 0xa28 },
- .{ 0xa2a, 0xa30 },
- .{ 0xa32, 0xa33 },
- .{ 0xa35, 0xa36 },
- .{ 0xa38, 0xa39 },
- .{ 0xa3c, 0xa3c },
- .{ 0xa3e, 0xa42 },
- .{ 0xa47, 0xa48 },
- .{ 0xa4b, 0xa4d },
- .{ 0xa51, 0xa51 },
- .{ 0xa59, 0xa5c },
- .{ 0xa5e, 0xa5e },
- .{ 0xa66, 0xa75 },
- .{ 0xa81, 0xa83 },
- .{ 0xa85, 0xa8d },
- .{ 0xa8f, 0xa91 },
- .{ 0xa93, 0xaa8 },
- .{ 0xaaa, 0xab0 },
- .{ 0xab2, 0xab3 },
- .{ 0xab5, 0xab9 },
- .{ 0xabc, 0xac5 },
- .{ 0xac7, 0xac9 },
- .{ 0xacb, 0xacd },
- .{ 0xad0, 0xad0 },
- .{ 0xae0, 0xae3 },
- .{ 0xae6, 0xaef },
- .{ 0xaf9, 0xaff },
- .{ 0xb01, 0xb03 },
- .{ 0xb05, 0xb0c },
- .{ 0xb0f, 0xb10 },
- .{ 0xb13, 0xb28 },
- .{ 0xb2a, 0xb30 },
- .{ 0xb32, 0xb33 },
- .{ 0xb35, 0xb39 },
- .{ 0xb3c, 0xb44 },
- .{ 0xb47, 0xb48 },
- .{ 0xb4b, 0xb4d },
- .{ 0xb55, 0xb57 },
- .{ 0xb5c, 0xb5d },
- .{ 0xb5f, 0xb63 },
- .{ 0xb66, 0xb6f },
- .{ 0xb71, 0xb71 },
- .{ 0xb82, 0xb83 },
- .{ 0xb85, 0xb8a },
- .{ 0xb8e, 0xb90 },
- .{ 0xb92, 0xb95 },
- .{ 0xb99, 0xb9a },
- .{ 0xb9c, 0xb9c },
- .{ 0xb9e, 0xb9f },
- .{ 0xba3, 0xba4 },
- .{ 0xba8, 0xbaa },
- .{ 0xbae, 0xbb9 },
- .{ 0xbbe, 0xbc2 },
- .{ 0xbc6, 0xbc8 },
- .{ 0xbca, 0xbcd },
- .{ 0xbd0, 0xbd0 },
- .{ 0xbd7, 0xbd7 },
- .{ 0xbe6, 0xbef },
- .{ 0xc00, 0xc0c },
- .{ 0xc0e, 0xc10 },
- .{ 0xc12, 0xc28 },
- .{ 0xc2a, 0xc39 },
- .{ 0xc3d, 0xc44 },
- .{ 0xc46, 0xc48 },
- .{ 0xc4a, 0xc4d },
- .{ 0xc55, 0xc56 },
- .{ 0xc58, 0xc5a },
- .{ 0xc60, 0xc63 },
- .{ 0xc66, 0xc6f },
- .{ 0xc80, 0xc83 },
- .{ 0xc85, 0xc8c },
- .{ 0xc8e, 0xc90 },
- .{ 0xc92, 0xca8 },
- .{ 0xcaa, 0xcb3 },
- .{ 0xcb5, 0xcb9 },
- .{ 0xcbc, 0xcc4 },
- .{ 0xcc6, 0xcc8 },
- .{ 0xcca, 0xccd },
- .{ 0xcd5, 0xcd6 },
- .{ 0xcde, 0xcde },
- .{ 0xce0, 0xce3 },
- .{ 0xce6, 0xcef },
- .{ 0xcf1, 0xcf2 },
- .{ 0xd00, 0xd0c },
- .{ 0xd0e, 0xd10 },
- .{ 0xd12, 0xd44 },
- .{ 0xd46, 0xd48 },
- .{ 0xd4a, 0xd4e },
- .{ 0xd54, 0xd57 },
- .{ 0xd5f, 0xd63 },
- .{ 0xd66, 0xd6f },
- .{ 0xd7a, 0xd7f },
- .{ 0xd81, 0xd83 },
- .{ 0xd85, 0xd96 },
- .{ 0xd9a, 0xdb1 },
- .{ 0xdb3, 0xdbb },
- .{ 0xdbd, 0xdbd },
- .{ 0xdc0, 0xdc6 },
- .{ 0xdca, 0xdca },
- .{ 0xdcf, 0xdd4 },
- .{ 0xdd6, 0xdd6 },
- .{ 0xdd8, 0xddf },
- .{ 0xde6, 0xdef },
- .{ 0xdf2, 0xdf3 },
- .{ 0xe01, 0xe3a },
- .{ 0xe40, 0xe4e },
- .{ 0xe50, 0xe59 },
- .{ 0xe81, 0xe82 },
- .{ 0xe84, 0xe84 },
- .{ 0xe86, 0xe8a },
- .{ 0xe8c, 0xea3 },
- .{ 0xea5, 0xea5 },
- .{ 0xea7, 0xebd },
- .{ 0xec0, 0xec4 },
- .{ 0xec6, 0xec6 },
- .{ 0xec8, 0xecd },
- .{ 0xed0, 0xed9 },
- .{ 0xedc, 0xedf },
- .{ 0xf00, 0xf00 },
- .{ 0xf18, 0xf19 },
- .{ 0xf20, 0xf29 },
- .{ 0xf35, 0xf35 },
- .{ 0xf37, 0xf37 },
- .{ 0xf39, 0xf39 },
- .{ 0xf3e, 0xf47 },
- .{ 0xf49, 0xf6c },
- .{ 0xf71, 0xf84 },
- .{ 0xf86, 0xf97 },
- .{ 0xf99, 0xfbc },
- .{ 0xfc6, 0xfc6 },
- },
- &[_]R32Range{
- .{ 0x1000, 0x1049 },
- .{ 0x1050, 0x109d },
- .{ 0x10a0, 0x10c5 },
- .{ 0x10c7, 0x10c7 },
- .{ 0x10cd, 0x10cd },
- .{ 0x10d0, 0x10fa },
- .{ 0x10fc, 0x1248 },
- .{ 0x124a, 0x124d },
- .{ 0x1250, 0x1256 },
- .{ 0x1258, 0x1258 },
- .{ 0x125a, 0x125d },
- .{ 0x1260, 0x1288 },
- .{ 0x128a, 0x128d },
- .{ 0x1290, 0x12b0 },
- .{ 0x12b2, 0x12b5 },
- .{ 0x12b8, 0x12be },
- .{ 0x12c0, 0x12c0 },
- .{ 0x12c2, 0x12c5 },
- .{ 0x12c8, 0x12d6 },
- .{ 0x12d8, 0x1310 },
- .{ 0x1312, 0x1315 },
- .{ 0x1318, 0x135a },
- .{ 0x135d, 0x135f },
- .{ 0x1369, 0x1371 },
- .{ 0x1380, 0x138f },
- .{ 0x13a0, 0x13f5 },
- .{ 0x13f8, 0x13fd },
- .{ 0x1401, 0x166c },
- .{ 0x166f, 0x167f },
- .{ 0x1681, 0x169a },
- .{ 0x16a0, 0x16ea },
- .{ 0x16ee, 0x16f8 },
- .{ 0x1700, 0x170c },
- .{ 0x170e, 0x1714 },
- .{ 0x1720, 0x1734 },
- .{ 0x1740, 0x1753 },
- .{ 0x1760, 0x176c },
- .{ 0x176e, 0x1770 },
- .{ 0x1772, 0x1773 },
- .{ 0x1780, 0x17d3 },
- .{ 0x17d7, 0x17d7 },
- .{ 0x17dc, 0x17dd },
- .{ 0x17e0, 0x17e9 },
- .{ 0x180b, 0x180d },
- .{ 0x1810, 0x1819 },
- .{ 0x1820, 0x1878 },
- .{ 0x1880, 0x18aa },
- .{ 0x18b0, 0x18f5 },
- .{ 0x1900, 0x191e },
- .{ 0x1920, 0x192b },
- .{ 0x1930, 0x193b },
- .{ 0x1946, 0x196d },
- .{ 0x1970, 0x1974 },
- .{ 0x1980, 0x19ab },
- .{ 0x19b0, 0x19c9 },
- .{ 0x19d0, 0x19da },
- .{ 0x1a00, 0x1a1b },
- .{ 0x1a20, 0x1a5e },
- .{ 0x1a60, 0x1a7c },
- .{ 0x1a7f, 0x1a89 },
- .{ 0x1a90, 0x1a99 },
- .{ 0x1aa7, 0x1aa7 },
- .{ 0x1ab0, 0x1abd },
- .{ 0x1abf, 0x1ac0 },
- .{ 0x1b00, 0x1b4b },
- .{ 0x1b50, 0x1b59 },
- .{ 0x1b6b, 0x1b73 },
- .{ 0x1b80, 0x1bf3 },
- .{ 0x1c00, 0x1c37 },
- .{ 0x1c40, 0x1c49 },
- .{ 0x1c4d, 0x1c7d },
- .{ 0x1c80, 0x1c88 },
- .{ 0x1c90, 0x1cba },
- .{ 0x1cbd, 0x1cbf },
- .{ 0x1cd0, 0x1cd2 },
- .{ 0x1cd4, 0x1cfa },
- .{ 0x1d00, 0x1df9 },
- .{ 0x1dfb, 0x1f15 },
- .{ 0x1f18, 0x1f1d },
- .{ 0x1f20, 0x1f45 },
- .{ 0x1f48, 0x1f4d },
- .{ 0x1f50, 0x1f57 },
- .{ 0x1f59, 0x1f59 },
- .{ 0x1f5b, 0x1f5b },
- .{ 0x1f5d, 0x1f5d },
- .{ 0x1f5f, 0x1f7d },
- .{ 0x1f80, 0x1fb4 },
- .{ 0x1fb6, 0x1fbc },
- .{ 0x1fbe, 0x1fbe },
- .{ 0x1fc2, 0x1fc4 },
- .{ 0x1fc6, 0x1fcc },
- .{ 0x1fd0, 0x1fd3 },
- .{ 0x1fd6, 0x1fdb },
- .{ 0x1fe0, 0x1fec },
- .{ 0x1ff2, 0x1ff4 },
- .{ 0x1ff6, 0x1ffc },
- .{ 0x203f, 0x2040 },
- .{ 0x2054, 0x2054 },
- .{ 0x2071, 0x2071 },
- .{ 0x207f, 0x207f },
- .{ 0x2090, 0x209c },
- .{ 0x20d0, 0x20dc },
- .{ 0x20e1, 0x20e1 },
- .{ 0x20e5, 0x20f0 },
- .{ 0x2102, 0x2102 },
- .{ 0x2107, 0x2107 },
- .{ 0x210a, 0x2113 },
- .{ 0x2115, 0x2115 },
- .{ 0x2118, 0x211d },
- .{ 0x2124, 0x2124 },
- .{ 0x2126, 0x2126 },
- .{ 0x2128, 0x2128 },
- .{ 0x212a, 0x2139 },
- .{ 0x213c, 0x213f },
- .{ 0x2145, 0x2149 },
- .{ 0x214e, 0x214e },
- .{ 0x2160, 0x2188 },
- .{ 0x2c00, 0x2c2e },
- .{ 0x2c30, 0x2c5e },
- .{ 0x2c60, 0x2ce4 },
- .{ 0x2ceb, 0x2cf3 },
- .{ 0x2d00, 0x2d25 },
- .{ 0x2d27, 0x2d27 },
- .{ 0x2d2d, 0x2d2d },
- .{ 0x2d30, 0x2d67 },
- .{ 0x2d6f, 0x2d6f },
- .{ 0x2d7f, 0x2d96 },
- .{ 0x2da0, 0x2da6 },
- .{ 0x2da8, 0x2dae },
- .{ 0x2db0, 0x2db6 },
- .{ 0x2db8, 0x2dbe },
- .{ 0x2dc0, 0x2dc6 },
- .{ 0x2dc8, 0x2dce },
- .{ 0x2dd0, 0x2dd6 },
- .{ 0x2dd8, 0x2dde },
- .{ 0x2de0, 0x2dff },
- .{ 0x3005, 0x3007 },
- .{ 0x3021, 0x302f },
- .{ 0x3031, 0x3035 },
- .{ 0x3038, 0x303c },
- .{ 0x3041, 0x3096 },
- .{ 0x3099, 0x309f },
- .{ 0x30a1, 0x30ff },
- .{ 0x3105, 0x312f },
- .{ 0x3131, 0x318e },
- .{ 0x31a0, 0x31bf },
- .{ 0x31f0, 0x31ff },
- .{ 0x3400, 0x4dbf },
- .{ 0x4e00, 0x9ffc },
- .{ 0xa000, 0xa48c },
- .{ 0xa4d0, 0xa4fd },
- .{ 0xa500, 0xa60c },
- .{ 0xa610, 0xa62b },
- .{ 0xa640, 0xa66f },
- .{ 0xa674, 0xa67d },
- .{ 0xa67f, 0xa6f1 },
- .{ 0xa717, 0xa71f },
- .{ 0xa722, 0xa788 },
- .{ 0xa78b, 0xa7bf },
- .{ 0xa7c2, 0xa7ca },
- .{ 0xa7f5, 0xa827 },
- .{ 0xa82c, 0xa82c },
- .{ 0xa840, 0xa873 },
- .{ 0xa880, 0xa8c5 },
- .{ 0xa8d0, 0xa8d9 },
- .{ 0xa8e0, 0xa8f7 },
- .{ 0xa8fb, 0xa8fb },
- .{ 0xa8fd, 0xa92d },
- .{ 0xa930, 0xa953 },
- .{ 0xa960, 0xa97c },
- .{ 0xa980, 0xa9c0 },
- .{ 0xa9cf, 0xa9d9 },
- .{ 0xa9e0, 0xa9fe },
- .{ 0xaa00, 0xaa36 },
- .{ 0xaa40, 0xaa4d },
- .{ 0xaa50, 0xaa59 },
- .{ 0xaa60, 0xaa76 },
- .{ 0xaa7a, 0xaac2 },
- .{ 0xaadb, 0xaadd },
- .{ 0xaae0, 0xaaef },
- .{ 0xaaf2, 0xaaf6 },
- .{ 0xab01, 0xab06 },
- .{ 0xab09, 0xab0e },
- .{ 0xab11, 0xab16 },
- .{ 0xab20, 0xab26 },
- .{ 0xab28, 0xab2e },
- .{ 0xab30, 0xab5a },
- .{ 0xab5c, 0xab69 },
- .{ 0xab70, 0xabea },
- .{ 0xabec, 0xabed },
- .{ 0xabf0, 0xabf9 },
- .{ 0xac00, 0xd7a3 },
- .{ 0xd7b0, 0xd7c6 },
- .{ 0xd7cb, 0xd7fb },
- .{ 0xf900, 0xfa6d },
- .{ 0xfa70, 0xfad9 },
- .{ 0xfb00, 0xfb06 },
- .{ 0xfb13, 0xfb17 },
- .{ 0xfb1d, 0xfb28 },
- .{ 0xfb2a, 0xfb36 },
- .{ 0xfb38, 0xfb3c },
- .{ 0xfb3e, 0xfb3e },
- .{ 0xfb40, 0xfb41 },
- .{ 0xfb43, 0xfb44 },
- .{ 0xfb46, 0xfbb1 },
- .{ 0xfbd3, 0xfd3d },
- .{ 0xfd50, 0xfd8f },
- .{ 0xfd92, 0xfdc7 },
- .{ 0xfdf0, 0xfdfb },
- .{ 0xfe00, 0xfe0f },
- .{ 0xfe20, 0xfe2f },
- .{ 0xfe33, 0xfe34 },
- .{ 0xfe4d, 0xfe4f },
- .{ 0xfe70, 0xfe74 },
- .{ 0xfe76, 0xfefc },
- .{ 0xff10, 0xff19 },
- .{ 0xff21, 0xff3a },
- .{ 0xff3f, 0xff3f },
- .{ 0xff41, 0xff5a },
- .{ 0xff65, 0xffbe },
- .{ 0xffc2, 0xffc7 },
- .{ 0xffca, 0xffcf },
- .{ 0xffd2, 0xffd7 },
- .{ 0xffda, 0xffdc },
- .{ 0x10000, 0x1000b },
- .{ 0x1000d, 0x10026 },
- .{ 0x10028, 0x1003a },
- .{ 0x1003c, 0x1003d },
- .{ 0x1003f, 0x1004d },
- .{ 0x10050, 0x1005d },
- .{ 0x10080, 0x100fa },
- .{ 0x10140, 0x10174 },
- .{ 0x101fd, 0x101fd },
- .{ 0x10280, 0x1029c },
- .{ 0x102a0, 0x102d0 },
- .{ 0x102e0, 0x102e0 },
- .{ 0x10300, 0x1031f },
- .{ 0x1032d, 0x1034a },
- .{ 0x10350, 0x1037a },
- .{ 0x10380, 0x1039d },
- .{ 0x103a0, 0x103c3 },
- .{ 0x103c8, 0x103cf },
- .{ 0x103d1, 0x103d5 },
- .{ 0x10400, 0x1049d },
- .{ 0x104a0, 0x104a9 },
- .{ 0x104b0, 0x104d3 },
- .{ 0x104d8, 0x104fb },
- .{ 0x10500, 0x10527 },
- .{ 0x10530, 0x10563 },
- .{ 0x10600, 0x10736 },
- .{ 0x10740, 0x10755 },
- .{ 0x10760, 0x10767 },
- .{ 0x10800, 0x10805 },
- .{ 0x10808, 0x10808 },
- .{ 0x1080a, 0x10835 },
- .{ 0x10837, 0x10838 },
- .{ 0x1083c, 0x1083c },
- .{ 0x1083f, 0x10855 },
- .{ 0x10860, 0x10876 },
- .{ 0x10880, 0x1089e },
- .{ 0x108e0, 0x108f2 },
- .{ 0x108f4, 0x108f5 },
- .{ 0x10900, 0x10915 },
- .{ 0x10920, 0x10939 },
- .{ 0x10980, 0x109b7 },
- .{ 0x109be, 0x109bf },
- .{ 0x10a00, 0x10a03 },
- .{ 0x10a05, 0x10a06 },
- .{ 0x10a0c, 0x10a13 },
- .{ 0x10a15, 0x10a17 },
- .{ 0x10a19, 0x10a35 },
- .{ 0x10a38, 0x10a3a },
- .{ 0x10a3f, 0x10a3f },
- .{ 0x10a60, 0x10a7c },
- .{ 0x10a80, 0x10a9c },
- .{ 0x10ac0, 0x10ac7 },
- .{ 0x10ac9, 0x10ae6 },
- .{ 0x10b00, 0x10b35 },
- .{ 0x10b40, 0x10b55 },
- .{ 0x10b60, 0x10b72 },
- .{ 0x10b80, 0x10b91 },
- .{ 0x10c00, 0x10c48 },
- .{ 0x10c80, 0x10cb2 },
- .{ 0x10cc0, 0x10cf2 },
- .{ 0x10d00, 0x10d27 },
- .{ 0x10d30, 0x10d39 },
- .{ 0x10e80, 0x10ea9 },
- .{ 0x10eab, 0x10eac },
- .{ 0x10eb0, 0x10eb1 },
- .{ 0x10f00, 0x10f1c },
- .{ 0x10f27, 0x10f27 },
- .{ 0x10f30, 0x10f50 },
- .{ 0x10fb0, 0x10fc4 },
- .{ 0x10fe0, 0x10ff6 },
- .{ 0x11000, 0x11046 },
- .{ 0x11066, 0x1106f },
- .{ 0x1107f, 0x110ba },
- .{ 0x110d0, 0x110e8 },
- .{ 0x110f0, 0x110f9 },
- .{ 0x11100, 0x11134 },
- .{ 0x11136, 0x1113f },
- .{ 0x11144, 0x11147 },
- .{ 0x11150, 0x11173 },
- .{ 0x11176, 0x11176 },
- .{ 0x11180, 0x111c4 },
- .{ 0x111c9, 0x111cc },
- .{ 0x111ce, 0x111da },
- .{ 0x111dc, 0x111dc },
- .{ 0x11200, 0x11211 },
- .{ 0x11213, 0x11237 },
- .{ 0x1123e, 0x1123e },
- .{ 0x11280, 0x11286 },
- .{ 0x11288, 0x11288 },
- .{ 0x1128a, 0x1128d },
- .{ 0x1128f, 0x1129d },
- .{ 0x1129f, 0x112a8 },
- .{ 0x112b0, 0x112ea },
- .{ 0x112f0, 0x112f9 },
- .{ 0x11300, 0x11303 },
- .{ 0x11305, 0x1130c },
- .{ 0x1130f, 0x11310 },
- .{ 0x11313, 0x11328 },
- .{ 0x1132a, 0x11330 },
- .{ 0x11332, 0x11333 },
- .{ 0x11335, 0x11339 },
- .{ 0x1133b, 0x11344 },
- .{ 0x11347, 0x11348 },
- .{ 0x1134b, 0x1134d },
- .{ 0x11350, 0x11350 },
- .{ 0x11357, 0x11357 },
- .{ 0x1135d, 0x11363 },
- .{ 0x11366, 0x1136c },
- .{ 0x11370, 0x11374 },
- .{ 0x11400, 0x1144a },
- .{ 0x11450, 0x11459 },
- .{ 0x1145e, 0x11461 },
- .{ 0x11480, 0x114c5 },
- .{ 0x114c7, 0x114c7 },
- .{ 0x114d0, 0x114d9 },
- .{ 0x11580, 0x115b5 },
- .{ 0x115b8, 0x115c0 },
- .{ 0x115d8, 0x115dd },
- .{ 0x11600, 0x11640 },
- .{ 0x11644, 0x11644 },
- .{ 0x11650, 0x11659 },
- .{ 0x11680, 0x116b8 },
- .{ 0x116c0, 0x116c9 },
- .{ 0x11700, 0x1171a },
- .{ 0x1171d, 0x1172b },
- .{ 0x11730, 0x11739 },
- .{ 0x11800, 0x1183a },
- .{ 0x118a0, 0x118e9 },
- .{ 0x118ff, 0x11906 },
- .{ 0x11909, 0x11909 },
- .{ 0x1190c, 0x11913 },
- .{ 0x11915, 0x11916 },
- .{ 0x11918, 0x11935 },
- .{ 0x11937, 0x11938 },
- .{ 0x1193b, 0x11943 },
- .{ 0x11950, 0x11959 },
- .{ 0x119a0, 0x119a7 },
- .{ 0x119aa, 0x119d7 },
- .{ 0x119da, 0x119e1 },
- .{ 0x119e3, 0x119e4 },
- .{ 0x11a00, 0x11a3e },
- .{ 0x11a47, 0x11a47 },
- .{ 0x11a50, 0x11a99 },
- .{ 0x11a9d, 0x11a9d },
- .{ 0x11ac0, 0x11af8 },
- .{ 0x11c00, 0x11c08 },
- .{ 0x11c0a, 0x11c36 },
- .{ 0x11c38, 0x11c40 },
- .{ 0x11c50, 0x11c59 },
- .{ 0x11c72, 0x11c8f },
- .{ 0x11c92, 0x11ca7 },
- .{ 0x11ca9, 0x11cb6 },
- .{ 0x11d00, 0x11d06 },
- .{ 0x11d08, 0x11d09 },
- .{ 0x11d0b, 0x11d36 },
- .{ 0x11d3a, 0x11d3a },
- .{ 0x11d3c, 0x11d3d },
- .{ 0x11d3f, 0x11d47 },
- .{ 0x11d50, 0x11d59 },
- .{ 0x11d60, 0x11d65 },
- .{ 0x11d67, 0x11d68 },
- .{ 0x11d6a, 0x11d8e },
- .{ 0x11d90, 0x11d91 },
- .{ 0x11d93, 0x11d98 },
- .{ 0x11da0, 0x11da9 },
- .{ 0x11ee0, 0x11ef6 },
- .{ 0x11fb0, 0x11fb0 },
- .{ 0x12000, 0x12399 },
- .{ 0x12400, 0x1246e },
- .{ 0x12480, 0x12543 },
- .{ 0x13000, 0x1342e },
- .{ 0x14400, 0x14646 },
- .{ 0x16800, 0x16a38 },
- .{ 0x16a40, 0x16a5e },
- .{ 0x16a60, 0x16a69 },
- .{ 0x16ad0, 0x16aed },
- .{ 0x16af0, 0x16af4 },
- .{ 0x16b00, 0x16b36 },
- .{ 0x16b40, 0x16b43 },
- .{ 0x16b50, 0x16b59 },
- .{ 0x16b63, 0x16b77 },
- .{ 0x16b7d, 0x16b8f },
- .{ 0x16e40, 0x16e7f },
- .{ 0x16f00, 0x16f4a },
- .{ 0x16f4f, 0x16f87 },
- .{ 0x16f8f, 0x16f9f },
- .{ 0x16fe0, 0x16fe1 },
- .{ 0x16fe3, 0x16fe4 },
- .{ 0x16ff0, 0x16ff1 },
- .{ 0x17000, 0x187f7 },
- .{ 0x18800, 0x18cd5 },
- .{ 0x18d00, 0x18d08 },
- .{ 0x1b000, 0x1b11e },
- .{ 0x1b150, 0x1b152 },
- .{ 0x1b164, 0x1b167 },
- .{ 0x1b170, 0x1b2fb },
- .{ 0x1bc00, 0x1bc6a },
- .{ 0x1bc70, 0x1bc7c },
- .{ 0x1bc80, 0x1bc88 },
- .{ 0x1bc90, 0x1bc99 },
- .{ 0x1bc9d, 0x1bc9e },
- .{ 0x1d165, 0x1d169 },
- .{ 0x1d16d, 0x1d172 },
- .{ 0x1d17b, 0x1d182 },
- .{ 0x1d185, 0x1d18b },
- .{ 0x1d1aa, 0x1d1ad },
- .{ 0x1d242, 0x1d244 },
- .{ 0x1d400, 0x1d454 },
- .{ 0x1d456, 0x1d49c },
- .{ 0x1d49e, 0x1d49f },
- .{ 0x1d4a2, 0x1d4a2 },
- .{ 0x1d4a5, 0x1d4a6 },
- .{ 0x1d4a9, 0x1d4ac },
- .{ 0x1d4ae, 0x1d4b9 },
- .{ 0x1d4bb, 0x1d4bb },
- .{ 0x1d4bd, 0x1d4c3 },
- .{ 0x1d4c5, 0x1d505 },
- .{ 0x1d507, 0x1d50a },
- .{ 0x1d50d, 0x1d514 },
- .{ 0x1d516, 0x1d51c },
- .{ 0x1d51e, 0x1d539 },
- .{ 0x1d53b, 0x1d53e },
- .{ 0x1d540, 0x1d544 },
- .{ 0x1d546, 0x1d546 },
- .{ 0x1d54a, 0x1d550 },
- .{ 0x1d552, 0x1d6a5 },
- .{ 0x1d6a8, 0x1d6c0 },
- .{ 0x1d6c2, 0x1d6da },
- .{ 0x1d6dc, 0x1d6fa },
- .{ 0x1d6fc, 0x1d714 },
- .{ 0x1d716, 0x1d734 },
- .{ 0x1d736, 0x1d74e },
- .{ 0x1d750, 0x1d76e },
- .{ 0x1d770, 0x1d788 },
- .{ 0x1d78a, 0x1d7a8 },
- .{ 0x1d7aa, 0x1d7c2 },
- .{ 0x1d7c4, 0x1d7cb },
- .{ 0x1d7ce, 0x1d7ff },
- .{ 0x1da00, 0x1da36 },
- .{ 0x1da3b, 0x1da6c },
- .{ 0x1da75, 0x1da75 },
- .{ 0x1da84, 0x1da84 },
- .{ 0x1da9b, 0x1da9f },
- .{ 0x1daa1, 0x1daaf },
- .{ 0x1e000, 0x1e006 },
- .{ 0x1e008, 0x1e018 },
- .{ 0x1e01b, 0x1e021 },
- .{ 0x1e023, 0x1e024 },
- .{ 0x1e026, 0x1e02a },
- .{ 0x1e100, 0x1e12c },
- .{ 0x1e130, 0x1e13d },
- .{ 0x1e140, 0x1e149 },
- .{ 0x1e14e, 0x1e14e },
- .{ 0x1e2c0, 0x1e2f9 },
- .{ 0x1e800, 0x1e8c4 },
- .{ 0x1e8d0, 0x1e8d6 },
- .{ 0x1e900, 0x1e94b },
- .{ 0x1e950, 0x1e959 },
- .{ 0x1ee00, 0x1ee03 },
- .{ 0x1ee05, 0x1ee1f },
- .{ 0x1ee21, 0x1ee22 },
- .{ 0x1ee24, 0x1ee24 },
- .{ 0x1ee27, 0x1ee27 },
- .{ 0x1ee29, 0x1ee32 },
- .{ 0x1ee34, 0x1ee37 },
- .{ 0x1ee39, 0x1ee39 },
- .{ 0x1ee3b, 0x1ee3b },
- .{ 0x1ee42, 0x1ee42 },
- .{ 0x1ee47, 0x1ee47 },
- .{ 0x1ee49, 0x1ee49 },
- .{ 0x1ee4b, 0x1ee4b },
- .{ 0x1ee4d, 0x1ee4f },
- .{ 0x1ee51, 0x1ee52 },
- .{ 0x1ee54, 0x1ee54 },
- .{ 0x1ee57, 0x1ee57 },
- .{ 0x1ee59, 0x1ee59 },
- .{ 0x1ee5b, 0x1ee5b },
- .{ 0x1ee5d, 0x1ee5d },
- .{ 0x1ee5f, 0x1ee5f },
- .{ 0x1ee61, 0x1ee62 },
- .{ 0x1ee64, 0x1ee64 },
- .{ 0x1ee67, 0x1ee6a },
- .{ 0x1ee6c, 0x1ee72 },
- .{ 0x1ee74, 0x1ee77 },
- .{ 0x1ee79, 0x1ee7c },
- .{ 0x1ee7e, 0x1ee7e },
- .{ 0x1ee80, 0x1ee89 },
- .{ 0x1ee8b, 0x1ee9b },
- .{ 0x1eea1, 0x1eea3 },
- .{ 0x1eea5, 0x1eea9 },
- .{ 0x1eeab, 0x1eebb },
- .{ 0x1fbf0, 0x1fbf9 },
- .{ 0x20000, 0x2a6dd },
- .{ 0x2a700, 0x2b734 },
- .{ 0x2b740, 0x2b81d },
- .{ 0x2b820, 0x2cea1 },
- .{ 0x2ceb0, 0x2ebe0 },
- .{ 0x2f800, 0x2fa1d },
- .{ 0x30000, 0x3134a },
- .{ 0xe0100, 0xe01ef },
- },
-);
-
-pub const printable_id_start = RangeTable.init(
- 117,
- &[_]R16Range{
- .{ 0x41, 0x5a },
- .{ 0x61, 0x7a },
- .{ 0xaa, 0xaa },
- .{ 0xb5, 0xb5 },
- .{ 0xba, 0xba },
- .{ 0xc0, 0xd6 },
- .{ 0xd8, 0xf6 },
- .{ 0xf8, 0x2c1 },
- .{ 0x2c6, 0x2d1 },
- .{ 0x2e0, 0x2e4 },
- .{ 0x2ec, 0x2ec },
- .{ 0x2ee, 0x2ee },
- .{ 0x370, 0x374 },
- .{ 0x376, 0x377 },
- .{ 0x37a, 0x37d },
- .{ 0x37f, 0x37f },
- .{ 0x386, 0x386 },
- .{ 0x388, 0x38a },
- .{ 0x38c, 0x38c },
- .{ 0x38e, 0x3a1 },
- .{ 0x3a3, 0x3f5 },
- .{ 0x3f7, 0x481 },
- .{ 0x48a, 0x52f },
- .{ 0x531, 0x556 },
- .{ 0x559, 0x559 },
- .{ 0x560, 0x588 },
- .{ 0x5d0, 0x5ea },
- .{ 0x5ef, 0x5f2 },
- .{ 0x620, 0x64a },
- .{ 0x66e, 0x66f },
- .{ 0x671, 0x6d3 },
- .{ 0x6d5, 0x6d5 },
- .{ 0x6e5, 0x6e6 },
- .{ 0x6ee, 0x6ef },
- .{ 0x6fa, 0x6fc },
- .{ 0x6ff, 0x6ff },
- .{ 0x710, 0x710 },
- .{ 0x712, 0x72f },
- .{ 0x74d, 0x7a5 },
- .{ 0x7b1, 0x7b1 },
- .{ 0x7ca, 0x7ea },
- .{ 0x7f4, 0x7f5 },
- .{ 0x7fa, 0x7fa },
- .{ 0x800, 0x815 },
- .{ 0x81a, 0x81a },
- .{ 0x824, 0x824 },
- .{ 0x828, 0x828 },
- .{ 0x840, 0x858 },
- .{ 0x860, 0x86a },
- .{ 0x8a0, 0x8b4 },
- .{ 0x8b6, 0x8c7 },
- .{ 0x904, 0x939 },
- .{ 0x93d, 0x93d },
- .{ 0x950, 0x950 },
- .{ 0x958, 0x961 },
- .{ 0x971, 0x980 },
- .{ 0x985, 0x98c },
- .{ 0x98f, 0x990 },
- .{ 0x993, 0x9a8 },
- .{ 0x9aa, 0x9b0 },
- .{ 0x9b2, 0x9b2 },
- .{ 0x9b6, 0x9b9 },
- .{ 0x9bd, 0x9bd },
- .{ 0x9ce, 0x9ce },
- .{ 0x9dc, 0x9dd },
- .{ 0x9df, 0x9e1 },
- .{ 0x9f0, 0x9f1 },
- .{ 0x9fc, 0x9fc },
- .{ 0xa05, 0xa0a },
- .{ 0xa0f, 0xa10 },
- .{ 0xa13, 0xa28 },
- .{ 0xa2a, 0xa30 },
- .{ 0xa32, 0xa33 },
- .{ 0xa35, 0xa36 },
- .{ 0xa38, 0xa39 },
- .{ 0xa59, 0xa5c },
- .{ 0xa5e, 0xa5e },
- .{ 0xa72, 0xa74 },
- .{ 0xa85, 0xa8d },
- .{ 0xa8f, 0xa91 },
- .{ 0xa93, 0xaa8 },
- .{ 0xaaa, 0xab0 },
- .{ 0xab2, 0xab3 },
- .{ 0xab5, 0xab9 },
- .{ 0xabd, 0xabd },
- .{ 0xad0, 0xad0 },
- .{ 0xae0, 0xae1 },
- .{ 0xaf9, 0xaf9 },
- .{ 0xb05, 0xb0c },
- .{ 0xb0f, 0xb10 },
- .{ 0xb13, 0xb28 },
- .{ 0xb2a, 0xb30 },
- .{ 0xb32, 0xb33 },
- .{ 0xb35, 0xb39 },
- .{ 0xb3d, 0xb3d },
- .{ 0xb5c, 0xb5d },
- .{ 0xb5f, 0xb61 },
- .{ 0xb71, 0xb71 },
- .{ 0xb83, 0xb83 },
- .{ 0xb85, 0xb8a },
- .{ 0xb8e, 0xb90 },
- .{ 0xb92, 0xb95 },
- .{ 0xb99, 0xb9a },
- .{ 0xb9c, 0xb9c },
- .{ 0xb9e, 0xb9f },
- .{ 0xba3, 0xba4 },
- .{ 0xba8, 0xbaa },
- .{ 0xbae, 0xbb9 },
- .{ 0xbd0, 0xbd0 },
- .{ 0xc05, 0xc0c },
- .{ 0xc0e, 0xc10 },
- .{ 0xc12, 0xc28 },
- .{ 0xc2a, 0xc39 },
- .{ 0xc3d, 0xc3d },
- .{ 0xc58, 0xc5a },
- .{ 0xc60, 0xc61 },
- .{ 0xc80, 0xc80 },
- .{ 0xc85, 0xc8c },
- .{ 0xc8e, 0xc90 },
- .{ 0xc92, 0xca8 },
- .{ 0xcaa, 0xcb3 },
- .{ 0xcb5, 0xcb9 },
- .{ 0xcbd, 0xcbd },
- .{ 0xcde, 0xcde },
- .{ 0xce0, 0xce1 },
- .{ 0xcf1, 0xcf2 },
- .{ 0xd04, 0xd0c },
- .{ 0xd0e, 0xd10 },
- .{ 0xd12, 0xd3a },
- .{ 0xd3d, 0xd3d },
- .{ 0xd4e, 0xd4e },
- .{ 0xd54, 0xd56 },
- .{ 0xd5f, 0xd61 },
- .{ 0xd7a, 0xd7f },
- .{ 0xd85, 0xd96 },
- .{ 0xd9a, 0xdb1 },
- .{ 0xdb3, 0xdbb },
- .{ 0xdbd, 0xdbd },
- .{ 0xdc0, 0xdc6 },
- .{ 0xe01, 0xe30 },
- .{ 0xe32, 0xe33 },
- .{ 0xe40, 0xe46 },
- .{ 0xe81, 0xe82 },
- .{ 0xe84, 0xe84 },
- .{ 0xe86, 0xe8a },
- .{ 0xe8c, 0xea3 },
- .{ 0xea5, 0xea5 },
- .{ 0xea7, 0xeb0 },
- .{ 0xeb2, 0xeb3 },
- .{ 0xebd, 0xebd },
- .{ 0xec0, 0xec4 },
- .{ 0xec6, 0xec6 },
- .{ 0xedc, 0xedf },
- .{ 0xf00, 0xf00 },
- .{ 0xf40, 0xf47 },
- .{ 0xf49, 0xf6c },
- .{ 0xf88, 0xf8c },
- },
- &[_]R32Range{
- .{ 0x1000, 0x102a },
- .{ 0x103f, 0x103f },
- .{ 0x1050, 0x1055 },
- .{ 0x105a, 0x105d },
- .{ 0x1061, 0x1061 },
- .{ 0x1065, 0x1066 },
- .{ 0x106e, 0x1070 },
- .{ 0x1075, 0x1081 },
- .{ 0x108e, 0x108e },
- .{ 0x10a0, 0x10c5 },
- .{ 0x10c7, 0x10c7 },
- .{ 0x10cd, 0x10cd },
- .{ 0x10d0, 0x10fa },
- .{ 0x10fc, 0x1248 },
- .{ 0x124a, 0x124d },
- .{ 0x1250, 0x1256 },
- .{ 0x1258, 0x1258 },
- .{ 0x125a, 0x125d },
- .{ 0x1260, 0x1288 },
- .{ 0x128a, 0x128d },
- .{ 0x1290, 0x12b0 },
- .{ 0x12b2, 0x12b5 },
- .{ 0x12b8, 0x12be },
- .{ 0x12c0, 0x12c0 },
- .{ 0x12c2, 0x12c5 },
- .{ 0x12c8, 0x12d6 },
- .{ 0x12d8, 0x1310 },
- .{ 0x1312, 0x1315 },
- .{ 0x1318, 0x135a },
- .{ 0x1380, 0x138f },
- .{ 0x13a0, 0x13f5 },
- .{ 0x13f8, 0x13fd },
- .{ 0x1401, 0x166c },
- .{ 0x166f, 0x167f },
- .{ 0x1681, 0x169a },
- .{ 0x16a0, 0x16ea },
- .{ 0x16ee, 0x16f8 },
- .{ 0x1700, 0x170c },
- .{ 0x170e, 0x1711 },
- .{ 0x1720, 0x1731 },
- .{ 0x1740, 0x1751 },
- .{ 0x1760, 0x176c },
- .{ 0x176e, 0x1770 },
- .{ 0x1780, 0x17b3 },
- .{ 0x17d7, 0x17d7 },
- .{ 0x17dc, 0x17dc },
- .{ 0x1820, 0x1878 },
- .{ 0x1880, 0x18a8 },
- .{ 0x18aa, 0x18aa },
- .{ 0x18b0, 0x18f5 },
- .{ 0x1900, 0x191e },
- .{ 0x1950, 0x196d },
- .{ 0x1970, 0x1974 },
- .{ 0x1980, 0x19ab },
- .{ 0x19b0, 0x19c9 },
- .{ 0x1a00, 0x1a16 },
- .{ 0x1a20, 0x1a54 },
- .{ 0x1aa7, 0x1aa7 },
- .{ 0x1b05, 0x1b33 },
- .{ 0x1b45, 0x1b4b },
- .{ 0x1b83, 0x1ba0 },
- .{ 0x1bae, 0x1baf },
- .{ 0x1bba, 0x1be5 },
- .{ 0x1c00, 0x1c23 },
- .{ 0x1c4d, 0x1c4f },
- .{ 0x1c5a, 0x1c7d },
- .{ 0x1c80, 0x1c88 },
- .{ 0x1c90, 0x1cba },
- .{ 0x1cbd, 0x1cbf },
- .{ 0x1ce9, 0x1cec },
- .{ 0x1cee, 0x1cf3 },
- .{ 0x1cf5, 0x1cf6 },
- .{ 0x1cfa, 0x1cfa },
- .{ 0x1d00, 0x1dbf },
- .{ 0x1e00, 0x1f15 },
- .{ 0x1f18, 0x1f1d },
- .{ 0x1f20, 0x1f45 },
- .{ 0x1f48, 0x1f4d },
- .{ 0x1f50, 0x1f57 },
- .{ 0x1f59, 0x1f59 },
- .{ 0x1f5b, 0x1f5b },
- .{ 0x1f5d, 0x1f5d },
- .{ 0x1f5f, 0x1f7d },
- .{ 0x1f80, 0x1fb4 },
- .{ 0x1fb6, 0x1fbc },
- .{ 0x1fbe, 0x1fbe },
- .{ 0x1fc2, 0x1fc4 },
- .{ 0x1fc6, 0x1fcc },
- .{ 0x1fd0, 0x1fd3 },
- .{ 0x1fd6, 0x1fdb },
- .{ 0x1fe0, 0x1fec },
- .{ 0x1ff2, 0x1ff4 },
- .{ 0x1ff6, 0x1ffc },
- .{ 0x2071, 0x2071 },
- .{ 0x207f, 0x207f },
- .{ 0x2090, 0x209c },
- .{ 0x2102, 0x2102 },
- .{ 0x2107, 0x2107 },
- .{ 0x210a, 0x2113 },
- .{ 0x2115, 0x2115 },
- .{ 0x2118, 0x211d },
- .{ 0x2124, 0x2124 },
- .{ 0x2126, 0x2126 },
- .{ 0x2128, 0x2128 },
- .{ 0x212a, 0x2139 },
- .{ 0x213c, 0x213f },
- .{ 0x2145, 0x2149 },
- .{ 0x214e, 0x214e },
- .{ 0x2160, 0x2188 },
- .{ 0x2c00, 0x2c2e },
- .{ 0x2c30, 0x2c5e },
- .{ 0x2c60, 0x2ce4 },
- .{ 0x2ceb, 0x2cee },
- .{ 0x2cf2, 0x2cf3 },
- .{ 0x2d00, 0x2d25 },
- .{ 0x2d27, 0x2d27 },
- .{ 0x2d2d, 0x2d2d },
- .{ 0x2d30, 0x2d67 },
- .{ 0x2d6f, 0x2d6f },
- .{ 0x2d80, 0x2d96 },
- .{ 0x2da0, 0x2da6 },
- .{ 0x2da8, 0x2dae },
- .{ 0x2db0, 0x2db6 },
- .{ 0x2db8, 0x2dbe },
- .{ 0x2dc0, 0x2dc6 },
- .{ 0x2dc8, 0x2dce },
- .{ 0x2dd0, 0x2dd6 },
- .{ 0x2dd8, 0x2dde },
- .{ 0x3005, 0x3007 },
- .{ 0x3021, 0x3029 },
- .{ 0x3031, 0x3035 },
- .{ 0x3038, 0x303c },
- .{ 0x3041, 0x3096 },
- .{ 0x309b, 0x309f },
- .{ 0x30a1, 0x30fa },
- .{ 0x30fc, 0x30ff },
- .{ 0x3105, 0x312f },
- .{ 0x3131, 0x318e },
- .{ 0x31a0, 0x31bf },
- .{ 0x31f0, 0x31ff },
- .{ 0x3400, 0x4dbf },
- .{ 0x4e00, 0x9ffc },
- .{ 0xa000, 0xa48c },
- .{ 0xa4d0, 0xa4fd },
- .{ 0xa500, 0xa60c },
- .{ 0xa610, 0xa61f },
- .{ 0xa62a, 0xa62b },
- .{ 0xa640, 0xa66e },
- .{ 0xa67f, 0xa69d },
- .{ 0xa6a0, 0xa6ef },
- .{ 0xa717, 0xa71f },
- .{ 0xa722, 0xa788 },
- .{ 0xa78b, 0xa7bf },
- .{ 0xa7c2, 0xa7ca },
- .{ 0xa7f5, 0xa801 },
- .{ 0xa803, 0xa805 },
- .{ 0xa807, 0xa80a },
- .{ 0xa80c, 0xa822 },
- .{ 0xa840, 0xa873 },
- .{ 0xa882, 0xa8b3 },
- .{ 0xa8f2, 0xa8f7 },
- .{ 0xa8fb, 0xa8fb },
- .{ 0xa8fd, 0xa8fe },
- .{ 0xa90a, 0xa925 },
- .{ 0xa930, 0xa946 },
- .{ 0xa960, 0xa97c },
- .{ 0xa984, 0xa9b2 },
- .{ 0xa9cf, 0xa9cf },
- .{ 0xa9e0, 0xa9e4 },
- .{ 0xa9e6, 0xa9ef },
- .{ 0xa9fa, 0xa9fe },
- .{ 0xaa00, 0xaa28 },
- .{ 0xaa40, 0xaa42 },
- .{ 0xaa44, 0xaa4b },
- .{ 0xaa60, 0xaa76 },
- .{ 0xaa7a, 0xaa7a },
- .{ 0xaa7e, 0xaaaf },
- .{ 0xaab1, 0xaab1 },
- .{ 0xaab5, 0xaab6 },
- .{ 0xaab9, 0xaabd },
- .{ 0xaac0, 0xaac0 },
- .{ 0xaac2, 0xaac2 },
- .{ 0xaadb, 0xaadd },
- .{ 0xaae0, 0xaaea },
- .{ 0xaaf2, 0xaaf4 },
- .{ 0xab01, 0xab06 },
- .{ 0xab09, 0xab0e },
- .{ 0xab11, 0xab16 },
- .{ 0xab20, 0xab26 },
- .{ 0xab28, 0xab2e },
- .{ 0xab30, 0xab5a },
- .{ 0xab5c, 0xab69 },
- .{ 0xab70, 0xabe2 },
- .{ 0xac00, 0xd7a3 },
- .{ 0xd7b0, 0xd7c6 },
- .{ 0xd7cb, 0xd7fb },
- .{ 0xf900, 0xfa6d },
- .{ 0xfa70, 0xfad9 },
- .{ 0xfb00, 0xfb06 },
- .{ 0xfb13, 0xfb17 },
- .{ 0xfb1d, 0xfb1d },
- .{ 0xfb1f, 0xfb28 },
- .{ 0xfb2a, 0xfb36 },
- .{ 0xfb38, 0xfb3c },
- .{ 0xfb3e, 0xfb3e },
- .{ 0xfb40, 0xfb41 },
- .{ 0xfb43, 0xfb44 },
- .{ 0xfb46, 0xfbb1 },
- .{ 0xfbd3, 0xfd3d },
- .{ 0xfd50, 0xfd8f },
- .{ 0xfd92, 0xfdc7 },
- .{ 0xfdf0, 0xfdfb },
- .{ 0xfe70, 0xfe74 },
- .{ 0xfe76, 0xfefc },
- .{ 0xff21, 0xff3a },
- .{ 0xff41, 0xff5a },
- .{ 0xff66, 0xffbe },
- .{ 0xffc2, 0xffc7 },
- .{ 0xffca, 0xffcf },
- .{ 0xffd2, 0xffd7 },
- .{ 0xffda, 0xffdc },
- .{ 0x10000, 0x1000b },
- .{ 0x1000d, 0x10026 },
- .{ 0x10028, 0x1003a },
- .{ 0x1003c, 0x1003d },
- .{ 0x1003f, 0x1004d },
- .{ 0x10050, 0x1005d },
- .{ 0x10080, 0x100fa },
- .{ 0x10140, 0x10174 },
- .{ 0x10280, 0x1029c },
- .{ 0x102a0, 0x102d0 },
- .{ 0x10300, 0x1031f },
- .{ 0x1032d, 0x1034a },
- .{ 0x10350, 0x10375 },
- .{ 0x10380, 0x1039d },
- .{ 0x103a0, 0x103c3 },
- .{ 0x103c8, 0x103cf },
- .{ 0x103d1, 0x103d5 },
- .{ 0x10400, 0x1049d },
- .{ 0x104b0, 0x104d3 },
- .{ 0x104d8, 0x104fb },
- .{ 0x10500, 0x10527 },
- .{ 0x10530, 0x10563 },
- .{ 0x10600, 0x10736 },
- .{ 0x10740, 0x10755 },
- .{ 0x10760, 0x10767 },
- .{ 0x10800, 0x10805 },
- .{ 0x10808, 0x10808 },
- .{ 0x1080a, 0x10835 },
- .{ 0x10837, 0x10838 },
- .{ 0x1083c, 0x1083c },
- .{ 0x1083f, 0x10855 },
- .{ 0x10860, 0x10876 },
- .{ 0x10880, 0x1089e },
- .{ 0x108e0, 0x108f2 },
- .{ 0x108f4, 0x108f5 },
- .{ 0x10900, 0x10915 },
- .{ 0x10920, 0x10939 },
- .{ 0x10980, 0x109b7 },
- .{ 0x109be, 0x109bf },
- .{ 0x10a00, 0x10a00 },
- .{ 0x10a10, 0x10a13 },
- .{ 0x10a15, 0x10a17 },
- .{ 0x10a19, 0x10a35 },
- .{ 0x10a60, 0x10a7c },
- .{ 0x10a80, 0x10a9c },
- .{ 0x10ac0, 0x10ac7 },
- .{ 0x10ac9, 0x10ae4 },
- .{ 0x10b00, 0x10b35 },
- .{ 0x10b40, 0x10b55 },
- .{ 0x10b60, 0x10b72 },
- .{ 0x10b80, 0x10b91 },
- .{ 0x10c00, 0x10c48 },
- .{ 0x10c80, 0x10cb2 },
- .{ 0x10cc0, 0x10cf2 },
- .{ 0x10d00, 0x10d23 },
- .{ 0x10e80, 0x10ea9 },
- .{ 0x10eb0, 0x10eb1 },
- .{ 0x10f00, 0x10f1c },
- .{ 0x10f27, 0x10f27 },
- .{ 0x10f30, 0x10f45 },
- .{ 0x10fb0, 0x10fc4 },
- .{ 0x10fe0, 0x10ff6 },
- .{ 0x11003, 0x11037 },
- .{ 0x11083, 0x110af },
- .{ 0x110d0, 0x110e8 },
- .{ 0x11103, 0x11126 },
- .{ 0x11144, 0x11144 },
- .{ 0x11147, 0x11147 },
- .{ 0x11150, 0x11172 },
- .{ 0x11176, 0x11176 },
- .{ 0x11183, 0x111b2 },
- .{ 0x111c1, 0x111c4 },
- .{ 0x111da, 0x111da },
- .{ 0x111dc, 0x111dc },
- .{ 0x11200, 0x11211 },
- .{ 0x11213, 0x1122b },
- .{ 0x11280, 0x11286 },
- .{ 0x11288, 0x11288 },
- .{ 0x1128a, 0x1128d },
- .{ 0x1128f, 0x1129d },
- .{ 0x1129f, 0x112a8 },
- .{ 0x112b0, 0x112de },
- .{ 0x11305, 0x1130c },
- .{ 0x1130f, 0x11310 },
- .{ 0x11313, 0x11328 },
- .{ 0x1132a, 0x11330 },
- .{ 0x11332, 0x11333 },
- .{ 0x11335, 0x11339 },
- .{ 0x1133d, 0x1133d },
- .{ 0x11350, 0x11350 },
- .{ 0x1135d, 0x11361 },
- .{ 0x11400, 0x11434 },
- .{ 0x11447, 0x1144a },
- .{ 0x1145f, 0x11461 },
- .{ 0x11480, 0x114af },
- .{ 0x114c4, 0x114c5 },
- .{ 0x114c7, 0x114c7 },
- .{ 0x11580, 0x115ae },
- .{ 0x115d8, 0x115db },
- .{ 0x11600, 0x1162f },
- .{ 0x11644, 0x11644 },
- .{ 0x11680, 0x116aa },
- .{ 0x116b8, 0x116b8 },
- .{ 0x11700, 0x1171a },
- .{ 0x11800, 0x1182b },
- .{ 0x118a0, 0x118df },
- .{ 0x118ff, 0x11906 },
- .{ 0x11909, 0x11909 },
- .{ 0x1190c, 0x11913 },
- .{ 0x11915, 0x11916 },
- .{ 0x11918, 0x1192f },
- .{ 0x1193f, 0x1193f },
- .{ 0x11941, 0x11941 },
- .{ 0x119a0, 0x119a7 },
- .{ 0x119aa, 0x119d0 },
- .{ 0x119e1, 0x119e1 },
- .{ 0x119e3, 0x119e3 },
- .{ 0x11a00, 0x11a00 },
- .{ 0x11a0b, 0x11a32 },
- .{ 0x11a3a, 0x11a3a },
- .{ 0x11a50, 0x11a50 },
- .{ 0x11a5c, 0x11a89 },
- .{ 0x11a9d, 0x11a9d },
- .{ 0x11ac0, 0x11af8 },
- .{ 0x11c00, 0x11c08 },
- .{ 0x11c0a, 0x11c2e },
- .{ 0x11c40, 0x11c40 },
- .{ 0x11c72, 0x11c8f },
- .{ 0x11d00, 0x11d06 },
- .{ 0x11d08, 0x11d09 },
- .{ 0x11d0b, 0x11d30 },
- .{ 0x11d46, 0x11d46 },
- .{ 0x11d60, 0x11d65 },
- .{ 0x11d67, 0x11d68 },
- .{ 0x11d6a, 0x11d89 },
- .{ 0x11d98, 0x11d98 },
- .{ 0x11ee0, 0x11ef2 },
- .{ 0x11fb0, 0x11fb0 },
- .{ 0x12000, 0x12399 },
- .{ 0x12400, 0x1246e },
- .{ 0x12480, 0x12543 },
- .{ 0x13000, 0x1342e },
- .{ 0x14400, 0x14646 },
- .{ 0x16800, 0x16a38 },
- .{ 0x16a40, 0x16a5e },
- .{ 0x16ad0, 0x16aed },
- .{ 0x16b00, 0x16b2f },
- .{ 0x16b40, 0x16b43 },
- .{ 0x16b63, 0x16b77 },
- .{ 0x16b7d, 0x16b8f },
- .{ 0x16e40, 0x16e7f },
- .{ 0x16f00, 0x16f4a },
- .{ 0x16f50, 0x16f50 },
- .{ 0x16f93, 0x16f9f },
- .{ 0x16fe0, 0x16fe1 },
- .{ 0x16fe3, 0x16fe3 },
- .{ 0x17000, 0x187f7 },
- .{ 0x18800, 0x18cd5 },
- .{ 0x18d00, 0x18d08 },
- .{ 0x1b000, 0x1b11e },
- .{ 0x1b150, 0x1b152 },
- .{ 0x1b164, 0x1b167 },
- .{ 0x1b170, 0x1b2fb },
- .{ 0x1bc00, 0x1bc6a },
- .{ 0x1bc70, 0x1bc7c },
- .{ 0x1bc80, 0x1bc88 },
- .{ 0x1bc90, 0x1bc99 },
- .{ 0x1d400, 0x1d454 },
- .{ 0x1d456, 0x1d49c },
- .{ 0x1d49e, 0x1d49f },
- .{ 0x1d4a2, 0x1d4a2 },
- .{ 0x1d4a5, 0x1d4a6 },
- .{ 0x1d4a9, 0x1d4ac },
- .{ 0x1d4ae, 0x1d4b9 },
- .{ 0x1d4bb, 0x1d4bb },
- .{ 0x1d4bd, 0x1d4c3 },
- .{ 0x1d4c5, 0x1d505 },
- .{ 0x1d507, 0x1d50a },
- .{ 0x1d50d, 0x1d514 },
- .{ 0x1d516, 0x1d51c },
- .{ 0x1d51e, 0x1d539 },
- .{ 0x1d53b, 0x1d53e },
- .{ 0x1d540, 0x1d544 },
- .{ 0x1d546, 0x1d546 },
- .{ 0x1d54a, 0x1d550 },
- .{ 0x1d552, 0x1d6a5 },
- .{ 0x1d6a8, 0x1d6c0 },
- .{ 0x1d6c2, 0x1d6da },
- .{ 0x1d6dc, 0x1d6fa },
- .{ 0x1d6fc, 0x1d714 },
- .{ 0x1d716, 0x1d734 },
- .{ 0x1d736, 0x1d74e },
- .{ 0x1d750, 0x1d76e },
- .{ 0x1d770, 0x1d788 },
- .{ 0x1d78a, 0x1d7a8 },
- .{ 0x1d7aa, 0x1d7c2 },
- .{ 0x1d7c4, 0x1d7cb },
- .{ 0x1e100, 0x1e12c },
- .{ 0x1e137, 0x1e13d },
- .{ 0x1e14e, 0x1e14e },
- .{ 0x1e2c0, 0x1e2eb },
- .{ 0x1e800, 0x1e8c4 },
- .{ 0x1e900, 0x1e943 },
- .{ 0x1e94b, 0x1e94b },
- .{ 0x1ee00, 0x1ee03 },
- .{ 0x1ee05, 0x1ee1f },
- .{ 0x1ee21, 0x1ee22 },
- .{ 0x1ee24, 0x1ee24 },
- .{ 0x1ee27, 0x1ee27 },
- .{ 0x1ee29, 0x1ee32 },
- .{ 0x1ee34, 0x1ee37 },
- .{ 0x1ee39, 0x1ee39 },
- .{ 0x1ee3b, 0x1ee3b },
- .{ 0x1ee42, 0x1ee42 },
- .{ 0x1ee47, 0x1ee47 },
- .{ 0x1ee49, 0x1ee49 },
- .{ 0x1ee4b, 0x1ee4b },
- .{ 0x1ee4d, 0x1ee4f },
- .{ 0x1ee51, 0x1ee52 },
- .{ 0x1ee54, 0x1ee54 },
- .{ 0x1ee57, 0x1ee57 },
- .{ 0x1ee59, 0x1ee59 },
- .{ 0x1ee5b, 0x1ee5b },
- .{ 0x1ee5d, 0x1ee5d },
- .{ 0x1ee5f, 0x1ee5f },
- .{ 0x1ee61, 0x1ee62 },
- .{ 0x1ee64, 0x1ee64 },
- .{ 0x1ee67, 0x1ee6a },
- .{ 0x1ee6c, 0x1ee72 },
- .{ 0x1ee74, 0x1ee77 },
- .{ 0x1ee79, 0x1ee7c },
- .{ 0x1ee7e, 0x1ee7e },
- .{ 0x1ee80, 0x1ee89 },
- .{ 0x1ee8b, 0x1ee9b },
- .{ 0x1eea1, 0x1eea3 },
- .{ 0x1eea5, 0x1eea9 },
- .{ 0x1eeab, 0x1eebb },
- .{ 0x20000, 0x2a6dd },
- .{ 0x2a700, 0x2b734 },
- .{ 0x2b740, 0x2b81d },
- .{ 0x2b820, 0x2cea1 },
- .{ 0x2ceb0, 0x2ebe0 },
- .{ 0x2f800, 0x2fa1d },
- .{ 0x30000, 0x3134a },
- },
-);
-pub const printable_id_continue = RangeTable.init(
- 129,
- &[_]R16Range{
- .{ 0x30, 0x39 },
- .{ 0x41, 0x5a },
- .{ 0x5f, 0x5f },
- .{ 0x61, 0x7a },
- .{ 0xaa, 0xaa },
- .{ 0xb5, 0xb5 },
- .{ 0xb7, 0xb7 },
- .{ 0xba, 0xba },
- .{ 0xc0, 0xd6 },
- .{ 0xd8, 0xf6 },
- .{ 0xf8, 0x2c1 },
- .{ 0x2c6, 0x2d1 },
- .{ 0x2e0, 0x2e4 },
- .{ 0x2ec, 0x2ec },
- .{ 0x2ee, 0x2ee },
- .{ 0x300, 0x374 },
- .{ 0x376, 0x377 },
- .{ 0x37a, 0x37d },
- .{ 0x37f, 0x37f },
- .{ 0x386, 0x38a },
- .{ 0x38c, 0x38c },
- .{ 0x38e, 0x3a1 },
- .{ 0x3a3, 0x3f5 },
- .{ 0x3f7, 0x481 },
- .{ 0x483, 0x487 },
- .{ 0x48a, 0x52f },
- .{ 0x531, 0x556 },
- .{ 0x559, 0x559 },
- .{ 0x560, 0x588 },
- .{ 0x591, 0x5bd },
- .{ 0x5bf, 0x5bf },
- .{ 0x5c1, 0x5c2 },
- .{ 0x5c4, 0x5c5 },
- .{ 0x5c7, 0x5c7 },
- .{ 0x5d0, 0x5ea },
- .{ 0x5ef, 0x5f2 },
- .{ 0x610, 0x61a },
- .{ 0x620, 0x669 },
- .{ 0x66e, 0x6d3 },
- .{ 0x6d5, 0x6dc },
- .{ 0x6df, 0x6e8 },
- .{ 0x6ea, 0x6fc },
- .{ 0x6ff, 0x6ff },
- .{ 0x710, 0x74a },
- .{ 0x74d, 0x7b1 },
- .{ 0x7c0, 0x7f5 },
- .{ 0x7fa, 0x7fa },
- .{ 0x7fd, 0x7fd },
- .{ 0x800, 0x82d },
- .{ 0x840, 0x85b },
- .{ 0x860, 0x86a },
- .{ 0x8a0, 0x8b4 },
- .{ 0x8b6, 0x8c7 },
- .{ 0x8d3, 0x8e1 },
- .{ 0x8e3, 0x963 },
- .{ 0x966, 0x96f },
- .{ 0x971, 0x983 },
- .{ 0x985, 0x98c },
- .{ 0x98f, 0x990 },
- .{ 0x993, 0x9a8 },
- .{ 0x9aa, 0x9b0 },
- .{ 0x9b2, 0x9b2 },
- .{ 0x9b6, 0x9b9 },
- .{ 0x9bc, 0x9c4 },
- .{ 0x9c7, 0x9c8 },
- .{ 0x9cb, 0x9ce },
- .{ 0x9d7, 0x9d7 },
- .{ 0x9dc, 0x9dd },
- .{ 0x9df, 0x9e3 },
- .{ 0x9e6, 0x9f1 },
- .{ 0x9fc, 0x9fc },
- .{ 0x9fe, 0x9fe },
- .{ 0xa01, 0xa03 },
- .{ 0xa05, 0xa0a },
- .{ 0xa0f, 0xa10 },
- .{ 0xa13, 0xa28 },
- .{ 0xa2a, 0xa30 },
- .{ 0xa32, 0xa33 },
- .{ 0xa35, 0xa36 },
- .{ 0xa38, 0xa39 },
- .{ 0xa3c, 0xa3c },
- .{ 0xa3e, 0xa42 },
- .{ 0xa47, 0xa48 },
- .{ 0xa4b, 0xa4d },
- .{ 0xa51, 0xa51 },
- .{ 0xa59, 0xa5c },
- .{ 0xa5e, 0xa5e },
- .{ 0xa66, 0xa75 },
- .{ 0xa81, 0xa83 },
- .{ 0xa85, 0xa8d },
- .{ 0xa8f, 0xa91 },
- .{ 0xa93, 0xaa8 },
- .{ 0xaaa, 0xab0 },
- .{ 0xab2, 0xab3 },
- .{ 0xab5, 0xab9 },
- .{ 0xabc, 0xac5 },
- .{ 0xac7, 0xac9 },
- .{ 0xacb, 0xacd },
- .{ 0xad0, 0xad0 },
- .{ 0xae0, 0xae3 },
- .{ 0xae6, 0xaef },
- .{ 0xaf9, 0xaff },
- .{ 0xb01, 0xb03 },
- .{ 0xb05, 0xb0c },
- .{ 0xb0f, 0xb10 },
- .{ 0xb13, 0xb28 },
- .{ 0xb2a, 0xb30 },
- .{ 0xb32, 0xb33 },
- .{ 0xb35, 0xb39 },
- .{ 0xb3c, 0xb44 },
- .{ 0xb47, 0xb48 },
- .{ 0xb4b, 0xb4d },
- .{ 0xb55, 0xb57 },
- .{ 0xb5c, 0xb5d },
- .{ 0xb5f, 0xb63 },
- .{ 0xb66, 0xb6f },
- .{ 0xb71, 0xb71 },
- .{ 0xb82, 0xb83 },
- .{ 0xb85, 0xb8a },
- .{ 0xb8e, 0xb90 },
- .{ 0xb92, 0xb95 },
- .{ 0xb99, 0xb9a },
- .{ 0xb9c, 0xb9c },
- .{ 0xb9e, 0xb9f },
- .{ 0xba3, 0xba4 },
- .{ 0xba8, 0xbaa },
- .{ 0xbae, 0xbb9 },
- .{ 0xbbe, 0xbc2 },
- .{ 0xbc6, 0xbc8 },
- .{ 0xbca, 0xbcd },
- .{ 0xbd0, 0xbd0 },
- .{ 0xbd7, 0xbd7 },
- .{ 0xbe6, 0xbef },
- .{ 0xc00, 0xc0c },
- .{ 0xc0e, 0xc10 },
- .{ 0xc12, 0xc28 },
- .{ 0xc2a, 0xc39 },
- .{ 0xc3d, 0xc44 },
- .{ 0xc46, 0xc48 },
- .{ 0xc4a, 0xc4d },
- .{ 0xc55, 0xc56 },
- .{ 0xc58, 0xc5a },
- .{ 0xc60, 0xc63 },
- .{ 0xc66, 0xc6f },
- .{ 0xc80, 0xc83 },
- .{ 0xc85, 0xc8c },
- .{ 0xc8e, 0xc90 },
- .{ 0xc92, 0xca8 },
- .{ 0xcaa, 0xcb3 },
- .{ 0xcb5, 0xcb9 },
- .{ 0xcbc, 0xcc4 },
- .{ 0xcc6, 0xcc8 },
- .{ 0xcca, 0xccd },
- .{ 0xcd5, 0xcd6 },
- .{ 0xcde, 0xcde },
- .{ 0xce0, 0xce3 },
- .{ 0xce6, 0xcef },
- .{ 0xcf1, 0xcf2 },
- .{ 0xd00, 0xd0c },
- .{ 0xd0e, 0xd10 },
- .{ 0xd12, 0xd44 },
- .{ 0xd46, 0xd48 },
- .{ 0xd4a, 0xd4e },
- .{ 0xd54, 0xd57 },
- .{ 0xd5f, 0xd63 },
- .{ 0xd66, 0xd6f },
- .{ 0xd7a, 0xd7f },
- .{ 0xd81, 0xd83 },
- .{ 0xd85, 0xd96 },
- .{ 0xd9a, 0xdb1 },
- .{ 0xdb3, 0xdbb },
- .{ 0xdbd, 0xdbd },
- .{ 0xdc0, 0xdc6 },
- .{ 0xdca, 0xdca },
- .{ 0xdcf, 0xdd4 },
- .{ 0xdd6, 0xdd6 },
- .{ 0xdd8, 0xddf },
- .{ 0xde6, 0xdef },
- .{ 0xdf2, 0xdf3 },
- .{ 0xe01, 0xe3a },
- .{ 0xe40, 0xe4e },
- .{ 0xe50, 0xe59 },
- .{ 0xe81, 0xe82 },
- .{ 0xe84, 0xe84 },
- .{ 0xe86, 0xe8a },
- .{ 0xe8c, 0xea3 },
- .{ 0xea5, 0xea5 },
- .{ 0xea7, 0xebd },
- .{ 0xec0, 0xec4 },
- .{ 0xec6, 0xec6 },
- .{ 0xec8, 0xecd },
- .{ 0xed0, 0xed9 },
- .{ 0xedc, 0xedf },
- .{ 0xf00, 0xf00 },
- .{ 0xf18, 0xf19 },
- .{ 0xf20, 0xf29 },
- .{ 0xf35, 0xf35 },
- .{ 0xf37, 0xf37 },
- .{ 0xf39, 0xf39 },
- .{ 0xf3e, 0xf47 },
- .{ 0xf49, 0xf6c },
- .{ 0xf71, 0xf84 },
- .{ 0xf86, 0xf97 },
- .{ 0xf99, 0xfbc },
- .{ 0xfc6, 0xfc6 },
- },
- &[_]R32Range{
- .{ 0x1000, 0x1049 },
- .{ 0x1050, 0x109d },
- .{ 0x10a0, 0x10c5 },
- .{ 0x10c7, 0x10c7 },
- .{ 0x10cd, 0x10cd },
- .{ 0x10d0, 0x10fa },
- .{ 0x10fc, 0x1248 },
- .{ 0x124a, 0x124d },
- .{ 0x1250, 0x1256 },
- .{ 0x1258, 0x1258 },
- .{ 0x125a, 0x125d },
- .{ 0x1260, 0x1288 },
- .{ 0x128a, 0x128d },
- .{ 0x1290, 0x12b0 },
- .{ 0x12b2, 0x12b5 },
- .{ 0x12b8, 0x12be },
- .{ 0x12c0, 0x12c0 },
- .{ 0x12c2, 0x12c5 },
- .{ 0x12c8, 0x12d6 },
- .{ 0x12d8, 0x1310 },
- .{ 0x1312, 0x1315 },
- .{ 0x1318, 0x135a },
- .{ 0x135d, 0x135f },
- .{ 0x1369, 0x1371 },
- .{ 0x1380, 0x138f },
- .{ 0x13a0, 0x13f5 },
- .{ 0x13f8, 0x13fd },
- .{ 0x1401, 0x166c },
- .{ 0x166f, 0x167f },
- .{ 0x1681, 0x169a },
- .{ 0x16a0, 0x16ea },
- .{ 0x16ee, 0x16f8 },
- .{ 0x1700, 0x170c },
- .{ 0x170e, 0x1714 },
- .{ 0x1720, 0x1734 },
- .{ 0x1740, 0x1753 },
- .{ 0x1760, 0x176c },
- .{ 0x176e, 0x1770 },
- .{ 0x1772, 0x1773 },
- .{ 0x1780, 0x17d3 },
- .{ 0x17d7, 0x17d7 },
- .{ 0x17dc, 0x17dd },
- .{ 0x17e0, 0x17e9 },
- .{ 0x180b, 0x180d },
- .{ 0x1810, 0x1819 },
- .{ 0x1820, 0x1878 },
- .{ 0x1880, 0x18aa },
- .{ 0x18b0, 0x18f5 },
- .{ 0x1900, 0x191e },
- .{ 0x1920, 0x192b },
- .{ 0x1930, 0x193b },
- .{ 0x1946, 0x196d },
- .{ 0x1970, 0x1974 },
- .{ 0x1980, 0x19ab },
- .{ 0x19b0, 0x19c9 },
- .{ 0x19d0, 0x19da },
- .{ 0x1a00, 0x1a1b },
- .{ 0x1a20, 0x1a5e },
- .{ 0x1a60, 0x1a7c },
- .{ 0x1a7f, 0x1a89 },
- .{ 0x1a90, 0x1a99 },
- .{ 0x1aa7, 0x1aa7 },
- .{ 0x1ab0, 0x1abd },
- .{ 0x1abf, 0x1ac0 },
- .{ 0x1b00, 0x1b4b },
- .{ 0x1b50, 0x1b59 },
- .{ 0x1b6b, 0x1b73 },
- .{ 0x1b80, 0x1bf3 },
- .{ 0x1c00, 0x1c37 },
- .{ 0x1c40, 0x1c49 },
- .{ 0x1c4d, 0x1c7d },
- .{ 0x1c80, 0x1c88 },
- .{ 0x1c90, 0x1cba },
- .{ 0x1cbd, 0x1cbf },
- .{ 0x1cd0, 0x1cd2 },
- .{ 0x1cd4, 0x1cfa },
- .{ 0x1d00, 0x1df9 },
- .{ 0x1dfb, 0x1f15 },
- .{ 0x1f18, 0x1f1d },
- .{ 0x1f20, 0x1f45 },
- .{ 0x1f48, 0x1f4d },
- .{ 0x1f50, 0x1f57 },
- .{ 0x1f59, 0x1f59 },
- .{ 0x1f5b, 0x1f5b },
- .{ 0x1f5d, 0x1f5d },
- .{ 0x1f5f, 0x1f7d },
- .{ 0x1f80, 0x1fb4 },
- .{ 0x1fb6, 0x1fbc },
- .{ 0x1fbe, 0x1fbe },
- .{ 0x1fc2, 0x1fc4 },
- .{ 0x1fc6, 0x1fcc },
- .{ 0x1fd0, 0x1fd3 },
- .{ 0x1fd6, 0x1fdb },
- .{ 0x1fe0, 0x1fec },
- .{ 0x1ff2, 0x1ff4 },
- .{ 0x1ff6, 0x1ffc },
- .{ 0x203f, 0x2040 },
- .{ 0x2054, 0x2054 },
- .{ 0x2071, 0x2071 },
- .{ 0x207f, 0x207f },
- .{ 0x2090, 0x209c },
- .{ 0x20d0, 0x20dc },
- .{ 0x20e1, 0x20e1 },
- .{ 0x20e5, 0x20f0 },
- .{ 0x2102, 0x2102 },
- .{ 0x2107, 0x2107 },
- .{ 0x210a, 0x2113 },
- .{ 0x2115, 0x2115 },
- .{ 0x2118, 0x211d },
- .{ 0x2124, 0x2124 },
- .{ 0x2126, 0x2126 },
- .{ 0x2128, 0x2128 },
- .{ 0x212a, 0x2139 },
- .{ 0x213c, 0x213f },
- .{ 0x2145, 0x2149 },
- .{ 0x214e, 0x214e },
- .{ 0x2160, 0x2188 },
- .{ 0x2c00, 0x2c2e },
- .{ 0x2c30, 0x2c5e },
- .{ 0x2c60, 0x2ce4 },
- .{ 0x2ceb, 0x2cf3 },
- .{ 0x2d00, 0x2d25 },
- .{ 0x2d27, 0x2d27 },
- .{ 0x2d2d, 0x2d2d },
- .{ 0x2d30, 0x2d67 },
- .{ 0x2d6f, 0x2d6f },
- .{ 0x2d7f, 0x2d96 },
- .{ 0x2da0, 0x2da6 },
- .{ 0x2da8, 0x2dae },
- .{ 0x2db0, 0x2db6 },
- .{ 0x2db8, 0x2dbe },
- .{ 0x2dc0, 0x2dc6 },
- .{ 0x2dc8, 0x2dce },
- .{ 0x2dd0, 0x2dd6 },
- .{ 0x2dd8, 0x2dde },
- .{ 0x2de0, 0x2dff },
- .{ 0x3005, 0x3007 },
- .{ 0x3021, 0x302f },
- .{ 0x3031, 0x3035 },
- .{ 0x3038, 0x303c },
- .{ 0x3041, 0x3096 },
- .{ 0x3099, 0x309f },
- .{ 0x30a1, 0x30fa },
- .{ 0x30fc, 0x30ff },
- .{ 0x3105, 0x312f },
- .{ 0x3131, 0x318e },
- .{ 0x31a0, 0x31bf },
- .{ 0x31f0, 0x31ff },
- .{ 0x3400, 0x4dbf },
- .{ 0x4e00, 0x9ffc },
- .{ 0xa000, 0xa48c },
- .{ 0xa4d0, 0xa4fd },
- .{ 0xa500, 0xa60c },
- .{ 0xa610, 0xa62b },
- .{ 0xa640, 0xa66f },
- .{ 0xa674, 0xa67d },
- .{ 0xa67f, 0xa6f1 },
- .{ 0xa717, 0xa71f },
- .{ 0xa722, 0xa788 },
- .{ 0xa78b, 0xa7bf },
- .{ 0xa7c2, 0xa7ca },
- .{ 0xa7f5, 0xa827 },
- .{ 0xa82c, 0xa82c },
- .{ 0xa840, 0xa873 },
- .{ 0xa880, 0xa8c5 },
- .{ 0xa8d0, 0xa8d9 },
- .{ 0xa8e0, 0xa8f7 },
- .{ 0xa8fb, 0xa8fb },
- .{ 0xa8fd, 0xa92d },
- .{ 0xa930, 0xa953 },
- .{ 0xa960, 0xa97c },
- .{ 0xa980, 0xa9c0 },
- .{ 0xa9cf, 0xa9d9 },
- .{ 0xa9e0, 0xa9fe },
- .{ 0xaa00, 0xaa36 },
- .{ 0xaa40, 0xaa4d },
- .{ 0xaa50, 0xaa59 },
- .{ 0xaa60, 0xaa76 },
- .{ 0xaa7a, 0xaac2 },
- .{ 0xaadb, 0xaadd },
- .{ 0xaae0, 0xaaef },
- .{ 0xaaf2, 0xaaf6 },
- .{ 0xab01, 0xab06 },
- .{ 0xab09, 0xab0e },
- .{ 0xab11, 0xab16 },
- .{ 0xab20, 0xab26 },
- .{ 0xab28, 0xab2e },
- .{ 0xab30, 0xab5a },
- .{ 0xab5c, 0xab69 },
- .{ 0xab70, 0xabea },
- .{ 0xabec, 0xabed },
- .{ 0xabf0, 0xabf9 },
- .{ 0xac00, 0xd7a3 },
- .{ 0xd7b0, 0xd7c6 },
- .{ 0xd7cb, 0xd7fb },
- .{ 0xf900, 0xfa6d },
- .{ 0xfa70, 0xfad9 },
- .{ 0xfb00, 0xfb06 },
- .{ 0xfb13, 0xfb17 },
- .{ 0xfb1d, 0xfb28 },
- .{ 0xfb2a, 0xfb36 },
- .{ 0xfb38, 0xfb3c },
- .{ 0xfb3e, 0xfb3e },
- .{ 0xfb40, 0xfb41 },
- .{ 0xfb43, 0xfb44 },
- .{ 0xfb46, 0xfbb1 },
- .{ 0xfbd3, 0xfd3d },
- .{ 0xfd50, 0xfd8f },
- .{ 0xfd92, 0xfdc7 },
- .{ 0xfdf0, 0xfdfb },
- .{ 0xfe00, 0xfe0f },
- .{ 0xfe20, 0xfe2f },
- .{ 0xfe33, 0xfe34 },
- .{ 0xfe4d, 0xfe4f },
- .{ 0xfe70, 0xfe74 },
- .{ 0xfe76, 0xfefc },
- .{ 0xff10, 0xff19 },
- .{ 0xff21, 0xff3a },
- .{ 0xff3f, 0xff3f },
- .{ 0xff41, 0xff5a },
- .{ 0xff66, 0xffbe },
- .{ 0xffc2, 0xffc7 },
- .{ 0xffca, 0xffcf },
- .{ 0xffd2, 0xffd7 },
- .{ 0xffda, 0xffdc },
- .{ 0x10000, 0x1000b },
- .{ 0x1000d, 0x10026 },
- .{ 0x10028, 0x1003a },
- .{ 0x1003c, 0x1003d },
- .{ 0x1003f, 0x1004d },
- .{ 0x10050, 0x1005d },
- .{ 0x10080, 0x100fa },
- .{ 0x10140, 0x10174 },
- .{ 0x101fd, 0x101fd },
- .{ 0x10280, 0x1029c },
- .{ 0x102a0, 0x102d0 },
- .{ 0x102e0, 0x102e0 },
- .{ 0x10300, 0x1031f },
- .{ 0x1032d, 0x1034a },
- .{ 0x10350, 0x1037a },
- .{ 0x10380, 0x1039d },
- .{ 0x103a0, 0x103c3 },
- .{ 0x103c8, 0x103cf },
- .{ 0x103d1, 0x103d5 },
- .{ 0x10400, 0x1049d },
- .{ 0x104a0, 0x104a9 },
- .{ 0x104b0, 0x104d3 },
- .{ 0x104d8, 0x104fb },
- .{ 0x10500, 0x10527 },
- .{ 0x10530, 0x10563 },
- .{ 0x10600, 0x10736 },
- .{ 0x10740, 0x10755 },
- .{ 0x10760, 0x10767 },
- .{ 0x10800, 0x10805 },
- .{ 0x10808, 0x10808 },
- .{ 0x1080a, 0x10835 },
- .{ 0x10837, 0x10838 },
- .{ 0x1083c, 0x1083c },
- .{ 0x1083f, 0x10855 },
- .{ 0x10860, 0x10876 },
- .{ 0x10880, 0x1089e },
- .{ 0x108e0, 0x108f2 },
- .{ 0x108f4, 0x108f5 },
- .{ 0x10900, 0x10915 },
- .{ 0x10920, 0x10939 },
- .{ 0x10980, 0x109b7 },
- .{ 0x109be, 0x109bf },
- .{ 0x10a00, 0x10a03 },
- .{ 0x10a05, 0x10a06 },
- .{ 0x10a0c, 0x10a13 },
- .{ 0x10a15, 0x10a17 },
- .{ 0x10a19, 0x10a35 },
- .{ 0x10a38, 0x10a3a },
- .{ 0x10a3f, 0x10a3f },
- .{ 0x10a60, 0x10a7c },
- .{ 0x10a80, 0x10a9c },
- .{ 0x10ac0, 0x10ac7 },
- .{ 0x10ac9, 0x10ae6 },
- .{ 0x10b00, 0x10b35 },
- .{ 0x10b40, 0x10b55 },
- .{ 0x10b60, 0x10b72 },
- .{ 0x10b80, 0x10b91 },
- .{ 0x10c00, 0x10c48 },
- .{ 0x10c80, 0x10cb2 },
- .{ 0x10cc0, 0x10cf2 },
- .{ 0x10d00, 0x10d27 },
- .{ 0x10d30, 0x10d39 },
- .{ 0x10e80, 0x10ea9 },
- .{ 0x10eab, 0x10eac },
- .{ 0x10eb0, 0x10eb1 },
- .{ 0x10f00, 0x10f1c },
- .{ 0x10f27, 0x10f27 },
- .{ 0x10f30, 0x10f50 },
- .{ 0x10fb0, 0x10fc4 },
- .{ 0x10fe0, 0x10ff6 },
- .{ 0x11000, 0x11046 },
- .{ 0x11066, 0x1106f },
- .{ 0x1107f, 0x110ba },
- .{ 0x110d0, 0x110e8 },
- .{ 0x110f0, 0x110f9 },
- .{ 0x11100, 0x11134 },
- .{ 0x11136, 0x1113f },
- .{ 0x11144, 0x11147 },
- .{ 0x11150, 0x11173 },
- .{ 0x11176, 0x11176 },
- .{ 0x11180, 0x111c4 },
- .{ 0x111c9, 0x111cc },
- .{ 0x111ce, 0x111da },
- .{ 0x111dc, 0x111dc },
- .{ 0x11200, 0x11211 },
- .{ 0x11213, 0x11237 },
- .{ 0x1123e, 0x1123e },
- .{ 0x11280, 0x11286 },
- .{ 0x11288, 0x11288 },
- .{ 0x1128a, 0x1128d },
- .{ 0x1128f, 0x1129d },
- .{ 0x1129f, 0x112a8 },
- .{ 0x112b0, 0x112ea },
- .{ 0x112f0, 0x112f9 },
- .{ 0x11300, 0x11303 },
- .{ 0x11305, 0x1130c },
- .{ 0x1130f, 0x11310 },
- .{ 0x11313, 0x11328 },
- .{ 0x1132a, 0x11330 },
- .{ 0x11332, 0x11333 },
- .{ 0x11335, 0x11339 },
- .{ 0x1133b, 0x11344 },
- .{ 0x11347, 0x11348 },
- .{ 0x1134b, 0x1134d },
- .{ 0x11350, 0x11350 },
- .{ 0x11357, 0x11357 },
- .{ 0x1135d, 0x11363 },
- .{ 0x11366, 0x1136c },
- .{ 0x11370, 0x11374 },
- .{ 0x11400, 0x1144a },
- .{ 0x11450, 0x11459 },
- .{ 0x1145e, 0x11461 },
- .{ 0x11480, 0x114c5 },
- .{ 0x114c7, 0x114c7 },
- .{ 0x114d0, 0x114d9 },
- .{ 0x11580, 0x115b5 },
- .{ 0x115b8, 0x115c0 },
- .{ 0x115d8, 0x115dd },
- .{ 0x11600, 0x11640 },
- .{ 0x11644, 0x11644 },
- .{ 0x11650, 0x11659 },
- .{ 0x11680, 0x116b8 },
- .{ 0x116c0, 0x116c9 },
- .{ 0x11700, 0x1171a },
- .{ 0x1171d, 0x1172b },
- .{ 0x11730, 0x11739 },
- .{ 0x11800, 0x1183a },
- .{ 0x118a0, 0x118e9 },
- .{ 0x118ff, 0x11906 },
- .{ 0x11909, 0x11909 },
- .{ 0x1190c, 0x11913 },
- .{ 0x11915, 0x11916 },
- .{ 0x11918, 0x11935 },
- .{ 0x11937, 0x11938 },
- .{ 0x1193b, 0x11943 },
- .{ 0x11950, 0x11959 },
- .{ 0x119a0, 0x119a7 },
- .{ 0x119aa, 0x119d7 },
- .{ 0x119da, 0x119e1 },
- .{ 0x119e3, 0x119e4 },
- .{ 0x11a00, 0x11a3e },
- .{ 0x11a47, 0x11a47 },
- .{ 0x11a50, 0x11a99 },
- .{ 0x11a9d, 0x11a9d },
- .{ 0x11ac0, 0x11af8 },
- .{ 0x11c00, 0x11c08 },
- .{ 0x11c0a, 0x11c36 },
- .{ 0x11c38, 0x11c40 },
- .{ 0x11c50, 0x11c59 },
- .{ 0x11c72, 0x11c8f },
- .{ 0x11c92, 0x11ca7 },
- .{ 0x11ca9, 0x11cb6 },
- .{ 0x11d00, 0x11d06 },
- .{ 0x11d08, 0x11d09 },
- .{ 0x11d0b, 0x11d36 },
- .{ 0x11d3a, 0x11d3a },
- .{ 0x11d3c, 0x11d3d },
- .{ 0x11d3f, 0x11d47 },
- .{ 0x11d50, 0x11d59 },
- .{ 0x11d60, 0x11d65 },
- .{ 0x11d67, 0x11d68 },
- .{ 0x11d6a, 0x11d8e },
- .{ 0x11d90, 0x11d91 },
- .{ 0x11d93, 0x11d98 },
- .{ 0x11da0, 0x11da9 },
- .{ 0x11ee0, 0x11ef6 },
- .{ 0x11fb0, 0x11fb0 },
- .{ 0x12000, 0x12399 },
- .{ 0x12400, 0x1246e },
- .{ 0x12480, 0x12543 },
- .{ 0x13000, 0x1342e },
- .{ 0x14400, 0x14646 },
- .{ 0x16800, 0x16a38 },
- .{ 0x16a40, 0x16a5e },
- .{ 0x16a60, 0x16a69 },
- .{ 0x16ad0, 0x16aed },
- .{ 0x16af0, 0x16af4 },
- .{ 0x16b00, 0x16b36 },
- .{ 0x16b40, 0x16b43 },
- .{ 0x16b50, 0x16b59 },
- .{ 0x16b63, 0x16b77 },
- .{ 0x16b7d, 0x16b8f },
- .{ 0x16e40, 0x16e7f },
- .{ 0x16f00, 0x16f4a },
- .{ 0x16f4f, 0x16f87 },
- .{ 0x16f8f, 0x16f9f },
- .{ 0x16fe0, 0x16fe1 },
- .{ 0x16fe3, 0x16fe4 },
- .{ 0x16ff0, 0x16ff1 },
- .{ 0x17000, 0x187f7 },
- .{ 0x18800, 0x18cd5 },
- .{ 0x18d00, 0x18d08 },
- .{ 0x1b000, 0x1b11e },
- .{ 0x1b150, 0x1b152 },
- .{ 0x1b164, 0x1b167 },
- .{ 0x1b170, 0x1b2fb },
- .{ 0x1bc00, 0x1bc6a },
- .{ 0x1bc70, 0x1bc7c },
- .{ 0x1bc80, 0x1bc88 },
- .{ 0x1bc90, 0x1bc99 },
- .{ 0x1bc9d, 0x1bc9e },
- .{ 0x1d165, 0x1d169 },
- .{ 0x1d16d, 0x1d172 },
- .{ 0x1d17b, 0x1d182 },
- .{ 0x1d185, 0x1d18b },
- .{ 0x1d1aa, 0x1d1ad },
- .{ 0x1d242, 0x1d244 },
- .{ 0x1d400, 0x1d454 },
- .{ 0x1d456, 0x1d49c },
- .{ 0x1d49e, 0x1d49f },
- .{ 0x1d4a2, 0x1d4a2 },
- .{ 0x1d4a5, 0x1d4a6 },
- .{ 0x1d4a9, 0x1d4ac },
- .{ 0x1d4ae, 0x1d4b9 },
- .{ 0x1d4bb, 0x1d4bb },
- .{ 0x1d4bd, 0x1d4c3 },
- .{ 0x1d4c5, 0x1d505 },
- .{ 0x1d507, 0x1d50a },
- .{ 0x1d50d, 0x1d514 },
- .{ 0x1d516, 0x1d51c },
- .{ 0x1d51e, 0x1d539 },
- .{ 0x1d53b, 0x1d53e },
- .{ 0x1d540, 0x1d544 },
- .{ 0x1d546, 0x1d546 },
- .{ 0x1d54a, 0x1d550 },
- .{ 0x1d552, 0x1d6a5 },
- .{ 0x1d6a8, 0x1d6c0 },
- .{ 0x1d6c2, 0x1d6da },
- .{ 0x1d6dc, 0x1d6fa },
- .{ 0x1d6fc, 0x1d714 },
- .{ 0x1d716, 0x1d734 },
- .{ 0x1d736, 0x1d74e },
- .{ 0x1d750, 0x1d76e },
- .{ 0x1d770, 0x1d788 },
- .{ 0x1d78a, 0x1d7a8 },
- .{ 0x1d7aa, 0x1d7c2 },
- .{ 0x1d7c4, 0x1d7cb },
- .{ 0x1d7ce, 0x1d7ff },
- .{ 0x1da00, 0x1da36 },
- .{ 0x1da3b, 0x1da6c },
- .{ 0x1da75, 0x1da75 },
- .{ 0x1da84, 0x1da84 },
- .{ 0x1da9b, 0x1da9f },
- .{ 0x1daa1, 0x1daaf },
- .{ 0x1e000, 0x1e006 },
- .{ 0x1e008, 0x1e018 },
- .{ 0x1e01b, 0x1e021 },
- .{ 0x1e023, 0x1e024 },
- .{ 0x1e026, 0x1e02a },
- .{ 0x1e100, 0x1e12c },
- .{ 0x1e130, 0x1e13d },
- .{ 0x1e140, 0x1e149 },
- .{ 0x1e14e, 0x1e14e },
- .{ 0x1e2c0, 0x1e2f9 },
- .{ 0x1e800, 0x1e8c4 },
- .{ 0x1e8d0, 0x1e8d6 },
- .{ 0x1e900, 0x1e94b },
- .{ 0x1e950, 0x1e959 },
- .{ 0x1ee00, 0x1ee03 },
- .{ 0x1ee05, 0x1ee1f },
- .{ 0x1ee21, 0x1ee22 },
- .{ 0x1ee24, 0x1ee24 },
- .{ 0x1ee27, 0x1ee27 },
- .{ 0x1ee29, 0x1ee32 },
- .{ 0x1ee34, 0x1ee37 },
- .{ 0x1ee39, 0x1ee39 },
- .{ 0x1ee3b, 0x1ee3b },
- .{ 0x1ee42, 0x1ee42 },
- .{ 0x1ee47, 0x1ee47 },
- .{ 0x1ee49, 0x1ee49 },
- .{ 0x1ee4b, 0x1ee4b },
- .{ 0x1ee4d, 0x1ee4f },
- .{ 0x1ee51, 0x1ee52 },
- .{ 0x1ee54, 0x1ee54 },
- .{ 0x1ee57, 0x1ee57 },
- .{ 0x1ee59, 0x1ee59 },
- .{ 0x1ee5b, 0x1ee5b },
- .{ 0x1ee5d, 0x1ee5d },
- .{ 0x1ee5f, 0x1ee5f },
- .{ 0x1ee61, 0x1ee62 },
- .{ 0x1ee64, 0x1ee64 },
- .{ 0x1ee67, 0x1ee6a },
- .{ 0x1ee6c, 0x1ee72 },
- .{ 0x1ee74, 0x1ee77 },
- .{ 0x1ee79, 0x1ee7c },
- .{ 0x1ee7e, 0x1ee7e },
- .{ 0x1ee80, 0x1ee89 },
- .{ 0x1ee8b, 0x1ee9b },
- .{ 0x1eea1, 0x1eea3 },
- .{ 0x1eea5, 0x1eea9 },
- .{ 0x1eeab, 0x1eebb },
- .{ 0x1fbf0, 0x1fbf9 },
- .{ 0x20000, 0x2a6dd },
- .{ 0x2a700, 0x2b734 },
- .{ 0x2b740, 0x2b81d },
- .{ 0x2b820, 0x2cea1 },
- .{ 0x2ceb0, 0x2ebe0 },
- .{ 0x2f800, 0x2fa1d },
- .{ 0x30000, 0x3134a },
- .{ 0xe0100, 0xe01ef },
- },
-);
-
-pub fn isIdentifierStart(comptime Codepoint: type, codepoint: Codepoint) bool {
- return switch (codepoint) {
- 0x41...0x5a,
- 0x61...0x7a,
- 0xaa...0xaa,
- 0xb5...0xb5,
- 0xba...0xba,
- 0xc0...0xd6,
- 0xd8...0xf6,
- 0xf8...0x2c1,
- 0x2c6...0x2d1,
- 0x2e0...0x2e4,
- 0x2ec...0x2ec,
- 0x2ee...0x2ee,
- 0x370...0x374,
- 0x376...0x377,
- 0x37a...0x37d,
- 0x37f...0x37f,
- 0x386...0x386,
- 0x388...0x38a,
- 0x38c...0x38c,
- 0x38e...0x3a1,
- 0x3a3...0x3f5,
- 0x3f7...0x481,
- 0x48a...0x52f,
- 0x531...0x556,
- 0x559...0x559,
- 0x560...0x588,
- 0x5d0...0x5ea,
- 0x5ef...0x5f2,
- 0x620...0x64a,
- 0x66e...0x66f,
- 0x671...0x6d3,
- 0x6d5...0x6d5,
- 0x6e5...0x6e6,
- 0x6ee...0x6ef,
- 0x6fa...0x6fc,
- 0x6ff...0x6ff,
- 0x710...0x710,
- 0x712...0x72f,
- 0x74d...0x7a5,
- 0x7b1...0x7b1,
- 0x7ca...0x7ea,
- 0x7f4...0x7f5,
- 0x7fa...0x7fa,
- 0x800...0x815,
- 0x81a...0x81a,
- 0x824...0x824,
- 0x828...0x828,
- 0x840...0x858,
- 0x860...0x86a,
- 0x8a0...0x8b4,
- 0x8b6...0x8c7,
- 0x904...0x939,
- 0x93d...0x93d,
- 0x950...0x950,
- 0x958...0x961,
- 0x971...0x980,
- 0x985...0x98c,
- 0x98f...0x990,
- 0x993...0x9a8,
- 0x9aa...0x9b0,
- 0x9b2...0x9b2,
- 0x9b6...0x9b9,
- 0x9bd...0x9bd,
- 0x9ce...0x9ce,
- 0x9dc...0x9dd,
- 0x9df...0x9e1,
- 0x9f0...0x9f1,
- 0x9fc...0x9fc,
- 0xa05...0xa0a,
- 0xa0f...0xa10,
- 0xa13...0xa28,
- 0xa2a...0xa30,
- 0xa32...0xa33,
- 0xa35...0xa36,
- 0xa38...0xa39,
- 0xa59...0xa5c,
- 0xa5e...0xa5e,
- 0xa72...0xa74,
- 0xa85...0xa8d,
- 0xa8f...0xa91,
- 0xa93...0xaa8,
- 0xaaa...0xab0,
- 0xab2...0xab3,
- 0xab5...0xab9,
- 0xabd...0xabd,
- 0xad0...0xad0,
- 0xae0...0xae1,
- 0xaf9...0xaf9,
- 0xb05...0xb0c,
- 0xb0f...0xb10,
- 0xb13...0xb28,
- 0xb2a...0xb30,
- 0xb32...0xb33,
- 0xb35...0xb39,
- 0xb3d...0xb3d,
- 0xb5c...0xb5d,
- 0xb5f...0xb61,
- 0xb71...0xb71,
- 0xb83...0xb83,
- 0xb85...0xb8a,
- 0xb8e...0xb90,
- 0xb92...0xb95,
- 0xb99...0xb9a,
- 0xb9c...0xb9c,
- 0xb9e...0xb9f,
- 0xba3...0xba4,
- 0xba8...0xbaa,
- 0xbae...0xbb9,
- 0xbd0...0xbd0,
- 0xc05...0xc0c,
- 0xc0e...0xc10,
- 0xc12...0xc28,
- 0xc2a...0xc39,
- 0xc3d...0xc3d,
- 0xc58...0xc5a,
- 0xc60...0xc61,
- 0xc80...0xc80,
- 0xc85...0xc8c,
- 0xc8e...0xc90,
- 0xc92...0xca8,
- 0xcaa...0xcb3,
- 0xcb5...0xcb9,
- 0xcbd...0xcbd,
- 0xcde...0xcde,
- 0xce0...0xce1,
- 0xcf1...0xcf2,
- 0xd04...0xd0c,
- 0xd0e...0xd10,
- 0xd12...0xd3a,
- 0xd3d...0xd3d,
- 0xd4e...0xd4e,
- 0xd54...0xd56,
- 0xd5f...0xd61,
- 0xd7a...0xd7f,
- 0xd85...0xd96,
- 0xd9a...0xdb1,
- 0xdb3...0xdbb,
- 0xdbd...0xdbd,
- 0xdc0...0xdc6,
- 0xe01...0xe30,
- 0xe32...0xe33,
- 0xe40...0xe46,
- 0xe81...0xe82,
- 0xe84...0xe84,
- 0xe86...0xe8a,
- 0xe8c...0xea3,
- 0xea5...0xea5,
- 0xea7...0xeb0,
- 0xeb2...0xeb3,
- 0xebd...0xebd,
- 0xec0...0xec4,
- 0xec6...0xec6,
- 0xedc...0xedf,
- 0xf00...0xf00,
- 0xf40...0xf47,
- 0xf49...0xf6c,
- 0xf88...0xf8c,
- 0x1000...0x102a,
- 0x103f...0x103f,
- 0x1050...0x1055,
- 0x105a...0x105d,
- 0x1061...0x1061,
- 0x1065...0x1066,
- 0x106e...0x1070,
- 0x1075...0x1081,
- 0x108e...0x108e,
- 0x10a0...0x10c5,
- 0x10c7...0x10c7,
- 0x10cd...0x10cd,
- 0x10d0...0x10fa,
- 0x10fc...0x1248,
- 0x124a...0x124d,
- 0x1250...0x1256,
- 0x1258...0x1258,
- 0x125a...0x125d,
- 0x1260...0x1288,
- 0x128a...0x128d,
- 0x1290...0x12b0,
- 0x12b2...0x12b5,
- 0x12b8...0x12be,
- 0x12c0...0x12c0,
- 0x12c2...0x12c5,
- 0x12c8...0x12d6,
- 0x12d8...0x1310,
- 0x1312...0x1315,
- 0x1318...0x135a,
- 0x1380...0x138f,
- 0x13a0...0x13f5,
- 0x13f8...0x13fd,
- 0x1401...0x166c,
- 0x166f...0x167f,
- 0x1681...0x169a,
- 0x16a0...0x16ea,
- 0x16ee...0x16f8,
- 0x1700...0x170c,
- 0x170e...0x1711,
- 0x1720...0x1731,
- 0x1740...0x1751,
- 0x1760...0x176c,
- 0x176e...0x1770,
- 0x1780...0x17b3,
- 0x17d7...0x17d7,
- 0x17dc...0x17dc,
- 0x1820...0x1878,
- 0x1880...0x18a8,
- 0x18aa...0x18aa,
- 0x18b0...0x18f5,
- 0x1900...0x191e,
- 0x1950...0x196d,
- 0x1970...0x1974,
- 0x1980...0x19ab,
- 0x19b0...0x19c9,
- 0x1a00...0x1a16,
- 0x1a20...0x1a54,
- 0x1aa7...0x1aa7,
- 0x1b05...0x1b33,
- 0x1b45...0x1b4b,
- 0x1b83...0x1ba0,
- 0x1bae...0x1baf,
- 0x1bba...0x1be5,
- 0x1c00...0x1c23,
- 0x1c4d...0x1c4f,
- 0x1c5a...0x1c7d,
- 0x1c80...0x1c88,
- 0x1c90...0x1cba,
- 0x1cbd...0x1cbf,
- 0x1ce9...0x1cec,
- 0x1cee...0x1cf3,
- 0x1cf5...0x1cf6,
- 0x1cfa...0x1cfa,
- 0x1d00...0x1dbf,
- 0x1e00...0x1f15,
- 0x1f18...0x1f1d,
- 0x1f20...0x1f45,
- 0x1f48...0x1f4d,
- 0x1f50...0x1f57,
- 0x1f59...0x1f59,
- 0x1f5b...0x1f5b,
- 0x1f5d...0x1f5d,
- 0x1f5f...0x1f7d,
- 0x1f80...0x1fb4,
- 0x1fb6...0x1fbc,
- 0x1fbe...0x1fbe,
- 0x1fc2...0x1fc4,
- 0x1fc6...0x1fcc,
- 0x1fd0...0x1fd3,
- 0x1fd6...0x1fdb,
- 0x1fe0...0x1fec,
- 0x1ff2...0x1ff4,
- 0x1ff6...0x1ffc,
- 0x2071...0x2071,
- 0x207f...0x207f,
- 0x2090...0x209c,
- 0x2102...0x2102,
- 0x2107...0x2107,
- 0x210a...0x2113,
- 0x2115...0x2115,
- 0x2118...0x211d,
- 0x2124...0x2124,
- 0x2126...0x2126,
- 0x2128...0x2128,
- 0x212a...0x2139,
- 0x213c...0x213f,
- 0x2145...0x2149,
- 0x214e...0x214e,
- 0x2160...0x2188,
- 0x2c00...0x2c2e,
- 0x2c30...0x2c5e,
- 0x2c60...0x2ce4,
- 0x2ceb...0x2cee,
- 0x2cf2...0x2cf3,
- 0x2d00...0x2d25,
- 0x2d27...0x2d27,
- 0x2d2d...0x2d2d,
- 0x2d30...0x2d67,
- 0x2d6f...0x2d6f,
- 0x2d80...0x2d96,
- 0x2da0...0x2da6,
- 0x2da8...0x2dae,
- 0x2db0...0x2db6,
- 0x2db8...0x2dbe,
- 0x2dc0...0x2dc6,
- 0x2dc8...0x2dce,
- 0x2dd0...0x2dd6,
- 0x2dd8...0x2dde,
- 0x3005...0x3007,
- 0x3021...0x3029,
- 0x3031...0x3035,
- 0x3038...0x303c,
- 0x3041...0x3096,
- 0x309b...0x309f,
- 0x30a1...0x30fa,
- 0x30fc...0x30ff,
- 0x3105...0x312f,
- 0x3131...0x318e,
- 0x31a0...0x31bf,
- 0x31f0...0x31ff,
- 0x3400...0x4dbf,
- 0x4e00...0x9ffc,
- 0xa000...0xa48c,
- 0xa4d0...0xa4fd,
- 0xa500...0xa60c,
- 0xa610...0xa61f,
- 0xa62a...0xa62b,
- 0xa640...0xa66e,
- 0xa67f...0xa69d,
- 0xa6a0...0xa6ef,
- 0xa717...0xa71f,
- 0xa722...0xa788,
- 0xa78b...0xa7bf,
- 0xa7c2...0xa7ca,
- 0xa7f5...0xa801,
- 0xa803...0xa805,
- 0xa807...0xa80a,
- 0xa80c...0xa822,
- 0xa840...0xa873,
- 0xa882...0xa8b3,
- 0xa8f2...0xa8f7,
- 0xa8fb...0xa8fb,
- 0xa8fd...0xa8fe,
- 0xa90a...0xa925,
- 0xa930...0xa946,
- 0xa960...0xa97c,
- 0xa984...0xa9b2,
- 0xa9cf...0xa9cf,
- 0xa9e0...0xa9e4,
- 0xa9e6...0xa9ef,
- 0xa9fa...0xa9fe,
- 0xaa00...0xaa28,
- 0xaa40...0xaa42,
- 0xaa44...0xaa4b,
- 0xaa60...0xaa76,
- 0xaa7a...0xaa7a,
- 0xaa7e...0xaaaf,
- 0xaab1...0xaab1,
- 0xaab5...0xaab6,
- 0xaab9...0xaabd,
- 0xaac0...0xaac0,
- 0xaac2...0xaac2,
- 0xaadb...0xaadd,
- 0xaae0...0xaaea,
- 0xaaf2...0xaaf4,
- 0xab01...0xab06,
- 0xab09...0xab0e,
- 0xab11...0xab16,
- 0xab20...0xab26,
- 0xab28...0xab2e,
- 0xab30...0xab5a,
- 0xab5c...0xab69,
- 0xab70...0xabe2,
- 0xac00...0xd7a3,
- 0xd7b0...0xd7c6,
- 0xd7cb...0xd7fb,
- 0xf900...0xfa6d,
- 0xfa70...0xfad9,
- 0xfb00...0xfb06,
- 0xfb13...0xfb17,
- 0xfb1d...0xfb1d,
- 0xfb1f...0xfb28,
- 0xfb2a...0xfb36,
- 0xfb38...0xfb3c,
- 0xfb3e...0xfb3e,
- 0xfb40...0xfb41,
- 0xfb43...0xfb44,
- 0xfb46...0xfbb1,
- 0xfbd3...0xfd3d,
- 0xfd50...0xfd8f,
- 0xfd92...0xfdc7,
- 0xfdf0...0xfdfb,
- 0xfe70...0xfe74,
- 0xfe76...0xfefc,
- 0xff21...0xff3a,
- 0xff41...0xff5a,
- 0xff66...0xffbe,
- 0xffc2...0xffc7,
- 0xffca...0xffcf,
- 0xffd2...0xffd7,
- 0xffda...0xffdc,
- 0x10000...0x1000b,
- 0x1000d...0x10026,
- 0x10028...0x1003a,
- 0x1003c...0x1003d,
- 0x1003f...0x1004d,
- 0x10050...0x1005d,
- 0x10080...0x100fa,
- 0x10140...0x10174,
- 0x10280...0x1029c,
- 0x102a0...0x102d0,
- 0x10300...0x1031f,
- 0x1032d...0x1034a,
- 0x10350...0x10375,
- 0x10380...0x1039d,
- 0x103a0...0x103c3,
- 0x103c8...0x103cf,
- 0x103d1...0x103d5,
- 0x10400...0x1049d,
- 0x104b0...0x104d3,
- 0x104d8...0x104fb,
- 0x10500...0x10527,
- 0x10530...0x10563,
- 0x10600...0x10736,
- 0x10740...0x10755,
- 0x10760...0x10767,
- 0x10800...0x10805,
- 0x10808...0x10808,
- 0x1080a...0x10835,
- 0x10837...0x10838,
- 0x1083c...0x1083c,
- 0x1083f...0x10855,
- 0x10860...0x10876,
- 0x10880...0x1089e,
- 0x108e0...0x108f2,
- 0x108f4...0x108f5,
- 0x10900...0x10915,
- 0x10920...0x10939,
- 0x10980...0x109b7,
- 0x109be...0x109bf,
- 0x10a00...0x10a00,
- 0x10a10...0x10a13,
- 0x10a15...0x10a17,
- 0x10a19...0x10a35,
- 0x10a60...0x10a7c,
- 0x10a80...0x10a9c,
- 0x10ac0...0x10ac7,
- 0x10ac9...0x10ae4,
- 0x10b00...0x10b35,
- 0x10b40...0x10b55,
- 0x10b60...0x10b72,
- 0x10b80...0x10b91,
- 0x10c00...0x10c48,
- 0x10c80...0x10cb2,
- 0x10cc0...0x10cf2,
- 0x10d00...0x10d23,
- 0x10e80...0x10ea9,
- 0x10eb0...0x10eb1,
- 0x10f00...0x10f1c,
- 0x10f27...0x10f27,
- 0x10f30...0x10f45,
- 0x10fb0...0x10fc4,
- 0x10fe0...0x10ff6,
- 0x11003...0x11037,
- 0x11083...0x110af,
- 0x110d0...0x110e8,
- 0x11103...0x11126,
- 0x11144...0x11144,
- 0x11147...0x11147,
- 0x11150...0x11172,
- 0x11176...0x11176,
- 0x11183...0x111b2,
- 0x111c1...0x111c4,
- 0x111da...0x111da,
- 0x111dc...0x111dc,
- 0x11200...0x11211,
- 0x11213...0x1122b,
- 0x11280...0x11286,
- 0x11288...0x11288,
- 0x1128a...0x1128d,
- 0x1128f...0x1129d,
- 0x1129f...0x112a8,
- 0x112b0...0x112de,
- 0x11305...0x1130c,
- 0x1130f...0x11310,
- 0x11313...0x11328,
- 0x1132a...0x11330,
- 0x11332...0x11333,
- 0x11335...0x11339,
- 0x1133d...0x1133d,
- 0x11350...0x11350,
- 0x1135d...0x11361,
- 0x11400...0x11434,
- 0x11447...0x1144a,
- 0x1145f...0x11461,
- 0x11480...0x114af,
- 0x114c4...0x114c5,
- 0x114c7...0x114c7,
- 0x11580...0x115ae,
- 0x115d8...0x115db,
- 0x11600...0x1162f,
- 0x11644...0x11644,
- 0x11680...0x116aa,
- 0x116b8...0x116b8,
- 0x11700...0x1171a,
- 0x11800...0x1182b,
- 0x118a0...0x118df,
- 0x118ff...0x11906,
- 0x11909...0x11909,
- 0x1190c...0x11913,
- 0x11915...0x11916,
- 0x11918...0x1192f,
- 0x1193f...0x1193f,
- 0x11941...0x11941,
- 0x119a0...0x119a7,
- 0x119aa...0x119d0,
- 0x119e1...0x119e1,
- 0x119e3...0x119e3,
- 0x11a00...0x11a00,
- 0x11a0b...0x11a32,
- 0x11a3a...0x11a3a,
- 0x11a50...0x11a50,
- 0x11a5c...0x11a89,
- 0x11a9d...0x11a9d,
- 0x11ac0...0x11af8,
- 0x11c00...0x11c08,
- 0x11c0a...0x11c2e,
- 0x11c40...0x11c40,
- 0x11c72...0x11c8f,
- 0x11d00...0x11d06,
- 0x11d08...0x11d09,
- 0x11d0b...0x11d30,
- 0x11d46...0x11d46,
- 0x11d60...0x11d65,
- 0x11d67...0x11d68,
- 0x11d6a...0x11d89,
- 0x11d98...0x11d98,
- 0x11ee0...0x11ef2,
- 0x11fb0...0x11fb0,
- 0x12000...0x12399,
- 0x12400...0x1246e,
- 0x12480...0x12543,
- 0x13000...0x1342e,
- 0x14400...0x14646,
- 0x16800...0x16a38,
- 0x16a40...0x16a5e,
- 0x16ad0...0x16aed,
- 0x16b00...0x16b2f,
- 0x16b40...0x16b43,
- 0x16b63...0x16b77,
- 0x16b7d...0x16b8f,
- 0x16e40...0x16e7f,
- 0x16f00...0x16f4a,
- 0x16f50...0x16f50,
- 0x16f93...0x16f9f,
- 0x16fe0...0x16fe1,
- 0x16fe3...0x16fe3,
- 0x17000...0x187f7,
- 0x18800...0x18cd5,
- 0x18d00...0x18d08,
- 0x1b000...0x1b11e,
- 0x1b150...0x1b152,
- 0x1b164...0x1b167,
- 0x1b170...0x1b2fb,
- 0x1bc00...0x1bc6a,
- 0x1bc70...0x1bc7c,
- 0x1bc80...0x1bc88,
- 0x1bc90...0x1bc99,
- 0x1d400...0x1d454,
- 0x1d456...0x1d49c,
- 0x1d49e...0x1d49f,
- 0x1d4a2...0x1d4a2,
- 0x1d4a5...0x1d4a6,
- 0x1d4a9...0x1d4ac,
- 0x1d4ae...0x1d4b9,
- 0x1d4bb...0x1d4bb,
- 0x1d4bd...0x1d4c3,
- 0x1d4c5...0x1d505,
- 0x1d507...0x1d50a,
- 0x1d50d...0x1d514,
- 0x1d516...0x1d51c,
- 0x1d51e...0x1d539,
- 0x1d53b...0x1d53e,
- 0x1d540...0x1d544,
- 0x1d546...0x1d546,
- 0x1d54a...0x1d550,
- 0x1d552...0x1d6a5,
- 0x1d6a8...0x1d6c0,
- 0x1d6c2...0x1d6da,
- 0x1d6dc...0x1d6fa,
- 0x1d6fc...0x1d714,
- 0x1d716...0x1d734,
- 0x1d736...0x1d74e,
- 0x1d750...0x1d76e,
- 0x1d770...0x1d788,
- 0x1d78a...0x1d7a8,
- 0x1d7aa...0x1d7c2,
- 0x1d7c4...0x1d7cb,
- 0x1e100...0x1e12c,
- 0x1e137...0x1e13d,
- 0x1e14e...0x1e14e,
- 0x1e2c0...0x1e2eb,
- 0x1e800...0x1e8c4,
- 0x1e900...0x1e943,
- 0x1e94b...0x1e94b,
- 0x1ee00...0x1ee03,
- 0x1ee05...0x1ee1f,
- 0x1ee21...0x1ee22,
- 0x1ee24...0x1ee24,
- 0x1ee27...0x1ee27,
- 0x1ee29...0x1ee32,
- 0x1ee34...0x1ee37,
- 0x1ee39...0x1ee39,
- 0x1ee3b...0x1ee3b,
- 0x1ee42...0x1ee42,
- 0x1ee47...0x1ee47,
- 0x1ee49...0x1ee49,
- 0x1ee4b...0x1ee4b,
- 0x1ee4d...0x1ee4f,
- 0x1ee51...0x1ee52,
- 0x1ee54...0x1ee54,
- 0x1ee57...0x1ee57,
- 0x1ee59...0x1ee59,
- 0x1ee5b...0x1ee5b,
- 0x1ee5d...0x1ee5d,
- 0x1ee5f...0x1ee5f,
- 0x1ee61...0x1ee62,
- 0x1ee64...0x1ee64,
- 0x1ee67...0x1ee6a,
- 0x1ee6c...0x1ee72,
- 0x1ee74...0x1ee77,
- 0x1ee79...0x1ee7c,
- 0x1ee7e...0x1ee7e,
- 0x1ee80...0x1ee89,
- 0x1ee8b...0x1ee9b,
- 0x1eea1...0x1eea3,
- 0x1eea5...0x1eea9,
- 0x1eeab...0x1eebb,
- 0x20000...0x2a6dd,
- 0x2a700...0x2b734,
- 0x2b740...0x2b81d,
- 0x2b820...0x2cea1,
- 0x2ceb0...0x2ebe0,
- 0x2f800...0x2fa1d,
- 0x30000...0x3134a,
- => true,
- else => false,
- };
-}
-
-pub fn isIdentifierContinue(comptime Codepoint: type, codepoint: Codepoint) bool {
- return switch (codepoint) {
- 0x30...0x39,
- 0x41...0x5a,
- 0x5f...0x5f,
- 0x61...0x7a,
- 0xaa...0xaa,
- 0xb5...0xb5,
- 0xb7...0xb7,
- 0xba...0xba,
- 0xc0...0xd6,
- 0xd8...0xf6,
- 0xf8...0x2c1,
- 0x2c6...0x2d1,
- 0x2e0...0x2e4,
- 0x2ec...0x2ec,
- 0x2ee...0x2ee,
- 0x300...0x374,
- 0x376...0x377,
- 0x37a...0x37d,
- 0x37f...0x37f,
- 0x386...0x38a,
- 0x38c...0x38c,
- 0x38e...0x3a1,
- 0x3a3...0x3f5,
- 0x3f7...0x481,
- 0x483...0x487,
- 0x48a...0x52f,
- 0x531...0x556,
- 0x559...0x559,
- 0x560...0x588,
- 0x591...0x5bd,
- 0x5bf...0x5bf,
- 0x5c1...0x5c2,
- 0x5c4...0x5c5,
- 0x5c7...0x5c7,
- 0x5d0...0x5ea,
- 0x5ef...0x5f2,
- 0x610...0x61a,
- 0x620...0x669,
- 0x66e...0x6d3,
- 0x6d5...0x6dc,
- 0x6df...0x6e8,
- 0x6ea...0x6fc,
- 0x6ff...0x6ff,
- 0x710...0x74a,
- 0x74d...0x7b1,
- 0x7c0...0x7f5,
- 0x7fa...0x7fa,
- 0x7fd...0x7fd,
- 0x800...0x82d,
- 0x840...0x85b,
- 0x860...0x86a,
- 0x8a0...0x8b4,
- 0x8b6...0x8c7,
- 0x8d3...0x8e1,
- 0x8e3...0x963,
- 0x966...0x96f,
- 0x971...0x983,
- 0x985...0x98c,
- 0x98f...0x990,
- 0x993...0x9a8,
- 0x9aa...0x9b0,
- 0x9b2...0x9b2,
- 0x9b6...0x9b9,
- 0x9bc...0x9c4,
- 0x9c7...0x9c8,
- 0x9cb...0x9ce,
- 0x9d7...0x9d7,
- 0x9dc...0x9dd,
- 0x9df...0x9e3,
- 0x9e6...0x9f1,
- 0x9fc...0x9fc,
- 0x9fe...0x9fe,
- 0xa01...0xa03,
- 0xa05...0xa0a,
- 0xa0f...0xa10,
- 0xa13...0xa28,
- 0xa2a...0xa30,
- 0xa32...0xa33,
- 0xa35...0xa36,
- 0xa38...0xa39,
- 0xa3c...0xa3c,
- 0xa3e...0xa42,
- 0xa47...0xa48,
- 0xa4b...0xa4d,
- 0xa51...0xa51,
- 0xa59...0xa5c,
- 0xa5e...0xa5e,
- 0xa66...0xa75,
- 0xa81...0xa83,
- 0xa85...0xa8d,
- 0xa8f...0xa91,
- 0xa93...0xaa8,
- 0xaaa...0xab0,
- 0xab2...0xab3,
- 0xab5...0xab9,
- 0xabc...0xac5,
- 0xac7...0xac9,
- 0xacb...0xacd,
- 0xad0...0xad0,
- 0xae0...0xae3,
- 0xae6...0xaef,
- 0xaf9...0xaff,
- 0xb01...0xb03,
- 0xb05...0xb0c,
- 0xb0f...0xb10,
- 0xb13...0xb28,
- 0xb2a...0xb30,
- 0xb32...0xb33,
- 0xb35...0xb39,
- 0xb3c...0xb44,
- 0xb47...0xb48,
- 0xb4b...0xb4d,
- 0xb55...0xb57,
- 0xb5c...0xb5d,
- 0xb5f...0xb63,
- 0xb66...0xb6f,
- 0xb71...0xb71,
- 0xb82...0xb83,
- 0xb85...0xb8a,
- 0xb8e...0xb90,
- 0xb92...0xb95,
- 0xb99...0xb9a,
- 0xb9c...0xb9c,
- 0xb9e...0xb9f,
- 0xba3...0xba4,
- 0xba8...0xbaa,
- 0xbae...0xbb9,
- 0xbbe...0xbc2,
- 0xbc6...0xbc8,
- 0xbca...0xbcd,
- 0xbd0...0xbd0,
- 0xbd7...0xbd7,
- 0xbe6...0xbef,
- 0xc00...0xc0c,
- 0xc0e...0xc10,
- 0xc12...0xc28,
- 0xc2a...0xc39,
- 0xc3d...0xc44,
- 0xc46...0xc48,
- 0xc4a...0xc4d,
- 0xc55...0xc56,
- 0xc58...0xc5a,
- 0xc60...0xc63,
- 0xc66...0xc6f,
- 0xc80...0xc83,
- 0xc85...0xc8c,
- 0xc8e...0xc90,
- 0xc92...0xca8,
- 0xcaa...0xcb3,
- 0xcb5...0xcb9,
- 0xcbc...0xcc4,
- 0xcc6...0xcc8,
- 0xcca...0xccd,
- 0xcd5...0xcd6,
- 0xcde...0xcde,
- 0xce0...0xce3,
- 0xce6...0xcef,
- 0xcf1...0xcf2,
- 0xd00...0xd0c,
- 0xd0e...0xd10,
- 0xd12...0xd44,
- 0xd46...0xd48,
- 0xd4a...0xd4e,
- 0xd54...0xd57,
- 0xd5f...0xd63,
- 0xd66...0xd6f,
- 0xd7a...0xd7f,
- 0xd81...0xd83,
- 0xd85...0xd96,
- 0xd9a...0xdb1,
- 0xdb3...0xdbb,
- 0xdbd...0xdbd,
- 0xdc0...0xdc6,
- 0xdca...0xdca,
- 0xdcf...0xdd4,
- 0xdd6...0xdd6,
- 0xdd8...0xddf,
- 0xde6...0xdef,
- 0xdf2...0xdf3,
- 0xe01...0xe3a,
- 0xe40...0xe4e,
- 0xe50...0xe59,
- 0xe81...0xe82,
- 0xe84...0xe84,
- 0xe86...0xe8a,
- 0xe8c...0xea3,
- 0xea5...0xea5,
- 0xea7...0xebd,
- 0xec0...0xec4,
- 0xec6...0xec6,
- 0xec8...0xecd,
- 0xed0...0xed9,
- 0xedc...0xedf,
- 0xf00...0xf00,
- 0xf18...0xf19,
- 0xf20...0xf29,
- 0xf35...0xf35,
- 0xf37...0xf37,
- 0xf39...0xf39,
- 0xf3e...0xf47,
- 0xf49...0xf6c,
- 0xf71...0xf84,
- 0xf86...0xf97,
- 0xf99...0xfbc,
- 0xfc6...0xfc6,
- 0x1000...0x1049,
- 0x1050...0x109d,
- 0x10a0...0x10c5,
- 0x10c7...0x10c7,
- 0x10cd...0x10cd,
- 0x10d0...0x10fa,
- 0x10fc...0x1248,
- 0x124a...0x124d,
- 0x1250...0x1256,
- 0x1258...0x1258,
- 0x125a...0x125d,
- 0x1260...0x1288,
- 0x128a...0x128d,
- 0x1290...0x12b0,
- 0x12b2...0x12b5,
- 0x12b8...0x12be,
- 0x12c0...0x12c0,
- 0x12c2...0x12c5,
- 0x12c8...0x12d6,
- 0x12d8...0x1310,
- 0x1312...0x1315,
- 0x1318...0x135a,
- 0x135d...0x135f,
- 0x1369...0x1371,
- 0x1380...0x138f,
- 0x13a0...0x13f5,
- 0x13f8...0x13fd,
- 0x1401...0x166c,
- 0x166f...0x167f,
- 0x1681...0x169a,
- 0x16a0...0x16ea,
- 0x16ee...0x16f8,
- 0x1700...0x170c,
- 0x170e...0x1714,
- 0x1720...0x1734,
- 0x1740...0x1753,
- 0x1760...0x176c,
- 0x176e...0x1770,
- 0x1772...0x1773,
- 0x1780...0x17d3,
- 0x17d7...0x17d7,
- 0x17dc...0x17dd,
- 0x17e0...0x17e9,
- 0x180b...0x180d,
- 0x1810...0x1819,
- 0x1820...0x1878,
- 0x1880...0x18aa,
- 0x18b0...0x18f5,
- 0x1900...0x191e,
- 0x1920...0x192b,
- 0x1930...0x193b,
- 0x1946...0x196d,
- 0x1970...0x1974,
- 0x1980...0x19ab,
- 0x19b0...0x19c9,
- 0x19d0...0x19da,
- 0x1a00...0x1a1b,
- 0x1a20...0x1a5e,
- 0x1a60...0x1a7c,
- 0x1a7f...0x1a89,
- 0x1a90...0x1a99,
- 0x1aa7...0x1aa7,
- 0x1ab0...0x1abd,
- 0x1abf...0x1ac0,
- 0x1b00...0x1b4b,
- 0x1b50...0x1b59,
- 0x1b6b...0x1b73,
- 0x1b80...0x1bf3,
- 0x1c00...0x1c37,
- 0x1c40...0x1c49,
- 0x1c4d...0x1c7d,
- 0x1c80...0x1c88,
- 0x1c90...0x1cba,
- 0x1cbd...0x1cbf,
- 0x1cd0...0x1cd2,
- 0x1cd4...0x1cfa,
- 0x1d00...0x1df9,
- 0x1dfb...0x1f15,
- 0x1f18...0x1f1d,
- 0x1f20...0x1f45,
- 0x1f48...0x1f4d,
- 0x1f50...0x1f57,
- 0x1f59...0x1f59,
- 0x1f5b...0x1f5b,
- 0x1f5d...0x1f5d,
- 0x1f5f...0x1f7d,
- 0x1f80...0x1fb4,
- 0x1fb6...0x1fbc,
- 0x1fbe...0x1fbe,
- 0x1fc2...0x1fc4,
- 0x1fc6...0x1fcc,
- 0x1fd0...0x1fd3,
- 0x1fd6...0x1fdb,
- 0x1fe0...0x1fec,
- 0x1ff2...0x1ff4,
- 0x1ff6...0x1ffc,
- 0x203f...0x2040,
- 0x2054...0x2054,
- 0x2071...0x2071,
- 0x207f...0x207f,
- 0x2090...0x209c,
- 0x20d0...0x20dc,
- 0x20e1...0x20e1,
- 0x20e5...0x20f0,
- 0x2102...0x2102,
- 0x2107...0x2107,
- 0x210a...0x2113,
- 0x2115...0x2115,
- 0x2118...0x211d,
- 0x2124...0x2124,
- 0x2126...0x2126,
- 0x2128...0x2128,
- 0x212a...0x2139,
- 0x213c...0x213f,
- 0x2145...0x2149,
- 0x214e...0x214e,
- 0x2160...0x2188,
- 0x2c00...0x2c2e,
- 0x2c30...0x2c5e,
- 0x2c60...0x2ce4,
- 0x2ceb...0x2cf3,
- 0x2d00...0x2d25,
- 0x2d27...0x2d27,
- 0x2d2d...0x2d2d,
- 0x2d30...0x2d67,
- 0x2d6f...0x2d6f,
- 0x2d7f...0x2d96,
- 0x2da0...0x2da6,
- 0x2da8...0x2dae,
- 0x2db0...0x2db6,
- 0x2db8...0x2dbe,
- 0x2dc0...0x2dc6,
- 0x2dc8...0x2dce,
- 0x2dd0...0x2dd6,
- 0x2dd8...0x2dde,
- 0x2de0...0x2dff,
- 0x3005...0x3007,
- 0x3021...0x302f,
- 0x3031...0x3035,
- 0x3038...0x303c,
- 0x3041...0x3096,
- 0x3099...0x309f,
- 0x30a1...0x30ff,
- 0x3105...0x312f,
- 0x3131...0x318e,
- 0x31a0...0x31bf,
- 0x31f0...0x31ff,
- 0x3400...0x4dbf,
- 0x4e00...0x9ffc,
- 0xa000...0xa48c,
- 0xa4d0...0xa4fd,
- 0xa500...0xa60c,
- 0xa610...0xa62b,
- 0xa640...0xa66f,
- 0xa674...0xa67d,
- 0xa67f...0xa6f1,
- 0xa717...0xa71f,
- 0xa722...0xa788,
- 0xa78b...0xa7bf,
- 0xa7c2...0xa7ca,
- 0xa7f5...0xa827,
- 0xa82c...0xa82c,
- 0xa840...0xa873,
- 0xa880...0xa8c5,
- 0xa8d0...0xa8d9,
- 0xa8e0...0xa8f7,
- 0xa8fb...0xa8fb,
- 0xa8fd...0xa92d,
- 0xa930...0xa953,
- 0xa960...0xa97c,
- 0xa980...0xa9c0,
- 0xa9cf...0xa9d9,
- 0xa9e0...0xa9fe,
- 0xaa00...0xaa36,
- 0xaa40...0xaa4d,
- 0xaa50...0xaa59,
- 0xaa60...0xaa76,
- 0xaa7a...0xaac2,
- 0xaadb...0xaadd,
- 0xaae0...0xaaef,
- 0xaaf2...0xaaf6,
- 0xab01...0xab06,
- 0xab09...0xab0e,
- 0xab11...0xab16,
- 0xab20...0xab26,
- 0xab28...0xab2e,
- 0xab30...0xab5a,
- 0xab5c...0xab69,
- 0xab70...0xabea,
- 0xabec...0xabed,
- 0xabf0...0xabf9,
- 0xac00...0xd7a3,
- 0xd7b0...0xd7c6,
- 0xd7cb...0xd7fb,
- 0xf900...0xfa6d,
- 0xfa70...0xfad9,
- 0xfb00...0xfb06,
- 0xfb13...0xfb17,
- 0xfb1d...0xfb28,
- 0xfb2a...0xfb36,
- 0xfb38...0xfb3c,
- 0xfb3e...0xfb3e,
- 0xfb40...0xfb41,
- 0xfb43...0xfb44,
- 0xfb46...0xfbb1,
- 0xfbd3...0xfd3d,
- 0xfd50...0xfd8f,
- 0xfd92...0xfdc7,
- 0xfdf0...0xfdfb,
- 0xfe00...0xfe0f,
- 0xfe20...0xfe2f,
- 0xfe33...0xfe34,
- 0xfe4d...0xfe4f,
- 0xfe70...0xfe74,
- 0xfe76...0xfefc,
- 0xff10...0xff19,
- 0xff21...0xff3a,
- 0xff3f...0xff3f,
- 0xff41...0xff5a,
- 0xff65...0xffbe,
- 0xffc2...0xffc7,
- 0xffca...0xffcf,
- 0xffd2...0xffd7,
- 0xffda...0xffdc,
- 0x10000...0x1000b,
- 0x1000d...0x10026,
- 0x10028...0x1003a,
- 0x1003c...0x1003d,
- 0x1003f...0x1004d,
- 0x10050...0x1005d,
- 0x10080...0x100fa,
- 0x10140...0x10174,
- 0x101fd...0x101fd,
- 0x10280...0x1029c,
- 0x102a0...0x102d0,
- 0x102e0...0x102e0,
- 0x10300...0x1031f,
- 0x1032d...0x1034a,
- 0x10350...0x1037a,
- 0x10380...0x1039d,
- 0x103a0...0x103c3,
- 0x103c8...0x103cf,
- 0x103d1...0x103d5,
- 0x10400...0x1049d,
- 0x104a0...0x104a9,
- 0x104b0...0x104d3,
- 0x104d8...0x104fb,
- 0x10500...0x10527,
- 0x10530...0x10563,
- 0x10600...0x10736,
- 0x10740...0x10755,
- 0x10760...0x10767,
- 0x10800...0x10805,
- 0x10808...0x10808,
- 0x1080a...0x10835,
- 0x10837...0x10838,
- 0x1083c...0x1083c,
- 0x1083f...0x10855,
- 0x10860...0x10876,
- 0x10880...0x1089e,
- 0x108e0...0x108f2,
- 0x108f4...0x108f5,
- 0x10900...0x10915,
- 0x10920...0x10939,
- 0x10980...0x109b7,
- 0x109be...0x109bf,
- 0x10a00...0x10a03,
- 0x10a05...0x10a06,
- 0x10a0c...0x10a13,
- 0x10a15...0x10a17,
- 0x10a19...0x10a35,
- 0x10a38...0x10a3a,
- 0x10a3f...0x10a3f,
- 0x10a60...0x10a7c,
- 0x10a80...0x10a9c,
- 0x10ac0...0x10ac7,
- 0x10ac9...0x10ae6,
- 0x10b00...0x10b35,
- 0x10b40...0x10b55,
- 0x10b60...0x10b72,
- 0x10b80...0x10b91,
- 0x10c00...0x10c48,
- 0x10c80...0x10cb2,
- 0x10cc0...0x10cf2,
- 0x10d00...0x10d27,
- 0x10d30...0x10d39,
- 0x10e80...0x10ea9,
- 0x10eab...0x10eac,
- 0x10eb0...0x10eb1,
- 0x10f00...0x10f1c,
- 0x10f27...0x10f27,
- 0x10f30...0x10f50,
- 0x10fb0...0x10fc4,
- 0x10fe0...0x10ff6,
- 0x11000...0x11046,
- 0x11066...0x1106f,
- 0x1107f...0x110ba,
- 0x110d0...0x110e8,
- 0x110f0...0x110f9,
- 0x11100...0x11134,
- 0x11136...0x1113f,
- 0x11144...0x11147,
- 0x11150...0x11173,
- 0x11176...0x11176,
- 0x11180...0x111c4,
- 0x111c9...0x111cc,
- 0x111ce...0x111da,
- 0x111dc...0x111dc,
- 0x11200...0x11211,
- 0x11213...0x11237,
- 0x1123e...0x1123e,
- 0x11280...0x11286,
- 0x11288...0x11288,
- 0x1128a...0x1128d,
- 0x1128f...0x1129d,
- 0x1129f...0x112a8,
- 0x112b0...0x112ea,
- 0x112f0...0x112f9,
- 0x11300...0x11303,
- 0x11305...0x1130c,
- 0x1130f...0x11310,
- 0x11313...0x11328,
- 0x1132a...0x11330,
- 0x11332...0x11333,
- 0x11335...0x11339,
- 0x1133b...0x11344,
- 0x11347...0x11348,
- 0x1134b...0x1134d,
- 0x11350...0x11350,
- 0x11357...0x11357,
- 0x1135d...0x11363,
- 0x11366...0x1136c,
- 0x11370...0x11374,
- 0x11400...0x1144a,
- 0x11450...0x11459,
- 0x1145e...0x11461,
- 0x11480...0x114c5,
- 0x114c7...0x114c7,
- 0x114d0...0x114d9,
- 0x11580...0x115b5,
- 0x115b8...0x115c0,
- 0x115d8...0x115dd,
- 0x11600...0x11640,
- 0x11644...0x11644,
- 0x11650...0x11659,
- 0x11680...0x116b8,
- 0x116c0...0x116c9,
- 0x11700...0x1171a,
- 0x1171d...0x1172b,
- 0x11730...0x11739,
- 0x11800...0x1183a,
- 0x118a0...0x118e9,
- 0x118ff...0x11906,
- 0x11909...0x11909,
- 0x1190c...0x11913,
- 0x11915...0x11916,
- 0x11918...0x11935,
- 0x11937...0x11938,
- 0x1193b...0x11943,
- 0x11950...0x11959,
- 0x119a0...0x119a7,
- 0x119aa...0x119d7,
- 0x119da...0x119e1,
- 0x119e3...0x119e4,
- 0x11a00...0x11a3e,
- 0x11a47...0x11a47,
- 0x11a50...0x11a99,
- 0x11a9d...0x11a9d,
- 0x11ac0...0x11af8,
- 0x11c00...0x11c08,
- 0x11c0a...0x11c36,
- 0x11c38...0x11c40,
- 0x11c50...0x11c59,
- 0x11c72...0x11c8f,
- 0x11c92...0x11ca7,
- 0x11ca9...0x11cb6,
- 0x11d00...0x11d06,
- 0x11d08...0x11d09,
- 0x11d0b...0x11d36,
- 0x11d3a...0x11d3a,
- 0x11d3c...0x11d3d,
- 0x11d3f...0x11d47,
- 0x11d50...0x11d59,
- 0x11d60...0x11d65,
- 0x11d67...0x11d68,
- 0x11d6a...0x11d8e,
- 0x11d90...0x11d91,
- 0x11d93...0x11d98,
- 0x11da0...0x11da9,
- 0x11ee0...0x11ef6,
- 0x11fb0...0x11fb0,
- 0x12000...0x12399,
- 0x12400...0x1246e,
- 0x12480...0x12543,
- 0x13000...0x1342e,
- 0x14400...0x14646,
- 0x16800...0x16a38,
- 0x16a40...0x16a5e,
- 0x16a60...0x16a69,
- 0x16ad0...0x16aed,
- 0x16af0...0x16af4,
- 0x16b00...0x16b36,
- 0x16b40...0x16b43,
- 0x16b50...0x16b59,
- 0x16b63...0x16b77,
- 0x16b7d...0x16b8f,
- 0x16e40...0x16e7f,
- 0x16f00...0x16f4a,
- 0x16f4f...0x16f87,
- 0x16f8f...0x16f9f,
- 0x16fe0...0x16fe1,
- 0x16fe3...0x16fe4,
- 0x16ff0...0x16ff1,
- 0x17000...0x187f7,
- 0x18800...0x18cd5,
- 0x18d00...0x18d08,
- 0x1b000...0x1b11e,
- 0x1b150...0x1b152,
- 0x1b164...0x1b167,
- 0x1b170...0x1b2fb,
- 0x1bc00...0x1bc6a,
- 0x1bc70...0x1bc7c,
- 0x1bc80...0x1bc88,
- 0x1bc90...0x1bc99,
- 0x1bc9d...0x1bc9e,
- 0x1d165...0x1d169,
- 0x1d16d...0x1d172,
- 0x1d17b...0x1d182,
- 0x1d185...0x1d18b,
- 0x1d1aa...0x1d1ad,
- 0x1d242...0x1d244,
- 0x1d400...0x1d454,
- 0x1d456...0x1d49c,
- 0x1d49e...0x1d49f,
- 0x1d4a2...0x1d4a2,
- 0x1d4a5...0x1d4a6,
- 0x1d4a9...0x1d4ac,
- 0x1d4ae...0x1d4b9,
- 0x1d4bb...0x1d4bb,
- 0x1d4bd...0x1d4c3,
- 0x1d4c5...0x1d505,
- 0x1d507...0x1d50a,
- 0x1d50d...0x1d514,
- 0x1d516...0x1d51c,
- 0x1d51e...0x1d539,
- 0x1d53b...0x1d53e,
- 0x1d540...0x1d544,
- 0x1d546...0x1d546,
- 0x1d54a...0x1d550,
- 0x1d552...0x1d6a5,
- 0x1d6a8...0x1d6c0,
- 0x1d6c2...0x1d6da,
- 0x1d6dc...0x1d6fa,
- 0x1d6fc...0x1d714,
- 0x1d716...0x1d734,
- 0x1d736...0x1d74e,
- 0x1d750...0x1d76e,
- 0x1d770...0x1d788,
- 0x1d78a...0x1d7a8,
- 0x1d7aa...0x1d7c2,
- 0x1d7c4...0x1d7cb,
- 0x1d7ce...0x1d7ff,
- 0x1da00...0x1da36,
- 0x1da3b...0x1da6c,
- 0x1da75...0x1da75,
- 0x1da84...0x1da84,
- 0x1da9b...0x1da9f,
- 0x1daa1...0x1daaf,
- 0x1e000...0x1e006,
- 0x1e008...0x1e018,
- 0x1e01b...0x1e021,
- 0x1e023...0x1e024,
- 0x1e026...0x1e02a,
- 0x1e100...0x1e12c,
- 0x1e130...0x1e13d,
- 0x1e140...0x1e149,
- 0x1e14e...0x1e14e,
- 0x1e2c0...0x1e2f9,
- 0x1e800...0x1e8c4,
- 0x1e8d0...0x1e8d6,
- 0x1e900...0x1e94b,
- 0x1e950...0x1e959,
- 0x1ee00...0x1ee03,
- 0x1ee05...0x1ee1f,
- 0x1ee21...0x1ee22,
- 0x1ee24...0x1ee24,
- 0x1ee27...0x1ee27,
- 0x1ee29...0x1ee32,
- 0x1ee34...0x1ee37,
- 0x1ee39...0x1ee39,
- 0x1ee3b...0x1ee3b,
- 0x1ee42...0x1ee42,
- 0x1ee47...0x1ee47,
- 0x1ee49...0x1ee49,
- 0x1ee4b...0x1ee4b,
- 0x1ee4d...0x1ee4f,
- 0x1ee51...0x1ee52,
- 0x1ee54...0x1ee54,
- 0x1ee57...0x1ee57,
- 0x1ee59...0x1ee59,
- 0x1ee5b...0x1ee5b,
- 0x1ee5d...0x1ee5d,
- 0x1ee5f...0x1ee5f,
- 0x1ee61...0x1ee62,
- 0x1ee64...0x1ee64,
- 0x1ee67...0x1ee6a,
- 0x1ee6c...0x1ee72,
- 0x1ee74...0x1ee77,
- 0x1ee79...0x1ee7c,
- 0x1ee7e...0x1ee7e,
- 0x1ee80...0x1ee89,
- 0x1ee8b...0x1ee9b,
- 0x1eea1...0x1eea3,
- 0x1eea5...0x1eea9,
- 0x1eeab...0x1eebb,
- 0x1fbf0...0x1fbf9,
- 0x20000...0x2a6dd,
- 0x2a700...0x2b734,
- 0x2b740...0x2b81d,
- 0x2b820...0x2cea1,
- 0x2ceb0...0x2ebe0,
- 0x2f800...0x2fa1d,
- 0x30000...0x3134a,
- 0xe0100...0xe01ef,
- => true,
- else => false,
- };
-}
diff --git a/src/js_lexer_tables.zig b/src/js_lexer_tables.zig
index ac71ed7e7..0dd221b0d 100644
--- a/src/js_lexer_tables.zig
+++ b/src/js_lexer_tables.zig
@@ -835,7 +835,7 @@ pub fn initJSXEntityMap() !void {
}
test "tokenToString" {
- expectString(tokenToString.get(T.t_end_of_file), "end of file");
+ try expectString(tokenToString.get(T.t_end_of_file), "end of file");
}
// test "jsxEntity" {
@@ -850,5 +850,3 @@ test "tokenToString" {
// }
// }
-pub const id_start = @import("./js_lexer/unicode.zig").id_start;
-pub const id_continue = @import("./js_lexer/unicode.zig").id_continue;
diff --git a/src/js_parser/imports.zig b/src/js_parser/imports.zig
index 80f162d88..f01dfced0 100644
--- a/src/js_parser/imports.zig
+++ b/src/js_parser/imports.zig
@@ -4,7 +4,6 @@ pub const js_lexer = @import("../js_lexer.zig");
pub const importRecord = @import("../import_record.zig");
pub const js_ast = @import("../js_ast.zig");
pub const options = @import("../options.zig");
-pub const alloc = @import("../alloc.zig");
pub const js_printer = @import("../js_printer.zig");
pub const renamer = @import("../renamer.zig");
const _runtime = @import("../runtime.zig");
diff --git a/src/js_printer.zig b/src/js_printer.zig
index 17868fb10..fa67250e4 100644
--- a/src/js_printer.zig
+++ b/src/js_printer.zig
@@ -4,7 +4,6 @@ const js_lexer = @import("js_lexer.zig");
const importRecord = @import("import_record.zig");
const js_ast = @import("js_ast.zig");
const options = @import("options.zig");
-const alloc = @import("alloc.zig");
const rename = @import("renamer.zig");
const runtime = @import("runtime.zig");
const Lock = @import("./lock.zig").Lock;
@@ -52,6 +51,18 @@ fn notimpl() void {
Global.panic("Not implemented yet!", .{});
}
+fn formatUnsignedIntegerBetween(comptime len: u16, buf: *[len]u8, val: u64, comptime min: u32, comptime max: u32) void {
+ comptime var i: u16 = len;
+ var remainder = val;
+ // Write out the number from the end to the front
+
+ inline while (i > 0) {
+ comptime i -= 1;
+ buf[comptime i] = @intCast(u8, (remainder % 10)) + '0';
+ remainder /= 10;
+ }
+}
+
pub fn writeModuleId(comptime Writer: type, writer: Writer, module_id: u32) void {
std.debug.assert(module_id != 0); // either module_id is forgotten or it should be disabled
_ = writer.writeAll("$") catch unreachable;
@@ -592,15 +603,108 @@ pub fn NewPrinter(
pub fn printNonNegativeFloat(p: *Printer, float: f64) void {
// Is this actually an integer?
@setRuntimeSafety(false);
- if (float < std.math.maxInt(u32) and std.math.ceil(float) == float) {
+ const floored: f64 = @floor(float);
+ const remainder: f64 = (float - floored);
+ const is_integer = remainder == 0;
+ if (float < std.math.maxInt(u52) and is_integer) {
+ @setFloatMode(.Optimized);
// In JavaScript, numbers are represented as 64 bit floats
// However, they could also be signed or unsigned int 32 (when doing bit shifts)
// In this case, it's always going to unsigned since that conversion has already happened.
- std.fmt.formatInt(@floatToInt(u32, float), 10, .upper, .{}, p) catch unreachable;
+ const val = @floatToInt(u64, float);
+ switch (val) {
+ 0 => {
+ p.print("0");
+ },
+ 1...9 => {
+ var bytes = [1]u8{'0' + @intCast(u8, val)};
+ p.print(&bytes);
+ },
+ 10 => {
+ p.print("10");
+ },
+ 11...99 => {
+ var buf: *[2]u8 = (p.writer.reserve(2) catch unreachable)[0..2];
+ formatUnsignedIntegerBetween(2, buf, val, 11, 99);
+ p.writer.advance(2);
+ },
+ 100 => {
+ p.print("100");
+ },
+ 101...999 => {
+ var buf: *[3]u8 = (p.writer.reserve(3) catch unreachable)[0..3];
+ formatUnsignedIntegerBetween(3, buf, val, 101, 999);
+ p.writer.advance(3);
+ },
+
+ 1000 => {
+ p.print("1000");
+ },
+ 1001...9999 => {
+ var buf: *[4]u8 = (p.writer.reserve(4) catch unreachable)[0..4];
+ formatUnsignedIntegerBetween(4, buf, val, 1001, 9999);
+ p.writer.advance(4);
+ },
+ 10000 => {
+ p.print("1e4");
+ },
+ 100000 => {
+ p.print("1e5");
+ },
+ 1000000 => {
+ p.print("1e6");
+ },
+ 10000000 => {
+ p.print("1e7");
+ },
+ 100000000 => {
+ p.print("1e8");
+ },
+ 1000000000 => {
+ p.print("1e9");
+ },
+
+ 10001...99999 => {
+ var buf: *[5]u8 = (p.writer.reserve(5) catch unreachable)[0..5];
+ formatUnsignedIntegerBetween(5, buf, val, 10001, 99999);
+ p.writer.advance(5);
+ },
+ 100001...999999 => {
+ var buf: *[6]u8 = (p.writer.reserve(6) catch unreachable)[0..6];
+ formatUnsignedIntegerBetween(6, buf, val, 100001, 999999);
+ p.writer.advance(6);
+ },
+ 1_000_001...9_999_999 => {
+ var buf: *[7]u8 = (p.writer.reserve(7) catch unreachable)[0..7];
+ formatUnsignedIntegerBetween(7, buf, val, 1_000_001, 9_999_999);
+ p.writer.advance(7);
+ },
+ 10_000_001...99_999_999 => {
+ var buf: *[8]u8 = (p.writer.reserve(8) catch unreachable)[0..8];
+ formatUnsignedIntegerBetween(8, buf, val, 10_000_001, 99_999_999);
+ p.writer.advance(8);
+ },
+ 100_000_001...999_999_999 => {
+ var buf: *[9]u8 = (p.writer.reserve(9) catch unreachable)[0..9];
+ formatUnsignedIntegerBetween(9, buf, val, 100_000_001, 999_999_999);
+ p.writer.advance(9);
+ },
+ 1_000_000_001...9_999_999_999 => {
+ var buf: *[10]u8 = (p.writer.reserve(10) catch unreachable)[0..10];
+ formatUnsignedIntegerBetween(10, buf, val, 100_000_001, 999_999_999);
+ p.writer.advance(10);
+ },
+ else => std.fmt.formatInt(val, 10, .lower, .{}, p) catch unreachable,
+ }
+
return;
}
- std.fmt.formatFloatScientific(float, .{}, p) catch unreachable;
+ std.fmt.formatFloatDecimal(
+ float,
+ .{},
+ p,
+ ) catch unreachable;
}
pub fn printQuotedUTF16(e: *Printer, text: []const u16, quote: u8) void {
@@ -1457,7 +1561,8 @@ pub fn NewPrinter(
},
.e_number => |e| {
const value = e.value;
- const absValue = std.math.fabs(value);
+
+ const absValue = @fabs(value);
if (std.math.isNan(value)) {
p.printSpaceBeforeIdentifier();
@@ -4002,7 +4107,7 @@ const FileWriterInternal = struct {
pub fn init(file: std.fs.File) FileWriterInternal {
if (!has_loaded_buffer) {
- buffer = MutableString.init(alloc.dynamic, 0) catch unreachable;
+ buffer = MutableString.init(default_allocator, 0) catch unreachable;
has_loaded_buffer = true;
}
diff --git a/src/json_parser.zig b/src/json_parser.zig
index e68796c29..f84619320 100644
--- a/src/json_parser.zig
+++ b/src/json_parser.zig
@@ -4,7 +4,6 @@ const js_lexer = @import("js_lexer.zig");
const importRecord = @import("import_record.zig");
const js_ast = @import("js_ast.zig");
const options = @import("options.zig");
-const alloc = @import("alloc.zig");
const fs = @import("fs.zig");
usingnamespace @import("global.zig");
@@ -625,34 +624,35 @@ const js_printer = @import("js_printer.zig");
const renamer = @import("renamer.zig");
const SymbolList = [][]Symbol;
+const Bundler = @import("./bundler.zig").Bundler;
+const ParseResult = @import("./bundler.zig").ParseResult;
fn expectPrintedJSON(_contents: string, expected: string) !void {
- var contents = alloc.dynamic.alloc(u8, _contents.len + 1) catch unreachable;
+ Expr.Data.Store.create(default_allocator);
+ Stmt.Data.Store.create(default_allocator);
+ defer {
+ Expr.Data.Store.reset();
+ Stmt.Data.Store.reset();
+ }
+ var contents = default_allocator.alloc(u8, _contents.len + 1) catch unreachable;
std.mem.copy(u8, contents, _contents);
contents[contents.len - 1] = ';';
- var log = logger.Log.init(alloc.dynamic);
+ var log = logger.Log.init(default_allocator);
defer log.msgs.deinit();
var source = logger.Source.initPathString(
"source.json",
contents,
);
- const expr = try ParseJSON(&source, &log, alloc.dynamic);
- var stmt = Stmt.alloc(alloc.dynamic, S.SExpr{ .value = expr }, logger.Loc{ .start = 0 });
+ const expr = try ParseJSON(&source, &log, default_allocator);
- var part = js_ast.Part{
- .stmts = &([_]Stmt{stmt}),
- };
- const tree = js_ast.Ast.initTest(&([_]js_ast.Part{part}));
- var symbols: SymbolList = &([_][]Symbol{tree.symbols});
- var symbol_map = js_ast.Symbol.Map.initList(symbols);
if (log.msgs.items.len > 0) {
Global.panic("--FAIL--\nExpr {s}\nLog: {s}\n--FAIL--", .{ expr, log.msgs.items[0].data.text });
}
- var linker = @import("linker.zig").Linker{};
-
- const result = js_printer.printAst(alloc.dynamic, tree, symbol_map, &source, true, js_printer.Options{ .to_module_ref = Ref{ .inner_index = 0 } }, &linker) catch unreachable;
- var js = result.js;
+ var buffer_writer = try js_printer.BufferWriter.init(default_allocator);
+ var writer = js_printer.BufferPrinter.init(buffer_writer);
+ const written = try js_printer.printJSON(@TypeOf(&writer), &writer, expr, &source);
+ var js = writer.ctx.buffer.list.items.ptr[0 .. written + 1];
if (js.len > 1) {
while (js[js.len - 1] == '\n') {
@@ -664,11 +664,10 @@ fn expectPrintedJSON(_contents: string, expected: string) !void {
}
}
- std.testing.expectEqualStrings(expected, js);
+ try std.testing.expectEqualStrings(expected, js);
}
test "ParseJSON" {
- try alloc.setup(default_allocator);
try expectPrintedJSON("true", "true");
try expectPrintedJSON("false", "false");
try expectPrintedJSON("1", "1");
@@ -680,41 +679,16 @@ test "ParseJSON" {
try expectPrintedJSON("3.4159820837456", "3.4159820837456");
try expectPrintedJSON("-10000.25", "-10000.25");
try expectPrintedJSON("\"hi\"", "\"hi\"");
- try expectPrintedJSON("{\"hi\": 1, \"hey\": \"200\", \"boom\": {\"yo\": true}}", "({\"hi\": 1, \"hey\": \"200\", \"boom\": {\"yo\": true}})");
- try expectPrintedJSON("{\"hi\": \"hey\"}", "({hi: \"hey\"})");
- try expectPrintedJSON("{\"hi\": [\"hey\", \"yo\"]}", "({hi:[\"hey\",\"yo\"]})");
- // TODO: emoji?
-}
-
-test "ParseJSON DuplicateKey warning" {
- alloc.setup(std.heap.page_allocator) catch unreachable;
- var log = logger.Log.init(alloc.dynamic);
-
- var source = logger.Source.initPathString(
- "package.json",
- duplicateKeyJson,
+ try expectPrintedJSON("{\"hi\": 1, \"hey\": \"200\", \"boom\": {\"yo\": true}}", "{\"hi\": 1, \"hey\": \"200\", \"boom\": {\"yo\": true } }");
+ try expectPrintedJSON("{\"hi\": \"hey\"}", "{\"hi\": \"hey\" }");
+ try expectPrintedJSON(
+ "{\"hi\": [\"hey\", \"yo\"]}",
+ \\{"hi": [
+ \\ "hey",
+ \\ "yo"
+ \\] }
+ ,
);
- const expr = try ParseJSON(&source, &log, alloc.dynamic);
-
- const tag = @as(Expr.Tag, expr.data);
- expect(tag == .e_object);
- const object = expr.data.e_object;
- std.testing.expectEqual(@as(usize, 2), object.properties.len);
- const name1 = object.properties[0];
- expect(name1.key != null);
- expect(name1.value != null);
- expect(Expr.Tag.e_string == @as(Expr.Tag, name1.value.?.data));
- expect(Expr.Tag.e_string == @as(Expr.Tag, name1.key.?.data));
- expect(strings.eqlUtf16("name", name1.key.?.data.e_string.value));
- expect(strings.eqlUtf16("valid", name1.value.?.data.e_string.value));
-
- const name2 = object.properties[1];
- expect(name2.key != null);
- expect(name2.value != null);
- expect(Expr.Tag.e_string == @as(Expr.Tag, name2.value.?.data));
- expect(Expr.Tag.e_string == @as(Expr.Tag, name2.key.?.data));
- expect(strings.eqlUtf16("name", name2.key.?.data.e_string.value));
- std.testing.expectEqualStrings("invalid", try name2.value.?.data.e_string.string(alloc.dynamic));
-
- std.testing.expectEqual(@as(usize, 1), log.msgs.items.len);
+
+ // TODO: emoji?
}
diff --git a/src/linker.zig b/src/linker.zig
index 5c6f56179..52c3090a5 100644
--- a/src/linker.zig
+++ b/src/linker.zig
@@ -4,7 +4,6 @@ usingnamespace @import("./ast/base.zig");
const std = @import("std");
const lex = @import("js_lexer.zig");
const logger = @import("logger.zig");
-const alloc = @import("alloc.zig");
const Options = @import("options.zig");
const js_parser = @import("js_parser.zig");
const json_parser = @import("json_parser.zig");
diff --git a/src/main.zig b/src/main.zig
index d70602827..985118812 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1,7 +1,6 @@
const std = @import("std");
const lex = @import("js_lexer.zig");
const logger = @import("logger.zig");
-const alloc = @import("alloc.zig");
const options = @import("options.zig");
const js_parser = @import("js_parser.zig");
const json_parser = @import("json_parser.zig");
@@ -31,7 +30,7 @@ pub fn main() anyerror!void {
// std.heap.GeneralPurposeAllocator makes this about 3x _slower_ than esbuild.
// var root_alloc = std.heap.ArenaAllocator.init(std.heap.raw_c_allocator);
// var root_alloc_ = &root_alloc.allocator;
- try alloc.setup(default_allocator);
+
var stdout = std.io.getStdOut();
// var stdout = std.io.bufferedWriter(stdout_file.writer());
var stderr = std.io.getStdErr();
@@ -39,6 +38,7 @@ pub fn main() anyerror!void {
Output.Source.set(&output_source);
defer Output.flush();
+
cli.Cli.start(default_allocator, stdout, stderr, MainPanicHandler) catch |err| {
switch (err) {
error.CurrentWorkingDirectoryUnlinked => {
@@ -59,3 +59,11 @@ pub fn main() anyerror!void {
}
pub const JavaScriptVirtualMachine = VirtualMachine;
+
+test "" {
+ @import("std").testing.refAllDecls(@This());
+
+ std.mem.doNotOptimizeAway(JavaScriptVirtualMachine.fetch);
+ std.mem.doNotOptimizeAway(JavaScriptVirtualMachine.init);
+ std.mem.doNotOptimizeAway(JavaScriptVirtualMachine.resolve);
+}
diff --git a/src/main_api.zig b/src/main_api.zig
index ac908b671..b3aead965 100644
--- a/src/main_api.zig
+++ b/src/main_api.zig
@@ -1,14 +1,11 @@
const Api = @import("./api/schema.zig").Api;
const Options = @import("./options.zig");
-const alloc = @import("./alloc.zig");
var options: Options.BundleOptions = undefined;
export fn init() void {
if (!alloc.needs_setup) {
return;
}
-
- alloc.setup(default_allocator);
}
export fn setOptions(options_ptr: [*c]u8, options_len: c_int) void {}
diff --git a/src/main_javascript.zig b/src/main_javascript.zig
index 0ecff30d5..8cf3e959f 100644
--- a/src/main_javascript.zig
+++ b/src/main_javascript.zig
@@ -1,7 +1,6 @@
const std = @import("std");
const lex = @import("js_lexer.zig");
const logger = @import("logger.zig");
-const alloc = @import("alloc.zig");
const options = @import("options.zig");
const js_parser = @import("js_parser.zig");
const json_parser = @import("json_parser.zig");
@@ -37,7 +36,7 @@ pub fn main() anyerror!void {
// std.heap.GeneralPurposeAllocator makes this about 3x _slower_ than esbuild.
// var root_alloc = std.heap.ArenaAllocator.init(std.heap.raw_c_allocator);
// var root_alloc_ = &root_alloc.allocator;
- try alloc.setup(default_allocator);
+
var stdout = std.io.getStdOut();
// var stdout = std.io.bufferedWriter(stdout_file.writer());
var stderr = std.io.getStdErr();
@@ -371,7 +370,6 @@ pub const Cli = struct {
stderr: Stderr,
args: Api.TransformOptions,
pub fn spawn(this: @This()) !void {
- try alloc.setup(default_allocator);
var stdout = std.io.getStdOut();
// var stdout = std.io.bufferedWriter(stdout_file.writer());
var stderr = std.io.getStdErr();
@@ -400,7 +398,7 @@ pub const Cli = struct {
var panicker = MainPanicHandler.init(&log);
MainPanicHandler.Singleton = &panicker;
- var args = try Arguments.parse(alloc.static, stdout, stderr);
+ var args = try Arguments.parse(default_allocator, stdout, stderr);
// var serve_bundler = try bundler.ServeBundler.init(allocator, &log, args);
// var res = try serve_bundler.buildFile(&log, allocator, args.entry_points[0], std.fs.path.extension(args.entry_points[0]));
diff --git a/src/main_wasi.zig b/src/main_wasi.zig
index 5d24c2e69..66371e949 100644
--- a/src/main_wasi.zig
+++ b/src/main_wasi.zig
@@ -1,7 +1,7 @@
const std = @import("std");
const lex = @import("js_lexer.zig");
const logger = @import("logger.zig");
-const alloc = @import("alloc.zig");
+
const options = @import("options.zig");
const js_parser = @import("js_parser.zig");
const json_parser = @import("json_parser.zig");
@@ -26,12 +26,11 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) nore
pub fn main() anyerror!void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
var allocator = &arena.allocator;
- try alloc.setup(allocator);
- var log = logger.Log.init(alloc.dynamic);
+ var log = logger.Log.init(default_allocator);
var panicker = MainPanicHandler.init(&log);
MainPanicHandler.Singleton = &panicker;
- const args = try std.process.argsAlloc(alloc.dynamic);
+ const args = try std.process.argsAlloc(default_allocator);
const stdout = std.io.getStdOut();
const stderr = std.io.getStdErr();
@@ -42,29 +41,29 @@ pub fn main() anyerror!void {
const absolutePath = args[args.len - 1];
const pathname = fs.PathName.init(absolutePath);
- const entryPointName = try alloc.dynamic.alloc(u8, pathname.base.len + pathname.ext.len);
+ const entryPointName = try default_allocator.alloc(u8, pathname.base.len + pathname.ext.len);
std.mem.copy(u8, entryPointName, pathname.base);
std.mem.copy(u8, entryPointName[pathname.base.len..entryPointName.len], pathname.ext);
- const code = try std.io.getStdIn().readToEndAlloc(alloc.dynamic, std.math.maxInt(usize));
+ const code = try std.io.getStdIn().readToEndAlloc(default_allocator, std.math.maxInt(usize));
- const opts = try options.TransformOptions.initUncached(alloc.dynamic, entryPointName, code);
- var source = logger.Source.initFile(opts.entry_point, alloc.dynamic);
+ const opts = try options.TransformOptions.initUncached(default_allocator, entryPointName, code);
+ var source = logger.Source.initFile(opts.entry_point, default_allocator);
var ast: js_ast.Ast = undefined;
- var raw_defines = RawDefines.init(alloc.static);
+ var raw_defines = RawDefines.init(default_allocator);
try raw_defines.put("process.env.NODE_ENV", "\"development\"");
- var user_defines = try DefineData.from_input(raw_defines, &log, alloc.static);
+ var user_defines = try DefineData.from_input(raw_defines, &log, default_allocator);
var define = try Define.init(
- alloc.static,
+ default_allocator,
user_defines,
);
switch (opts.loader) {
.json => {
- var expr = try json_parser.ParseJSON(&source, &log, alloc.dynamic);
- var stmt = js_ast.Stmt.alloc(alloc.dynamic, js_ast.S.ExportDefault{
+ var expr = try json_parser.ParseJSON(&source, &log, default_allocator);
+ var stmt = js_ast.Stmt.alloc(default_allocator, js_ast.S.ExportDefault{
.value = js_ast.StmtOrExpr{ .expr = expr },
.default_name = js_ast.LocRef{ .loc = logger.Loc{}, .ref = Ref{} },
}, logger.Loc{ .start = 0 });
@@ -76,7 +75,7 @@ pub fn main() anyerror!void {
ast = js_ast.Ast.initTest(&([_]js_ast.Part{part}));
},
.jsx, .tsx, .ts, .js => {
- var parser = try js_parser.Parser.init(opts, &log, &source, define, alloc.dynamic);
+ var parser = try js_parser.Parser.init(opts, &log, &source, define, default_allocator);
var res = try parser.parse();
ast = res.ast;
},
@@ -88,7 +87,7 @@ pub fn main() anyerror!void {
var _linker = linker.Linker{};
var symbols: [][]js_ast.Symbol = &([_][]js_ast.Symbol{ast.symbols});
const printed = try js_printer.printAst(
- alloc.dynamic,
+ default_allocator,
ast,
js_ast.Symbol.Map.initList(symbols),
&source,
@@ -101,7 +100,7 @@ pub fn main() anyerror!void {
// var fixed_buffer = [_]u8{0} ** 512000;
// var buf_stream = std.io.fixedBufferStream(&fixed_buffer);
- // try ast.toJSON(alloc.dynamic, stderr.writer());
+ // try ast.toJSON(default_allocator, stderr.writer());
// }
_ = try stdout.write(printed.js);
diff --git a/src/main_wasm.zig b/src/main_wasm.zig
index a3b31e995..e8281b486 100644
--- a/src/main_wasm.zig
+++ b/src/main_wasm.zig
@@ -1,7 +1,6 @@
const std = @import("std");
const lex = @import("js_lexer.zig");
const logger = @import("logger.zig");
-const alloc = @import("alloc.zig");
const options = @import("options.zig");
const js_parser = @import("js_parser.zig");
const json_parser = @import("json_parser.zig");
@@ -50,7 +49,7 @@ pub const Uint8Array = packed struct {
}
pub fn encode(comptime SchemaType: type, obj: SchemaType) !Abi {
- var list = std.ArrayList(u8).init(alloc.dynamic);
+ var list = std.ArrayList(u8).init(default_allocator);
var writer = list.writer();
try obj.encode(writer);
return Uint8Array.fromSlice(list.toOwnedSlice());
@@ -59,7 +58,7 @@ pub const Uint8Array = packed struct {
pub fn decode(self: Abi, comptime SchemaType: type) !SchemaType {
var buf = Uint8Array.toSlice(self);
var stream = std.io.fixedBufferStream(buf);
- const res = try SchemaType.decode(alloc.dynamic, stream.reader());
+ const res = try SchemaType.decode(default_allocator, stream.reader());
return res;
}
};
@@ -75,25 +74,25 @@ pub const Api = struct {
defines: ?*Define = null,
pub fn transform(self: *Api, request: Schema.Transform) !Schema.TransformResponse {
- const opts = try options.TransformOptions.initUncached(alloc.dynamic, request.path.?, request.contents);
- var source = logger.Source.initFile(opts.entry_point, alloc.dynamic);
+ const opts = try options.TransformOptions.initUncached(default_allocator, request.path.?, request.contents);
+ var source = logger.Source.initFile(opts.entry_point, default_allocator);
var ast: js_ast.Ast = undefined;
if (self.defines == null) {
- var raw_defines = RawDefines.init(alloc.static);
+ var raw_defines = RawDefines.init(default_allocator);
raw_defines.put("process.env.NODE_ENV", "\"development\"") catch unreachable;
- var user_defines = try DefineData.from_input(raw_defines, &self.log, alloc.static);
+ var user_defines = try DefineData.from_input(raw_defines, &self.log, default_allocator);
self.defines = try Define.init(
- alloc.static,
+ default_allocator,
user_defines,
);
}
switch (opts.loader) {
.json => {
- var expr = try json_parser.ParseJSON(&source, &self.log, alloc.dynamic);
- var stmt = js_ast.Stmt.alloc(alloc.dynamic, js_ast.S.ExportDefault{
+ var expr = try json_parser.ParseJSON(&source, &self.log, default_allocator);
+ var stmt = js_ast.Stmt.alloc(default_allocator, js_ast.S.ExportDefault{
.value = js_ast.StmtOrExpr{ .expr = expr },
.default_name = js_ast.LocRef{ .loc = logger.Loc{}, .ref = Ref{} },
}, logger.Loc{ .start = 0 });
@@ -105,7 +104,7 @@ pub const Api = struct {
ast = js_ast.Ast.initTest(&([_]js_ast.Part{part}));
},
.jsx, .tsx, .ts, .js => {
- var parser = try js_parser.Parser.init(opts, &self.log, &source, self.defines.?, alloc.dynamic);
+ var parser = try js_parser.Parser.init(opts, &self.log, &source, self.defines.?, default_allocator);
var res = try parser.parse();
ast = res.ast;
},
@@ -117,7 +116,7 @@ pub const Api = struct {
var _linker = linker.Linker{};
var symbols: [][]js_ast.Symbol = &([_][]js_ast.Symbol{ast.symbols});
const printed = try js_printer.printAst(
- alloc.dynamic,
+ default_allocator,
ast,
js_ast.Symbol.Map.initList(symbols),
&source,
@@ -126,7 +125,7 @@ pub const Api = struct {
&_linker,
);
// Output.print("Parts count: {d}", .{ast.parts.len});
- var output_files = try alloc.dynamic.alloc(Schema.OutputFile, 1);
+ var output_files = try default_allocator.alloc(Schema.OutputFile, 1);
var _data = printed.js[0..printed.js.len];
var _path = constStrToU8(source.path.text);
@@ -172,7 +171,6 @@ pub const Exports = struct {
// var gpa = Gpa{};
// var allocator = &gpa.allocator;
- // alloc.setup(allocator) catch return -1;
var out_buffer = perma_hunk_low.allocator.alloc(u8, 4096) catch return -1;
var err_buffer = perma_hunk_low.allocator.alloc(u8, 4096) catch return -1;
var output = perma_hunk_low.allocator.create(Output.Source) catch return -1;
@@ -206,13 +204,13 @@ pub const Exports = struct {
hunk = alloc.Hunk.init(buf);
hunk_high = hunk.high();
hunk_low = hunk.low();
- alloc.dynamic = &hunk_high.allocator;
- alloc.static = &hunk_low.allocator;
+ default_allocator = &hunk_high.allocator;
+ default_allocator = &hunk_low.allocator;
alloc.needs_setup = false;
}
Output.printErrorable("Initialized.", .{}) catch |err| {
- var name = alloc.static.alloc(u8, @errorName(err).len) catch unreachable;
+ var name = default_allocator.alloc(u8, @errorName(err).len) catch unreachable;
std.mem.copy(u8, name, @errorName(err));
console_error(Uint8Array.fromSlice(name));
};
@@ -224,7 +222,7 @@ pub const Exports = struct {
// Output.print("Received {d}", .{abi});
const req: Schema.Transform = Uint8Array.decode(abi, Schema.Transform) catch return Uint8Array.empty();
// Output.print("Req {s}", .{req});
- // alloc.dynamic.free(Uint8Array.toSlice(abi));
+ // default_allocator.free(Uint8Array.toSlice(abi));
const resp = api.?.transform(req) catch return Uint8Array.empty();
var res = Uint8Array.encode(Schema.TransformResponse, resp) catch return Uint8Array.empty();
@@ -254,7 +252,7 @@ pub const Exports = struct {
if (size == 0) {
return 0;
}
- const result = alloc.dynamic.alloc(u8, size) catch unreachable;
+ const result = default_allocator.alloc(u8, size) catch unreachable;
return Uint8Array.fromSlice(result);
}
// fn calloc(num_elements: usize, element_size: usize) callconv(.C) ?*c_void {
@@ -273,14 +271,14 @@ pub const Exports = struct {
// } else if (c_ptr) |ptr| {
// // Use a synthetic slice
// const p = @ptrCast([*]u8, ptr);
- // const result = alloc.dynamic.realloc(p[0..1], new_size) catch return null;
+ // const result = default_allocator.realloc(p[0..1], new_size) catch return null;
// return @ptrCast(*c_void, result.ptr);
// } else {
// return @call(.{ .modifier = .never_inline }, malloc, .{new_size});
// }
// }
fn free(abi: Uint8Array.Abi) callconv(.C) void {
- alloc.dynamic.free(Uint8Array.toSlice(abi));
+ default_allocator.free(Uint8Array.toSlice(abi));
}
};
diff --git a/src/open.zig b/src/open.zig
index 7f0988491..f3fac5f96 100644
--- a/src/open.zig
+++ b/src/open.zig
@@ -1,6 +1,5 @@
usingnamespace @import("./global.zig");
const std = @import("std");
-const alloc = @import("./alloc.zig");
const opener = switch (std.Target.current.os.tag) {
.macos => "/usr/bin/open",
@@ -16,7 +15,7 @@ pub fn openURL(url: string) !void {
}
var args_buf = [_]string{ opener, url };
- var child_process = try std.ChildProcess.init(&args_buf, alloc.dynamic);
+ var child_process = try std.ChildProcess.init(&args_buf, default_allocator);
child_process.stderr_behavior = .Pipe;
child_process.stdin_behavior = .Ignore;
child_process.stdout_behavior = .Pipe;
@@ -24,4 +23,3 @@ pub fn openURL(url: string) !void {
_ = try child_process.wait();
return;
}
-
diff --git a/src/options.zig b/src/options.zig
index 33950cf4d..357bafedf 100644
--- a/src/options.zig
+++ b/src/options.zig
@@ -3,7 +3,7 @@
const std = @import("std");
const logger = @import("logger.zig");
const Fs = @import("fs.zig");
-const alloc = @import("alloc.zig");
+
const resolver = @import("./resolver/resolver.zig");
const api = @import("./api/schema.zig");
const Api = api.Api;
diff --git a/src/resolver/package_json.zig b/src/resolver/package_json.zig
index ad7f5490b..099035299 100644
--- a/src/resolver/package_json.zig
+++ b/src/resolver/package_json.zig
@@ -5,7 +5,7 @@ const options = @import("../options.zig");
const cache = @import("../cache.zig");
const logger = @import("../logger.zig");
const js_ast = @import("../js_ast.zig");
-const alloc = @import("../alloc.zig");
+
const fs = @import("../fs.zig");
const resolver = @import("./resolver.zig");
const js_lexer = @import("../js_lexer.zig");
@@ -445,7 +445,6 @@ pub const PackageJSON = struct {
dirname_fd: StoredFileDescriptorType,
comptime generate_hash: bool,
comptime include_scripts: bool,
-
) ?PackageJSON {
// TODO: remove this extra copy
diff --git a/src/resolver/resolve_path.zig b/src/resolver/resolve_path.zig
index 729a1edbf..587a8e9ed 100644
--- a/src/resolver/resolve_path.zig
+++ b/src/resolver/resolve_path.zig
@@ -1,6 +1,5 @@
const tester = @import("../test/tester.zig");
const std = @import("std");
-
const FeatureFlags = @import("../feature_flags.zig");
const default_allocator = @import("../memory_allocator.zig").c_allocator;
@@ -19,13 +18,15 @@ inline fn nqlAtIndex(comptime string_count: comptime_int, index: usize, strings:
return false;
}
+const IsSeparatorFunc = fn (char: u8) bool;
+
// TODO: is it faster to determine longest_common_separator in the while loop
// or as an extra step at the end?
// only boether to check if this function appears in benchmarking
-pub fn longestCommonPathGeneric(strings: []const []const u8, comptime separator: u8, comptime isPathSeparator: anytype) []const u8 {
+pub fn longestCommonPathGeneric(strings: []const []const u8, comptime separator: u8, comptime isPathSeparator: IsSeparatorFunc) []const u8 {
var min_length: usize = std.math.maxInt(usize);
for (strings) |str| {
- min_length = std.math.min(str.len, min_length);
+ min_length = @minimum(str.len, min_length);
}
var last_common_separator_is_at_end = false;
@@ -150,34 +151,6 @@ pub fn longestCommonPathGeneric(strings: []const []const u8, comptime separator:
return strings[0][0 .. last_common_separator + 1];
}
-const sep_posix_str = &([_]u8{std.fs.path.sep_posix});
-const node_modules_root = "node_modules" ++ std.fs.path.sep_str;
-
-pub const PackageRelativePath = struct { base_path: string, package_name: string };
-pub fn packageRelative(absolute_path: string) ?PackageRelativePath {
- if (std.Target.current.os.tag == .windows) {
- @compileError("Not implemented in windows");
- }
-
- const node_modules_index = std.mem.lastIndexOf(u8, absolute_path, node_modules_root) orelse return null;
- const current_path = absolute_path[node_modules_index + node_modules_root.len + 1 ..];
- return packageRelativeFromNodeModulesFolder(current_path);
-}
-
-pub fn packageRelativeFromNodeModulesFolder(current_path: string) ?PackageRelativePath {
- if (std.Target.current.os.tag == .windows) {
- @compileError("Not implemented in windows");
- }
-
- const package_name_end = std.mem.indexOfScalar(u8, current_path, std.fs.path.sep) orelse return null;
- const package_name = current_path[0..package_name_end];
-
- return PackageRelativePath{
- .base_path = current_path[package_name_end + 1 ..],
- .package_name = package_name,
- };
-}
-
pub fn longestCommonPath(strings: []const []const u8) []const u8 {
return longestCommonPathGeneric(strings, '/', isSepAny);
}
@@ -207,9 +180,9 @@ pub fn relativeToCommonPath(
const common_path = if (has_leading_separator) _common_path[1..] else _common_path;
- var shortest = std.math.min(normalized_from.len, normalized_to.len);
+ var shortest = @minimum(normalized_from.len, normalized_to.len);
- var last_common_separator = std.math.max(common_path.len, 1) - 1;
+ var last_common_separator = @maximum(common_path.len, 1) - 1;
if (shortest == common_path.len) {
if (normalized_to.len > normalized_from.len) {
@@ -303,7 +276,7 @@ pub fn relativeToCommonPath(
pub fn relativeNormalized(from: []const u8, to: []const u8, comptime platform: Platform, comptime always_copy: bool) []const u8 {
const two = [_][]const u8{ from, to };
- const common_path = longestCommonPathGeneric(&two, comptime platform.separator(), platform.isSeparator);
+ const common_path = longestCommonPathGeneric(&two, comptime platform.separator(), comptime platform.getSeparatorFunc());
return relativeToCommonPath(common_path, from, to, &relative_to_common_path_buf, comptime platform.separator(), always_copy);
}
@@ -344,7 +317,7 @@ pub fn relativePlatform(from: []const u8, to: []const u8, comptime platform: Pla
}
pub fn relativeAlloc(allocator: *std.mem.Allocator, from: []const u8, to: []const u8) ![]const u8 {
- if (FeatureFlags.use_std_path_relative) {
+ if (comptime FeatureFlags.use_std_path_relative) {
return try std.fs.path.relative(allocator, from, to);
} else {
const result = relativePlatform(from, to, Platform.current, false);
@@ -352,49 +325,6 @@ pub fn relativeAlloc(allocator: *std.mem.Allocator, from: []const u8, to: []cons
}
}
-test "relative" {
- var t = tester.Tester.t(default_allocator);
- defer t.report(@src());
-
- const strs = [_][]const u8{
- "/var/boo/foo/",
- "/var/boo/foo/baz/",
- "/var/boo/foo/beep/",
- "/var/boo/foo/beep/bleep",
- "/bar/baz",
- "/bar/not-related",
- "/bar/file.txt",
- };
- _ = t.expect("var/foo", try relativeAlloc(default_allocator, "/", "/var/foo/"), @src());
- _ = t.expect("index.js", try relativeAlloc(default_allocator, "/app/public/", "/app/public/index.js"), @src());
- _ = t.expect("..", try relativeAlloc(default_allocator, "/app/public/index.js", "/app/public/"), @src());
- _ = t.expect("../../src/bacon.ts", try relativeAlloc(default_allocator, "/app/public/index.html", "/app/src/bacon.ts"), @src());
-}
-
-test "longestCommonPath" {
- var t = tester.Tester.t(default_allocator);
- defer t.report(@src());
-
- const strs = [_][]const u8{
- "/var/boo/foo/",
- "/var/boo/foo/baz/",
- "/var/boo/foo/beep/",
- "/var/boo/foo/beep/bleep",
- "/bar/baz",
- "/bar/not-related",
- "/bar/file.txt",
- };
- _ = t.expect("/var/boo/foo/", longestCommonPath(strs[0..2]), @src());
- _ = t.expect("/var/boo/foo/", longestCommonPath(strs[0..4]), @src());
- _ = t.expect("/var/boo/foo/beep/", longestCommonPath(strs[2..3]), @src());
- _ = t.expect("/bar/", longestCommonPath(strs[5..strs.len]), @src());
- _ = t.expect("/", longestCommonPath(&strs), @src());
-
- const more = [_][]const u8{ "/app/public/index.html", "/app/public/index.js", "/app/public", "/app/src/bacon.ts" };
- _ = t.expect("/app/", longestCommonPath(&more), @src());
- _ = t.expect("/app/public/", longestCommonPath(more[0..2]), @src());
-}
-
// This function is based on Node.js' path.normalize function.
// https://github.com/nodejs/node/blob/36bb31be5f0b85a0f6cbcb36b64feb3a12c60984/lib/path.js#L66
pub fn normalizeStringGeneric(str: []const u8, buf: []u8, comptime allow_above_root: bool, comptime separator: u8, comptime isPathSeparator: anytype, lastIndexOfSeparator: anytype, comptime preserve_trailing_slash: bool) []u8 {
@@ -500,14 +430,28 @@ pub const Platform = enum {
};
}
- pub const current = switch (std.Target.current.os.tag) {
- .windows => .windows,
- else => .posix,
+ pub const current: Platform = switch (std.Target.current.os.tag) {
+ .windows => Platform.windows,
+ else => Platform.posix,
};
- pub fn isSeparator(comptime _platform: Platform, char: u8) bool {
- const platform = _platform.resolve();
- switch (platform) {
+ pub fn getSeparatorFunc(comptime _platform: Platform) IsSeparatorFunc {
+ switch (comptime _platform.resolve()) {
+ .auto => unreachable,
+ .loose => {
+ return isSepAny;
+ },
+ .windows => {
+ return isSepWin32;
+ },
+ .posix => {
+ return isSepPosix;
+ },
+ }
+ }
+
+ pub inline fn isSeparator(comptime _platform: Platform, char: u8) bool {
+ switch (comptime _platform.resolve()) {
.auto => unreachable,
.loose => {
return isSepAny(char);
@@ -522,7 +466,7 @@ pub const Platform = enum {
}
pub fn leadingSeparatorIndex(comptime _platform: Platform, path: anytype) ?usize {
- switch (_platform.resolve()) {
+ switch (comptime _platform.resolve()) {
.windows => {
if (path.len < 1)
return null;
@@ -561,20 +505,14 @@ pub const Platform = enum {
}
pub fn resolve(comptime _platform: Platform) Platform {
- if (_platform == .auto) {
- switch (std.Target.current.os.tag) {
- .windows => {
- return .windows;
- },
-
- .freestanding, .emscripten, .other => {
- return .loose;
- },
-
- else => {
- return .posix;
- },
- }
+ if (comptime _platform == .auto) {
+ return switch (std.Target.current.os.tag) {
+ .windows => Platform.windows,
+
+ .freestanding, .emscripten, .other => Platform.loose,
+
+ else => Platform.posix,
+ };
}
return _platform;
@@ -586,7 +524,7 @@ pub fn normalizeString(str: []const u8, comptime allow_above_root: bool, comptim
}
pub fn normalizeStringBuf(str: []const u8, buf: []u8, comptime allow_above_root: bool, comptime _platform: Platform, comptime preserve_trailing_slash: anytype) []u8 {
- const platform = _platform.resolve();
+ const platform = comptime _platform.resolve();
switch (platform) {
.auto => unreachable,
@@ -1089,3 +1027,50 @@ test "normalizeStringWindows" {
_ = t.expect("..", try normalizeStringAlloc(default_allocator, "..\\boom\\..\\", true, .windows), @src());
_ = t.expect("", try normalizeStringAlloc(default_allocator, ".\\", true, .windows), @src());
}
+
+test "relative" {
+ var t = tester.Tester.t(default_allocator);
+ defer t.report(@src());
+
+ const strs = [_][]const u8{
+ "/var/boo/foo/",
+ "/var/boo/foo/baz/",
+ "/var/boo/foo/beep/",
+ "/var/boo/foo/beep/bleep",
+ "/bar/baz",
+ "/bar/not-related",
+ "/bar/file.txt",
+ };
+ _ = t.expect("var/foo", try relativeAlloc(default_allocator, "/", "/var/foo/"), @src());
+ _ = t.expect("index.js", try relativeAlloc(default_allocator, "/app/public/", "/app/public/index.js"), @src());
+ _ = t.expect("..", try relativeAlloc(default_allocator, "/app/public/index.js", "/app/public/"), @src());
+ _ = t.expect("../../src/bacon.ts", try relativeAlloc(default_allocator, "/app/public/index.html", "/app/src/bacon.ts"), @src());
+}
+
+test "longestCommonPath" {
+ var t = tester.Tester.t(default_allocator);
+ defer t.report(@src());
+
+ const strs = [_][]const u8{
+ "/var/boo/foo/",
+ "/var/boo/foo/baz/",
+ "/var/boo/foo/beep/",
+ "/var/boo/foo/beep/bleep",
+ "/bar/baz",
+ "/bar/not-related",
+ "/bar/file.txt",
+ };
+ _ = t.expect("/var/boo/foo/", longestCommonPath(strs[0..2]), @src());
+ _ = t.expect("/var/boo/foo/", longestCommonPath(strs[0..4]), @src());
+ _ = t.expect("/var/boo/foo/beep/", longestCommonPath(strs[2..3]), @src());
+ _ = t.expect("/bar/", longestCommonPath(strs[5..strs.len]), @src());
+ _ = t.expect("/", longestCommonPath(&strs), @src());
+
+ const more = [_][]const u8{ "/app/public/index.html", "/app/public/index.js", "/app/public", "/app/src/bacon.ts" };
+ _ = t.expect("/app/", longestCommonPath(&more), @src());
+ _ = t.expect("/app/public/", longestCommonPath(more[0..2]), @src());
+}
+
+test "" {
+ @import("std").testing.refAllDecls(@This());
+}
diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig
index 3d7404a17..34dc09088 100644
--- a/src/resolver/resolver.zig
+++ b/src/resolver/resolver.zig
@@ -1359,7 +1359,7 @@ pub const Resolver = struct {
null,
);
// The file name needs to be persistent because it can have errors
- // and if those errors need to print the filename
+ // and if those errors need to print the filename
// then it will be undefined memory if we parse another tsconfig.json late
const key_path = try Path.init(file).dupeAlloc(r.allocator);
@@ -2715,18 +2715,6 @@ pub const Dirname = struct {
}
};
-test "murmur" {
- var str = try std.heap.c_allocator.alloc(u8, "swiper@6.8.2swiper.cjs.js".len);
- var str2 = try std.heap.c_allocator.alloc(u8, "swiper@6.8.2swiper.cjs.js".len);
- std.mem.copy(u8, str, "swiper@6.8.2swiper.cjs.js");
- std.mem.copy(u8, str2, "swiper@6.8.2swiper.cjs.js");
-
- try std.testing.expectEqual(
- std.hash.murmur.Murmur3_32.hash(str),
- std.hash.murmur.Murmur3_32.hash(str2),
- );
-}
-
pub const RootPathPair = struct {
base_path: string,
package_json: *const PackageJSON,
diff --git a/src/resolver/tsconfig_json.zig b/src/resolver/tsconfig_json.zig
index 2d936dcf8..ac132c326 100644
--- a/src/resolver/tsconfig_json.zig
+++ b/src/resolver/tsconfig_json.zig
@@ -5,7 +5,6 @@ const logger = @import("../logger.zig");
const cache = @import("../cache.zig");
const js_ast = @import("../js_ast.zig");
const js_lexer = @import("../js_lexer.zig");
-const alloc = @import("../alloc.zig");
// Heuristic: you probably don't have 100 of these
// Probably like 5-10
@@ -370,7 +369,3 @@ pub const TSConfigJSON = struct {
return false;
}
};
-
-test "tsconfig.json" {
- try alloc.setup(default_allocator);
-}
diff --git a/src/router.zig b/src/router.zig
index 36b3fe192..ac7587851 100644
--- a/src/router.zig
+++ b/src/router.zig
@@ -958,11 +958,12 @@ pub const Test = struct {
}
pub fn make(comptime testName: string, data: anytype) !Router {
+ std.testing.refAllDecls(@import("./javascript/jsc/bindings/exports.zig"));
try makeTest(testName, data);
const JSAst = @import("./js_ast.zig");
JSAst.Expr.Data.Store.create(default_allocator);
JSAst.Stmt.Data.Store.create(default_allocator);
- var fs = try FileSystem.init1(default_allocator, null);
+ var fs = try FileSystem.init1WithForce(default_allocator, null, true);
var top_level_dir = fs.top_level_dir;
var pages_parts = [_]string{ top_level_dir, "pages" };
@@ -1014,331 +1015,6 @@ pub const Test = struct {
}
};
-test "Github API Route Loader" {
- var server = MockServer{};
- var ctx = MockRequestContextType{
- .url = try URLPath.parse("/hi"),
- };
- const fixtures = @import("./test/fixtures.zig");
- var router = try Test.make("routes-github-api", fixtures.github_api_routes_list);
-
- var parameters = Param.List{};
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/organizations") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(!route.hasParams());
- try expectEqualStrings(route.name, "/organizations");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/app/installations/") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(!route.hasParams());
- try expectEqualStrings(route.name, "/app/installations");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/app/installations/123") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try expectEqualStrings(route.name, "/app/installations/[installation_id]");
- try expectEqualStrings(route.params.get(0).name, "installation_id");
- try expectEqualStrings(route.params.get(0).value, "123");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/codes_of_conduct/") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(!route.hasParams());
- try expectEqualStrings(route.name, "/codes_of_conduct");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/codes_of_conduct/123") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try expectEqualStrings(route.name, "/codes_of_conduct/[key]");
- try expectEqualStrings(route.params.get(0).name, "key");
- try expectEqualStrings(route.params.get(0).value, "123");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/codes_of_conduct/123/") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try expectEqualStrings(route.name, "/codes_of_conduct/[key]");
- try expectEqualStrings(route.params.get(0).name, "key");
- try expectEqualStrings(route.params.get(0).value, "123");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/orgs/123/index") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try expectEqualStrings(route.name, "/orgs/[org]");
- try expectEqualStrings(route.params.get(0).name, "org");
- try expectEqualStrings(route.params.get(0).value, "123");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/orgs/123/actions/permissions") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try expectEqualStrings(route.name, "/orgs/[org]/actions/permissions");
- try expectEqualStrings(route.params.get(0).name, "org");
- try expectEqualStrings(route.params.get(0).value, "123");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/orgs/orgg/teams/teamm/discussions/123/comments/999/reactions") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try expectEqualStrings(route.name, "/orgs/[org]/teams/[team_slug]/discussions/[discussion_number]/comments/[comment_number]/reactions");
- try expectEqualStrings(route.params.get(0).name, "org");
- try expectEqualStrings(route.params.get(0).value, "orgg");
-
- try expectEqualStrings(route.params.get(1).name, "team_slug");
- try expectEqualStrings(route.params.get(1).value, "teamm");
-
- try expectEqualStrings(route.params.get(2).name, "discussion_number");
- try expectEqualStrings(route.params.get(2).value, "123");
-
- try expectEqualStrings(route.params.get(3).name, "comment_number");
- try expectEqualStrings(route.params.get(3).value, "999");
- }
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/repositories/123/environments/production/not-real") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try expectEqualStrings(route.name, "/repositories/[repository_id]/[...jarred-fake-catch-all]");
- try expectEqualStrings(route.params.get(0).name, "repository_id");
- try expectEqualStrings(route.params.get(0).value, "123");
-
- try expectEqualStrings(route.params.get(1).name, "jarred-fake-catch-all");
- try expectEqualStrings(route.params.get(1).value, "environments/production/not-real");
-
- try expectEqual(route.params.len, 2);
- }
-}
-
-test "Sample Route Loader" {
- var server = MockServer{};
- var ctx = MockRequestContextType{
- .url = try URLPath.parse("/hi"),
- };
- const fixtures = @import("./test/fixtures.zig");
- var router = try Test.make("routes-sample", fixtures.sample_route_list);
-
- var parameters = Param.List{};
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/foo") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(!route.hasParams());
- try expectEqualStrings(route.name, "/Foo");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/Foo") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(!route.hasParams());
- try expectEqualStrings(route.name, "/Foo");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(!route.hasParams());
- try expectEqualStrings(route.name, "/");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/index") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(!route.hasParams());
- try expectEqualStrings(route.name, "/");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/file") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(route.hasParams());
- try expectEqualStrings(route.name, "/[TitleCaseParam]/file");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(route.hasParams());
- try expectEqualStrings(route.name, "/[TitleCaseParam]");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/snow") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(route.hasParams());
- try expectEqualStrings(route.name, "/[TitleCaseParam]/[snake_case_param]");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/snow/file") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(route.hasParams());
- try expectEqualStrings(route.name, "/[TitleCaseParam]/[snake_case_param]/file");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/snow/bacon") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(route.hasParams());
- try expectEqualStrings(route.name, "/[TitleCaseParam]/[snake_case_param]/bacon");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/snow/bacon/index") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(route.hasParams());
- try expectEqualStrings(route.name, "/[TitleCaseParam]/[snake_case_param]/bacon");
- try expectEqualStrings(route.params.get(0).name, "TitleCaseParam");
- try expectEqualStrings(route.params.get(0).value, "Bacon");
-
- try expectEqualStrings(route.params.get(1).name, "snake_case_param");
- try expectEqualStrings(route.params.get(1).value, "snow");
- }
-
- {
- ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/snow/bacon/catch-all-should-happen") };
- try router.match(*MockServer, &server, MockRequestContextType, &ctx);
- var route = ctx.matched_route.?;
- try std.testing.expect(route.hasParams());
- try expectEqualStrings(route.name, "/[...catch-all-at-root]");
- try expectEqualStrings(route.params.get(0).name, "catch-all-at-root");
- try expectEqualStrings(route.params.get(0).value, "Bacon/snow/bacon/catch-all-should-happen");
- }
-}
-
-test "Routes basic" {
- var server = MockServer{};
- var ctx = MockRequestContextType{
- .url = try URLPath.parse("/hi"),
- };
-
- var router = try Test.make("routes-basic", .{
- .@"pages/hi.js" = "//hi",
- .@"pages/index.js" = "//index",
- .@"pages/blog/hi.js" = "//blog/hi",
- });
- try router.match(*MockServer, &server, &server, MockRequestContextType, &ctx);
- try expectEqualStrings(ctx.matched_route.?.name, "/hi");
-
- ctx = MockRequestContextType{
- .url = try URLPath.parse("/"),
- };
-
- try router.match(*MockServer, &server, &server, MockRequestContextType, &ctx);
- try expectEqualStrings(ctx.matched_route.?.name, "/");
-
- ctx = MockRequestContextType{
- .url = try URLPath.parse("/blog/hi"),
- };
-
- try router.match(*MockServer, &server, &server, MockRequestContextType, &ctx);
- try expectEqualStrings(ctx.matched_route.?.name, "/blog/hi");
-
- ctx = MockRequestContextType{
- .url = try URLPath.parse("/blog/hey"),
- };
-
- try router.match(*MockServer, &server, &server, MockRequestContextType, &ctx);
- try expect(ctx.matched_route == null);
-
- ctx = MockRequestContextType{
- .url = try URLPath.parse("/blog/"),
- };
-
- try router.match(*MockServer, &server, &server, MockRequestContextType, &ctx);
- try expect(ctx.matched_route == null);
-
- ctx = MockRequestContextType{
- .url = try URLPath.parse("/pages/hi"),
- };
-
- try router.match(*MockServer, &server, &server, MockRequestContextType, &ctx);
- try expect(ctx.matched_route == null);
-}
-
-test "Dynamic routes" {
- var server = MockServer{};
- var ctx = MockRequestContextType{
- .url = try URLPath.parse("/blog/hi"),
- };
- var filepath_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
- var router = try Test.make("routes-dynamic", .{
- .@"pages/index.js" = "//index.js",
- .@"pages/blog/hi.js" = "//blog-hi",
- .@"pages/posts/[id].js" = "//hi",
- // .@"pages/blog/posts/bacon.js" = "//index",
- });
-
- try router.match(*MockServer, &server, &server, MockRequestContextType, &ctx);
- try expectEqualStrings(ctx.matched_route.?.name, "blog/hi");
-
- var params = ctx.matched_route.?.paramsIterator();
- try expect(params.next() == null);
-
- ctx.matched_route = null;
-
- ctx.url = try URLPath.parse("/posts/123");
- try router.match(*MockServer, &server, &server, MockRequestContextType, &ctx);
-
- params = ctx.matched_route.?.paramsIterator();
-
- try expectEqualStrings(ctx.matched_route.?.name, "posts/[id]");
- try expectEqualStrings(params.next().?.rawValue(ctx.matched_route.?.pathname), "123");
-
- // ctx = MockRequestContextType{
- // .url = try URLPath.parse("/"),
- // };
-
- // try router.match(*MockServer, &server, &server, MockRequestContextType, &ctx);
- // try expectEqualStrings(ctx.matched_route.name, "index");
-}
-
-test "Pattern" {
- const pattern = "[dynamic]/static/[dynamic2]/static2/[...catch_all]";
-
- const dynamic = try Pattern.init(pattern, 0);
- try expectStr(@tagName(dynamic.value), "dynamic");
- const static = try Pattern.init(pattern, dynamic.len);
- try expectStr(@tagName(static.value), "static");
- const dynamic2 = try Pattern.init(pattern, static.len);
- try expectStr(@tagName(dynamic2.value), "dynamic");
- const static2 = try Pattern.init(pattern, dynamic2.len);
- try expectStr(@tagName(static2.value), "static");
- const catch_all = try Pattern.init(pattern, static2.len);
- try expectStr(@tagName(catch_all.value), "catch_all");
-
- try expectStr(dynamic.value.dynamic.str(pattern), "dynamic");
- try expectStr(static.value.static.str(), "static");
- try expectStr(dynamic2.value.dynamic.str(pattern), "dynamic2");
- try expectStr(static2.value.static.str(), "static2");
- try expectStr(catch_all.value.catch_all.str(pattern), "catch_all");
-}
-
const Pattern = struct {
value: Value,
len: RoutePathInt = 0,
@@ -1851,3 +1527,328 @@ test "Pattern Match" {
if (TestList.run(regular_list) > 0) try expect(false);
if (TestList.run(optional_catch_all) > 0) try expect(false);
}
+
+test "Github API Route Loader" {
+ var server = MockServer{};
+ var ctx = MockRequestContextType{
+ .url = try URLPath.parse("/hi"),
+ };
+ const fixtures = @import("./test/fixtures.zig");
+ var router = try Test.make("routes-github-api", fixtures.github_api_routes_list);
+
+ var parameters = Param.List{};
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/organizations") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(!route.hasParams());
+ try expectEqualStrings(route.name, "/organizations");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/app/installations/") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(!route.hasParams());
+ try expectEqualStrings(route.name, "/app/installations");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/app/installations/123") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try expectEqualStrings(route.name, "/app/installations/[installation_id]");
+ try expectEqualStrings(route.params.get(0).name, "installation_id");
+ try expectEqualStrings(route.params.get(0).value, "123");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/codes_of_conduct/") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(!route.hasParams());
+ try expectEqualStrings(route.name, "/codes_of_conduct");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/codes_of_conduct/123") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try expectEqualStrings(route.name, "/codes_of_conduct/[key]");
+ try expectEqualStrings(route.params.get(0).name, "key");
+ try expectEqualStrings(route.params.get(0).value, "123");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/codes_of_conduct/123/") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try expectEqualStrings(route.name, "/codes_of_conduct/[key]");
+ try expectEqualStrings(route.params.get(0).name, "key");
+ try expectEqualStrings(route.params.get(0).value, "123");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/orgs/123/index") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try expectEqualStrings(route.name, "/orgs/[org]");
+ try expectEqualStrings(route.params.get(0).name, "org");
+ try expectEqualStrings(route.params.get(0).value, "123");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/orgs/123/actions/permissions") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try expectEqualStrings(route.name, "/orgs/[org]/actions/permissions");
+ try expectEqualStrings(route.params.get(0).name, "org");
+ try expectEqualStrings(route.params.get(0).value, "123");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/orgs/orgg/teams/teamm/discussions/123/comments/999/reactions") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try expectEqualStrings(route.name, "/orgs/[org]/teams/[team_slug]/discussions/[discussion_number]/comments/[comment_number]/reactions");
+ try expectEqualStrings(route.params.get(0).name, "org");
+ try expectEqualStrings(route.params.get(0).value, "orgg");
+
+ try expectEqualStrings(route.params.get(1).name, "team_slug");
+ try expectEqualStrings(route.params.get(1).value, "teamm");
+
+ try expectEqualStrings(route.params.get(2).name, "discussion_number");
+ try expectEqualStrings(route.params.get(2).value, "123");
+
+ try expectEqualStrings(route.params.get(3).name, "comment_number");
+ try expectEqualStrings(route.params.get(3).value, "999");
+ }
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/repositories/123/environments/production/not-real") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try expectEqualStrings(route.name, "/repositories/[repository_id]/[...jarred-fake-catch-all]");
+ try expectEqualStrings(route.params.get(0).name, "repository_id");
+ try expectEqualStrings(route.params.get(0).value, "123");
+
+ try expectEqualStrings(route.params.get(1).name, "jarred-fake-catch-all");
+ try expectEqualStrings(route.params.get(1).value, "environments/production/not-real");
+
+ try expectEqual(route.params.len, 2);
+ }
+}
+
+test "Sample Route Loader" {
+ var server = MockServer{};
+ var ctx = MockRequestContextType{
+ .url = try URLPath.parse("/hi"),
+ };
+ const fixtures = @import("./test/fixtures.zig");
+ var router = try Test.make("routes-sample", fixtures.sample_route_list);
+
+ var parameters = Param.List{};
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/foo") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(!route.hasParams());
+ try expectEqualStrings(route.name, "/Foo");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/Foo") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(!route.hasParams());
+ try expectEqualStrings(route.name, "/Foo");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(!route.hasParams());
+ try expectEqualStrings(route.name, "/");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/index") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(!route.hasParams());
+ try expectEqualStrings(route.name, "/");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/file") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(route.hasParams());
+ try expectEqualStrings(route.name, "/[TitleCaseParam]/file");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(route.hasParams());
+ try expectEqualStrings(route.name, "/[TitleCaseParam]");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/snow") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(route.hasParams());
+ try expectEqualStrings(route.name, "/[TitleCaseParam]/[snake_case_param]");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/snow/file") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(route.hasParams());
+ try expectEqualStrings(route.name, "/[TitleCaseParam]/[snake_case_param]/file");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/snow/bacon") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(route.hasParams());
+ try expectEqualStrings(route.name, "/[TitleCaseParam]/[snake_case_param]/bacon");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/snow/bacon/index") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(route.hasParams());
+ try expectEqualStrings(route.name, "/[TitleCaseParam]/[snake_case_param]/bacon");
+ try expectEqualStrings(route.params.get(0).name, "TitleCaseParam");
+ try expectEqualStrings(route.params.get(0).value, "Bacon");
+
+ try expectEqualStrings(route.params.get(1).name, "snake_case_param");
+ try expectEqualStrings(route.params.get(1).value, "snow");
+ }
+
+ {
+ ctx = MockRequestContextType{ .url = try URLPath.parse("/Bacon/snow/bacon/catch-all-should-happen") };
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ var route = ctx.matched_route.?;
+ try std.testing.expect(route.hasParams());
+ try expectEqualStrings(route.name, "/[...catch-all-at-root]");
+ try expectEqualStrings(route.params.get(0).name, "catch-all-at-root");
+ try expectEqualStrings(route.params.get(0).value, "Bacon/snow/bacon/catch-all-should-happen");
+ }
+}
+
+test "Routes basic" {
+ var server = MockServer{};
+ var ctx = MockRequestContextType{
+ .url = try URLPath.parse("/hi"),
+ };
+
+ var router = try Test.make("routes-basic", .{
+ .@"pages/hi.js" = "//hi",
+ .@"pages/index.js" = "//index",
+ .@"pages/blog/hi.js" = "//blog/hi",
+ });
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ try expectEqualStrings(ctx.matched_route.?.name, "/hi");
+
+ ctx = MockRequestContextType{
+ .url = try URLPath.parse("/"),
+ };
+
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ try expectEqualStrings(ctx.matched_route.?.name, "/");
+
+ ctx = MockRequestContextType{
+ .url = try URLPath.parse("/blog/hi"),
+ };
+
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ try expectEqualStrings(ctx.matched_route.?.name, "/blog/hi");
+
+ ctx = MockRequestContextType{
+ .url = try URLPath.parse("/blog/hey"),
+ };
+
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ try expect(ctx.matched_route == null);
+
+ ctx = MockRequestContextType{
+ .url = try URLPath.parse("/blog/"),
+ };
+
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ try expect(ctx.matched_route == null);
+
+ ctx = MockRequestContextType{
+ .url = try URLPath.parse("/pages/hi"),
+ };
+
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ try expect(ctx.matched_route == null);
+}
+
+test "Dynamic routes" {
+ var server = MockServer{};
+ var ctx = MockRequestContextType{
+ .url = try URLPath.parse("/blog/hi"),
+ };
+ var filepath_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
+ var router = try Test.make("routes-dynamic", .{
+ .@"pages/index.js" = "//index.js",
+ .@"pages/blog/hi.js" = "//blog-hi",
+ .@"pages/posts/[id].js" = "//hi",
+ // .@"pages/blog/posts/bacon.js" = "//index",
+ });
+
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+ try expectEqualStrings(ctx.matched_route.?.name, "/blog/hi");
+
+ var params = ctx.matched_route.?.paramsIterator();
+ try expect(params.next() == null);
+
+ ctx.matched_route = null;
+
+ ctx.url = try URLPath.parse("/posts/123");
+ try router.match(*MockServer, &server, MockRequestContextType, &ctx);
+
+ params = ctx.matched_route.?.paramsIterator();
+
+ try expectEqualStrings(ctx.matched_route.?.name, "/posts/[id]");
+ try expectEqualStrings(params.next().?.rawValue(ctx.matched_route.?.pathname), "123");
+
+ // ctx = MockRequestContextType{
+ // .url = try URLPath.parse("/"),
+ // };
+
+ // try router.match(*MockServer, &server, &server, MockRequestContextType, &ctx);
+ // try expectEqualStrings(ctx.matched_route.name, "index");
+}
+
+test "Pattern" {
+ const pattern = "[dynamic]/static/[dynamic2]/static2/[...catch_all]";
+
+ const dynamic = try Pattern.init(pattern, 0);
+ try expectStr(@tagName(dynamic.value), "dynamic");
+ const static = try Pattern.init(pattern, dynamic.len);
+ try expectStr(@tagName(static.value), "static");
+ const dynamic2 = try Pattern.init(pattern, static.len);
+ try expectStr(@tagName(dynamic2.value), "dynamic");
+ const static2 = try Pattern.init(pattern, dynamic2.len);
+ try expectStr(@tagName(static2.value), "static");
+ const catch_all = try Pattern.init(pattern, static2.len);
+ try expectStr(@tagName(catch_all.value), "catch_all");
+
+ try expectStr(dynamic.value.dynamic.str(pattern), "dynamic");
+ try expectStr(static.value.static.str(), "static");
+ try expectStr(dynamic2.value.dynamic.str(pattern), "dynamic2");
+ try expectStr(static2.value.static.str(), "static2");
+ try expectStr(catch_all.value.catch_all.str(pattern), "catch_all");
+}
diff --git a/src/test/fixtures/tsconfig.json b/src/test/fixtures/tsconfig.json
index b3105de67..04a8d8eb9 100644
--- a/src/test/fixtures/tsconfig.json
+++ b/src/test/fixtures/tsconfig.json
@@ -4,6 +4,6 @@
"paths": {
"components/*": ["components/*"]
},
- "jsx": "preserve"
+ "jsx": "preserve",
}
}
diff --git a/src/watcher.zig b/src/watcher.zig
index f8de190bd..1622be25a 100644
--- a/src/watcher.zig
+++ b/src/watcher.zig
@@ -736,3 +736,5 @@ pub fn NewWatcher(comptime ContextType: type) type {
}
};
}
+
+