From d49f771f7fc8484156cd8e884d70fa2d47331972 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Wed, 28 Oct 2026 12:20:23 +0100 Subject: [PATCH 01/10] feat: add a portable native C interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Native embedders need independent parses over exact UTF-16 buffers without a WebAssembly runtime. Results retain their own metadata and decoded strings, with explicit source lifetimes and per-call failures. The native and Wasm builds share the scanner. Wasm keeps its slice interface and JavaScript decoder: the artifact shrinks from 28,959 to 28,832 bytes, and bundle parsing improves by 3.6–7.3% in warmed CPU measurements on Node.js 22. --- .github/workflows/native.yml | 41 + .gitignore | 1 + CMakeLists.txt | 49 + Makefile | 4 +- README.md | 53 + build/Makefile | 11 +- build/wasm.js | 2 +- include-wasm/cjs-module-lexer.h | 262 - include/cjs-module-lexer.h | 53 + lexer.js | 24 +- lib/lexer.wasm | Bin 28959 -> 28832 bytes lib/lexer.wat | 15978 +++++++++++++------------- package.json | 1 + src/lexer-internal.h | 177 + src/lexer.c | 1971 ++-- src/lexer.js | 10 +- src/native.c | 276 + src/wasm.c | 93 + test/_unit.js | 15 + test/extended.js | 4 + test/integration.js | 4 + test/native/consumer/CMakeLists.txt | 10 + test/native/consumer/main.c | 12 + test/native/consumer/main.cc | 1 + test/native/failures.c | 63 + test/native/fuzz.c | 25 + test/native/parse.c | 50 + test/native/parser.js | 26 + test/native/test.c | 108 + test/native/threads.cc | 42 + test/wasm-memory.js | 6 +- 31 files changed, 10169 insertions(+), 9203 deletions(-) create mode 100644 .github/workflows/native.yml create mode 100644 CMakeLists.txt delete mode 100755 include-wasm/cjs-module-lexer.h create mode 100644 include/cjs-module-lexer.h create mode 100644 src/lexer-internal.h create mode 100644 src/native.c create mode 100644 src/wasm.c create mode 100644 test/native/consumer/CMakeLists.txt create mode 100644 test/native/consumer/main.c create mode 100644 test/native/consumer/main.cc create mode 100644 test/native/failures.c create mode 100644 test/native/fuzz.c create mode 100644 test/native/parse.c create mode 100644 test/native/parser.js create mode 100644 test/native/test.c create mode 100644 test/native/threads.cc diff --git a/.github/workflows/native.yml b/.github/workflows/native.yml new file mode 100644 index 0000000..723ea60 --- /dev/null +++ b/.github/workflows/native.yml @@ -0,0 +1,41 @@ +name: Native + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + native: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 + with: + node-version: 18.x + - run: cmake -S . -B build/native -DCMAKE_BUILD_TYPE=Debug + - run: cmake --build build/native --config Debug --parallel + - run: ctest --test-dir build/native -C Debug --output-on-failure + - run: cmake --install build/native --config Debug --prefix "${{ github.workspace }}/build/native-install" + - run: cmake -S test/native/consumer -B build/native-consumer -DCMAKE_PREFIX_PATH="${{ github.workspace }}/build/native-install" + - run: cmake --build build/native-consumer --config Debug --parallel + - run: ctest --test-dir build/native-consumer -C Debug --output-on-failure + - run: npm ci + - run: npm run build + - run: npm run test-native + sanitizers: + runs-on: ubuntu-latest + strategy: + matrix: + sanitizer: ['address,undefined', thread] + steps: + - uses: actions/checkout@v7 + - run: cmake -S . -B build/native -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS="-fsanitize=${{ matrix.sanitizer }} -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=${{ matrix.sanitizer }} -fno-omit-frame-pointer" + - run: cmake --build build/native --parallel + - run: ctest --test-dir build/native --output-on-failure + - if: matrix.sanitizer == 'address,undefined' + run: clang -std=c11 -g -Iinclude -fsanitize=fuzzer,address,undefined src/lexer.c src/native.c test/native/fuzz.c -o build/native/fuzz && build/native/fuzz -runs=100000 diff --git a/.gitignore b/.gitignore index 0088252..99ad089 100755 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules dist yarn.lock build/toolchain +build/native* diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..24f93ff --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required(VERSION 3.15) +project(cjs_module_lexer VERSION 2.3.0 LANGUAGES C) + +add_library(cjs_module_lexer STATIC src/lexer.c src/native.c) +add_library(cjs_module_lexer::cjs_module_lexer ALIAS cjs_module_lexer) +target_compile_features(cjs_module_lexer PUBLIC c_std_11) +target_include_directories(cjs_module_lexer PUBLIC + $ + $) +if(MSVC) + target_compile_options(cjs_module_lexer PRIVATE /W4) +else() + target_compile_options(cjs_module_lexer PRIVATE -Wall -Wextra -Wno-parentheses) +endif() + +include(GNUInstallDirs) +install(TARGETS cjs_module_lexer EXPORT cjs_module_lexer_targets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES include/cjs-module-lexer.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(EXPORT cjs_module_lexer_targets FILE cjs_module_lexer-config.cmake + NAMESPACE cjs_module_lexer:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cjs_module_lexer) + +include(CTest) +if(BUILD_TESTING) + enable_language(CXX) + find_package(Threads REQUIRED) + add_executable(native_test test/native/test.c) + target_link_libraries(native_test PRIVATE cjs_module_lexer) + add_test(NAME native COMMAND native_test) + add_executable(native_parse test/native/parse.c) + target_link_libraries(native_parse PRIVATE cjs_module_lexer) + add_executable(native_threads test/native/threads.cc) + target_compile_features(native_threads PRIVATE cxx_std_11) + target_link_libraries(native_threads PRIVATE cjs_module_lexer Threads::Threads) + add_test(NAME native_threads COMMAND native_threads) + add_library(native_failure OBJECT src/lexer.c src/native.c) + target_include_directories(native_failure PRIVATE include) + target_compile_features(native_failure PRIVATE c_std_11) + target_compile_definitions(native_failure PRIVATE malloc=cjs_test_malloc realloc=cjs_test_realloc free=cjs_test_free) + add_executable(native_failures test/native/failures.c $) + target_include_directories(native_failures PRIVATE include) + add_test(NAME native_failures COMMAND native_failures) + foreach(target native_test native_threads native_failures) + if(MSVC) + target_compile_options(${target} PRIVATE /UNDEBUG) + else() + target_compile_options(${target} PRIVATE -UNDEBUG) + endif() + endforeach() +endif() diff --git a/Makefile b/Makefile index bf45b62..1a16121 100755 --- a/Makefile +++ b/Makefile @@ -6,14 +6,14 @@ WASM_OPT ?= ../binaryen/bin/wasm-opt lib/lexer.wat: lib/lexer.wasm $(WASM2WAT) lib/lexer.wasm -o lib/lexer.wat -lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c | lib/ +lib/lexer.wasm: include/cjs-module-lexer.h src/lexer-internal.h src/lexer.c src/wasm.c | lib/ node build/wasm.js --docker lib/: @mkdir -p $@ optimize: lib/lexer.wasm - $(WASM_OPT) -Oz --enable-bulk-memory --strip-debug lib/lexer.wasm -o lib/lexer.wasm + $(WASM_OPT) -Oz --strip-debug lib/lexer.wasm -o lib/lexer.wasm clean: $(RM) lib/* diff --git a/README.md b/README.md index 7e6f695..836bfdd 100755 --- a/README.md +++ b/README.md @@ -494,6 +494,59 @@ test/samples/*.js (3635 KiB) > 27.76ms ``` +## Native embedding + +The source distribution provides a C11 static library with no dependencies beyond the C library. +JavaScript installation does not require a native compiler. + +```sh +cmake -S . -B build/native -DBUILD_TESTING=OFF +cmake --build build/native --parallel +cmake --install build/native --prefix /your/prefix +``` + +CMake consumers can use `find_package(cjs_module_lexer CONFIG REQUIRED)` and link +`cjs_module_lexer::cjs_module_lexer`. Other builds can compile `src/lexer.c` and `src/native.c` with `include/` +on the header search path. The interface does not promise a cross-version shared-library ABI. + +```c +#include + +/* UTF-16 code units, without a terminator. */ +const uint16_t source[] = {'e', 'x', 'p', 'o', 'r', 't', 's', '.', 'a', '=', '1'}; +cjs_lexer_result* result; +cjs_lexer_error error; +uint32_t status = cjs_lexer_parse_utf16(source, sizeof(source) / sizeof(source[0]), 0, &result, &error); +if (status == CJS_LEXER_OK) { + for (size_t index = 0; index < cjs_lexer_export_count(result); index++) { + cjs_lexer_string16 name = cjs_lexer_export(result, index); + /* Consume name.data[0..name.length). */ + } + cjs_lexer_result_free(result); +} +``` + +Lengths and error offsets count UTF-16 code units. Null source is valid with zero length. +The flags `CJS_LEXER_ALLOW_MINIFIED_ENUMERABLE` and `CJS_LEXER_EXTENDED` select the corresponding JavaScript options. +The default remains conservative detection. The lexer does not validate JavaScript syntax. + +Each call creates private scanner state. Calls can run concurrently, and independently owned results can coexist. +The result owns metadata and decoded strings. Names that need no decoding borrow the source. +Keep the source unchanged and alive until `cjs_lexer_result_free(result)`. +Read-only result access can run concurrently, with release synchronized by the caller. +Indexed access requires an index below the corresponding count. `cjs_lexer_result_free(NULL)` is valid. + +The C interface returns decoded candidates after getter filtering and reexport replacement. +Candidates retain source order and can contain duplicates. JavaScript wrappers retain their unique arrays. +String rejection, getter filtering, and detection modes match the Wasm package. + +The status distinguishes invalid arguments, lexical failure, limits, and allocation failure. +Every failure sets the result to null and initializes the optional error output. +`error.has_offset` identifies an available source location, and `error.code` identifies the scanner error. +Codes 5, 6, and 7 identify ESM syntax. Nesting is limited to 2048 tracked brackets or templates. +Input lengths must fit `uint32_t`, `PTRDIFF_MAX - 32`, and the platform's UTF-16 allocation range. +Output locations must not overlap each other or the source. + ### Wasm Build Steps The build uses docker and make, they must be installed first. diff --git a/build/Makefile b/build/Makefile index 3a29c0c..6edfbe6 100755 --- a/build/Makefile +++ b/build/Makefile @@ -5,19 +5,16 @@ WASM_LDFLAGS := -nostartfiles # These are project-specific and are expected to be kept intact WASM_TARGET := -target wasm32-unknown-wasi -WASM_EXTRA_CFLAGS := -I include-wasm/ -Wno-logical-op-parentheses -Wno-parentheses -Oz +WASM_EXTRA_CFLAGS := -I include/ -Wno-logical-op-parentheses -Wno-parentheses -Oz WASM_EXTRA_CFLAGS += -flto -mllvm -inline-threshold=150 WASM_EXTRA_LDFLAGS := -Wl,-z,stack-size=13312,--no-entry,--compress-relocations,--strip-all WASM_EXTRA_LDFLAGS += -Wl,--mllvm=-inline-threshold=150 -WASM_EXTRA_LDFLAGS += -Wl,--export=__heap_base,--export=parseCJS,--export=sa -WASM_EXTRA_LDFLAGS += -Wl,--export=parseCJSWithOptions -WASM_EXTRA_LDFLAGS += -Wl,--export=e,--export=re,--export=es,--export=ee -WASM_EXTRA_LDFLAGS += -Wl,--export=rre,--export=ree,--export=res,--export=ru,--export=us,--export=ue +WASM_EXTRA_LDFLAGS += -Wl,--export=sa,--export=es,--export=ee,--export=re,--export=res,--export=ree,--export=rre,--export=us,--export=ue,--export=ru,--export=e,--export=parseCJS,--export=parseCJSWithOptions,--export=__heap_base -lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c +lib/lexer.wasm: include/cjs-module-lexer.h src/lexer-internal.h src/lexer.c src/wasm.c @mkdir -p lib $(WASM_CC) $(WASM_CFLAGS) $(WASM_TARGET) $(WASM_EXTRA_CFLAGS) \ - src/lexer.c -o lib/lexer.wasm \ + src/wasm.c -o lib/lexer.wasm \ $(WASM_LDFLAGS) $(WASM_EXTRA_LDFLAGS) optimize: lib/lexer.wasm diff --git a/build/wasm.js b/build/wasm.js index edd0c5f..cc5c27e 100644 --- a/build/wasm.js +++ b/build/wasm.js @@ -36,7 +36,7 @@ if (process.argv[2] === '--docker') { --mount type=bind,source=${ROOT}/build/Makefile,target=/home/node/build/Makefile \ --mount type=bind,source=${ROOT}/build.js,target=/home/node/build/build.js \ --mount type=bind,source=${ROOT}/package.json,target=/home/node/build/package.json \ - --mount type=bind,source=${ROOT}/include-wasm,target=/home/node/build/include-wasm \ + --mount type=bind,source=${ROOT}/include,target=/home/node/build/include \ -t ${WASM_BUILDER_CONTAINER} node wasm.js` console.log(`> ${cmd}\n\n`) execSync(cmd, { stdio: 'inherit' }) diff --git a/include-wasm/cjs-module-lexer.h b/include-wasm/cjs-module-lexer.h deleted file mode 100755 index 77911fe..0000000 --- a/include-wasm/cjs-module-lexer.h +++ /dev/null @@ -1,262 +0,0 @@ -#include -#include -#include -#include -#include - -extern unsigned char __heap_base; - -const uint16_t* source = (void*)&__heap_base; -uint32_t parse_error; - -struct Slice { - const uint16_t* start; - const uint16_t* end; - struct Slice* next; -}; -typedef struct Slice Slice; - -struct StarExportBinding { - const uint16_t* specifier_start; - const uint16_t* specifier_end; - const uint16_t* id_start; - const uint16_t* id_end; - struct StarExportBinding* next; -}; -typedef struct StarExportBinding StarExportBinding; - -Slice* first_export = NULL; -Slice* export_read_head = NULL; -Slice* export_write_head = NULL; -Slice* first_reexport = NULL; -Slice* reexport_read_head = NULL; -Slice* reexport_write_head = NULL; -Slice* first_unsafe_getter = NULL; -Slice* unsafe_getter_read_head = NULL; -Slice* unsafe_getter_write_head = NULL; -void* analysis_base; -// The end of a full Wasm32 memory does not fit in uintptr_t. -uint64_t analysis_head; -uint64_t analysis_limit; - -void bail (uint32_t err); - -// allocateSource -const uint16_t* sa (uint32_t utf16Len) { - const uint16_t* sourceEnd = source + utf16Len + 1; - // ensure source is null terminated - *(uint16_t*)(source + utf16Len) = '\0'; - const uintptr_t alignment = _Alignof(Slice); - analysis_base = (void*)(((uintptr_t)sourceEnd + alignment - 1) & ~(alignment - 1)); - analysis_head = (uintptr_t)analysis_base; - analysis_limit = (uint64_t)__builtin_wasm_memory_size(0) << 16; - first_export = NULL; - export_write_head = NULL; - export_read_head = NULL; - first_reexport = NULL; - reexport_write_head = NULL; - reexport_read_head = NULL; - first_unsafe_getter = NULL; - unsafe_getter_write_head = NULL; - unsafe_getter_read_head = NULL; - return source; -} - -// getErr -uint32_t e () { - return parse_error; -} - -// getExportStart -uint32_t es () { - return export_read_head->start - source; -} -// getExportEnd -uint32_t ee () { - return export_read_head->end - source; -} -// getReexportStart -uint32_t res () { - return reexport_read_head->start - source; -} -// getReexportEnd -uint32_t ree () { - return reexport_read_head->end - source; -} -// getUnsafeGetterStart -uint32_t us () { - return unsafe_getter_read_head->start - source; -} -// getUnsafeGetterEnd -uint32_t ue () { - return unsafe_getter_read_head->end - source; -} -// readExport -bool re () { - if (export_read_head == NULL) - export_read_head = first_export; - else - export_read_head = export_read_head->next; - if (export_read_head == NULL) - return false; - return true; -} -// readReexport -bool rre () { - if (reexport_read_head == NULL) - reexport_read_head = first_reexport; - else - reexport_read_head = reexport_read_head->next; - if (reexport_read_head == NULL) - return false; - return true; -} -// readUnsafeGetter -bool ru () { - if (unsafe_getter_read_head == NULL) - unsafe_getter_read_head = first_unsafe_getter; - else - unsafe_getter_read_head = unsafe_getter_read_head->next; - if (unsafe_getter_read_head == NULL) - return false; - return true; -} - -static __attribute__((noinline)) void growAnalysis (uint64_t required) { - uint32_t pages = (required - analysis_limit + 65535) >> 16; - if (__builtin_wasm_memory_grow(0, pages) == (size_t)-1) - __builtin_trap(); - analysis_limit += (uint64_t)pages << 16; -} - -static inline __attribute__((always_inline)) void ensureAnalysisCapacity (size_t size) { - uint64_t required = analysis_head + size; - if (required > analysis_limit) - growAnalysis(required); -} - -void _addExport (const uint16_t* start, const uint16_t* end) { - ensureAnalysisCapacity(sizeof(Slice)); - Slice* export = (Slice*)(uintptr_t)analysis_head; - analysis_head = analysis_head + sizeof(Slice); - if (export_write_head == NULL) - first_export = export; - else - export_write_head->next = export; - export_write_head = export; - export->start = start; - export->end = end; - export->next = NULL; -} -void _addReexport (const uint16_t* start, const uint16_t* end) { - ensureAnalysisCapacity(sizeof(Slice)); - Slice* reexport = (Slice*)(uintptr_t)analysis_head; - analysis_head = analysis_head + sizeof(Slice); - if (reexport_write_head == NULL) - first_reexport = reexport; - else - reexport_write_head->next = reexport; - reexport_write_head = reexport; - reexport->start = start; - reexport->end = end; - reexport->next = NULL; -} -void _addUnsafeGetter (const uint16_t* start, const uint16_t* end) { - ensureAnalysisCapacity(sizeof(Slice)); - Slice* unsafe_getter = (Slice*)(uintptr_t)analysis_head; - analysis_head = analysis_head + sizeof(Slice); - if (unsafe_getter_write_head == NULL) - first_unsafe_getter = unsafe_getter; - else - unsafe_getter_write_head->next = unsafe_getter; - unsafe_getter_write_head = unsafe_getter; - unsafe_getter->start = start; - unsafe_getter->end = end; - unsafe_getter->next = NULL; -} -void _clearReexports () { - reexport_write_head = NULL; - first_reexport = NULL; -} -void (*addExport)(const uint16_t*, const uint16_t*) = &_addExport; -void (*addReexport)(const uint16_t*, const uint16_t*) = &_addReexport; -void (*addUnsafeGetter)(const uint16_t*, const uint16_t*) = &_addUnsafeGetter; -void (*clearReexports)() = &_clearReexports; -uint32_t parseCJS (uint16_t* source, uint32_t sourceLen, void (*addExport)(const uint16_t* start, const uint16_t* end), void (*addReexport)(const uint16_t* start, const uint16_t* end), void (*addUnsafeGetter)(const uint16_t*, const uint16_t*), void (*clearReexports)()); -uint32_t parseCJSWithOptions (uint16_t* source, uint32_t sourceLen, void (*addExport)(const uint16_t* start, const uint16_t* end), void (*addReexport)(const uint16_t* start, const uint16_t* end), void (*addUnsafeGetter)(const uint16_t*, const uint16_t*), void (*clearReexports)(), uint32_t options); - -enum RequireType { - Import, - ExportAssign, - ExportStar -}; - -void tryBacktrackAddStarExportBinding (uint16_t* pos); -bool tryParseRequire (enum RequireType requireType); -void tryParseLiteralExports (); -void readExportDefinition (); -void readExportProperty (); -bool readExportsOrModuleDotExports (uint16_t ch); -void tryParseModuleExportsDotAssign (); -void tryParseExportsDotAssign (bool assign); -void tryParseObjectDefineOrKeys (bool keys); -bool identifier (uint16_t ch); - -void throwIfImportStatement (); -void throwIfExportStatement (); - -void readImportString (const uint16_t* ss, uint16_t ch); -uint16_t readExportAs (uint16_t* startPos, uint16_t* endPos); - -uint16_t commentWhitespace (); -void stringLiteral (uint16_t quote); -void regularExpression (); -void templateString (); -void blockComment (); -void lineComment (); - -uint16_t readToWsOrPunctuator (uint16_t ch); - -uint32_t fullCharCode (uint16_t ch); -uint32_t fullCharCodeAtLast (uint16_t* pos); -bool isIdentifierStart (uint32_t code); -bool isIdentifierChar (uint32_t code); -int charCodeByteLen (uint32_t ch); - -bool isBr (uint16_t c); -bool isBrOrWs (uint16_t c); -bool isBrOrWsOrPunctuator (uint16_t c); -bool isBrOrWsOrPunctuatorNotDot (uint16_t c); - -bool str_eq2 (uint16_t* pos, uint16_t c1, uint16_t c2); -bool str_eq3 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3); -bool str_eq4 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4); -bool str_eq5 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5); -bool str_eq6 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6); -bool str_eq7 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7); -bool str_eq8 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8); -bool str_eq9 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9); -bool str_eq10 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10); -bool str_eq13 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13); -bool str_eq18 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13, uint16_t c14, uint16_t c15, uint16_t c16, uint16_t c17, uint16_t c18); -bool str_eq22 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13, uint16_t c14, uint16_t c15, uint16_t c16, uint16_t c17, uint16_t c18, uint16_t c19, uint16_t c20, uint16_t c21, uint16_t c22); - -bool readPrecedingKeyword2(uint16_t* pos, uint16_t c1, uint16_t c2); -bool readPrecedingKeyword3(uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3); -bool readPrecedingKeyword4(uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4); -bool readPrecedingKeyword5(uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5); -bool readPrecedingKeyword6(uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6); -bool readPrecedingKeyword7(uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7); - -bool keywordStart (uint16_t* pos); -bool isExpressionKeyword (uint16_t* pos); -bool isParenKeyword (uint16_t* pos); -bool isPunctuator (uint16_t charCode); -bool isExpressionPunctuator (uint16_t charCode); -bool isExpressionTerminator (uint16_t* pos); - -void nextChar (uint16_t ch); -void nextCharSurrogate (uint16_t ch); -uint16_t readChar (); - -void syntaxError (uint32_t code); diff --git a/include/cjs-module-lexer.h b/include/cjs-module-lexer.h new file mode 100644 index 0000000..efb3a65 --- /dev/null +++ b/include/cjs-module-lexer.h @@ -0,0 +1,53 @@ +#ifndef CJS_MODULE_LEXER_H +#define CJS_MODULE_LEXER_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct cjs_lexer_result cjs_lexer_result; + +typedef struct { + const uint16_t* data; + size_t length; +} cjs_lexer_string16; + +typedef struct { + uint32_t code; + uint32_t has_offset; + size_t offset; +} cjs_lexer_error; + +#define CJS_LEXER_OK UINT32_C(0) +#define CJS_LEXER_INVALID_ARGUMENT UINT32_C(1) +#define CJS_LEXER_SYNTAX_ERROR UINT32_C(2) +#define CJS_LEXER_LIMIT UINT32_C(3) +#define CJS_LEXER_OUT_OF_MEMORY UINT32_C(4) + +#define CJS_LEXER_ALLOW_MINIFIED_ENUMERABLE UINT32_C(1) +#define CJS_LEXER_EXTENDED UINT32_C(2) + +/* Source is borrowed, in UTF-16 code units, without padding or a terminator. + * Keep it unchanged until result_free. Null source is valid only with length 0. + * Output locations must not alias source or each other. On failure *result is + * null and error, when supplied, describes this call only. */ +uint32_t cjs_lexer_parse_utf16(const uint16_t* source, size_t length, + uint32_t flags, cjs_lexer_result** result, + cjs_lexer_error* error); + +/* Views require a live result and index below the corresponding count. + * Candidates are decoded and filtered, in source order, with duplicates. + * Views remain valid until result_free, including across independent parses. */ +size_t cjs_lexer_export_count(const cjs_lexer_result* result); +size_t cjs_lexer_reexport_count(const cjs_lexer_result* result); +cjs_lexer_string16 cjs_lexer_export(const cjs_lexer_result* result, size_t index); +cjs_lexer_string16 cjs_lexer_reexport(const cjs_lexer_result* result, size_t index); +void cjs_lexer_result_free(cjs_lexer_result* result); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/lexer.js b/lexer.js index 2217554..ed1e039 100755 --- a/lexer.js +++ b/lexer.js @@ -120,6 +120,8 @@ function parseSource (cjsSource) { pos = -1; end = source.length - 1; let ch = 0; + let lastOpenTokenPos = -1; + let lastOpenTokenType = 0; // Handle #! if (source.charCodeAt(0) === 35/*#*/ && source.charCodeAt(1) === 33/*!*/) { @@ -139,6 +141,9 @@ function parseSource (cjsSource) { if (ch === 32 || ch < 14 && ch > 8) continue; + let closedTokenPos = -1; + let closedTokenType = 0; + if (openTokenDepth === 0) { switch (ch) { case 105/*i*/: @@ -146,6 +151,8 @@ function parseSource (cjsSource) { throwIfImportStatement(); skipTokenRun(); lastTokenPos = pos; + lastOpenTokenPos = -1; + lastOpenTokenType = 0; continue; case 114/*r*/: const startPos = pos; @@ -153,6 +160,8 @@ function parseSource (cjsSource) { tryBacktrackAddStarExportBinding(startPos - 1); skipTokenRun(); lastTokenPos = pos; + lastOpenTokenPos = -1; + lastOpenTokenType = 0; continue; case 95/*_*/: if (source.startsWith('interopRequireWildcard', pos + 1) && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) { @@ -180,6 +189,8 @@ function parseSource (cjsSource) { } skipTokenRun(); lastTokenPos = pos; + lastOpenTokenPos = -1; + lastOpenTokenType = 0; continue; } } @@ -232,6 +243,7 @@ function parseSource (cjsSource) { if (openTokenDepth === 0) throw new Error('Unexpected closing bracket.'); openTokenDepth--; + closedTokenPos = openTokenPosStack[openTokenDepth]; break; case 123/*{*/: pushOpenToken(lastTokenPos); @@ -246,6 +258,8 @@ function parseSource (cjsSource) { case 125/*}*/: if (openTokenDepth === 0) throw new Error('Unexpected closing brace.'); + closedTokenPos = openTokenPosStack[openTokenDepth - 1]; + closedTokenType = openTokenTypeStack[openTokenDepth - 1]; if (openTokenDepth-- === templateDepth) { templateDepth = templateStack[--templateStackDepth]; templateString(); @@ -283,10 +297,10 @@ function parseSource (cjsSource) { if (isExpressionPunctuator(lastToken) && !(lastToken === 46/*.*/ && (source.charCodeAt(lastTokenPos - 1) >= 48/*0*/ && source.charCodeAt(lastTokenPos - 1) <= 57/*9*/)) && !(lastToken === 43/*+*/ && source.charCodeAt(lastTokenPos - 1) === 43/*+*/) && !(lastToken === 45/*-*/ && source.charCodeAt(lastTokenPos - 1) === 45/*-*/) || - lastToken === 41/*)*/ && isParenKeyword(openTokenPosStack[openTokenDepth]) || - lastToken === 125/*}*/ && (isExpressionTerminator(openTokenPosStack[openTokenDepth]) || - (openTokenTypeStack[openTokenDepth] & ClassToken) || - extended && isStatementBrace(openTokenPosStack[openTokenDepth], openTokenDepth)) || + lastToken === 41/*)*/ && isParenKeyword(lastOpenTokenPos) || + lastToken === 125/*}*/ && (isExpressionTerminator(lastOpenTokenPos) || + (lastOpenTokenType & ClassToken) || + extended && isStatementBrace(lastOpenTokenPos, openTokenDepth)) || lastToken === 47/*/*/ && lastSlashWasDivision || isExpressionKeyword(lastTokenPos) || !lastToken) { @@ -307,6 +321,8 @@ function parseSource (cjsSource) { skipTokenRun(); } lastTokenPos = pos; + lastOpenTokenPos = closedTokenPos; + lastOpenTokenType = closedTokenType; } if (templateDepth !== -1) diff --git a/lib/lexer.wasm b/lib/lexer.wasm index fd7050af5d28867e4b123c01bb484ff15fc7f724..2270c54067c8300385ca2191ab83467d7b42bcc7 100755 GIT binary patch literal 28832 zcmchgd%T@hdFS8D-uvvFz4yt^g%A>m@7{7r$PF+M!3$aGCnt^6p);M^KQrpgWLk5^ zO9FOmOUVvMp=vE)YqdAx=xCc6JHe{s*eXG-wkmDv6)Dyzidq!{QUn1r-{14BwJ$j* zj?A?4hWEVBTJKuVdT#4k&$_&u>?K#dEYGqmf8O+qvwZ)H^ZoWGdvUQ}P`Q8q{_Ms1 zwV6R=WZ8?S$kRotk)X2QtJRAv&$A-W@Ufp)Qm>l%{wy4RJa0|yTikfr z?w7q{-!Bwd>qRg6x!o^$<%|B^ORm~oX2n%6$(Aj9T`t|MYYx=ctSc!jGySA!zbAMB>>aBP7%aC1C zG^?^IE-7j}@=J=W%GMUOejb{8s;tUaS0#DWscKtG-YHpYZ3S|qzr6j#iSn9$w!M4P zJGW(F|7>kr*5Z}Ft+MTd!ILLWoVfh@YpCAps-88OZO^tMnA=`nbfLD`R%{FRR%?r_ zpKs2y@XVbZ+TNTOp$8O>=}jnRJ9+q;fsH-AB79R|uPmus6@4hXf=U$QU6l#T^xRBM zI?G!v>Q%H0X@;N&_E60ATfKI<&ECOqv8S&hqGj@581#z$lUYAH<)rl&RoRubZAJ@{ zUNqM)!s#yzS;(v6>Tug&P}{q@)BDkwMsLHT6+HEe9kobZRffOG=4O_)w$5xVR&U+f z*jnGZb!*OD%UXz}4E?#8nH8kBt~jH+b?dXYZaqD|c!GN6vaQRr7Nwp$+u6$Fud>BG1WG+aBp+W~8C+NN-ESr&HPGqiQR{ zLn(J<`1=H|8Z~_82=AIvwJLlemFFO1ZxKp)Qpu?3)>gH*j6BM+EnLeQGh4Q_w`{?Mn5&T|YE5mK-m+!omM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\00\00\03\00\00\00.\00\00\00\0a\00\00\006\00\00\00\09\00\00\00\07\00\00\00\02\00\00\00%\00\00\00\0d\00\00\00\02\00\00\00\09\00\00\00\06\00\00\00\01\00\00\00-\00\00\00\00\00\00\00\0d\00\00\00\02\00\00\001\00\00\00\0d\00\00\00\09\00\00\00\03\00\00\00\02\00\00\00\0b\00\00\00S\00\00\00\0b\00\00\00\07\00\00\00\00\00\00\00\a1\00\00\00\0b\00\00\00\06\00\00\00\09\00\00\00\07\00\00\00\03\00\00\008\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\02\00\00\00\0a\00\00\00\00\00\00\00\0b\00\00\00\01\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\04\00\00\00\c1\00\00\00\11\00\00\00\0a\00\00\00\09\00\00\00\05\00\00\00\00\00\00\00R\00\00\00\13\00\00\00\0d\00\00\00\09\00\00\00\d6\00\00\00\06\00\00\00\03\00\00\00\08\00\00\00\1c\00\00\00\01\00\00\00S\00\00\00\10\00\00\00\10\00\00\00\09\00\00\00R\00\00\00\0c\00\00\00\09\00\00\00\09\00\00\00T\00\00\00\0e\00\00\00\05\00\00\00\09\00\00\00\f3\00\00\00\0e\00\00\00\a6\00\00\00\09\00\00\00G\00\00\00\05\00\00\00\02\00\00\00\01\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\0d\00\00\00\09\00\00\00x\00\00\00\06\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\00\00\00\00\1d\00\00\00\09\00\00\00)\00\00\00\06\00\00\00\02\00\00\00\03\00\00\00\09\00\00\00\00\00\00\00\0a\00\00\00\0a\00\00\00/\00\00\00\0f\00\00\00\96\01\00\00\07\00\00\00\02\00\00\00\07\00\00\00\11\00\00\00\09\00\00\009\00\00\00\15\00\00\00\02\00\00\00\0d\00\00\00{\00\00\00\05\00\00\00\04\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\00\00\00\00\09\00\00\00\09\00\00\001\00\00\00\04\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\09\00\00\00\09\00\00\00J\01\00\00\03\00\00\00jK\00\00\09\00\00\00\87\00\00\00\04\00\00\00<\00\00\00\06\00\00\00\1a\00\00\00\09\00\00\00\f6\03\00\00\00\00\00\00\02\00\00\006\00\00\00\08\00\00\00\03\00\00\00R\00\00\00\00\00\00\00\0c\00\00\00\01\00\00\00\acL\00\00\01\00\00\00\c7\14\00\00\04\00\00\00\04\00\00\00\05\00\00\00\09\00\00\00\07\00\00\00\03\00\00\00\06\00\00\00\1f\00\00\00\03\00\00\00\95\00\00\00\02\00\00\00\8a\05\00\001\00\00\00\01\02\00\006\00\00\00\05\00\00\001\00\00\00\09\00\00\00\00\00\00\00\0f\00\00\00\00\00\00\00\17\00\00\00\04\00\00\00\02\00\00\00\0e\00\00\00Q\05\00\00\06\00\00\00\02\00\00\00\10\00\00\00\03\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\06\01\00\00\06\00\00\00\0a\00\00\00\09\00\00\00\a3\01\00\00\0d\00\00\00\d7\05\00\00\06\00\00\00n\00\00\00\06\00\00\00\06\00\00\00\09\00\00\00\97\12\00\00\09\00\00\00\07\05\0c\00\ef") - (data (;2;) (i32.const 4024) "p|\00\00\01\00\00\00\02\00\00\00\03")) + (export "parseCJSWithOptions" (func 20)) + (export "parseCJS" (func 21)) + (export "e" (func 22)) + (export "es" (func 23)) + (export "ee" (func 24)) + (export "res" (func 25)) + (export "ree" (func 26)) + (export "us" (func 27)) + (export "ue" (func 28)) + (export "re" (func 29)) + (export "rre" (func 30)) + (export "ru" (func 31)) + (data (;0;) (i32.const 1060) "\01") + (data (;1;) (i32.const 1072) "\01\01\01\01\01\01\01\01\01\01\00\00\00\00\00\00\00\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\00\01\00\00\01\00\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01") + (data (;2;) (i32.const 1156) "\0b\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00\12\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\0e\00\00\00\03\00\00\00\0d\00\00\00#\00\00\00z\00\00\00F\00\00\004\00\00\00\0c\01\00\00\1c\00\00\00\04\00\00\000\00\00\000\00\00\00\1f\00\00\00\0e\00\00\00\1d\00\00\00\06\00\00\00%\00\00\00\0b\00\00\00\1d\00\00\00\03\00\00\00#\00\00\00\05\00\00\00\07\00\00\00\02\00\00\00\04\00\00\00+\00\00\00\9d\00\00\00\13\00\00\00#\00\00\00\05\00\00\00#\00\00\00\05\00\00\00'\00\00\00\09\00\00\003\00\00\00\9d\00\00\006\01\00\00\0a\00\00\00\15\00\00\00\0b\00\00\00\07\00\00\00\99\00\00\00\05\00\00\00\03\00\00\00\00\00\00\00\02\00\00\00+\00\00\00\02\00\00\00\01\00\00\00\04\00\00\00\00\00\00\00\03\00\00\00\16\00\00\00\0b\00\00\00\16\00\00\00\0a\00\00\00\1e\00\00\00B\00\00\00\12\00\00\00\02\00\00\00\01\00\00\00\0b\00\00\00\15\00\00\00\0b\00\00\00\19\00\00\00G\00\00\007\00\00\00\07\00\00\00\01\00\00\00A\00\00\00\00\00\00\00\10\00\00\00\03\00\00\00\02\00\00\00\02\00\00\00\02\00\00\00\1c\00\00\00+\00\00\00\1c\00\00\00\04\00\00\00\1c\00\00\00$\00\00\00\07\00\00\00\02\00\00\00\1b\00\00\00\1c\00\00\005\00\00\00\0b\00\00\00\15\00\00\00\0b\00\00\00\12\00\00\00\0e\00\00\00\11\00\00\00o\00\00\00H\00\00\008\00\00\002\00\00\00\0e\00\00\002\00\00\00\0e\00\00\00#\00\00\00]\01\00\00)\00\00\00\07\00\00\00\01\00\00\00O\00\00\00\1c\00\00\00\0b\00\00\00\00\00\00\00\09\00\00\00\15\00\00\00k\00\00\00\14\00\00\00\1c\00\00\00\16\00\00\00\0d\00\00\004\00\00\00L\00\00\00,\00\00\00!\00\00\00\18\00\00\00\1b\00\00\00#\00\00\00\1e\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\09\00\00\00\22\00\00\00\04\00\00\00\00\00\00\00\0d\00\00\00/\00\00\00\0f\00\00\00\03\00\00\00\16\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00$\00\00\00\11\00\00\00\02\00\00\00\18\00\00\00U\00\00\00\06\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\0e\00\00\00\02\00\00\00\09\00\00\00\08\00\00\00.\00\00\00'\00\00\00\07\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\15\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\04\00\00\00\00\00\00\00\13\00\00\00\00\00\00\00\0d\00\00\00\04\00\00\00\9f\00\00\004\00\00\00\13\00\00\00\03\00\00\00\15\00\00\00\02\00\00\00\1f\00\00\00/\00\00\00\15\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\b9\00\00\00.\00\00\00*\00\00\00\03\00\00\00%\00\00\00/\00\00\00\15\00\00\00\00\00\00\00<\00\00\00*\00\00\00\0e\00\00\00\00\00\00\00H\00\00\00\1a\00\00\00\e6\00\00\00+\00\00\00u\00\00\00?\00\00\00 \00\00\00\07\00\00\00\03\00\00\00\00\00\00\00\03\00\00\00\07\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\17\00\00\00\10\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00_\00\00\00\07\00\00\00\03\00\00\00&\00\00\00\11\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\1d\00\00\00\00\00\00\00\0b\00\00\00'\00\00\00\08\00\00\00\00\00\00\00\16\00\00\00\00\00\00\00\0c\00\00\00-\00\00\00\14\00\00\00\00\00\00\00#\00\00\008\00\00\00\08\01\00\00\08\00\00\00\02\00\00\00$\00\00\00\12\00\00\00\00\00\00\002\00\00\00\1d\00\00\00q\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00%\00\00\00\16\00\00\00\00\00\00\00\1a\00\00\00\05\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\1f\00\00\00\0f\00\00\00\00\00\00\00H\01\00\00\12\00\00\00\be\00\00\00\00\00\00\00P\00\00\00\99\03\00\00g\00\00\00n\00\00\00\12\00\00\00\c3\00\00\00\bd\0a\00\00.\04\00\00\d2\0f\00\00F\02\00\00\ba!\00\008\02\00\00\08\00\00\00\1e\00\00\00r\00\00\00\1d\00\00\00\13\00\00\00/\00\00\00\11\00\00\00\03\00\00\00 \00\00\00\14\00\00\00\06\00\00\00\12\00\00\00\b1\02\00\00?\00\00\00\81\00\00\00J\00\00\00\06\00\00\00\00\00\00\00C\00\00\00\0c\00\00\00A\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\1d\00\00\00\f7\17\00\00\09\00\00\00\d5\04\00\00+\00\00\00\08\00\00\00\f8\22\00\00\1e\01\00\002\00\00\00\02\00\00\00\12\00\00\00\03\00\00\00\09\00\00\00\8b\01\00\00\05\09\00\00j\00\00\00\06\00\00\00\0c\00\00\00\04\00\00\00\08\00\00\00\08\00\00\00\09\00\00\00g\17\00\00T\00\00\00\02\00\00\00F\00\00\00\02\00\00\00\01\00\00\00\03\00\00\00\00\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\0b\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00@\00\00\00\02\00\00\00\03\00\00\00\03\00\00\00\07\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\1b\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\04\00\00\00\02\00\00\00\00\00\00\00\04\00\00\00\06\00\00\00\02\00\00\00S\01\00\00\03\00\00\00\18\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\1e\00\00\00\02\00\00\00\18\00\00\00\02\00\00\00\07\00\00\005\09\00\00,\00\00\00\0b\00\00\00\06\00\00\00\11\00\00\00\00\00\00\00r\01\00\00+\00\00\00\15\05\00\00\c4\00\00\00<\00\00\00C\00\00\00\08\00\00\00\00\00\00\00\b5\04\00\00\03\00\00\00\02\00\00\00\1a\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\02\00\00\00\09\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\07\00\00\00\00\00\00\00\05\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\02\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\09\00\00\00\02\00\00\00\10\00\00\00\06\00\00\00\02\00\00\00\02\00\00\00\04\00\00\00\02\00\00\00\10\00\00\00E\11\00\00\dd\a6\00\00#\00\00\004\10\00\00\0c\00\00\00\dd\00\00\00\03\00\00\00\81\16\00\00\0f\00\00\000\1d\00\00 \0c\00\00\1d\02\00\00\e3\05\00\00J\13\00\00\fd\01\00\00\00\00\00\00\e3\00\00\00\00\00\00\00\96\00\00\00\04\00\00\00&\01\00\00\09\00\00\00X\05\00\00\02\00\00\00\02\00\00\00\01\00\00\00\06\00\00\00\03\00\00\00)\00\00\00\02\00\00\00\05\00\00\00\00\00\00\00\a6\00\00\00\01\00\00\00>\02\00\00\03\00\00\00\09\00\00\00\09\00\00\00r\01\00\00\01\00\00\00\9a\00\00\00\0a\00\00\00\b0\00\00\00\02\00\00\006\00\00\00\0e\00\00\00 \00\00\00\09\00\00\00\10\00\00\00\03\00\00\00.\00\00\00\0a\00\00\006\00\00\00\09\00\00\00\07\00\00\00\02\00\00\00%\00\00\00\0d\00\00\00\02\00\00\00\09\00\00\00\06\00\00\00\01\00\00\00-\00\00\00\00\00\00\00\0d\00\00\00\02\00\00\001\00\00\00\0d\00\00\00\09\00\00\00\03\00\00\00\02\00\00\00\0b\00\00\00S\00\00\00\0b\00\00\00\07\00\00\00\00\00\00\00\a1\00\00\00\0b\00\00\00\06\00\00\00\09\00\00\00\07\00\00\00\03\00\00\008\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\03\00\00\00\01\00\00\00\03\00\00\00\02\00\00\00\0a\00\00\00\00\00\00\00\0b\00\00\00\01\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\04\00\00\00\c1\00\00\00\11\00\00\00\0a\00\00\00\09\00\00\00\05\00\00\00\00\00\00\00R\00\00\00\13\00\00\00\0d\00\00\00\09\00\00\00\d6\00\00\00\06\00\00\00\03\00\00\00\08\00\00\00\1c\00\00\00\01\00\00\00S\00\00\00\10\00\00\00\10\00\00\00\09\00\00\00R\00\00\00\0c\00\00\00\09\00\00\00\09\00\00\00T\00\00\00\0e\00\00\00\05\00\00\00\09\00\00\00\f3\00\00\00\0e\00\00\00\a6\00\00\00\09\00\00\00G\00\00\00\05\00\00\00\02\00\00\00\01\00\00\00\03\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\0d\00\00\00\09\00\00\00x\00\00\00\06\00\00\00\03\00\00\00\06\00\00\00\04\00\00\00\00\00\00\00\1d\00\00\00\09\00\00\00)\00\00\00\06\00\00\00\02\00\00\00\03\00\00\00\09\00\00\00\00\00\00\00\0a\00\00\00\0a\00\00\00/\00\00\00\0f\00\00\00\96\01\00\00\07\00\00\00\02\00\00\00\07\00\00\00\11\00\00\00\09\00\00\009\00\00\00\15\00\00\00\02\00\00\00\0d\00\00\00{\00\00\00\05\00\00\00\04\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\06\00\00\00\02\00\00\00\00\00\00\00\09\00\00\00\09\00\00\001\00\00\00\04\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\09\00\00\00\09\00\00\00J\01\00\00\03\00\00\00jK\00\00\09\00\00\00\87\00\00\00\04\00\00\00<\00\00\00\06\00\00\00\1a\00\00\00\09\00\00\00\f6\03\00\00\00\00\00\00\02\00\00\006\00\00\00\08\00\00\00\03\00\00\00R\00\00\00\00\00\00\00\0c\00\00\00\01\00\00\00\acL\00\00\01\00\00\00\c7\14\00\00\04\00\00\00\04\00\00\00\05\00\00\00\09\00\00\00\07\00\00\00\03\00\00\00\06\00\00\00\1f\00\00\00\03\00\00\00\95\00\00\00\02\00\00\00\8a\05\00\001\00\00\00\01\02\00\006\00\00\00\05\00\00\001\00\00\00\09\00\00\00\00\00\00\00\0f\00\00\00\00\00\00\00\17\00\00\00\04\00\00\00\02\00\00\00\0e\00\00\00Q\05\00\00\06\00\00\00\02\00\00\00\10\00\00\00\03\00\00\00\06\00\00\00\02\00\00\00\01\00\00\00\02\00\00\00\04\00\00\00\06\01\00\00\06\00\00\00\0a\00\00\00\09\00\00\00\a3\01\00\00\0d\00\00\00\d7\05\00\00\06\00\00\00n\00\00\00\06\00\00\00\06\00\00\00\09\00\00\00\97\12\00\00\09\00\00\00\07\05\0c\00\ef\00\00\00defineProperty\00defineProperties")) diff --git a/package.json b/package.json index 6db516c..8d338d0 100755 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "test-wasm": "cross-env WASM=1 NODE_OPTIONS=--disallow-code-generation-from-strings mocha -b -u tdd test/*.js", "test-wasm-sync": "cross-env WASM_SYNC=1 NODE_OPTIONS=--disallow-code-generation-from-strings mocha -b -u tdd test/*.js", "test": "npm run test-wasm && npm run test-wasm-sync && npm run test-js", + "test-native": "cross-env NATIVE=1 WASM=1 NODE_OPTIONS=--disallow-code-generation-from-strings mocha -b -u tdd test/_unit.js test/extended.js test/integration.js", "bench": "node --expose-gc bench/index.mjs", "build": "node build.js", "build-wasm": "make lib/lexer.wasm ; node build.js", diff --git a/src/lexer-internal.h b/src/lexer-internal.h new file mode 100644 index 0000000..1d8dc7b --- /dev/null +++ b/src/lexer-internal.h @@ -0,0 +1,177 @@ +#ifndef CJS_LEXER_INTERNAL_H +#define CJS_LEXER_INTERNAL_H + +#include "cjs-module-lexer.h" +#include +#include +#include +#include + +#define STACK_DEPTH 2048 +#ifdef CJS_LEXER_WASM +#define CJS_INLINE inline __attribute__((always_inline)) +#else +#define CJS_INLINE inline +#endif + +#ifdef CJS_LEXER_WASM +typedef const uint16_t* Cursor; +#define SOURCE_START parser->input +#else +typedef ptrdiff_t Cursor; +#define SOURCE_START ((Cursor)0) +#endif +#define SOURCE_BEFORE (SOURCE_START - 1) + +#ifdef CJS_LEXER_WASM +typedef struct Slice { + Cursor start; + Cursor end; + struct Slice* next; +} Slice; + +typedef struct { + Slice* first; + Slice* last; + Slice* read; +} Candidates; + +struct cjs_lexer_result { + Candidates exports; + Candidates reexports; + Candidates unsafe_getters; +}; + +#else +typedef struct ArenaBlock { + struct ArenaBlock* next; + size_t used; + size_t capacity; + max_align_t data[]; +} ArenaBlock; + +typedef struct { + Cursor start; + Cursor end; + cjs_lexer_string16 value; + uint32_t hash; +} Candidate; + +typedef struct { + Candidate* data; + size_t count; + size_t capacity; +} Candidates; + +struct cjs_lexer_result { + Candidates exports; + Candidates reexports; + Candidates unsafe_getters; + ArenaBlock* blocks; +}; + +#endif + +typedef struct StarExportBinding { + Cursor specifier_start; + Cursor specifier_end; + Cursor id_start; + Cursor id_end; + struct StarExportBinding* next; +} StarExportBinding; + +typedef struct { + const uint16_t* input; + size_t sourceLen; + Cursor pos; + Cursor end; + Cursor lastTokenPos; + Cursor exportObjectPos; + uint16_t templateStackDepth; + uint16_t openTokenDepth; + uint16_t templateDepth; + bool lastSlashWasDivision; + bool nextBraceIsClass; + bool allowMinifiedEnumerable; + bool extended; + uint32_t error; + size_t parse_error; + uint16_t templateStack[STACK_DEPTH]; + Cursor openTokenPosStack[STACK_DEPTH]; + uint8_t openTokenTypeStack[STACK_DEPTH]; + StarExportBinding starExportBinding_; + StarExportBinding* firstStarExport; + StarExportBinding* lastStarExport; + cjs_lexer_result* result; +} Parser; + +#ifdef CJS_LEXER_WASM +#define scanInput(input, cursor) (*(cursor)) +#else +#define scanInput(input, cursor) ((input)[cursor]) +#endif + +enum RequireType { Import, ExportAssign, ExportStar }; + +static inline ptrdiff_t sourceIndex(const Parser* parser, Cursor cursor) { +#ifdef CJS_LEXER_WASM + return cursor - parser->input; +#else + (void)parser; + return cursor; +#endif +} + +static inline uint16_t at(const Parser* parser, Cursor cursor) { +#ifdef CJS_LEXER_WASM + return *cursor; +#else + return (size_t)cursor < parser->sourceLen ? parser->input[cursor] : 0; +#endif +} + +static inline bool hasChars(const Parser* parser, Cursor cursor, size_t length) { +#ifdef CJS_LEXER_WASM + return true; +#else + return cursor >= 0 && (size_t)cursor <= parser->sourceLen && + length <= parser->sourceLen - (size_t)cursor; +#endif +} + +#ifdef CJS_LEXER_WASM +__attribute__((noinline)) +#endif + +static inline bool matches(const Parser* parser, Cursor left, Cursor right, size_t length) { +#ifdef CJS_LEXER_WASM + if (left > parser->end + 1 || length > (size_t)(parser->end + 1 - left)) return false; + return memcmp(left, right, length * sizeof(uint16_t)) == 0; +#else + ptrdiff_t leftIndex = sourceIndex(parser, left); + ptrdiff_t rightIndex = sourceIndex(parser, right); + return leftIndex >= 0 && rightIndex >= 0 && (size_t)leftIndex <= parser->sourceLen && + (size_t)rightIndex <= parser->sourceLen && length <= parser->sourceLen - (size_t)leftIndex && + length <= parser->sourceLen - (size_t)rightIndex && + memcmp(parser->input + leftIndex, parser->input + rightIndex, length * sizeof(uint16_t)) == 0; +#endif +} + +#ifdef CJS_LEXER_WASM +__attribute__((noinline)) +#endif +static inline void clearCandidates(Candidates* list) { +#ifdef CJS_LEXER_WASM + list->first = NULL; + list->last = NULL; + list->read = NULL; +#else + list->count = 0; +#endif +} + +void* cjs_lexer_allocate(cjs_lexer_result* result, size_t size); +void cjs_lexer_add(Parser* parser, Candidates* list, Cursor start, Cursor end); +uint32_t cjs_lexer_scan(Parser* parser); + +#endif diff --git a/src/lexer.c b/src/lexer.c index dab3336..d20f4e4 100755 --- a/src/lexer.c +++ b/src/lexer.c @@ -1,167 +1,171 @@ -#include "cjs-module-lexer.h" - -const uint16_t* STANDARD_IMPORT = (uint16_t*)0x1; -const uint16_t* IMPORT_META = (uint16_t*)0x2; -const uint16_t __empty_char = '\0'; -const uint16_t* EMPTY_CHAR = &__empty_char; -// tracked depth of template and brackets -#define STACK_DEPTH 2048 +#include "lexer-internal.h" + enum TokenType { ClassToken = 1, ExportObjectToken = 2 }; -const uint16_t* source; - -bool lastSlashWasDivision; -uint16_t templateStackDepth; -uint16_t openTokenDepth; -uint16_t templateDepth; -uint16_t braceDepth; -uint16_t* lastTokenPos; -uint16_t* pos; -uint16_t* end; -uint16_t* templateStack; -uint16_t** openTokenPosStack; -bool nextBraceIsClass; -bool allowMinifiedEnumerable; -static bool extended; -static uint16_t* exportObjectPos; - -uint16_t* lastReexportStart; -uint16_t* lastReexportEnd; - -// Memory Structure: -// -> source -// -> analysis starts after source -uint32_t parse_error; -uint32_t error = 0; -uint32_t sourceLen; - -uint16_t templateStack_[STACK_DEPTH]; -uint16_t* openTokenPosStack_[STACK_DEPTH]; -uint8_t openTokenTypeStack[STACK_DEPTH]; -StarExportBinding starExportBinding_; -StarExportBinding* firstStarExport; -StarExportBinding* lastStarExport; - -void (*addExport)(const uint16_t*, const uint16_t*); -void (*addReexport)(const uint16_t*, const uint16_t*); -void (*addUnsafeGetter)(const uint16_t*, const uint16_t*); -void (*clearReexports)(); - -static bool isStatementBrace (uint16_t* curPos, uint16_t depth); -static uint16_t readExportExpressionStart (); - -static inline __attribute__((always_inline)) bool isTokenRunChar (uint16_t ch) { - return (uint16_t)((ch | 32) - 'a') < 26 || (uint16_t)(ch - '0') < 10 || - ch == '$' || ch == '_' || ch == '\\' || (ch > 127 && ch != 160); -} - -static inline __attribute__((always_inline)) bool pushOpenToken (uint16_t* tokenPos) { - if (openTokenDepth == STACK_DEPTH) { - syntaxError(12); + +static CJS_INLINE bool isTokenRunChar (uint16_t ch); +static CJS_INLINE bool pushOpenToken(Parser* parser, Cursor tokenPos); +static CJS_INLINE bool pushTemplate(Parser* parser); +static void tryBacktrackAddStarExportBinding(Parser* parser, Cursor bPos); +static bool tryParseObjectHasOwnProperty(Parser* parser, Cursor it_id_start, ptrdiff_t it_id_len); +static inline bool tryParseMinifiedEnumerable(Parser* parser, uint16_t ch); +static void tryParseObjectDefineOrKeys(Parser* parser, bool keys); +static bool readExportsOrModuleDotExports(Parser* parser, uint16_t ch); +static void tryParseModuleExportsDotAssign(Parser* parser); +static void tryParseExportsDotAssign(Parser* parser, bool assign); +static bool tryParseRequire(Parser* parser, enum RequireType requireType); +static bool matchesKeyword(Parser* parser, const char* keyword, uint32_t length); +static uint16_t readExportExpressionStart(Parser* parser); +static void readExportDefinition(Parser* parser); +static void readExportProperty(Parser* parser); +static void tryParseLiteralExports(Parser* parser); +static bool isNonASCIIidentifierStartChar (uint32_t ch); +static bool isNonASCIIidentifierChar (uint32_t ch); +static bool isInAstralIdentifierStartCodes (uint32_t code); +static bool isInAstralIdentifierCodes (uint32_t code); +static bool isIdentifierStart(uint32_t code); +static bool isIdentifierChar(uint32_t code); +static inline int charCodeByteLen(uint32_t ch); +static uint32_t fullCharCodeAtLast(Parser* parser, Cursor bPos); +static uint32_t fullCharCode(Parser* parser, uint16_t ch); +static bool identifier(Parser* parser, uint16_t startCh); +static void throwIfImportStatement(Parser* parser); +static void throwIfExportStatement(Parser* parser); +static uint16_t commentWhitespace(Parser* parser); +static void templateString(Parser* parser); +static void blockComment(Parser* parser); +static void lineComment(Parser* parser); +static void stringLiteral(Parser* parser, uint16_t quote); +static uint16_t regexCharacterClass(Parser* parser); +static void regularExpression(Parser* parser); +static bool isBr (uint16_t c); +static bool isBrOrWs (uint16_t c); +static bool isBrOrWsOrPunctuatorNotDot (uint16_t c); +static bool str_eq2(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2); +static bool str_eq3(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3); +static bool str_eq4(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4); +static bool str_eq5(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5); +static bool str_eq6(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6); +static bool str_eq7(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7); +static bool str_eq8(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8); +static bool str_eq9(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9); +static bool str_eq10(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10); +static bool str_eq13(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13); +static bool str_eq22(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13, uint16_t c14, uint16_t c15, uint16_t c16, uint16_t c17, uint16_t c18, uint16_t c19, uint16_t c20, uint16_t c21, uint16_t c22); +static bool keywordStart(Parser* parser, Cursor cursor); +static bool readPrecedingKeyword1(Parser* parser, Cursor cursor, uint16_t c1); +static bool readPrecedingKeyword2(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2); +static bool readPrecedingKeyword3(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3); +static bool readPrecedingKeyword4(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4); +static bool readPrecedingKeyword5(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5); +static bool readPrecedingKeyword6(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6); +static bool readPrecedingKeyword7(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7); +static bool isExpressionKeyword(Parser* parser, Cursor cursor); +static bool isParenKeyword(Parser* parser, Cursor curPos); +static bool isPunctuator (uint16_t ch); +static bool isExpressionPunctuator (uint16_t ch); +static Cursor precedingToken(Parser* parser, Cursor curPos); +static bool isStatementBrace(Parser* parser, Cursor curPos, uint16_t depth); +static bool isExpressionTerminator(Parser* parser, Cursor curPos); +static void syntaxError(Parser* parser, uint32_t code); + + +static CJS_INLINE bool isTokenRunChar (uint16_t ch) { + static const uint8_t tokenRun[128] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + }; + return ch < 128 ? tokenRun[ch] : ch != 160; +} + +static CJS_INLINE bool pushOpenToken(Parser* parser, Cursor tokenPos) { + if (parser->openTokenDepth == STACK_DEPTH) { + syntaxError(parser, 12); return false; } - if (extended) openTokenTypeStack[openTokenDepth] = 0; - openTokenPosStack[openTokenDepth++] = tokenPos; + parser->openTokenTypeStack[parser->openTokenDepth] = 0; + parser->openTokenPosStack[parser->openTokenDepth++] = tokenPos; return true; } -static inline __attribute__((always_inline)) bool pushTemplate () { - if (templateStackDepth == STACK_DEPTH || openTokenDepth == STACK_DEPTH) { - syntaxError(12); +static CJS_INLINE bool pushTemplate(Parser* parser) { + if (parser->templateStackDepth == STACK_DEPTH || parser->openTokenDepth == STACK_DEPTH) { + syntaxError(parser, 12); return false; } - templateStack[templateStackDepth++] = templateDepth; - if (extended) openTokenTypeStack[openTokenDepth] = 0; - templateDepth = ++openTokenDepth; + parser->templateStack[parser->templateStackDepth++] = parser->templateDepth; + parser->openTokenTypeStack[parser->openTokenDepth] = 0; + parser->openTokenPosStack[parser->openTokenDepth] = SOURCE_BEFORE; + parser->templateDepth = ++parser->openTokenDepth; return true; } -uint32_t parseCJS (uint16_t* _source, uint32_t _sourceLen, void (*_addExport)(const uint16_t*, const uint16_t*), void (*_addReexport)(const uint16_t*, const uint16_t*), void (*_addUnsafeGetter)(const uint16_t*, const uint16_t*), void (*_clearReexports)()) { - return parseCJSWithOptions(_source, _sourceLen, _addExport, _addReexport, _addUnsafeGetter, _clearReexports, 0); -} - // Note: parsing is based on the _assumption_ that the source is already valid -uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_addExport)(const uint16_t*, const uint16_t*), void (*_addReexport)(const uint16_t*, const uint16_t*), void (*_addUnsafeGetter)(const uint16_t*, const uint16_t*), void (*_clearReexports)(), uint32_t options) { - source = _source; - sourceLen = _sourceLen; - allowMinifiedEnumerable = (options & 1) != 0; - extended = (options & 2) != 0; - if (_addExport) - addExport = _addExport; - if (_addReexport) - addReexport = _addReexport; - if (_addUnsafeGetter) - addUnsafeGetter = _addUnsafeGetter; - - templateStackDepth = 0; - openTokenDepth = 0; - templateDepth = UINT16_MAX; - lastTokenPos = (uint16_t*)EMPTY_CHAR; - lastSlashWasDivision = false; - parse_error = 0; - error = 0; - templateStack = &templateStack_[0]; - openTokenPosStack = &openTokenPosStack_[0]; - firstStarExport = NULL; - lastStarExport = NULL; - nextBraceIsClass = false; - exportObjectPos = 0; - - pos = (uint16_t*)(source - 1); - uint16_t ch = '\0'; - end = pos + sourceLen; +uint32_t cjs_lexer_scan (Parser* parser) { + const uint16_t* input = parser->input; + uint16_t ch = 0; + Cursor lastOpenTokenPos = SOURCE_BEFORE; + Cursor lastClosedTokenPos = SOURCE_BEFORE; + uint8_t lastOpenTokenType = 0; // Handle #! - if (*source == '#' && *(source + 1) == '!') { - if (sourceLen == 2) + if (at(parser, SOURCE_START) == '#' && at(parser, SOURCE_START + 1) == '!') { + if (parser->sourceLen == 2) return 0; - pos += 2; - while (pos++ < end) { - ch = *pos; + parser->pos += 2; + while (++parser->pos <= parser->end) { + ch = scanInput(input, parser->pos); if (ch == '\n' || ch == '\r') break; } } - while (pos++ < end) { - ch = *pos; + while (++parser->pos <= parser->end) { + ch = scanInput(input, parser->pos); if (ch == 32 || ch < 14 && ch > 8) continue; - if (openTokenDepth == 0) { + + if (parser->openTokenDepth == 0) { switch (ch) { case 'i': - if (str_eq5(pos + 1, 'm', 'p', 'o', 'r', 't') && keywordStart(pos)) - throwIfImportStatement(); + if (str_eq5(parser, parser->pos + 1, 'm', 'p', 'o', 'r', 't') && keywordStart(parser, parser->pos)) + throwIfImportStatement(parser); goto skipTokenRun; case 'r': { - uint16_t* startPos = pos; - if (tryParseRequire(Import) && keywordStart(startPos)) - tryBacktrackAddStarExportBinding(startPos - 1); + Cursor startPos = parser->pos; + if (tryParseRequire(parser, Import) && keywordStart(parser, startPos)) + tryBacktrackAddStarExportBinding(parser, startPos - 1); goto skipTokenRun; } case '_': - if (str_eq22(pos + 1, 'i', 'n', 't', 'e', 'r', 'o', 'p', 'R', 'e', 'q', 'u', 'i', 'r', 'e', 'W', 'i', 'l', 'd', 'c', 'a', 'r', 'd') && (keywordStart(pos) || *(pos - 1) == '.')) { - uint16_t* startPos = pos; - pos += 23; - if (*pos == '(') { - pos++; - if (!pushOpenToken(lastTokenPos)) - return error; - if (tryParseRequire(Import) && keywordStart(startPos)) - tryBacktrackAddStarExportBinding(startPos - 1); + if (str_eq22(parser, parser->pos + 1, 'i', 'n', 't', 'e', 'r', 'o', 'p', 'R', 'e', 'q', 'u', 'i', 'r', 'e', 'W', 'i', 'l', 'd', 'c', 'a', 'r', 'd') && (keywordStart(parser, parser->pos) || at(parser, parser->pos - 1) == '.')) { + Cursor startPos = parser->pos; + parser->pos += 23; + if (at(parser, parser->pos) == '(') { + parser->pos++; + if (!pushOpenToken(parser, parser->lastTokenPos)) + return parser->error; + if (tryParseRequire(parser, Import) && keywordStart(parser, startPos)) + tryBacktrackAddStarExportBinding(parser, startPos - 1); } } - else if (str_eq7(pos + 1, '_', 'e', 'x', 'p', 'o', 'r', 't') && (keywordStart(pos) || *(pos - 1) == '.')) { - pos += 8; - if (str_eq4(pos, 'S', 't', 'a', 'r')) - pos += 4; - if (*pos == '(') { - if (!pushOpenToken(lastTokenPos)) - return error; - if (*(pos + 1) == 'r') { - pos++; - tryParseRequire(ExportStar); + else if (str_eq7(parser, parser->pos + 1, '_', 'e', 'x', 'p', 'o', 'r', 't') && (keywordStart(parser, parser->pos) || at(parser, parser->pos - 1) == '.')) { + parser->pos += 8; + if (str_eq4(parser, parser->pos, 'S', 't', 'a', 'r')) + parser->pos += 4; + if (at(parser, parser->pos) == '(') { + if (!pushOpenToken(parser, parser->lastTokenPos)) + return parser->error; + if (at(parser, parser->pos + 1) == 'r') { + parser->pos++; + tryParseRequire(parser, ExportStar); } } } @@ -171,70 +175,76 @@ uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_ad switch (ch) { case 'e': - if (str_eq5(pos + 1, 'x', 'p', 'o', 'r', 't') && keywordStart(pos)) { - if (*(pos + 6) == 's') - tryParseExportsDotAssign(false); - else if (openTokenDepth == 0) - throwIfExportStatement(); + if (str_eq5(parser, parser->pos + 1, 'x', 'p', 'o', 'r', 't') && keywordStart(parser, parser->pos)) { + if (at(parser, parser->pos + 6) == 's') + tryParseExportsDotAssign(parser, false); + else if (parser->openTokenDepth == 0) + throwIfExportStatement(parser); } goto skipTokenRun; case 'c': - if (keywordStart(pos) && str_eq4(pos + 1, 'l', 'a', 's', 's') && isBrOrWs(*(pos + 5))) - nextBraceIsClass = true; + if (keywordStart(parser, parser->pos) && str_eq4(parser, parser->pos + 1, 'l', 'a', 's', 's') && isBrOrWs(at(parser, parser->pos + 5))) + parser->nextBraceIsClass = true; goto skipTokenRun; case 'm': - if (str_eq5(pos + 1, 'o', 'd', 'u', 'l', 'e') && keywordStart(pos)) - tryParseModuleExportsDotAssign(); + if (str_eq5(parser, parser->pos + 1, 'o', 'd', 'u', 'l', 'e') && keywordStart(parser, parser->pos)) + tryParseModuleExportsDotAssign(parser); goto skipTokenRun; case 'O': - if (str_eq5(pos + 1, 'b', 'j', 'e', 'c', 't') && keywordStart(pos)) - tryParseObjectDefineOrKeys(openTokenDepth == 0); + if (str_eq5(parser, parser->pos + 1, 'b', 'j', 'e', 'c', 't') && keywordStart(parser, parser->pos)) + tryParseObjectDefineOrKeys(parser, parser->openTokenDepth == 0); goto skipTokenRun; case '(': - if (!pushOpenToken(lastTokenPos)) - return error; + if (!pushOpenToken(parser, parser->lastTokenPos)) + return parser->error; break; case '[': - if (extended && !pushOpenToken(lastTokenPos)) - return error; + if (parser->extended && !pushOpenToken(parser, parser->lastTokenPos)) + return parser->error; break; case ']': - if (extended) { - if (openTokenDepth == 0) - return syntaxError(8), error; - openTokenDepth--; + if (parser->extended) { + if (parser->openTokenDepth == 0) + return syntaxError(parser, 8), parser->error; + parser->openTokenDepth--; } break; case ',': - if (extended && openTokenDepth && (openTokenTypeStack[openTokenDepth - 1] & ExportObjectToken)) - readExportProperty(); + if (parser->extended && parser->openTokenDepth && (parser->openTokenTypeStack[parser->openTokenDepth - 1] & ExportObjectToken)) + readExportProperty(parser); break; case ')': - if (openTokenDepth == 0) - return syntaxError(8), error; - openTokenDepth--; + if (parser->openTokenDepth == 0) + return syntaxError(parser, 8), parser->error; + parser->openTokenDepth--; + lastOpenTokenPos = parser->openTokenPosStack[parser->openTokenDepth]; + lastOpenTokenType = 0; + lastClosedTokenPos = parser->pos; break; case '{': - if (!pushOpenToken(lastTokenPos)) - return error; - openTokenTypeStack[openTokenDepth - 1] = nextBraceIsClass ? ClassToken : 0; - nextBraceIsClass = false; - if (extended && pos == exportObjectPos) { - openTokenTypeStack[openTokenDepth - 1] |= ExportObjectToken; - exportObjectPos = 0; - readExportProperty(); + if (!pushOpenToken(parser, parser->lastTokenPos)) + return parser->error; + parser->openTokenTypeStack[parser->openTokenDepth - 1] = parser->nextBraceIsClass ? ClassToken : 0; + parser->nextBraceIsClass = false; + if (parser->extended && parser->pos == parser->exportObjectPos) { + parser->openTokenTypeStack[parser->openTokenDepth - 1] |= ExportObjectToken; + parser->exportObjectPos = SOURCE_BEFORE; + readExportProperty(parser); } break; case '}': - if (openTokenDepth == 0) - return syntaxError(2), error; - if (openTokenDepth-- == templateDepth) { - templateDepth = templateStack[--templateStackDepth]; - templateString(); + if (parser->openTokenDepth == 0) + return syntaxError(parser, 2), parser->error; + lastOpenTokenPos = parser->openTokenPosStack[parser->openTokenDepth - 1]; + lastOpenTokenType = parser->openTokenTypeStack[parser->openTokenDepth - 1]; + lastClosedTokenPos = parser->pos; + if (parser->openTokenDepth-- == parser->templateDepth) { + parser->templateDepth = parser->templateStack[--parser->templateStackDepth]; + templateString(parser); } else { - if (templateDepth != UINT16_MAX && openTokenDepth < templateDepth) - return syntaxError(3), error; + if (parser->templateDepth != UINT16_MAX && parser->openTokenDepth < parser->templateDepth) + return syntaxError(parser, 3), parser->error; } break; case '<': @@ -242,17 +252,17 @@ uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_ad break; case '\'': case '"': - stringLiteral(ch); + stringLiteral(parser, ch); break; case '/': { - uint16_t next_ch = *(pos + 1); + uint16_t next_ch = at(parser, parser->pos + 1); if (next_ch == '/') { - lineComment(); + lineComment(parser); // dont update lastToken continue; } else if (next_ch == '*') { - blockComment(); + blockComment(parser); // dont update lastToken continue; } @@ -261,62 +271,65 @@ uint32_t parseCJSWithOptions (uint16_t* _source, uint32_t _sourceLen, void (*_ad // - what token came previously (lastToken) // - if a closing brace or paren, what token came before the corresponding // opening brace or paren (lastOpenTokenIndex) - uint16_t lastToken = *lastTokenPos; + uint16_t lastToken = at(parser, parser->lastTokenPos); + Cursor preceding = parser->lastTokenPos == lastClosedTokenPos ? lastOpenTokenPos : SOURCE_BEFORE; + uint8_t closingType = parser->lastTokenPos == lastClosedTokenPos ? lastOpenTokenType : 0; if (isExpressionPunctuator(lastToken) && - !(lastToken == '.' && (*(lastTokenPos - 1) >= '0' && *(lastTokenPos - 1) <= '9')) && - !(lastToken == '+' && *(lastTokenPos - 1) == '+') && !(lastToken == '-' && *(lastTokenPos - 1) == '-') || - lastToken == ')' && isParenKeyword(openTokenPosStack[openTokenDepth]) || - lastToken == '}' && (isExpressionTerminator(openTokenPosStack[openTokenDepth]) || - (openTokenTypeStack[openTokenDepth] & ClassToken) || - extended && isStatementBrace(openTokenPosStack[openTokenDepth], openTokenDepth)) || - lastToken == '/' && lastSlashWasDivision || - isExpressionKeyword(lastTokenPos) || + !(lastToken == '.' && (at(parser, parser->lastTokenPos - 1) >= '0' && at(parser, parser->lastTokenPos - 1) <= '9')) && + !(lastToken == '+' && at(parser, parser->lastTokenPos - 1) == '+') && !(lastToken == '-' && at(parser, parser->lastTokenPos - 1) == '-') || + lastToken == ')' && isParenKeyword(parser, preceding) || + lastToken == '}' && (isExpressionTerminator(parser, preceding) || + (closingType & ClassToken) || + parser->extended && isStatementBrace(parser, preceding, parser->openTokenDepth)) || + lastToken == '/' && parser->lastSlashWasDivision || + isExpressionKeyword(parser, parser->lastTokenPos) || !lastToken) { - regularExpression(); - lastSlashWasDivision = false; + regularExpression(parser); + parser->lastSlashWasDivision = false; } else { - lastSlashWasDivision = true; + parser->lastSlashWasDivision = true; } } break; } case '`': - if (templateDepth == UINT16_MAX - 1) - return syntaxError(4), error; - templateString(); + if (parser->templateDepth == UINT16_MAX - 1) + return syntaxError(parser, 4), parser->error; + templateString(parser); break; default: skipTokenRun: - if (!isTokenRunChar(*pos)) + if (!isTokenRunChar(at(parser, parser->pos))) break; - while (isTokenRunChar(*(pos + 1))) - pos++; + while (parser->pos < parser->end && + isTokenRunChar(scanInput(input, parser->pos + 1))) + parser->pos++; } - lastTokenPos = pos; + parser->lastTokenPos = parser->pos; } - if (templateDepth != UINT16_MAX || openTokenDepth || error) { - if (!error) - syntaxError(1); - return error; + if (parser->templateDepth != UINT16_MAX || parser->openTokenDepth || parser->error) { + if (!parser->error) + syntaxError(parser, 1); + return parser->error; } // success return 0; } -void tryBacktrackAddStarExportBinding (uint16_t* bPos) { - while (*bPos == ' ' && bPos > source) +static void tryBacktrackAddStarExportBinding(Parser* parser, Cursor bPos) { + while (at(parser, bPos) == ' ' && bPos > SOURCE_START) bPos--; - if (*bPos == '=') { + if (at(parser, bPos) == '=') { bPos--; - while (*bPos == ' ' && bPos > source) + while (at(parser, bPos) == ' ' && bPos > SOURCE_START) bPos--; uint32_t charCode; - uint16_t* id_end = bPos; + Cursor id_end = bPos; bool identifierStart = false; - while ((charCode = fullCharCodeAtLast(bPos)) && bPos > source) { + while ((charCode = fullCharCodeAtLast(parser, bPos)) && bPos > SOURCE_START) { if (charCode == '\\') return; if (!isIdentifierChar(charCode)) @@ -324,598 +337,600 @@ void tryBacktrackAddStarExportBinding (uint16_t* bPos) { identifierStart = isIdentifierStart(charCode); bPos -= charCodeByteLen(charCode); } - if (identifierStart && *bPos == ' ') { - starExportBinding_.id_start = bPos + 1; - starExportBinding_.id_end = id_end + 1; - while (*bPos == ' ' && bPos > source) + if (identifierStart && at(parser, bPos) == ' ') { + parser->starExportBinding_.id_start = bPos + 1; + parser->starExportBinding_.id_end = id_end + 1; + while (at(parser, bPos) == ' ' && bPos > SOURCE_START) bPos--; - switch (*bPos) { + switch (at(parser, bPos)) { case 'r': - if (!readPrecedingKeyword2(bPos - 1, 'v', 'a')) + if (!readPrecedingKeyword2(parser, bPos - 1, 'v', 'a')) return; break; case 't': - if (!readPrecedingKeyword2(bPos - 1, 'l', 'e') && !readPrecedingKeyword4(bPos - 1, 'c', 'o', 'n', 's')) + if (!readPrecedingKeyword2(parser, bPos - 1, 'l', 'e') && !readPrecedingKeyword4(parser, bPos - 1, 'c', 'o', 'n', 's')) return; break; default: return; } - ensureAnalysisCapacity(sizeof(StarExportBinding)); - StarExportBinding* binding = (StarExportBinding*)(uintptr_t)analysis_head; - analysis_head += sizeof(StarExportBinding); - *binding = starExportBinding_; + StarExportBinding* binding = cjs_lexer_allocate(parser->result, sizeof(StarExportBinding)); + if (!binding) { + syntaxError(parser, 13); + return; + } + *binding = parser->starExportBinding_; binding->next = NULL; - if (lastStarExport) - lastStarExport->next = binding; + if (parser->lastStarExport) + parser->lastStarExport->next = binding; else - firstStarExport = binding; - lastStarExport = binding; + parser->firstStarExport = binding; + parser->lastStarExport = binding; } } } -bool tryParseObjectHasOwnProperty (uint16_t* it_id_start, ptrdiff_t it_id_len) { - uint16_t ch = commentWhitespace(); - if (ch != 'O' || !str_eq5(pos + 1, 'b', 'j', 'e', 'c', 't')) return false; - pos += 6; - ch = commentWhitespace(); +static bool tryParseObjectHasOwnProperty(Parser* parser, Cursor it_id_start, ptrdiff_t it_id_len) { + uint16_t ch = commentWhitespace(parser); + if (ch != 'O' || !str_eq5(parser, parser->pos + 1, 'b', 'j', 'e', 'c', 't')) return false; + parser->pos += 6; + ch = commentWhitespace(parser); if (ch != '.') return false; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch == 'p') { - if (!str_eq8(pos + 1, 'r', 'o', 't', 'o', 't', 'y', 'p', 'e')) return false; - pos += 9; - ch = commentWhitespace(); + if (!str_eq8(parser, parser->pos + 1, 'r', 'o', 't', 'o', 't', 'y', 'p', 'e')) return false; + parser->pos += 9; + ch = commentWhitespace(parser); if (ch != '.') return false; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } - if (ch != 'h' || !str_eq13(pos + 1, 'a', 's', 'O', 'w', 'n', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'y')) return false; - pos += 14; - ch = commentWhitespace(); + if (ch != 'h' || !str_eq13(parser, parser->pos + 1, 'a', 's', 'O', 'w', 'n', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'y')) return false; + parser->pos += 14; + ch = commentWhitespace(parser); if (ch != '.') return false; - pos++; - ch = commentWhitespace(); - if (ch != 'c' || !str_eq3(pos + 1, 'a', 'l', 'l')) return false; - pos += 4; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'c' || !str_eq3(parser, parser->pos + 1, 'a', 'l', 'l')) return false; + parser->pos += 4; + ch = commentWhitespace(parser); if (ch != '(') return false; - pos++; - ch = commentWhitespace(); - if (!identifier(ch)) return false; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!identifier(parser, ch)) return false; + ch = commentWhitespace(parser); if (ch != ',') return false; - pos++; - ch = commentWhitespace(); - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) return false; - pos += it_id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) return false; + parser->pos += it_id_len; + ch = commentWhitespace(parser); if (ch != ')') return false; - pos++; + parser->pos++; return true; } -static inline bool tryParseMinifiedEnumerable (uint16_t ch) { - if (!allowMinifiedEnumerable || ch != '!') return false; - pos++; - if (commentWhitespace() != '0') return false; - pos++; +static inline bool tryParseMinifiedEnumerable(Parser* parser, uint16_t ch) { + if (!parser->allowMinifiedEnumerable || ch != '!') return false; + parser->pos++; + if (commentWhitespace(parser) != '0') return false; + parser->pos++; return true; } -void tryParseObjectDefineOrKeys (bool keys) { - pos += 6; - uint16_t* revertPos = pos - 1; - uint16_t ch = commentWhitespace(); +static void tryParseObjectDefineOrKeys(Parser* parser, bool keys) { + parser->pos += 6; + Cursor revertPos = parser->pos - 1; + uint16_t ch = commentWhitespace(parser); if (ch == '.') { - pos++; - ch = commentWhitespace(); - if (extended && ch == 'd') { - readExportDefinition(); - pos = revertPos; + parser->pos++; + ch = commentWhitespace(parser); + if (parser->extended && ch == 'd') { + readExportDefinition(parser); + parser->pos = revertPos; return; } - if (ch == 'd' && str_eq13(pos + 1, 'e', 'f', 'i', 'n', 'e', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'y')) { - uint16_t* exportStart = 0; - uint16_t* exportEnd = 0; + if (ch == 'd' && str_eq13(parser, parser->pos + 1, 'e', 'f', 'i', 'n', 'e', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'y')) { + Cursor exportStart = SOURCE_START; + Cursor exportEnd = SOURCE_START; while (true) { - pos += 14; - revertPos = pos - 1; - ch = commentWhitespace(); + parser->pos += 14; + revertPos = parser->pos - 1; + ch = commentWhitespace(parser); if (ch != '(') break; - pos++; - ch = commentWhitespace(); - if (!readExportsOrModuleDotExports(ch)) break; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!readExportsOrModuleDotExports(parser, ch)) break; + ch = commentWhitespace(parser); if (ch != ',') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != '\'' && ch != '"') break; - exportStart = pos; - stringLiteral(ch); - exportEnd = ++pos; - ch = commentWhitespace(); + exportStart = parser->pos; + stringLiteral(parser, ch); + exportEnd = ++parser->pos; + ch = commentWhitespace(parser); if (ch != ',') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != '{') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch == 'e') { - if (!str_eq9(pos + 1, 'n', 'u', 'm', 'e', 'r', 'a', 'b', 'l', 'e')) break; - pos += 10; - ch = commentWhitespace(); + if (!str_eq9(parser, parser->pos + 1, 'n', 'u', 'm', 'e', 'r', 'a', 'b', 'l', 'e')) break; + parser->pos += 10; + ch = commentWhitespace(parser); if (ch != ':') break; - pos++; - ch = commentWhitespace(); - if (ch == 't' && str_eq3(pos + 1, 'r', 'u', 'e')) { - pos += 4; - } else if (!tryParseMinifiedEnumerable(ch)) { + parser->pos++; + ch = commentWhitespace(parser); + if (ch == 't' && str_eq3(parser, parser->pos + 1, 'r', 'u', 'e')) { + parser->pos += 4; + } else if (!tryParseMinifiedEnumerable(parser, ch)) { break; } - ch = commentWhitespace(); + ch = commentWhitespace(parser); if (ch != 44) break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } if (ch == 'v') { - if (!str_eq4(pos + 1, 'a', 'l', 'u', 'e')) break; - pos += 5; - ch = commentWhitespace(); + if (!str_eq4(parser, parser->pos + 1, 'a', 'l', 'u', 'e')) break; + parser->pos += 5; + ch = commentWhitespace(parser); if (ch != ':') break; - addExport(exportStart, exportEnd); - pos = revertPos; + cjs_lexer_add(parser, &parser->result->exports, exportStart, exportEnd); + parser->pos = revertPos; return; } else if (ch == 'g') { - if (!str_eq2(pos + 1, 'e', 't')) break; - pos += 3; - ch = commentWhitespace(); + if (!str_eq2(parser, parser->pos + 1, 'e', 't')) break; + parser->pos += 3; + ch = commentWhitespace(parser); if (ch == ':') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != 'f') break; - if (!str_eq7(pos + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n')) break; - pos += 8; - uint16_t* lastPos = pos; - ch = commentWhitespace(); - if (ch != '(' && (lastPos == pos || !identifier(ch))) break; - ch = commentWhitespace(); + if (!str_eq7(parser, parser->pos + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n')) break; + parser->pos += 8; + Cursor lastPos = parser->pos; + ch = commentWhitespace(parser); + if (ch != '(' && (lastPos == parser->pos || !identifier(parser, ch))) break; + ch = commentWhitespace(parser); } if (ch != '(') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != ')') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != '{') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != 'r') break; - if (!str_eq5(pos + 1, 'e', 't', 'u', 'r', 'n')) break; - pos += 6; - ch = commentWhitespace(); - if (!identifier(ch)) break; - ch = commentWhitespace(); + if (!str_eq5(parser, parser->pos + 1, 'e', 't', 'u', 'r', 'n')) break; + parser->pos += 6; + ch = commentWhitespace(parser); + if (!identifier(parser, ch)) break; + ch = commentWhitespace(parser); if (ch == '.') { - pos++; - ch = commentWhitespace(); - if (!identifier(ch)) break; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!identifier(parser, ch)) break; + ch = commentWhitespace(parser); } else if (ch == '[') { - pos++; - ch = commentWhitespace(); - if (ch == '\'' || ch == '"') stringLiteral(ch); + parser->pos++; + ch = commentWhitespace(parser); + if (ch == '\'' || ch == '"') stringLiteral(parser, ch); else break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != ']') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } if (ch == ';') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } if (ch != '}') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch == ',') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } if (ch != '}') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != ')') break; - addExport(exportStart, exportEnd); + cjs_lexer_add(parser, &parser->result->exports, exportStart, exportEnd); return; } break; } - if (exportEnd > 0) { - addUnsafeGetter(exportStart, exportEnd); + if (exportEnd > SOURCE_START) { + cjs_lexer_add(parser, &parser->result->unsafe_getters, exportStart, exportEnd); } } - else if (keys && ch == 'k' && str_eq3(pos + 1, 'e', 'y', 's')) { + else if (keys && ch == 'k' && str_eq3(parser, parser->pos + 1, 'e', 'y', 's')) { while (true) { - pos += 4; - revertPos = pos - 1; - ch = commentWhitespace(); + parser->pos += 4; + revertPos = parser->pos - 1; + ch = commentWhitespace(parser); if (ch != '(') break; - pos++; - ch = commentWhitespace(); - uint16_t* id_start = pos; - if (!identifier(ch)) break; - ptrdiff_t id_len = pos - id_start; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + Cursor id_start = parser->pos; + if (!identifier(parser, ch)) break; + ptrdiff_t id_len = parser->pos - id_start; + ch = commentWhitespace(parser); if (ch != ')') break; - revertPos = pos++; - ch = commentWhitespace(); + revertPos = parser->pos++; + ch = commentWhitespace(parser); if (ch != '.') break; - pos++; - ch = commentWhitespace(); - if (ch != 'f' || !str_eq6(pos + 1, 'o', 'r', 'E', 'a', 'c', 'h')) break; - pos += 7; - ch = commentWhitespace(); - revertPos = pos - 1; + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'f' || !str_eq6(parser, parser->pos + 1, 'o', 'r', 'E', 'a', 'c', 'h')) break; + parser->pos += 7; + ch = commentWhitespace(parser); + revertPos = parser->pos - 1; if (ch != '(') break; - pos++; - ch = commentWhitespace(); - if (ch != 'f' || !str_eq7(pos + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n')) break; - pos += 8; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'f' || !str_eq7(parser, parser->pos + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n')) break; + parser->pos += 8; + ch = commentWhitespace(parser); if (ch != '(') break; - pos++; - ch = commentWhitespace(); - uint16_t* it_id_start = pos; - if (!identifier(ch)) break; - ptrdiff_t it_id_len = pos - it_id_start; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + Cursor it_id_start = parser->pos; + if (!identifier(parser, ch)) break; + ptrdiff_t it_id_len = parser->pos - it_id_start; + ch = commentWhitespace(parser); if (ch != ')') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != '{') break; - pos++; - ch = commentWhitespace(); - if (ch != 'i' || *(pos + 1) != 'f') break; - pos += 2; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'i' || at(parser, parser->pos + 1) != 'f') break; + parser->pos += 2; + ch = commentWhitespace(parser); if (ch != '(') break; - pos++; - ch = commentWhitespace(); - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) break; - pos += it_id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) break; + parser->pos += it_id_len; + ch = commentWhitespace(parser); // `if (` IDENTIFIER$2 `===` ( `'default'` | `"default"` ) `||` IDENTIFIER$2 `===` ( '__esModule' | `"__esModule"` ) `) return` `;`? | if (ch == '=') { - if (!str_eq2(pos + 1, '=', '=')) break; - pos += 3; - ch = commentWhitespace(); + if (!str_eq2(parser, parser->pos + 1, '=', '=')) break; + parser->pos += 3; + ch = commentWhitespace(parser); if (ch != '"' && ch != '\'') break; uint16_t quot = ch; - if (!str_eq7(pos + 1, 'd', 'e', 'f', 'a', 'u', 'l', 't')) break; - pos += 8; - ch = commentWhitespace(); + if (!str_eq7(parser, parser->pos + 1, 'd', 'e', 'f', 'a', 'u', 'l', 't')) break; + parser->pos += 8; + ch = commentWhitespace(parser); if (ch != quot) break; - pos += 1; - ch = commentWhitespace(); - if (ch != '|' || *(pos + 1) != '|') break; - pos += 2; - ch = commentWhitespace(); - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) break; - pos += it_id_len; - ch = commentWhitespace(); - if (ch != '=' || !str_eq2(pos + 1, '=', '=')) break; - pos += 3; - ch = commentWhitespace(); + parser->pos += 1; + ch = commentWhitespace(parser); + if (ch != '|' || at(parser, parser->pos + 1) != '|') break; + parser->pos += 2; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) break; + parser->pos += it_id_len; + ch = commentWhitespace(parser); + if (ch != '=' || !str_eq2(parser, parser->pos + 1, '=', '=')) break; + parser->pos += 3; + ch = commentWhitespace(parser); if (ch != '"' && ch != '\'') break; quot = ch; - if (!str_eq10(pos + 1, '_', '_', 'e', 's', 'M', 'o', 'd', 'u', 'l', 'e')) break; - pos += 11; - ch = commentWhitespace(); + if (!str_eq10(parser, parser->pos + 1, '_', '_', 'e', 's', 'M', 'o', 'd', 'u', 'l', 'e')) break; + parser->pos += 11; + ch = commentWhitespace(parser); if (ch != quot) break; - pos += 1; - ch = commentWhitespace(); + parser->pos += 1; + ch = commentWhitespace(parser); if (ch != ')') break; - pos += 1; - ch = commentWhitespace(); - if (ch != 'r' || !str_eq5(pos + 1, 'e', 't', 'u', 'r', 'n')) break; - pos += 6; - ch = commentWhitespace(); + parser->pos += 1; + ch = commentWhitespace(parser); + if (ch != 'r' || !str_eq5(parser, parser->pos + 1, 'e', 't', 'u', 'r', 'n')) break; + parser->pos += 6; + ch = commentWhitespace(parser); if (ch == ';') - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); // `if (` - if (ch == 'i' && *(pos + 1) == 'f') { + if (ch == 'i' && at(parser, parser->pos + 1) == 'f') { bool inIf = true; - pos += 2; - ch = commentWhitespace(); + parser->pos += 2; + ch = commentWhitespace(parser); if (ch != '(') break; - pos++; - uint16_t *ifInnerPos = pos; + parser->pos++; + Cursor ifInnerPos = parser->pos; // `Object.prototype.hasOwnProperty.call(` IDENTIFIER `, ` IDENTIFIER$2 `)) return` `;`? - if (tryParseObjectHasOwnProperty(it_id_start, it_id_len)) { - ch = commentWhitespace(); + if (tryParseObjectHasOwnProperty(parser, it_id_start, it_id_len)) { + ch = commentWhitespace(parser); if (ch != ')') break; - pos++; - ch = commentWhitespace(); - if (ch != 'r' || !str_eq5(pos + 1, 'e', 't', 'u', 'r', 'n')) break; - pos += 6; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'r' || !str_eq5(parser, parser->pos + 1, 'e', 't', 'u', 'r', 'n')) break; + parser->pos += 6; + ch = commentWhitespace(parser); if (ch == ';') - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); // match next if - if (ch == 'i' && *(pos + 1) == 'f') { - pos += 2; - ch = commentWhitespace(); + if (ch == 'i' && at(parser, parser->pos + 1) == 'f') { + parser->pos += 2; + ch = commentWhitespace(parser); if (ch != '(') break; - pos++; + parser->pos++; } else { inIf = false; } } else { - pos = ifInnerPos; + parser->pos = ifInnerPos; } // `if (` IDENTIFIER$2 `in` EXPORTS_IDENTIFIER `&&` EXPORTS_IDENTIFIER `[` IDENTIFIER$2 `] ===` IDENTIFIER$1 `[` IDENTIFIER$2 `]) return` `;`? if (inIf) { - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) break; - pos += it_id_len; - ch = commentWhitespace(); - if (ch != 'i' || !str_eq2(pos + 1, 'n', ' ')) break; - pos += 3; - ch = commentWhitespace(); - if (!readExportsOrModuleDotExports(ch)) break; - ch = commentWhitespace(); - if (ch != '&' || *(pos + 1) != '&') break; - pos += 2; - ch = commentWhitespace(); - if (!readExportsOrModuleDotExports(ch)) break; - ch = commentWhitespace(); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) break; + parser->pos += it_id_len; + ch = commentWhitespace(parser); + if (ch != 'i' || !str_eq2(parser, parser->pos + 1, 'n', ' ')) break; + parser->pos += 3; + ch = commentWhitespace(parser); + if (!readExportsOrModuleDotExports(parser, ch)) break; + ch = commentWhitespace(parser); + if (ch != '&' || at(parser, parser->pos + 1) != '&') break; + parser->pos += 2; + ch = commentWhitespace(parser); + if (!readExportsOrModuleDotExports(parser, ch)) break; + ch = commentWhitespace(parser); if (ch != '[') break; - pos++; - ch = commentWhitespace(); - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) break; - pos += it_id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) break; + parser->pos += it_id_len; + ch = commentWhitespace(parser); if (ch != ']') break; - pos++; - ch = commentWhitespace(); - if (ch != '=' || !str_eq2(pos + 1, '=', '=')) break; - pos += 3; - ch = commentWhitespace(); - if (memcmp(pos, id_start, id_len * sizeof(uint16_t)) != 0) break; - pos += id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != '=' || !str_eq2(parser, parser->pos + 1, '=', '=')) break; + parser->pos += 3; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, id_start, (size_t)id_len)) break; + parser->pos += id_len; + ch = commentWhitespace(parser); if (ch != '[') break; - pos++; - ch = commentWhitespace(); - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) break; - pos += it_id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) break; + parser->pos += it_id_len; + ch = commentWhitespace(parser); if (ch != ']') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != ')') break; - pos++; - ch = commentWhitespace(); - if (ch != 'r' || !str_eq5(pos + 1, 'e', 't', 'u', 'r', 'n')) break; - pos += 6; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'r' || !str_eq5(parser, parser->pos + 1, 'e', 't', 'u', 'r', 'n')) break; + parser->pos += 6; + ch = commentWhitespace(parser); if (ch == ';') - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } } } // `if (` IDENTIFIER$2 `!==` ( `'default'` | `"default"` ) (`&& !` IDENTIFIER `.hasOwnProperty(` IDENTIFIER$2 `)` )? `)` else if (ch == '!') { - if (!str_eq2(pos + 1, '=', '=')) break; - pos += 3; - ch = commentWhitespace(); + if (!str_eq2(parser, parser->pos + 1, '=', '=')) break; + parser->pos += 3; + ch = commentWhitespace(parser); if (ch != '"' && ch != '\'') break; uint16_t quot = ch; - if (!str_eq7(pos + 1, 'd', 'e', 'f', 'a', 'u', 'l', 't')) break; - pos += 8; - ch = commentWhitespace(); + if (!str_eq7(parser, parser->pos + 1, 'd', 'e', 'f', 'a', 'u', 'l', 't')) break; + parser->pos += 8; + ch = commentWhitespace(parser); if (ch != quot) break; - pos += 1; - ch = commentWhitespace(); + parser->pos += 1; + ch = commentWhitespace(parser); if (ch == '&') { - if (*(pos + 1) != '&') break; - pos += 2; - ch = commentWhitespace(); + if (at(parser, parser->pos + 1) != '&') break; + parser->pos += 2; + ch = commentWhitespace(parser); if (ch != '!') break; - pos += 1; - ch = commentWhitespace(); - if (ch == 'O' && str_eq6(pos + 1, 'b', 'j', 'e', 'c', 't', '.')) { - if (!tryParseObjectHasOwnProperty(it_id_start, it_id_len)) break; + parser->pos += 1; + ch = commentWhitespace(parser); + if (ch == 'O' && str_eq6(parser, parser->pos + 1, 'b', 'j', 'e', 'c', 't', '.')) { + if (!tryParseObjectHasOwnProperty(parser, it_id_start, it_id_len)) break; } - else if (identifier(ch)) { - ch = commentWhitespace(); + else if (identifier(parser, ch)) { + ch = commentWhitespace(parser); if (ch != '.') break; - pos++; - ch = commentWhitespace(); - if (ch != 'h' || !str_eq13(pos + 1, 'a', 's', 'O', 'w', 'n', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'y')) break; - pos += 14; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'h' || !str_eq13(parser, parser->pos + 1, 'a', 's', 'O', 'w', 'n', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'y')) break; + parser->pos += 14; + ch = commentWhitespace(parser); if (ch != '(') break; - pos += 1; - ch = commentWhitespace(); - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) break; - pos += it_id_len; - ch = commentWhitespace(); + parser->pos += 1; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) break; + parser->pos += it_id_len; + ch = commentWhitespace(parser); if (ch != ')') break; - pos += 1; + parser->pos += 1; } - ch = commentWhitespace(); + ch = commentWhitespace(parser); } if (ch != ')') break; - pos += 1; - ch = commentWhitespace(); + parser->pos += 1; + ch = commentWhitespace(parser); } else break; // EXPORTS_IDENTIFIER `[` IDENTIFIER$2 `] =` IDENTIFIER$1 `[` IDENTIFIER$2 `]` - if (readExportsOrModuleDotExports(ch)) { - ch = commentWhitespace(); + if (readExportsOrModuleDotExports(parser, ch)) { + ch = commentWhitespace(parser); if (ch != '[') break; - pos++; - ch = commentWhitespace(); - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) break; - pos += it_id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) break; + parser->pos += it_id_len; + ch = commentWhitespace(parser); if (ch != ']') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != '=') break; - pos++; - ch = commentWhitespace(); - if (memcmp(pos, id_start, id_len * sizeof(uint16_t)) != 0) break; - pos += id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, id_start, (size_t)id_len)) break; + parser->pos += id_len; + ch = commentWhitespace(parser); if (ch != '[') break; - pos++; - ch = commentWhitespace(); - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) break; - pos += it_id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) break; + parser->pos += it_id_len; + ch = commentWhitespace(parser); if (ch != ']') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch == ';') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } } // `Object.defineProperty(` EXPORTS_IDENTIFIER `, ` IDENTIFIER$2 `, { enumerable: true, get: function () { return ` IDENTIFIER$1 `[` IDENTIFIER$2 `]; } })` else if (ch == 'O') { - if (!str_eq5(pos + 1, 'b', 'j', 'e', 'c', 't')) break; - pos += 6; - ch = commentWhitespace(); + if (!str_eq5(parser, parser->pos + 1, 'b', 'j', 'e', 'c', 't')) break; + parser->pos += 6; + ch = commentWhitespace(parser); if (ch != '.') break; - pos++; - ch = commentWhitespace(); - if (ch != 'd' || !str_eq13(pos + 1, 'e', 'f', 'i', 'n', 'e', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'y')) break; - pos += 14; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'd' || !str_eq13(parser, parser->pos + 1, 'e', 'f', 'i', 'n', 'e', 'P', 'r', 'o', 'p', 'e', 'r', 't', 'y')) break; + parser->pos += 14; + ch = commentWhitespace(parser); if (ch != '(') break; - pos++; - ch = commentWhitespace(); - if (!readExportsOrModuleDotExports(ch)) break; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!readExportsOrModuleDotExports(parser, ch)) break; + ch = commentWhitespace(parser); if (ch != ',') break; - pos++; - ch = commentWhitespace(); - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) break; - pos += it_id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) break; + parser->pos += it_id_len; + ch = commentWhitespace(parser); if (ch != ',') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != '{') break; - pos++; - ch = commentWhitespace(); - if (ch != 'e' || !str_eq9(pos + 1, 'n', 'u', 'm', 'e', 'r', 'a', 'b', 'l', 'e')) break; - pos += 10; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'e' || !str_eq9(parser, parser->pos + 1, 'n', 'u', 'm', 'e', 'r', 'a', 'b', 'l', 'e')) break; + parser->pos += 10; + ch = commentWhitespace(parser); if (ch != ':') break; - pos++; - ch = commentWhitespace(); - if (ch == 't' && str_eq3(pos + 1, 'r', 'u', 'e')) { - pos += 4; - } else if (!tryParseMinifiedEnumerable(ch)) { + parser->pos++; + ch = commentWhitespace(parser); + if (ch == 't' && str_eq3(parser, parser->pos + 1, 'r', 'u', 'e')) { + parser->pos += 4; + } else if (!tryParseMinifiedEnumerable(parser, ch)) { break; } - ch = commentWhitespace(); + ch = commentWhitespace(parser); if (ch != ',') break; - pos++; - ch = commentWhitespace(); - if (ch != 'g' || !str_eq2(pos + 1, 'e', 't')) break; - pos += 3; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'g' || !str_eq2(parser, parser->pos + 1, 'e', 't')) break; + parser->pos += 3; + ch = commentWhitespace(parser); if (ch == ':') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != 'f') break; - if (!str_eq7(pos + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n')) break; - pos += 8; - uint16_t* lastPos = pos; - ch = commentWhitespace(); - if (ch != '(' && (lastPos == pos || !identifier(ch))) break; - ch = commentWhitespace(); + if (!str_eq7(parser, parser->pos + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n')) break; + parser->pos += 8; + Cursor lastPos = parser->pos; + ch = commentWhitespace(parser); + if (ch != '(' && (lastPos == parser->pos || !identifier(parser, ch))) break; + ch = commentWhitespace(parser); } if (ch != '(') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != ')') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != '{') break; - pos++; - ch = commentWhitespace(); - if (ch != 'r' || !str_eq5(pos + 1, 'e', 't', 'u', 'r', 'n')) break; - pos += 6; - ch = commentWhitespace(); - if (memcmp(pos, id_start, id_len * sizeof(uint16_t)) != 0) break; - pos += id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (ch != 'r' || !str_eq5(parser, parser->pos + 1, 'e', 't', 'u', 'r', 'n')) break; + parser->pos += 6; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, id_start, (size_t)id_len)) break; + parser->pos += id_len; + ch = commentWhitespace(parser); if (ch != '[') break; - pos++; - ch = commentWhitespace(); - if (memcmp(pos, it_id_start, it_id_len * sizeof(uint16_t)) != 0) break; - pos += it_id_len; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!matches(parser, parser->pos, it_id_start, (size_t)it_id_len)) break; + parser->pos += it_id_len; + ch = commentWhitespace(parser); if (ch != ']') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch == ';') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } if (ch != '}') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch == ',') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } if (ch != '}') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != ')') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch == ';') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } } else break; if (ch != '}') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != ')') break; // search through export bindings to see if this is a star export // this is done last because it is a linear search through all require bindings // and by doing this search last after verifying the structure match, // we don't have to worry about the slow search algorithm - StarExportBinding* binding = firstStarExport; + StarExportBinding* binding = parser->firstStarExport; while (binding) { if (id_len == binding->id_end - binding->id_start && - 0 == memcmp(id_start, binding->id_start, id_len * sizeof(uint16_t))) { - addReexport(binding->specifier_start, binding->specifier_end); - pos = revertPos; + matches(parser, id_start, binding->id_start, (size_t)id_len)) { + cjs_lexer_add(parser, &parser->result->reexports, binding->specifier_start, binding->specifier_end); + parser->pos = revertPos; return; } binding = binding->next; @@ -924,61 +939,61 @@ void tryParseObjectDefineOrKeys (bool keys) { } } } - pos = revertPos; + parser->pos = revertPos; } -bool readExportsOrModuleDotExports (uint16_t ch) { - uint16_t* revertPos = pos; - if (ch == 'm' && str_eq5(pos + 1, 'o', 'd', 'u', 'l', 'e')) { - pos += 6; - ch = commentWhitespace(); +static bool readExportsOrModuleDotExports(Parser* parser, uint16_t ch) { + Cursor revertPos = parser->pos; + if (ch == 'm' && str_eq5(parser, parser->pos + 1, 'o', 'd', 'u', 'l', 'e')) { + parser->pos += 6; + ch = commentWhitespace(parser); if (ch != '.') { - pos = revertPos; + parser->pos = revertPos; return false; } - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } - if (ch == 'e' && str_eq6(pos + 1, 'x', 'p', 'o', 'r', 't', 's')) { - pos += 7; + if (ch == 'e' && str_eq6(parser, parser->pos + 1, 'x', 'p', 'o', 'r', 't', 's')) { + parser->pos += 7; return true; } else { - pos = revertPos; + parser->pos = revertPos; return false; } } -void tryParseModuleExportsDotAssign () { - pos += 6; - uint16_t* revertPos = pos - 1; - uint16_t ch = commentWhitespace(); +static void tryParseModuleExportsDotAssign(Parser* parser) { + parser->pos += 6; + Cursor revertPos = parser->pos - 1; + uint16_t ch = commentWhitespace(parser); if (ch == '.') { - pos++; - ch = commentWhitespace(); - if (ch == 'e' && str_eq6(pos + 1, 'x', 'p', 'o', 'r', 't', 's')) { - tryParseExportsDotAssign(true); + parser->pos++; + ch = commentWhitespace(parser); + if (ch == 'e' && str_eq6(parser, parser->pos + 1, 'x', 'p', 'o', 'r', 't', 's')) { + tryParseExportsDotAssign(parser, true); return; } } - pos = revertPos; + parser->pos = revertPos; } -void tryParseExportsDotAssign (bool assign) { - pos += 7; - uint16_t* revertPos = pos - 1; - uint16_t ch = commentWhitespace(); +static void tryParseExportsDotAssign(Parser* parser, bool assign) { + parser->pos += 7; + Cursor revertPos = parser->pos - 1; + uint16_t ch = commentWhitespace(parser); switch (ch) { // exports.asdf case '.': { - pos++; - ch = commentWhitespace(); - uint16_t* startPos = pos; - if (identifier(ch)) { - uint16_t* endPos = pos; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + Cursor startPos = parser->pos; + if (identifier(parser, ch)) { + Cursor endPos = parser->pos; + ch = commentWhitespace(parser); if (ch == '=') { - addExport(startPos, endPos); + cjs_lexer_add(parser, &parser->result->exports, startPos, endPos); return; } } @@ -986,263 +1001,263 @@ void tryParseExportsDotAssign (bool assign) { } // exports['asdf'] case '[': { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch == '\'' || ch == '"') { - uint16_t* startPos = pos; - stringLiteral(ch); - uint16_t* endPos = ++pos; - ch = commentWhitespace(); + Cursor startPos = parser->pos; + stringLiteral(parser, ch); + Cursor endPos = ++parser->pos; + ch = commentWhitespace(parser); if (ch != ']') break; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); if (ch != '=') break; - addExport(startPos, endPos); + cjs_lexer_add(parser, &parser->result->exports, startPos, endPos); } break; } // module.exports = case '=': { if (assign) { - if (!extended) clearReexports(); - pos++; - ch = commentWhitespace(); - if (extended) { - if (ch == '(') ch = readExportExpressionStart(); - if (ch == '{') exportObjectPos = pos; - else if (ch == 'r') tryParseRequire(ExportAssign); - pos = revertPos; + if (!parser->extended) clearCandidates(&parser->result->reexports); + parser->pos++; + ch = commentWhitespace(parser); + if (parser->extended) { + if (ch == '(') ch = readExportExpressionStart(parser); + if (ch == '{') parser->exportObjectPos = parser->pos; + else if (ch == 'r') tryParseRequire(parser, ExportAssign); + parser->pos = revertPos; return; } // { ... } if (ch == '{') { - tryParseLiteralExports(); + tryParseLiteralExports(parser); return; } // require('...') if (ch == 'r') - tryParseRequire(ExportAssign); + tryParseRequire(parser, ExportAssign); } } } - pos = revertPos; + parser->pos = revertPos; } -bool tryParseRequire (enum RequireType requireType) { - uint16_t* revertPos = pos; +static bool tryParseRequire(Parser* parser, enum RequireType requireType) { + Cursor revertPos = parser->pos; // require('...') - if (str_eq6(pos + 1, 'e', 'q', 'u', 'i', 'r', 'e')) { - pos += 7; - uint16_t ch = commentWhitespace(); + if (str_eq6(parser, parser->pos + 1, 'e', 'q', 'u', 'i', 'r', 'e')) { + parser->pos += 7; + uint16_t ch = commentWhitespace(parser); if (ch == '(') { - pos++; - ch = commentWhitespace(); - uint16_t* reexportStart = pos; + parser->pos++; + ch = commentWhitespace(parser); + Cursor reexportStart = parser->pos; if (ch == '\'' || ch == '"') { - stringLiteral(ch); - uint16_t* reexportEnd = ++pos; - ch = commentWhitespace(); + stringLiteral(parser, ch); + Cursor reexportEnd = ++parser->pos; + ch = commentWhitespace(parser); if (ch == ')') { switch (requireType) { case ExportStar: - addReexport(reexportStart, reexportEnd); + cjs_lexer_add(parser, &parser->result->reexports, reexportStart, reexportEnd); return true; case ExportAssign: - addReexport(reexportStart, reexportEnd); + cjs_lexer_add(parser, &parser->result->reexports, reexportStart, reexportEnd); return true; default: - starExportBinding_.specifier_start = reexportStart; - starExportBinding_.specifier_end = reexportEnd; + parser->starExportBinding_.specifier_start = reexportStart; + parser->starExportBinding_.specifier_end = reexportEnd; return true; } } } } - pos = revertPos; + parser->pos = revertPos; } return false; } -static bool matchesKeyword (const char* keyword, uint32_t length) { - if (pos > end || (uint32_t)(end - pos + 1) < length) return false; +static bool matchesKeyword(Parser* parser, const char* keyword, uint32_t length) { + if (parser->pos > parser->end || (uint32_t)(parser->end - parser->pos + 1) < length) return false; for (uint32_t i = 0; i < length; i++) { - if (pos[i] != keyword[i]) return false; + if (at(parser, parser->pos + i) != keyword[i]) return false; } return true; } -static uint16_t readExportExpressionStart () { +static uint16_t readExportExpressionStart(Parser* parser) { while (true) { - pos++; - uint16_t ch = commentWhitespace(); + parser->pos++; + uint16_t ch = commentWhitespace(parser); if (ch == '(') continue; - uint16_t* start = pos; + Cursor start = parser->pos; if (ch == '\'' || ch == '"') { - stringLiteral(ch); - pos++; + stringLiteral(parser, ch); + parser->pos++; } else if (ch == '{') { - pos++; - if (commentWhitespace() == '}') pos++; + parser->pos++; + if (commentWhitespace(parser) == '}') parser->pos++; else { - pos = start; + parser->pos = start; return ch; } } else { - while (pos <= end && isIdentifierChar(fullCharCode(*pos))) - pos += charCodeByteLen(fullCharCode(*pos)); + while (parser->pos <= parser->end && isIdentifierChar(fullCharCode(parser, at(parser, parser->pos)))) + parser->pos += charCodeByteLen(fullCharCode(parser, at(parser, parser->pos))); } - if (pos == start || commentWhitespace() != ',') { - pos = start; + if (parser->pos == start || commentWhitespace(parser) != ',') { + parser->pos = start; return ch; } } } -void readExportDefinition () { - bool property = matchesKeyword("defineProperty", 14); - bool properties = matchesKeyword("defineProperties", 16); +static void readExportDefinition(Parser* parser) { + bool property = matchesKeyword(parser, "defineProperty", 14); + bool properties = matchesKeyword(parser, "defineProperties", 16); if (!property && !properties) return; - pos += property ? 14 : 16; - uint16_t ch = commentWhitespace(); + parser->pos += property ? 14 : 16; + uint16_t ch = commentWhitespace(parser); if (ch != '(') return; - pos++; - ch = commentWhitespace(); - if (!readExportsOrModuleDotExports(ch)) return; - if (commentWhitespace() != ',') return; - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); + if (!readExportsOrModuleDotExports(parser, ch)) return; + if (commentWhitespace(parser) != ',') return; + parser->pos++; + ch = commentWhitespace(parser); if (properties) { - if (ch == '(') ch = readExportExpressionStart(); - if (ch == '{') exportObjectPos = pos; + if (ch == '(') ch = readExportExpressionStart(parser); + if (ch == '{') parser->exportObjectPos = parser->pos; } else if (ch == '\'' || ch == '"') { - uint16_t* nameStart = pos; - stringLiteral(ch); - uint16_t* nameEnd = ++pos; - if (commentWhitespace() == ',') addExport(nameStart, nameEnd); + Cursor nameStart = parser->pos; + stringLiteral(parser, ch); + Cursor nameEnd = ++parser->pos; + if (commentWhitespace(parser) == ',') cjs_lexer_add(parser, &parser->result->exports, nameStart, nameEnd); } } -void readExportProperty () { - uint16_t* revertPos = pos; - pos++; - uint16_t ch = commentWhitespace(); - if (ch == '.' && end - pos >= 2 && str_eq2(pos + 1, '.', '.')) { - pos += 3; - ch = commentWhitespace(); - if (ch == 'r') tryParseRequire(ExportAssign); - pos = revertPos; +static void readExportProperty(Parser* parser) { + Cursor revertPos = parser->pos; + parser->pos++; + uint16_t ch = commentWhitespace(parser); + if (ch == '.' && parser->end - parser->pos >= 2 && str_eq2(parser, parser->pos + 1, '.', '.')) { + parser->pos += 3; + ch = commentWhitespace(parser); + if (ch == 'r') tryParseRequire(parser, ExportAssign); + parser->pos = revertPos; return; } if (ch == '*') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } bool computed = ch == '['; if (computed) { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } - uint16_t* nameStart = pos; - uint16_t* nameEnd = 0; + Cursor nameStart = parser->pos; + Cursor nameEnd = SOURCE_START; if (ch == '\'' || ch == '"') { - stringLiteral(ch); - nameEnd = ++pos; + stringLiteral(parser, ch); + nameEnd = ++parser->pos; } - else if (!computed && identifier(ch)) { - nameEnd = pos; - ch = commentWhitespace(); - if ((nameEnd - nameStart == 3 && (str_eq3(nameStart, 'g', 'e', 't') || str_eq3(nameStart, 's', 'e', 't')) || - nameEnd - nameStart == 5 && str_eq5(nameStart, 'a', 's', 'y', 'n', 'c')) && + else if (!computed && identifier(parser, ch)) { + nameEnd = parser->pos; + ch = commentWhitespace(parser); + if ((nameEnd - nameStart == 3 && (str_eq3(parser, nameStart, 'g', 'e', 't') || str_eq3(parser, nameStart, 's', 'e', 't')) || + nameEnd - nameStart == 5 && str_eq5(parser, nameStart, 'a', 's', 'y', 'n', 'c')) && ch != ':' && ch != '(' && ch != ',' && ch != '}') { if (ch == '*') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } computed = ch == '['; if (computed) { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } - nameStart = pos; + nameStart = parser->pos; if (ch == '\'' || ch == '"') { - stringLiteral(ch); - nameEnd = ++pos; + stringLiteral(parser, ch); + nameEnd = ++parser->pos; } - else if (!computed && identifier(ch)) nameEnd = pos; + else if (!computed && identifier(parser, ch)) nameEnd = parser->pos; else nameEnd = 0; } } - ch = commentWhitespace(); + ch = commentWhitespace(parser); if (computed) { if (ch != ']') nameEnd = 0; else { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); } } if (nameEnd && (ch == ':' || ch == '(' || !computed && (ch == ',' || ch == '}'))) - addExport(nameStart, nameEnd); - pos = revertPos; -} - -void tryParseLiteralExports () { - uint16_t* revertPos = pos - 1; - while (pos++ < end) { - uint16_t ch = commentWhitespace(); - uint16_t* startPos = pos; - if (identifier(ch)) { - uint16_t* endPos = pos; - ch = commentWhitespace(); + cjs_lexer_add(parser, &parser->result->exports, nameStart, nameEnd); + parser->pos = revertPos; +} + +static void tryParseLiteralExports(Parser* parser) { + Cursor revertPos = parser->pos - 1; + while (parser->pos++ < parser->end) { + uint16_t ch = commentWhitespace(parser); + Cursor startPos = parser->pos; + if (identifier(parser, ch)) { + Cursor endPos = parser->pos; + ch = commentWhitespace(parser); if (ch == ':') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); // nothing more complex than identifier expressions for now - if (!identifier(ch) && *pos != '\\') { - pos = revertPos; + if (!identifier(parser, ch) && at(parser, parser->pos) != '\\') { + parser->pos = revertPos; return; } - ch = *pos; + ch = at(parser, parser->pos); } else if (ch != ',' && ch != '}' && ch != '=' && ch != '(') { - pos = revertPos; + parser->pos = revertPos; return; } - addExport(startPos, endPos); + cjs_lexer_add(parser, &parser->result->exports, startPos, endPos); } else if (ch == '\'' || ch == '"') { - uint16_t* startPos = pos; - stringLiteral(ch); - uint16_t* endPos = ++pos; - ch = commentWhitespace(); + Cursor startPos = parser->pos; + stringLiteral(parser, ch); + Cursor endPos = ++parser->pos; + ch = commentWhitespace(parser); if (ch == ':') { - pos++; - ch = commentWhitespace(); + parser->pos++; + ch = commentWhitespace(parser); // nothing more complex than identifier expressions for now - if (!identifier(ch) && *pos != '\\') { - pos = revertPos; + if (!identifier(parser, ch) && at(parser, parser->pos) != '\\') { + parser->pos = revertPos; return; } - ch = *pos; - addExport(startPos, endPos); + ch = at(parser, parser->pos); + cjs_lexer_add(parser, &parser->result->exports, startPos, endPos); } } - else if (ch == '.' && str_eq2(pos + 1, '.', '.')) { - pos += 3; - if (*pos == 'r' && tryParseRequire(ExportAssign)) { - pos++; + else if (ch == '.' && str_eq2(parser, parser->pos + 1, '.', '.')) { + parser->pos += 3; + if (at(parser, parser->pos) == 'r' && tryParseRequire(parser, ExportAssign)) { + parser->pos++; } - else if (!identifier(*pos)) { - pos = revertPos; + else if (!identifier(parser, at(parser, parser->pos))) { + parser->pos = revertPos; return; } - ch = commentWhitespace(); + ch = commentWhitespace(parser); } else { - pos = revertPos; + parser->pos = revertPos; return; } @@ -1250,7 +1265,7 @@ void tryParseLiteralExports () { return; if (ch != ',') { - pos = revertPos; + parser->pos = revertPos; return; } } @@ -1265,13 +1280,13 @@ void tryParseLiteralExports () { // code point above 128. // Generated by `bin/generate-identifier-regex.js`. -bool isNonASCIIidentifierStartChar (uint32_t ch) { +static bool isNonASCIIidentifierStartChar (uint32_t ch) { return ch == 0xaa || ch == 0xb5 || ch == 0xba || ch >= 0xc0 && ch <= 0xd6 || ch >= 0xd8 && ch <= 0xf6 || ch >= 0xf8 && ch <= 0x02c1 || ch >= 0x02c6 && ch <= 0x02d1 || ch >= 0x02e0 && ch <= 0x02e4 || ch == 0x02ec || ch == 0x02ee || ch >= 0x0370 && ch <= 0x0374 || ch == 0x0376 || ch == 0x0377 || ch >= 0x037a && ch <= 0x037d || ch == 0x037f || ch == 0x0386 || ch >= 0x0388 && ch <= 0x038a || ch == 0x038c || ch >= 0x038e && ch <= 0x03a1 || ch >= 0x03a3 && ch <= 0x03f5 || ch >= 0x03f7 && ch <= 0x0481 || ch >= 0x048a && ch <= 0x052f || ch >= 0x0531 && ch <= 0x0556 || ch == 0x0559 || ch >= 0x0560 && ch <= 0x0588 || ch >= 0x05d0 && ch <= 0x05ea || ch >= 0x05ef && ch <= 0x05f2 || ch >= 0x0620 && ch <= 0x064a || ch == 0x066e || ch == 0x066f || ch >= 0x0671 && ch <= 0x06d3 || ch == 0x06d5 || ch == 0x06e5 || ch == 0x06e6 || ch == 0x06ee || ch == 0x06ef || ch >= 0x06fa && ch <= 0x06fc || ch == 0x06ff || ch == 0x0710 || ch >= 0x0712 && ch <= 0x072f || ch >= 0x074d && ch <= 0x07a5 || ch == 0x07b1 || ch >= 0x07ca && ch <= 0x07ea || ch == 0x07f4 || ch == 0x07f5 || ch == 0x07fa || ch >= 0x0800 && ch <= 0x0815 || ch == 0x081a || ch == 0x0824 || ch == 0x0828 || ch >= 0x0840 && ch <= 0x0858 || ch >= 0x0860 && ch <= 0x086a || ch >= 0x08a0 && ch <= 0x08b4 || ch >= 0x08b6 && ch <= 0x08bd || ch >= 0x0904 && ch <= 0x0939 || ch == 0x093d || ch == 0x0950 || ch >= 0x0958 && ch <= 0x0961 || ch >= 0x0971 && ch <= 0x0980 || ch >= 0x0985 && ch <= 0x098c || ch == 0x098f || ch == 0x0990 || ch >= 0x0993 && ch <= 0x09a8 || ch >= 0x09aa && ch <= 0x09b0 || ch == 0x09b2 || ch >= 0x09b6 && ch <= 0x09b9 || ch == 0x09bd || ch == 0x09ce || ch == 0x09dc || ch == 0x09dd || ch >= 0x09df && ch <= 0x09e1 || ch == 0x09f0 || ch == 0x09f1 || ch == 0x09fc || ch >= 0x0a05 && ch <= 0x0a0a || ch == 0x0a0f || ch == 0x0a10 || ch >= 0x0a13 && ch <= 0x0a28 || ch >= 0x0a2a && ch <= 0x0a30 || ch == 0x0a32 || ch == 0x0a33 || ch == 0x0a35 || ch == 0x0a36 || ch == 0x0a38 || ch == 0x0a39 || ch >= 0x0a59 && ch <= 0x0a5c || ch == 0x0a5e || ch >= 0x0a72 && ch <= 0x0a74 || ch >= 0x0a85 && ch <= 0x0a8d || ch >= 0x0a8f && ch <= 0x0a91 || ch >= 0x0a93 && ch <= 0x0aa8 || ch >= 0x0aaa && ch <= 0x0ab0 || ch == 0x0ab2 || ch == 0x0ab3 || ch >= 0x0ab5 && ch <= 0x0ab9 || ch == 0x0abd || ch == 0x0ad0 || ch == 0x0ae0 || ch == 0x0ae1 || ch == 0x0af9 || ch >= 0x0b05 && ch <= 0x0b0c || ch == 0x0b0f || ch == 0x0b10 || ch >= 0x0b13 && ch <= 0x0b28 || ch >= 0x0b2a && ch <= 0x0b30 || ch == 0x0b32 || ch == 0x0b33 || ch >= 0x0b35 && ch <= 0x0b39 || ch == 0x0b3d || ch == 0x0b5c || ch == 0x0b5d || ch >= 0x0b5f && ch <= 0x0b61 || ch == 0x0b71 || ch == 0x0b83 || ch >= 0x0b85 && ch <= 0x0b8a || ch >= 0x0b8e && ch <= 0x0b90 || ch >= 0x0b92 && ch <= 0x0b95 || ch == 0x0b99 || ch == 0x0b9a || ch == 0x0b9c || ch == 0x0b9e || ch == 0x0b9f || ch == 0x0ba3 || ch == 0x0ba4 || ch >= 0x0ba8 && ch <= 0x0baa || ch >= 0x0bae && ch <= 0x0bb9 || ch == 0x0bd0 || ch >= 0x0c05 && ch <= 0x0c0c || ch >= 0x0c0e && ch <= 0x0c10 || ch >= 0x0c12 && ch <= 0x0c28 || ch >= 0x0c2a && ch <= 0x0c39 || ch == 0x0c3d || ch >= 0x0c58 && ch <= 0x0c5a || ch == 0x0c60 || ch == 0x0c61 || ch == 0x0c80 || ch >= 0x0c85 && ch <= 0x0c8c || ch >= 0x0c8e && ch <= 0x0c90 || ch >= 0x0c92 && ch <= 0x0ca8 || ch >= 0x0caa && ch <= 0x0cb3 || ch >= 0x0cb5 && ch <= 0x0cb9 || ch == 0x0cbd || ch == 0x0cde || ch == 0x0ce0 || ch == 0x0ce1 || ch == 0x0cf1 || ch == 0x0cf2 || ch >= 0x0d05 && ch <= 0x0d0c || ch >= 0x0d0e && ch <= 0x0d10 || ch >= 0x0d12 && ch <= 0x0d3a || ch == 0x0d3d || ch == 0x0d4e || ch >= 0x0d54 && ch <= 0x0d56 || ch >= 0x0d5f && ch <= 0x0d61 || ch >= 0x0d7a && ch <= 0x0d7f || ch >= 0x0d85 && ch <= 0x0d96 || ch >= 0x0d9a && ch <= 0x0db1 || ch >= 0x0db3 && ch <= 0x0dbb || ch == 0x0dbd || ch >= 0x0dc0 && ch <= 0x0dc6 || ch >= 0x0e01 && ch <= 0x0e30 || ch == 0x0e32 || ch == 0x0e33 || ch >= 0x0e40 && ch <= 0x0e46 || ch == 0x0e81 || ch == 0x0e82 || ch == 0x0e84 || ch == 0x0e87 || ch == 0x0e88 || ch == 0x0e8a || ch == 0x0e8d || ch >= 0x0e94 && ch <= 0x0e97 || ch >= 0x0e99 && ch <= 0x0e9f || ch >= 0x0ea1 && ch <= 0x0ea3 || ch == 0x0ea5 || ch == 0x0ea7 || ch == 0x0eaa || ch == 0x0eab || ch >= 0x0ead && ch <= 0x0eb0 || ch == 0x0eb2 || ch == 0x0eb3 || ch == 0x0ebd || ch >= 0x0ec0 && ch <= 0x0ec4 || ch == 0x0ec6 || ch >= 0x0edc && ch <= 0x0edf || ch == 0x0f00 || ch >= 0x0f40 && ch <= 0x0f47 || ch >= 0x0f49 && ch <= 0x0f6c || ch >= 0x0f88 && ch <= 0x0f8c || ch >= 0x1000 && ch <= 0x102a || ch == 0x103f || ch >= 0x1050 && ch <= 0x1055 || ch >= 0x105a && ch <= 0x105d || ch == 0x1061 || ch == 0x1065 || ch == 0x1066 || ch >= 0x106e && ch <= 0x1070 || ch >= 0x1075 && ch <= 0x1081 || ch == 0x108e || ch >= 0x10a0 && ch <= 0x10c5 || ch == 0x10c7 || ch == 0x10cd || ch >= 0x10d0 && ch <= 0x10fa || ch >= 0x10fc && ch <= 0x1248 || ch >= 0x124a && ch <= 0x124d || ch >= 0x1250 && ch <= 0x1256 || ch == 0x1258 || ch >= 0x125a && ch <= 0x125d || ch >= 0x1260 && ch <= 0x1288 || ch >= 0x128a && ch <= 0x128d || ch >= 0x1290 && ch <= 0x12b0 || ch >= 0x12b2 && ch <= 0x12b5 || ch >= 0x12b8 && ch <= 0x12be || ch == 0x12c0 || ch >= 0x12c2 && ch <= 0x12c5 || ch >= 0x12c8 && ch <= 0x12d6 || ch >= 0x12d8 && ch <= 0x1310 || ch >= 0x1312 && ch <= 0x1315 || ch >= 0x1318 && ch <= 0x135a || ch >= 0x1380 && ch <= 0x138f || ch >= 0x13a0 && ch <= 0x13f5 || ch >= 0x13f8 && ch <= 0x13fd || ch >= 0x1401 && ch <= 0x166c || ch >= 0x166f && ch <= 0x167f || ch >= 0x1681 && ch <= 0x169a || ch >= 0x16a0 && ch <= 0x16ea || ch >= 0x16ee && ch <= 0x16f8 || ch >= 0x1700 && ch <= 0x170c || ch >= 0x170e && ch <= 0x1711 || ch >= 0x1720 && ch <= 0x1731 || ch >= 0x1740 && ch <= 0x1751 || ch >= 0x1760 && ch <= 0x176c || ch >= 0x176e && ch <= 0x1770 || ch >= 0x1780 && ch <= 0x17b3 || ch == 0x17d7 || ch == 0x17dc || ch >= 0x1820 && ch <= 0x1878 || ch >= 0x1880 && ch <= 0x18a8 || ch == 0x18aa || ch >= 0x18b0 && ch <= 0x18f5 || ch >= 0x1900 && ch <= 0x191e || ch >= 0x1950 && ch <= 0x196d || ch >= 0x1970 && ch <= 0x1974 || ch >= 0x1980 && ch <= 0x19ab || ch >= 0x19b0 && ch <= 0x19c9 || ch >= 0x1a00 && ch <= 0x1a16 || ch >= 0x1a20 && ch <= 0x1a54 || ch == 0x1aa7 || ch >= 0x1b05 && ch <= 0x1b33 || ch >= 0x1b45 && ch <= 0x1b4b || ch >= 0x1b83 && ch <= 0x1ba0 || ch == 0x1bae || ch == 0x1baf || ch >= 0x1bba && ch <= 0x1be5 || ch >= 0x1c00 && ch <= 0x1c23 || ch >= 0x1c4d && ch <= 0x1c4f || ch >= 0x1c5a && ch <= 0x1c7d || ch >= 0x1c80 && ch <= 0x1c88 || ch >= 0x1c90 && ch <= 0x1cba || ch >= 0x1cbd && ch <= 0x1cbf || ch >= 0x1ce9 && ch <= 0x1cec || ch >= 0x1cee && ch <= 0x1cf1 || ch == 0x1cf5 || ch == 0x1cf6 || ch >= 0x1d00 && ch <= 0x1dbf || ch >= 0x1e00 && ch <= 0x1f15 || ch >= 0x1f18 && ch <= 0x1f1d || ch >= 0x1f20 && ch <= 0x1f45 || ch >= 0x1f48 && ch <= 0x1f4d || ch >= 0x1f50 && ch <= 0x1f57 || ch == 0x1f59 || ch == 0x1f5b || ch == 0x1f5d || ch >= 0x1f5f && ch <= 0x1f7d || ch >= 0x1f80 && ch <= 0x1fb4 || ch >= 0x1fb6 && ch <= 0x1fbc || ch == 0x1fbe || ch >= 0x1fc2 && ch <= 0x1fc4 || ch >= 0x1fc6 && ch <= 0x1fcc || ch >= 0x1fd0 && ch <= 0x1fd3 || ch >= 0x1fd6 && ch <= 0x1fdb || ch >= 0x1fe0 && ch <= 0x1fec || ch >= 0x1ff2 && ch <= 0x1ff4 || ch >= 0x1ff6 && ch <= 0x1ffc || ch == 0x2071 || ch == 0x207f || ch >= 0x2090 && ch <= 0x209c || ch == 0x2102 || ch == 0x2107 || ch >= 0x210a && ch <= 0x2113 || ch == 0x2115 || ch >= 0x2118 && ch <= 0x211d || ch == 0x2124 || ch == 0x2126 || ch == 0x2128 || ch >= 0x212a && ch <= 0x2139 || ch >= 0x213c && ch <= 0x213f || ch >= 0x2145 && ch <= 0x2149 || ch == 0x214e || ch >= 0x2160 && ch <= 0x2188 || ch >= 0x2c00 && ch <= 0x2c2e || ch >= 0x2c30 && ch <= 0x2c5e || ch >= 0x2c60 && ch <= 0x2ce4 || ch >= 0x2ceb && ch <= 0x2cee || ch == 0x2cf2 || ch == 0x2cf3 || ch >= 0x2d00 && ch <= 0x2d25 || ch == 0x2d27 || ch == 0x2d2d || ch >= 0x2d30 && ch <= 0x2d67 || ch == 0x2d6f || ch >= 0x2d80 && ch <= 0x2d96 || ch >= 0x2da0 && ch <= 0x2da6 || ch >= 0x2da8 && ch <= 0x2dae || ch >= 0x2db0 && ch <= 0x2db6 || ch >= 0x2db8 && ch <= 0x2dbe || ch >= 0x2dc0 && ch <= 0x2dc6 || ch >= 0x2dc8 && ch <= 0x2dce || ch >= 0x2dd0 && ch <= 0x2dd6 || ch >= 0x2dd8 && ch <= 0x2dde || ch >= 0x3005 && ch <= 0x3007 || ch >= 0x3021 && ch <= 0x3029 || ch >= 0x3031 && ch <= 0x3035 || ch >= 0x3038 && ch <= 0x303c || ch >= 0x3041 && ch <= 0x3096 || ch >= 0x309b && ch <= 0x309f || ch >= 0x30a1 && ch <= 0x30fa || ch >= 0x30fc && ch <= 0x30ff || ch >= 0x3105 && ch <= 0x312f || ch >= 0x3131 && ch <= 0x318e || ch >= 0x31a0 && ch <= 0x31ba || ch >= 0x31f0 && ch <= 0x31ff || ch >= 0x3400 && ch <= 0x4db5 || ch >= 0x4e00 && ch <= 0x9fef || ch >= 0xa000 && ch <= 0xa48c || ch >= 0xa4d0 && ch <= 0xa4fd || ch >= 0xa500 && ch <= 0xa60c || ch >= 0xa610 && ch <= 0xa61f || ch == 0xa62a || ch == 0xa62b || ch >= 0xa640 && ch <= 0xa66e || ch >= 0xa67f && ch <= 0xa69d || ch >= 0xa6a0 && ch <= 0xa6ef || ch >= 0xa717 && ch <= 0xa71f || ch >= 0xa722 && ch <= 0xa788 || ch >= 0xa78b && ch <= 0xa7b9 || ch >= 0xa7f7 && ch <= 0xa801 || ch >= 0xa803 && ch <= 0xa805 || ch >= 0xa807 && ch <= 0xa80a || ch >= 0xa80c && ch <= 0xa822 || ch >= 0xa840 && ch <= 0xa873 || ch >= 0xa882 && ch <= 0xa8b3 || ch >= 0xa8f2 && ch <= 0xa8f7 || ch == 0xa8fb || ch == 0xa8fd || ch == 0xa8fe || ch >= 0xa90a && ch <= 0xa925 || ch >= 0xa930 && ch <= 0xa946 || ch >= 0xa960 && ch <= 0xa97c || ch >= 0xa984 && ch <= 0xa9b2 || ch == 0xa9cf || ch >= 0xa9e0 && ch <= 0xa9e4 || ch >= 0xa9e6 && ch <= 0xa9ef || ch >= 0xa9fa && ch <= 0xa9fe || ch >= 0xaa00 && ch <= 0xaa28 || ch >= 0xaa40 && ch <= 0xaa42 || ch >= 0xaa44 && ch <= 0xaa4b || ch >= 0xaa60 && ch <= 0xaa76 || ch == 0xaa7a || ch >= 0xaa7e && ch <= 0xaaaf || ch == 0xaab1 || ch == 0xaab5 || ch == 0xaab6 || ch >= 0xaab9 && ch <= 0xaabd || ch == 0xaac0 || ch == 0xaac2 || ch >= 0xaadb && ch <= 0xaadd || ch >= 0xaae0 && ch <= 0xaaea || ch >= 0xaaf2 && ch <= 0xaaf4 || ch >= 0xab01 && ch <= 0xab06 || ch >= 0xab09 && ch <= 0xab0e || ch >= 0xab11 && ch <= 0xab16 || ch >= 0xab20 && ch <= 0xab26 || ch >= 0xab28 && ch <= 0xab2e || ch >= 0xab30 && ch <= 0xab5a || ch >= 0xab5c && ch <= 0xab65 || ch >= 0xab70 && ch <= 0xabe2 || ch >= 0xac00 && ch <= 0xd7a3 || ch >= 0xd7b0 && ch <= 0xd7c6 || ch >= 0xd7cb && ch <= 0xd7fb || ch >= 0xf900 && ch <= 0xfa6d || ch >= 0xfa70 && ch <= 0xfad9 || ch >= 0xfb00 && ch <= 0xfb06 || ch >= 0xfb13 && ch <= 0xfb17 || ch == 0xfb1d || ch >= 0xfb1f && ch <= 0xfb28 || ch >= 0xfb2a && ch <= 0xfb36 || ch >= 0xfb38 && ch <= 0xfb3c || ch == 0xfb3e || ch == 0xfb40 || ch == 0xfb41 || ch == 0xfb43 || ch == 0xfb44 || ch >= 0xfb46 && ch <= 0xfbb1 || ch >= 0xfbd3 && ch <= 0xfd3d || ch >= 0xfd50 && ch <= 0xfd8f || ch >= 0xfd92 && ch <= 0xfdc7 || ch >= 0xfdf0 && ch <= 0xfdfb || ch >= 0xfe70 && ch <= 0xfe74 || ch >= 0xfe76 && ch <= 0xfefc || ch >= 0xff21 && ch <= 0xff3a || ch >= 0xff41 && ch <= 0xff5a || ch >= 0xff66 && ch <= 0xffbe || ch >= 0xffc2 && ch <= 0xffc7 || ch >= 0xffca && ch <= 0xffcf || ch >= 0xffd2 && ch <= 0xffd7 || ch >= 0xffda && ch <= 0xffdc; } -bool isNonASCIIidentifierChar (uint32_t ch) { +static bool isNonASCIIidentifierChar (uint32_t ch) { return isNonASCIIidentifierStartChar(ch) || ch == 0x200c || ch == 0x200d || ch == 0xb7 || ch >= 0x0300 && ch <= 0x036f || ch == 0x0387 || ch >= 0x0483 && ch <= 0x0487 || ch >= 0x0591 && ch <= 0x05bd || ch == 0x05bf || ch == 0x05c1 || ch == 0x05c2 || ch == 0x05c4 || ch == 0x05c5 || ch == 0x05c7 || ch >= 0x0610 && ch <= 0x061a || ch >= 0x064b && ch <= 0x0669 || ch == 0x0670 || ch >= 0x06d6 && ch <= 0x06dc || ch >= 0x06df && ch <= 0x06e4 || ch == 0x06e7 || ch == 0x06e8 || ch >= 0x06ea && ch <= 0x06ed || ch >= 0x06f0 && ch <= 0x06f9 || ch == 0x0711 || ch >= 0x0730 && ch <= 0x074a || ch >= 0x07a6 && ch <= 0x07b0 || ch >= 0x07c0 && ch <= 0x07c9 || ch >= 0x07eb && ch <= 0x07f3 || ch == 0x07fd || ch >= 0x0816 && ch <= 0x0819 || ch >= 0x081b && ch <= 0x0823 || ch >= 0x0825 && ch <= 0x0827 || ch >= 0x0829 && ch <= 0x082d || ch >= 0x0859 && ch <= 0x085b || ch >= 0x08d3 && ch <= 0x08e1 || ch >= 0x08e3 && ch <= 0x0903 || ch >= 0x093a && ch <= 0x093c || ch >= 0x093e && ch <= 0x094f || ch >= 0x0951 && ch <= 0x0957 || ch == 0x0962 || ch == 0x0963 || ch >= 0x0966 && ch <= 0x096f || ch >= 0x0981 && ch <= 0x0983 || ch == 0x09bc || ch >= 0x09be && ch <= 0x09c4 || ch == 0x09c7 || ch == 0x09c8 || ch >= 0x09cb && ch <= 0x09cd || ch == 0x09d7 || ch == 0x09e2 || ch == 0x09e3 || ch >= 0x09e6 && ch <= 0x09ef || ch == 0x09fe || ch >= 0x0a01 && ch <= 0x0a03 || ch == 0x0a3c || ch >= 0x0a3e && ch <= 0x0a42 || ch == 0x0a47 || ch == 0x0a48 || ch >= 0x0a4b && ch <= 0x0a4d || ch == 0x0a51 || ch >= 0x0a66 && ch <= 0x0a71 || ch == 0x0a75 || ch >= 0x0a81 && ch <= 0x0a83 || ch == 0x0abc || ch >= 0x0abe && ch <= 0x0ac5 || ch >= 0x0ac7 && ch <= 0x0ac9 || ch >= 0x0acb && ch <= 0x0acd || ch == 0x0ae2 || ch == 0x0ae3 || ch >= 0x0ae6 && ch <= 0x0aef || ch >= 0x0afa && ch <= 0x0aff || ch >= 0x0b01 && ch <= 0x0b03 || ch == 0x0b3c || ch >= 0x0b3e && ch <= 0x0b44 || ch == 0x0b47 || ch == 0x0b48 || ch >= 0x0b4b && ch <= 0x0b4d || ch == 0x0b56 || ch == 0x0b57 || ch == 0x0b62 || ch == 0x0b63 || ch >= 0x0b66 && ch <= 0x0b6f || ch == 0x0b82 || ch >= 0x0bbe && ch <= 0x0bc2 || ch >= 0x0bc6 && ch <= 0x0bc8 || ch >= 0x0bca && ch <= 0x0bcd || ch == 0x0bd7 || ch >= 0x0be6 && ch <= 0x0bef || ch >= 0x0c00 && ch <= 0x0c04 || ch >= 0x0c3e && ch <= 0x0c44 || ch >= 0x0c46 && ch <= 0x0c48 || ch >= 0x0c4a && ch <= 0x0c4d || ch == 0x0c55 || ch == 0x0c56 || ch == 0x0c62 || ch == 0x0c63 || ch >= 0x0c66 && ch <= 0x0c6f || ch >= 0x0c81 && ch <= 0x0c83 || ch == 0x0cbc || ch >= 0x0cbe && ch <= 0x0cc4 || ch >= 0x0cc6 && ch <= 0x0cc8 || ch >= 0x0cca && ch <= 0x0ccd || ch == 0x0cd5 || ch == 0x0cd6 || ch == 0x0ce2 || ch == 0x0ce3 || ch >= 0x0ce6 && ch <= 0x0cef || ch >= 0x0d00 && ch <= 0x0d03 || ch == 0x0d3b || ch == 0x0d3c || ch >= 0x0d3e && ch <= 0x0d44 || ch >= 0x0d46 && ch <= 0x0d48 || ch >= 0x0d4a && ch <= 0x0d4d || ch == 0x0d57 || ch == 0x0d62 || ch == 0x0d63 || ch >= 0x0d66 && ch <= 0x0d6f || ch == 0x0d82 || ch == 0x0d83 || ch == 0x0dca || ch >= 0x0dcf && ch <= 0x0dd4 || ch == 0x0dd6 || ch >= 0x0dd8 && ch <= 0x0ddf || ch >= 0x0de6 && ch <= 0x0def || ch == 0x0df2 || ch == 0x0df3 || ch == 0x0e31 || ch >= 0x0e34 && ch <= 0x0e3a || ch >= 0x0e47 && ch <= 0x0e4e || ch >= 0x0e50 && ch <= 0x0e59 || ch == 0x0eb1 || ch >= 0x0eb4 && ch <= 0x0eb9 || ch == 0x0ebb || ch == 0x0ebc || ch >= 0x0ec8 && ch <= 0x0ecd || ch >= 0x0ed0 && ch <= 0x0ed9 || ch == 0x0f18 || ch == 0x0f19 || ch >= 0x0f20 && ch <= 0x0f29 || ch == 0x0f35 || ch == 0x0f37 || ch == 0x0f39 || ch == 0x0f3e || ch == 0x0f3f || ch >= 0x0f71 && ch <= 0x0f84 || ch == 0x0f86 || ch == 0x0f87 || ch >= 0x0f8d && ch <= 0x0f97 || ch >= 0x0f99 && ch <= 0x0fbc || ch == 0x0fc6 || ch >= 0x102b && ch <= 0x103e || ch >= 0x1040 && ch <= 0x1049 || ch >= 0x1056 && ch <= 0x1059 || ch >= 0x105e && ch <= 0x1060 || ch >= 0x1062 && ch <= 0x1064 || ch >= 0x1067 && ch <= 0x106d || ch >= 0x1071 && ch <= 0x1074 || ch >= 0x1082 && ch <= 0x108d || ch >= 0x108f && ch <= 0x109d || ch >= 0x135d && ch <= 0x135f || ch >= 0x1369 && ch <= 0x1371 || ch >= 0x1712 && ch <= 0x1714 || ch >= 0x1732 && ch <= 0x1734 || ch == 0x1752 || ch == 0x1753 || ch == 0x1772 || ch == 0x1773 || ch >= 0x17b4 && ch <= 0x17d3 || ch == 0x17dd || ch >= 0x17e0 && ch <= 0x17e9 || ch >= 0x180b && ch <= 0x180d || ch >= 0x1810 && ch <= 0x1819 || ch == 0x18a9 || ch >= 0x1920 && ch <= 0x192b || ch >= 0x1930 && ch <= 0x193b || ch >= 0x1946 && ch <= 0x194f || ch >= 0x19d0 && ch <= 0x19da || ch >= 0x1a17 && ch <= 0x1a1b || ch >= 0x1a55 && ch <= 0x1a5e || ch >= 0x1a60 && ch <= 0x1a7c || ch >= 0x1a7f && ch <= 0x1a89 || ch >= 0x1a90 && ch <= 0x1a99 || ch >= 0x1ab0 && ch <= 0x1abd || ch >= 0x1b00 && ch <= 0x1b04 || ch >= 0x1b34 && ch <= 0x1b44 || ch >= 0x1b50 && ch <= 0x1b59 || ch >= 0x1b6b && ch <= 0x1b73 || ch >= 0x1b80 && ch <= 0x1b82 || ch >= 0x1ba1 && ch <= 0x1bad || ch >= 0x1bb0 && ch <= 0x1bb9 || ch >= 0x1be6 && ch <= 0x1bf3 || ch >= 0x1c24 && ch <= 0x1c37 || ch >= 0x1c40 && ch <= 0x1c49 || ch >= 0x1c50 && ch <= 0x1c59 || ch >= 0x1cd0 && ch <= 0x1cd2 || ch >= 0x1cd4 && ch <= 0x1ce8 || ch == 0x1ced || ch >= 0x1cf2 && ch <= 0x1cf4 || ch >= 0x1cf7 && ch <= 0x1cf9 || ch >= 0x1dc0 && ch <= 0x1df9 || ch >= 0x1dfb && ch <= 0x1dff || ch == 0x203f || ch == 0x2040 || ch == 0x2054 || ch >= 0x20d0 && ch <= 0x20dc || ch == 0x20e1 || ch >= 0x20e5 && ch <= 0x20f0 || ch >= 0x2cef && ch <= 0x2cf1 || ch == 0x2d7f || ch >= 0x2de0 && ch <= 0x2dff || ch >= 0x302a && ch <= 0x302f || ch == 0x3099 || ch == 0x309a || ch >= 0xa620 && ch <= 0xa629 || ch == 0xa66f || ch >= 0xa674 && ch <= 0xa67d || ch == 0xa69e || ch == 0xa69f || ch == 0xa6f0 || ch == 0xa6f1 || ch == 0xa802 || ch == 0xa806 || ch == 0xa80b || ch >= 0xa823 && ch <= 0xa827 || ch == 0xa880 || ch == 0xa881 || ch >= 0xa8b4 && ch <= 0xa8c5 || ch >= 0xa8d0 && ch <= 0xa8d9 || ch >= 0xa8e0 && ch <= 0xa8f1 || ch >= 0xa8ff && ch <= 0xa909 || ch >= 0xa926 && ch <= 0xa92d || ch >= 0xa947 && ch <= 0xa953 || ch >= 0xa980 && ch <= 0xa983 || ch >= 0xa9b3 && ch <= 0xa9c0 || ch >= 0xa9d0 && ch <= 0xa9d9 || ch == 0xa9e5 || ch >= 0xa9f0 && ch <= 0xa9f9 || ch >= 0xaa29 && ch <= 0xaa36 || ch == 0xaa43 || ch == 0xaa4c || ch == 0xaa4d || ch >= 0xaa50 && ch <= 0xaa59 || ch >= 0xaa7b && ch <= 0xaa7d || ch == 0xaab0 || ch >= 0xaab2 && ch <= 0xaab4 || ch == 0xaab7 || ch == 0xaab8 || ch == 0xaabe || ch == 0xaabf || ch == 0xaac1 || ch >= 0xaaeb && ch <= 0xaaef || ch == 0xaaf5 || ch == 0xaaf6 || ch >= 0xabe3 && ch <= 0xabea || ch == 0xabec || ch == 0xabed || ch >= 0xabf0 && ch <= 0xabf9 || ch == 0xfb1e || ch >= 0xfe00 && ch <= 0xfe0f || ch >= 0xfe20 && ch <= 0xfe2f || ch == 0xfe33 || ch == 0xfe34 || ch >= 0xfe4d && ch <= 0xfe4f || ch >= 0xff10 && ch <= 0xff19 || ch == 0xff3f; } @@ -1288,7 +1303,7 @@ static uint32_t astralIdentifierCodes[] = { 509,0,227,0,150,4,294,9,1368,2,2,1,6 // This has a complexity linear to the value of the code. The // assumption is that looking up astral identifier characters is // rare. -bool isInAstralIdentifierStartCodes (uint32_t code) { +static bool isInAstralIdentifierStartCodes (uint32_t code) { uint32_t cur = 0x10000; for (unsigned int i = 0; i < sizeof(astralIdentifierStartCodes) / sizeof(uint32_t); i += 2) { cur += astralIdentifierStartCodes[i]; @@ -1301,7 +1316,7 @@ bool isInAstralIdentifierStartCodes (uint32_t code) { return false; } -bool isInAstralIdentifierCodes (uint32_t code) { +static bool isInAstralIdentifierCodes (uint32_t code) { uint32_t cur = 0x10000; for (unsigned int i = 0; i < sizeof(astralIdentifierCodes) / sizeof(uint32_t); i += 2) { cur += astralIdentifierCodes[i]; @@ -1315,7 +1330,7 @@ bool isInAstralIdentifierCodes (uint32_t code) { } // Test whether a given character code starts an identifier. -bool isIdentifierStart(uint32_t code) { +static bool isIdentifierStart(uint32_t code) { if (code < 65) return code == 36; if (code < 91) return true; if (code < 97) return code == 95; @@ -1326,7 +1341,7 @@ bool isIdentifierStart(uint32_t code) { // Test whether a given character is part of an identifier. -bool isIdentifierChar(uint32_t code) { +static bool isIdentifierChar(uint32_t code) { if (code < 48) return code == 36; if (code < 58) return true; if (code < 65) return false; @@ -1337,34 +1352,34 @@ bool isIdentifierChar(uint32_t code) { return isInAstralIdentifierStartCodes(code) || isInAstralIdentifierCodes(code); } -inline int charCodeByteLen(uint32_t ch) { +static inline int charCodeByteLen(uint32_t ch) { if (ch < 0x10000) return 1; return 2; } -uint32_t fullCharCodeAtLast(uint16_t* bPos) { +static uint32_t fullCharCodeAtLast(Parser* parser, Cursor bPos) { // Gives the UTF char for backtracking surrogates - uint16_t ch = *bPos; + uint16_t ch = at(parser, bPos); if ((ch & 0xFC00) == 0xDC00) - return (((*(bPos - 1) & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; + return (((at(parser, bPos - 1) & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; return ch; } -uint32_t fullCharCode(uint16_t ch) { +static uint32_t fullCharCode(Parser* parser, uint16_t ch) { // Read UTF Surrogates if necessary if ((ch & 0xFC00) == 0xD800) - return (((ch & 0x3FF) << 10) | (*(pos + 1) & 0x3FF)) + 0x10000; + return (((ch & 0x3FF) << 10) | (at(parser, parser->pos + 1) & 0x3FF)) + 0x10000; return ch; } -bool identifier (uint16_t startCh) { - uint32_t ch = fullCharCode(startCh); +static bool identifier(Parser* parser, uint16_t startCh) { + uint32_t ch = fullCharCode(parser, startCh); if (!isIdentifierStart(ch)) return false; - pos += charCodeByteLen(ch); - while (ch = fullCharCode(*pos)) { + parser->pos += charCodeByteLen(ch); + while ((ch = fullCharCode(parser, at(parser, parser->pos)))) { if (isIdentifierChar(ch)) { - pos += charCodeByteLen(ch); + parser->pos += charCodeByteLen(ch); } else if (ch == '\\') { // no identifier escapes support for now @@ -1377,333 +1392,323 @@ bool identifier (uint16_t startCh) { return true; } -void throwIfImportStatement () { - uint16_t* startPos = pos; - pos += 6; - uint16_t ch = commentWhitespace(); +static void throwIfImportStatement(Parser* parser) { + Cursor startPos = parser->pos; + parser->pos += 6; + uint16_t ch = commentWhitespace(parser); switch (ch) { // dynamic import case '(': - if (!pushOpenToken(startPos)) + if (!pushOpenToken(parser, startPos)) return; return; // import.meta case '.': - syntaxError(5); + syntaxError(parser, 5); return; - + default: // no space after "import" -> not an import keyword - if (pos == startPos + 6) + if (parser->pos == startPos + 6) break; case '"': case '\'': case '{': case '*': // import statement only permitted at base-level - if (openTokenDepth != 0) { - pos--; + if (parser->openTokenDepth != 0) { + parser->pos--; return; } // import statements are a syntax error in CommonJS - syntaxError(6); + syntaxError(parser, 6); } } -void throwIfExportStatement () { - pos += 6; - uint16_t* curPos = pos; - uint16_t ch = commentWhitespace(); - if (pos == curPos && !isPunctuator(ch)) +static void throwIfExportStatement(Parser* parser) { + parser->pos += 6; + Cursor curPos = parser->pos; + uint16_t ch = commentWhitespace(parser); + if (parser->pos == curPos && !isPunctuator(ch)) return; - syntaxError(7); + syntaxError(parser, 7); } -uint16_t commentWhitespace () { +static uint16_t commentWhitespace(Parser* parser) { uint16_t ch; do { - ch = *pos; + ch = at(parser, parser->pos); if (ch == '/') { - uint16_t next_ch = *(pos + 1); + uint16_t next_ch = at(parser, parser->pos + 1); if (next_ch == '/') - lineComment(); + lineComment(parser); else if (next_ch == '*') - blockComment(); + blockComment(parser); else return ch; } else if (!isBrOrWs(ch)) { return ch; } - } while (pos++ < end); + } while (parser->pos++ < parser->end); return ch; } -void templateString () { - while (pos++ < end) { - uint16_t ch = *pos; - if (ch == '$' && *(pos + 1) == '{') { - pos++; - if (!pushTemplate()) +static void templateString(Parser* parser) { + while (parser->pos++ < parser->end) { + uint16_t ch = at(parser, parser->pos); + if (ch == '$' && at(parser, parser->pos + 1) == '{') { + parser->pos++; + if (!pushTemplate(parser)) return; return; } if (ch == '`') return; if (ch == '\\') - pos++; + parser->pos++; } - syntaxError(8); + syntaxError(parser, 8); } -void blockComment () { - pos++; - while (pos++ < end) { - uint16_t ch = *pos; - if (ch == '*' && *(pos + 1) == '/') { - pos++; +static void blockComment(Parser* parser) { + parser->pos++; + while (parser->pos++ < parser->end) { + uint16_t ch = at(parser, parser->pos); + if (ch == '*' && at(parser, parser->pos + 1) == '/') { + parser->pos++; return; } } } -void lineComment () { - while (pos++ < end) { - uint16_t ch = *pos; +static void lineComment(Parser* parser) { + while (parser->pos++ < parser->end) { + uint16_t ch = at(parser, parser->pos); if (ch == '\n' || ch == '\r') return; } } -void stringLiteral (uint16_t quote) { - while (pos++ < end) { - uint16_t ch = *pos; +static void stringLiteral(Parser* parser, uint16_t quote) { + while (parser->pos++ < parser->end) { + uint16_t ch = at(parser, parser->pos); if (ch == quote) return; if (ch == '\\') { - ch = *++pos; - if (ch == '\r' && *(pos + 1) == '\n') - pos++; + ch = at(parser, ++parser->pos); + if (ch == '\r' && at(parser, parser->pos + 1) == '\n') + parser->pos++; } else if (isBr(ch)) break; } - syntaxError(9); + syntaxError(parser, 9); } -uint16_t regexCharacterClass () { - while (pos++ < end) { - uint16_t ch = *pos; +static uint16_t regexCharacterClass(Parser* parser) { + while (parser->pos++ < parser->end) { + uint16_t ch = at(parser, parser->pos); if (ch == ']') return ch; if (ch == '\\') - pos++; + parser->pos++; else if (ch == '\n' || ch == '\r') break; } - syntaxError(10); + syntaxError(parser, 10); return '\0'; } -void regularExpression () { - while (pos++ < end) { - uint16_t ch = *pos; +static void regularExpression(Parser* parser) { + while (parser->pos++ < parser->end) { + uint16_t ch = at(parser, parser->pos); if (ch == '/') return; if (ch == '[') - ch = regexCharacterClass(); + ch = regexCharacterClass(parser); else if (ch == '\\') - pos++; + parser->pos++; else if (ch == '\n' || ch == '\r') break; } - syntaxError(11); + syntaxError(parser, 11); } -uint16_t readToWsOrPunctuator (uint16_t ch) { - do { - if (isBrOrWs(ch) || isPunctuator(ch)) - return ch; - } while (ch = *(++pos)); - return ch; -} // Note: non-asii BR and whitespace checks omitted for perf / footprint // if there is a significant user need this can be reconsidered -bool isBr (uint16_t c) { +static bool isBr (uint16_t c) { return c == '\r' || c == '\n'; } -bool isBrOrWs (uint16_t c) { +static bool isBrOrWs (uint16_t c) { return c > 8 && c < 14 || c == 32 || c == 160; } -bool isBrOrWsOrPunctuatorNotDot (uint16_t c) { +static bool isBrOrWsOrPunctuatorNotDot (uint16_t c) { return c > 8 && c < 14 || c == 32 || c == 160 || isPunctuator(c) && c != '.'; } -bool str_eq2 (uint16_t* pos, uint16_t c1, uint16_t c2) { - return *pos == c1 && *(pos + 1) == c2; +static bool str_eq2(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2) { + return hasChars(parser, cursor, 2) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2; } -bool str_eq3 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3; +static bool str_eq3(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3) { + return hasChars(parser, cursor, 3) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3; } -bool str_eq4 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3 && *(pos + 3) == c4; +static bool str_eq4(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4) { + return hasChars(parser, cursor, 4) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4; } -bool str_eq5 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3 && *(pos + 3) == c4 && *(pos + 4) == c5; +static bool str_eq5(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5) { + return hasChars(parser, cursor, 5) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5; } -bool str_eq6 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3 && *(pos + 3) == c4 && *(pos + 4) == c5 && *(pos + 5) == c6; +static bool str_eq6(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6) { + return hasChars(parser, cursor, 6) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6; } -bool str_eq7 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3 && *(pos + 3) == c4 && *(pos + 4) == c5 && *(pos + 5) == c6 && *(pos + 6) == c7; +static bool str_eq7(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7) { + return hasChars(parser, cursor, 7) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7; } -bool str_eq8 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3 && *(pos + 3) == c4 && *(pos + 4) == c5 && *(pos + 5) == c6 && *(pos + 6) == c7 && *(pos + 7) == c8; +static bool str_eq8(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8) { + return hasChars(parser, cursor, 8) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7 && at(parser, cursor + 7) == c8; } -bool str_eq9 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3 && *(pos + 3) == c4 && *(pos + 4) == c5 && *(pos + 5) == c6 && *(pos + 6) == c7 && *(pos + 7) == c8 && *(pos + 8) == c9; +static bool str_eq9(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9) { + return hasChars(parser, cursor, 9) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7 && at(parser, cursor + 7) == c8 && at(parser, cursor + 8) == c9; } -bool str_eq10 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3 && *(pos + 3) == c4 && *(pos + 4) == c5 && *(pos + 5) == c6 && *(pos + 6) == c7 && *(pos + 7) == c8 && *(pos + 8) == c9 && *(pos + 9) == c10; +static bool str_eq10(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10) { + return hasChars(parser, cursor, 10) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7 && at(parser, cursor + 7) == c8 && at(parser, cursor + 8) == c9 && at(parser, cursor + 9) == c10; } -bool str_eq13 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3 && *(pos + 3) == c4 && *(pos + 4) == c5 && *(pos + 5) == c6 && *(pos + 6) == c7 && *(pos + 7) == c8 && *(pos + 8) == c9 && *(pos + 9) == c10 && *(pos + 10) == c11 && *(pos + 11) == c12 && *(pos + 12) == c13; +static bool str_eq13(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13) { + return hasChars(parser, cursor, 13) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7 && at(parser, cursor + 7) == c8 && at(parser, cursor + 8) == c9 && at(parser, cursor + 9) == c10 && at(parser, cursor + 10) == c11 && at(parser, cursor + 11) == c12 && at(parser, cursor + 12) == c13; } -bool str_eq18 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13, uint16_t c14, uint16_t c15, uint16_t c16, uint16_t c17, uint16_t c18) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3 && *(pos + 3) == c4 && *(pos + 4) == c5 && *(pos + 5) == c6 && *(pos + 6) == c7 && *(pos + 7) == c8 && *(pos + 8) == c9 && *(pos + 9) == c10 && *(pos + 10) == c11 && *(pos + 11) == c12 && *(pos + 12) == c13 && *(pos + 13) == c14 && *(pos + 14) == c15 && *(pos + 15) == c16 && *(pos + 16) == c17 && *(pos + 17) == c18; -} -bool str_eq22 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13, uint16_t c14, uint16_t c15, uint16_t c16, uint16_t c17, uint16_t c18, uint16_t c19, uint16_t c20, uint16_t c21, uint16_t c22) { - return *pos == c1 && *(pos + 1) == c2 && *(pos + 2) == c3 && *(pos + 3) == c4 && *(pos + 4) == c5 && *(pos + 5) == c6 && *(pos + 6) == c7 && *(pos + 7) == c8 && *(pos + 8) == c9 && *(pos + 9) == c10 && *(pos + 10) == c11 && *(pos + 11) == c12 && *(pos + 12) == c13 && *(pos + 13) == c14 && *(pos + 14) == c15 && *(pos + 15) == c16 && *(pos + 16) == c17 && *(pos + 17) == c18 && *(pos + 18) == c19 && *(pos + 19) == c20 && *(pos + 20) == c21 && *(pos + 21) == c22; +static bool str_eq22(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13, uint16_t c14, uint16_t c15, uint16_t c16, uint16_t c17, uint16_t c18, uint16_t c19, uint16_t c20, uint16_t c21, uint16_t c22) { + return hasChars(parser, cursor, 22) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7 && at(parser, cursor + 7) == c8 && at(parser, cursor + 8) == c9 && at(parser, cursor + 9) == c10 && at(parser, cursor + 10) == c11 && at(parser, cursor + 11) == c12 && at(parser, cursor + 12) == c13 && at(parser, cursor + 13) == c14 && at(parser, cursor + 14) == c15 && at(parser, cursor + 15) == c16 && at(parser, cursor + 16) == c17 && at(parser, cursor + 17) == c18 && at(parser, cursor + 18) == c19 && at(parser, cursor + 19) == c20 && at(parser, cursor + 20) == c21 && at(parser, cursor + 21) == c22; } -bool keywordStart (uint16_t* pos) { - return pos == source || isBrOrWsOrPunctuatorNotDot(*(pos - 1)); +static bool keywordStart(Parser* parser, Cursor cursor) { + return cursor == SOURCE_START || isBrOrWsOrPunctuatorNotDot(at(parser, cursor - 1)); } -bool readPrecedingKeyword1 (uint16_t* pos, uint16_t c1) { - if (pos < source) return false; - return *pos == c1 && (pos == source || isBrOrWsOrPunctuatorNotDot(*(pos - 1))); +static bool readPrecedingKeyword1(Parser* parser, Cursor cursor, uint16_t c1) { + if (cursor < SOURCE_START) return false; + return at(parser, cursor) == c1 && (cursor == SOURCE_START || isBrOrWsOrPunctuatorNotDot(at(parser, cursor - 1))); } -bool readPrecedingKeyword2 (uint16_t* pos, uint16_t c1, uint16_t c2) { - if (pos - 1 < source) return false; - return str_eq2(pos - 1, c1, c2) && (pos - 1 == source || isBrOrWsOrPunctuatorNotDot(*(pos - 2))); +static bool readPrecedingKeyword2(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2) { + if (cursor - 1 < SOURCE_START) return false; + return str_eq2(parser, cursor - 1, c1, c2) && (cursor - 1 == SOURCE_START || isBrOrWsOrPunctuatorNotDot(at(parser, cursor - 2))); } -bool readPrecedingKeyword3 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3) { - if (pos - 2 < source) return false; - return str_eq3(pos - 2, c1, c2, c3) && (pos - 2 == source || isBrOrWsOrPunctuatorNotDot(*(pos - 3))); +static bool readPrecedingKeyword3(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3) { + if (cursor - 2 < SOURCE_START) return false; + return str_eq3(parser, cursor - 2, c1, c2, c3) && (cursor - 2 == SOURCE_START || isBrOrWsOrPunctuatorNotDot(at(parser, cursor - 3))); } -bool readPrecedingKeyword4 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4) { - if (pos - 3 < source) return false; - return str_eq4(pos - 3, c1, c2, c3, c4) && (pos - 3 == source || isBrOrWsOrPunctuatorNotDot(*(pos - 4))); +static bool readPrecedingKeyword4(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4) { + if (cursor - 3 < SOURCE_START) return false; + return str_eq4(parser, cursor - 3, c1, c2, c3, c4) && (cursor - 3 == SOURCE_START || isBrOrWsOrPunctuatorNotDot(at(parser, cursor - 4))); } -bool readPrecedingKeyword5 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5) { - if (pos - 4 < source) return false; - return str_eq5(pos - 4, c1, c2, c3, c4, c5) && (pos - 4 == source || isBrOrWsOrPunctuatorNotDot(*(pos - 5))); +static bool readPrecedingKeyword5(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5) { + if (cursor - 4 < SOURCE_START) return false; + return str_eq5(parser, cursor - 4, c1, c2, c3, c4, c5) && (cursor - 4 == SOURCE_START || isBrOrWsOrPunctuatorNotDot(at(parser, cursor - 5))); } -bool readPrecedingKeyword6 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6) { - if (pos - 5 < source) return false; - return str_eq6(pos - 5, c1, c2, c3, c4, c5, c6) && (pos - 5 == source || isBrOrWsOrPunctuatorNotDot(*(pos - 6))); +static bool readPrecedingKeyword6(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6) { + if (cursor - 5 < SOURCE_START) return false; + return str_eq6(parser, cursor - 5, c1, c2, c3, c4, c5, c6) && (cursor - 5 == SOURCE_START || isBrOrWsOrPunctuatorNotDot(at(parser, cursor - 6))); } -bool readPrecedingKeyword7 (uint16_t* pos, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7) { - if (pos - 6 < source) return false; - return str_eq7(pos - 6, c1, c2, c3, c4, c5, c6, c7) && (pos - 6 == source || isBrOrWsOrPunctuatorNotDot(*(pos - 7))); +static bool readPrecedingKeyword7(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7) { + if (cursor - 6 < SOURCE_START) return false; + return str_eq7(parser, cursor - 6, c1, c2, c3, c4, c5, c6, c7) && (cursor - 6 == SOURCE_START || isBrOrWsOrPunctuatorNotDot(at(parser, cursor - 7))); } // Detects one of case, debugger, delete, do, else, in, instanceof, new, // return, throw, typeof, void, yield ,await -bool isExpressionKeyword (uint16_t* pos) { - switch (*pos) { +static bool isExpressionKeyword(Parser* parser, Cursor cursor) { + switch (at(parser, cursor)) { case 'd': - switch (*(pos - 1)) { + switch (at(parser, cursor - 1)) { case 'i': // void - return readPrecedingKeyword2(pos - 2, 'v', 'o'); + return readPrecedingKeyword2(parser, cursor - 2, 'v', 'o'); case 'l': // yield - return readPrecedingKeyword3(pos - 2, 'y', 'i', 'e'); + return readPrecedingKeyword3(parser, cursor - 2, 'y', 'i', 'e'); default: return false; } case 'e': - switch (*(pos - 1)) { + switch (at(parser, cursor - 1)) { case 's': - switch (*(pos - 2)) { + switch (at(parser, cursor - 2)) { case 'l': // else - return readPrecedingKeyword1(pos - 3, 'e'); + return readPrecedingKeyword1(parser, cursor - 3, 'e'); case 'a': // case - return readPrecedingKeyword1(pos - 3, 'c'); + return readPrecedingKeyword1(parser, cursor - 3, 'c'); default: return false; } case 't': // delete - return readPrecedingKeyword4(pos - 2, 'd', 'e', 'l', 'e'); + return readPrecedingKeyword4(parser, cursor - 2, 'd', 'e', 'l', 'e'); default: return false; } case 'f': - if (*(pos - 1) != 'o' || *(pos - 2) != 'e') + if (at(parser, cursor - 1) != 'o' || at(parser, cursor - 2) != 'e') return false; - switch (*(pos - 3)) { + switch (at(parser, cursor - 3)) { case 'c': // instanceof - return readPrecedingKeyword6(pos - 4, 'i', 'n', 's', 't', 'a', 'n'); + return readPrecedingKeyword6(parser, cursor - 4, 'i', 'n', 's', 't', 'a', 'n'); case 'p': // typeof - return readPrecedingKeyword2(pos - 4, 't', 'y'); + return readPrecedingKeyword2(parser, cursor - 4, 't', 'y'); default: return false; } case 'n': // in, return - return readPrecedingKeyword1(pos - 1, 'i') || readPrecedingKeyword5(pos - 1, 'r', 'e', 't', 'u', 'r'); + return readPrecedingKeyword1(parser, cursor - 1, 'i') || readPrecedingKeyword5(parser, cursor - 1, 'r', 'e', 't', 'u', 'r'); case 'o': // do - return readPrecedingKeyword1(pos - 1, 'd'); + return readPrecedingKeyword1(parser, cursor - 1, 'd'); case 'r': // debugger - return readPrecedingKeyword7(pos - 1, 'd', 'e', 'b', 'u', 'g', 'g', 'e'); + return readPrecedingKeyword7(parser, cursor - 1, 'd', 'e', 'b', 'u', 'g', 'g', 'e'); case 't': // await - return readPrecedingKeyword4(pos - 1, 'a', 'w', 'a', 'i'); + return readPrecedingKeyword4(parser, cursor - 1, 'a', 'w', 'a', 'i'); case 'w': - switch (*(pos - 1)) { + switch (at(parser, cursor - 1)) { case 'e': // new - return readPrecedingKeyword1(pos - 2, 'n'); + return readPrecedingKeyword1(parser, cursor - 2, 'n'); case 'o': // throw - return readPrecedingKeyword3(pos - 2, 't', 'h', 'r'); + return readPrecedingKeyword3(parser, cursor - 2, 't', 'h', 'r'); default: - return false; + return false; } } return false; } -bool isParenKeyword (uint16_t* curPos) { - return readPrecedingKeyword5(curPos, 'w', 'h', 'i', 'l', 'e') || - readPrecedingKeyword3(curPos, 'f', 'o', 'r') || - readPrecedingKeyword2(curPos, 'i', 'f'); +static bool isParenKeyword(Parser* parser, Cursor curPos) { + return readPrecedingKeyword5(parser, curPos, 'w', 'h', 'i', 'l', 'e') || + readPrecedingKeyword3(parser, curPos, 'f', 'o', 'r') || + readPrecedingKeyword2(parser, curPos, 'i', 'f'); } -bool isPunctuator (uint16_t ch) { +static bool isPunctuator (uint16_t ch) { // 23 possible punctuator endings: !%&()*+,-./:;<=>?[]^{}|~ return ch == '!' || ch == '%' || ch == '&' || ch > 39 && ch < 48 || ch > 57 && ch < 64 || @@ -1711,70 +1716,70 @@ bool isPunctuator (uint16_t ch) { ch > 122 && ch < 127; } -bool isExpressionPunctuator (uint16_t ch) { +static bool isExpressionPunctuator (uint16_t ch) { // 20 possible expression endings: !%&(*+,-.:;<=>?[^{|~ return ch == '!' || ch == '%' || ch == '&' || ch > 39 && ch < 47 && ch != 41 || ch > 57 && ch < 64 || ch == '[' || ch == '^' || ch > 122 && ch < 127 && ch != '}'; } -static uint16_t* precedingToken (uint16_t* curPos) { - while (curPos) { - while (isBrOrWs(*curPos)) { - if (curPos == source) return NULL; +static Cursor precedingToken(Parser* parser, Cursor curPos) { + while (curPos >= SOURCE_START) { + while (isBrOrWs(at(parser, curPos))) { + if (curPos == SOURCE_START) return SOURCE_BEFORE; curPos--; } - if (*curPos != '/' || curPos == source || *(curPos - 1) != '*') + if (at(parser, curPos) != '/' || curPos == SOURCE_START || at(parser, curPos - 1) != '*') return curPos; - if (curPos == source + 1) return NULL; + if (curPos == SOURCE_START + 1) return SOURCE_BEFORE; curPos -= 2; - while (curPos > source && !(*curPos == '*' && *(curPos - 1) == '/')) curPos--; - if (curPos <= source + 1) return NULL; + while (curPos > SOURCE_START && !(at(parser, curPos) == '*' && at(parser, curPos - 1) == '/')) curPos--; + if (curPos <= SOURCE_START + 1) return SOURCE_BEFORE; curPos -= 2; } - return NULL; + return SOURCE_BEFORE; } -static bool isStatementBrace (uint16_t* curPos, uint16_t depth) { - while (curPos && curPos != EMPTY_CHAR) { - uint16_t ch = *curPos; +static bool isStatementBrace(Parser* parser, Cursor curPos, uint16_t depth) { + while (curPos >= SOURCE_START) { + uint16_t ch = at(parser, curPos); if (ch == '{' && depth) { - curPos = openTokenPosStack[--depth]; + curPos = parser->openTokenPosStack[--depth]; continue; } if (ch != ':') - return ch == '}' || isExpressionTerminator(curPos); - if (curPos == source) return false; - curPos = precedingToken(curPos - 1); - if (!curPos) return false; - uint16_t* start = curPos; + return ch == '}' || isExpressionTerminator(parser, curPos); + if (curPos == SOURCE_START) return false; + curPos = precedingToken(parser, curPos - 1); + if (curPos < SOURCE_START) return false; + Cursor start = curPos; bool identifierStart = false; - uint16_t quote = *start; + uint16_t quote = at(parser, start); if (quote == '\'' || quote == '"') { - while (start > source) { + while (start > SOURCE_START) { start--; - if (*start != quote) continue; - uint16_t* before = start; - while (before > source && *(before - 1) == '\\') before--; + if (at(parser, start) != quote) continue; + Cursor before = start; + while (before > SOURCE_START && at(parser, before - 1) == '\\') before--; if ((start - before) % 2 == 0) break; } - if (start == source) return false; + if (start == SOURCE_START) return false; start--; } else { - while (start >= source && isIdentifierChar(fullCharCodeAtLast(start))) { - uint32_t codePoint = fullCharCodeAtLast(start); + while (start >= SOURCE_START && isIdentifierChar(fullCharCodeAtLast(parser, start))) { + uint32_t codePoint = fullCharCodeAtLast(parser, start); identifierStart = isIdentifierStart(codePoint); uint32_t length = charCodeByteLen(codePoint); - if ((size_t)(start - source) < length) return identifierStart; + if ((size_t)sourceIndex(parser, start) < length) return identifierStart; start -= length; } } - curPos = precedingToken(start); - if (curPos && (*curPos == '+' || *curPos == '-')) - curPos = curPos == source ? NULL : precedingToken(curPos - 1); - if (curPos && curPos - source >= 3 && str_eq4(curPos - 3, 'c', 'a', 's', 'e') && - (curPos == source + 3 || !isIdentifierChar(fullCharCodeAtLast(curPos - 4)) && *(curPos - 4) != '.')) + curPos = precedingToken(parser, start); + if (curPos >= SOURCE_START && (at(parser, curPos) == '+' || at(parser, curPos) == '-')) + curPos = curPos == SOURCE_START ? SOURCE_BEFORE : precedingToken(parser, curPos - 1); + if (curPos >= SOURCE_START && curPos >= SOURCE_START + 3 && str_eq4(parser, curPos - 3, 'c', 'a', 's', 'e') && + (curPos == SOURCE_START + 3 || !isIdentifierChar(fullCharCodeAtLast(parser, curPos - 4)) && at(parser, curPos - 4) != '.')) return true; if (!identifierStart) return false; @@ -1782,34 +1787,28 @@ static bool isStatementBrace (uint16_t* curPos, uint16_t depth) { return true; } -bool isExpressionTerminator (uint16_t* curPos) { +static bool isExpressionTerminator(Parser* parser, Cursor curPos) { // detects: // > ; ) -1 finally catch // as all of these followed by a { will indicate a statement brace - switch (*curPos) { + switch (at(parser, curPos)) { case '>': - return *(curPos - 1) == '='; + return at(parser, curPos - 1) == '='; case ';': case ')': return true; case 'h': - return readPrecedingKeyword4(curPos - 1, 'c', 'a', 't', 'c'); + return readPrecedingKeyword4(parser, curPos - 1, 'c', 'a', 't', 'c'); case 'y': - return readPrecedingKeyword6(curPos - 1, 'f', 'i', 'n', 'a', 'l', 'l'); + return readPrecedingKeyword6(parser, curPos - 1, 'f', 'i', 'n', 'a', 'l', 'l'); case 'e': - return readPrecedingKeyword3(curPos - 1, 'e', 'l', 's'); + return readPrecedingKeyword3(parser, curPos - 1, 'e', 'l', 's'); } return false; } -void bail (uint32_t err) { - error = 1; - parse_error = err; - pos = end + 1; -} - -void syntaxError (uint32_t code) { - if (error == 0) error = code; - parse_error = pos - source; - pos = end + 1; +static void syntaxError(Parser* parser, uint32_t code) { + if (parser->error == 0) parser->error = code; + parser->parse_error = sourceIndex(parser, parser->pos); + parser->pos = parser->end + 1; } diff --git a/src/lexer.js b/src/lexer.js index cb6509e..aeba727 100755 --- a/src/lexer.js +++ b/src/lexer.js @@ -18,15 +18,17 @@ export function parse (source, name = '@', options) { initSync(); const len = source.length; + if (len === 0) + return { exports: [], reexports: [] }; - // sa(len) writes a terminator at index len. + // The guest reserves 32 zero code units before the source and a terminator. let memory = wasm.memory.buffer; - const extraMem = (wasm.__heap_base.value || wasm.__heap_base) + (len + 1) * 2 - memory.byteLength; + const extraMem = (wasm.__heap_base.value || wasm.__heap_base) + (len + 33) * 2 - memory.byteLength; if (extraMem > 0) { wasm.memory.grow(Math.ceil(extraMem / 65536)); memory = wasm.memory.buffer; } - + const addr = wasm.sa(len); // Buffer setup is slower than the loop for short sources. if (len >= 64 && hasBuffer) @@ -45,7 +47,7 @@ export function parse (source, name = '@', options) { } let exports = new Set(), reexports = new Set(), unsafeGetters; - + while (wasm.rre()) { const reexptStr = decode(source.slice(wasm.res(), wasm.ree())); if (reexptStr !== undefined) diff --git a/src/native.c b/src/native.c new file mode 100644 index 0000000..b967fb0 --- /dev/null +++ b/src/native.c @@ -0,0 +1,276 @@ +#include "lexer-internal.h" + +void* cjs_lexer_allocate(cjs_lexer_result* result, size_t size) { + const size_t alignment = _Alignof(max_align_t); + if (size > SIZE_MAX - alignment + 1) return NULL; + size = (size + alignment - 1) & ~(alignment - 1); + ArenaBlock* block = result->blocks; + if (!block || size > block->capacity - block->used) { + size_t capacity = size > 4096 ? size : 4096; + if (capacity > SIZE_MAX - sizeof(ArenaBlock)) return NULL; + block = malloc(sizeof(ArenaBlock) + capacity); + if (!block) return NULL; + block->next = result->blocks; + block->used = 0; + block->capacity = capacity; + result->blocks = block; + } + void* value = (unsigned char*)block->data + block->used; + block->used += size; + return value; +} + +void cjs_lexer_add(Parser* parser, Candidates* list, ptrdiff_t start, ptrdiff_t end) { + if (parser->error) return; + if (start < 0 || end < start || (size_t)end > parser->sourceLen) return; + if (list->count == list->capacity) { + size_t capacity = list->capacity ? list->capacity * 2 : 16; + if (capacity < list->capacity || capacity > SIZE_MAX / sizeof(Candidate)) { + parser->error = 13; + parser->pos = parser->end + 1; + return; + } + Candidate* data = realloc(list->data, capacity * sizeof(Candidate)); + if (!data) { + parser->error = 13; + parser->pos = parser->end + 1; + return; + } + list->data = data; + list->capacity = capacity; + } + Candidate* candidate = &list->data[list->count++]; + candidate->start = start; + candidate->end = end; +} + +static int readHex(uint16_t code) { + if (code >= '0' && code <= '9') return code - '0'; + if (code >= 'a' && code <= 'f') return code - 'a' + 10; + if (code >= 'A' && code <= 'F') return code - 'A' + 10; + return -1; +} + +static bool validQuotedString(cjs_lexer_string16 value) { + for (size_t index = 0; index < value.length; index++) { + uint16_t prefix = value.data[index] & 0xfc00; + if (prefix < 0xd800) continue; + if (prefix != 0xd800 || ++index == value.length || + (value.data[index] & 0xfc00) != 0xdc00) return false; + } + return true; +} + +/* Return -1 on allocation failure, 0 for a rejected name, 1 for a view. */ +static int decode(cjs_lexer_result* result, const uint16_t* source, Candidate* candidate) { + size_t start = (size_t)candidate->start; + size_t end = (size_t)candidate->end; + candidate->value.data = source + start; + candidate->value.length = end - start; + if (start == end || (source[start] != '\'' && source[start] != '"')) return 1; + if (end - start < 2 || source[end - 1] != source[start]) return 0; + start++; + end--; + candidate->value.data = source + start; + candidate->value.length = end - start; + size_t first = start; + while (first < end && source[first] != '\\') first++; + if (first == end) return validQuotedString(candidate->value); + if (end - start > SIZE_MAX / sizeof(uint16_t)) return -1; + uint16_t* output = cjs_lexer_allocate(result, (end - start) * sizeof(uint16_t)); + if (!output) return -1; + size_t written = first - start; + memcpy(output, source + start, written * sizeof(uint16_t)); + for (size_t index = first; index < end; index++) { + uint32_t code = source[index]; + if (code == '\\') { + if (++index == end) return 0; + code = source[index]; + switch (code) { + case '\r': + if (index + 1 < end && source[index + 1] == '\n') index++; + continue; + case '\n': case 0x2028: case 0x2029: continue; + case 'r': code = '\r'; break; + case 'n': code = '\n'; break; + case 't': code = '\t'; break; + case 'b': code = '\b'; break; + case 'f': code = '\f'; break; + case 'v': code = '\v'; break; + case 'x': case 'u': { + bool braced = code == 'u' && index + 1 < end && source[index + 1] == '{'; + size_t digits = code == 'x' ? 2 : 4; + code = 0; + if (braced) { + index++; + size_t count = 0; + while (++index < end && source[index] != '}') { + int digit = readHex(source[index]); + if (digit < 0 || code > (0x10ffffU - (uint32_t)digit) / 16) return 0; + code = code * 16 + (uint32_t)digit; + count++; + } + if (!count || index == end) return 0; + } else { + if (digits > end - index - 1) return 0; + while (digits--) { + int digit = readHex(source[++index]); + if (digit < 0) return 0; + code = code * 16 + (uint32_t)digit; + } + } + break; + } + default: + if (code >= '0' && code <= '7') { + size_t remaining = code <= '3' ? 2 : 1; + code -= '0'; + while (remaining-- && index + 1 < end && source[index + 1] >= '0' && source[index + 1] <= '7') + code = code * 8 + source[++index] - '0'; + } + } + } + if (code > 0xffff) { + code -= 0x10000; + output[written++] = (uint16_t)(0xd800 | (code >> 10)); + output[written++] = (uint16_t)(0xdc00 | (code & 0x3ff)); + } else { + output[written++] = (uint16_t)code; + } + } + candidate->value.data = output; + candidate->value.length = written; + return validQuotedString(candidate->value); +} + +static bool normalize(cjs_lexer_result* result, const uint16_t* source, Candidates* list) { + size_t count = 0; + for (size_t index = 0; index < list->count; index++) { + Candidate value; + value.start = list->data[index].start; + value.end = list->data[index].end; + value.hash = 0; + int status = decode(result, source, &value); + if (status < 0) return false; + if (!status) continue; + list->data[count++] = value; + } + list->count = count; + return true; +} + +static int compareNames(const void* left, const void* right) { + const Candidate* first = left; + const Candidate* second = right; + if (first->hash != second->hash) return first->hash < second->hash ? -1 : 1; + if (first->value.length != second->value.length) + return first->value.length < second->value.length ? -1 : 1; + return memcmp(first->value.data, second->value.data, first->value.length * sizeof(uint16_t)); +} + +static void hashNames(Candidates* list) { + for (size_t index = 0; index < list->count; index++) { + Candidate* candidate = &list->data[index]; + uint32_t hash = UINT32_C(2166136261); + for (size_t unit = 0; unit < candidate->value.length; unit++) + hash = (hash ^ candidate->value.data[unit]) * UINT32_C(16777619); + candidate->hash = hash; + } +} + +uint32_t cjs_lexer_parse_utf16(const uint16_t* source, size_t length, + uint32_t flags, cjs_lexer_result** result, + cjs_lexer_error* error) { + if (error) *error = (cjs_lexer_error){0, 0, 0}; + if (!result) return CJS_LEXER_INVALID_ARGUMENT; + *result = NULL; + if ((!source && length) || (flags & ~UINT32_C(3))) return CJS_LEXER_INVALID_ARGUMENT; + if (length > UINT32_MAX || length > (size_t)PTRDIFF_MAX - 32 || + length > SIZE_MAX / sizeof(uint16_t)) return CJS_LEXER_LIMIT; + cjs_lexer_result* output = malloc(sizeof(cjs_lexer_result)); + if (!output) return CJS_LEXER_OUT_OF_MEMORY; + *output = (cjs_lexer_result){0}; + Parser parser; + parser.input = source; + parser.sourceLen = length; + parser.pos = -1; + parser.end = (ptrdiff_t)length - 1; + parser.lastTokenPos = -1; + parser.exportObjectPos = -1; + parser.templateStackDepth = 0; + parser.openTokenDepth = 0; + parser.templateDepth = UINT16_MAX; + parser.lastSlashWasDivision = false; + parser.nextBraceIsClass = false; + parser.allowMinifiedEnumerable = (flags & CJS_LEXER_ALLOW_MINIFIED_ENUMERABLE) != 0; + parser.extended = (flags & CJS_LEXER_EXTENDED) != 0; + parser.error = 0; + parser.parse_error = 0; + parser.starExportBinding_ = (StarExportBinding){0}; + parser.firstStarExport = NULL; + parser.lastStarExport = NULL; + parser.result = output; + uint32_t status = cjs_lexer_scan(&parser); + if (status) { + if (error && status != 13) { + error->code = status; + error->has_offset = 1; + error->offset = parser.parse_error > length ? length : parser.parse_error; + } + status = status == 13 ? CJS_LEXER_OUT_OF_MEMORY : + status == 12 ? CJS_LEXER_LIMIT : CJS_LEXER_SYNTAX_ERROR; + } else if (!normalize(output, source, &output->exports) || + !normalize(output, source, &output->reexports) || + !normalize(output, source, &output->unsafe_getters)) { + status = CJS_LEXER_OUT_OF_MEMORY; + } else if (output->unsafe_getters.count) { + hashNames(&output->exports); + hashNames(&output->unsafe_getters); + qsort(output->unsafe_getters.data, output->unsafe_getters.count, sizeof(Candidate), compareNames); + size_t count = 0; + for (size_t index = 0; index < output->exports.count; index++) { + Candidate candidate = output->exports.data[index]; + if (!bsearch(&candidate, output->unsafe_getters.data, output->unsafe_getters.count, + sizeof(Candidate), compareNames)) output->exports.data[count++] = candidate; + } + output->exports.count = count; + } + if (status) { + cjs_lexer_result_free(output); + return status; + } + free(output->unsafe_getters.data); + output->unsafe_getters = (Candidates){0}; + *result = output; + return CJS_LEXER_OK; +} + +size_t cjs_lexer_export_count(const cjs_lexer_result* result) { + return result->exports.count; +} + +size_t cjs_lexer_reexport_count(const cjs_lexer_result* result) { + return result->reexports.count; +} + +cjs_lexer_string16 cjs_lexer_export(const cjs_lexer_result* result, size_t index) { + return result->exports.data[index].value; +} + +cjs_lexer_string16 cjs_lexer_reexport(const cjs_lexer_result* result, size_t index) { + return result->reexports.data[index].value; +} + +void cjs_lexer_result_free(cjs_lexer_result* result) { + if (!result) return; + ArenaBlock* block = result->blocks; + while (block) { + ArenaBlock* next = block->next; + free(block); + block = next; + } + free(result->exports.data); + free(result->reexports.data); + free(result->unsafe_getters.data); + free(result); +} diff --git a/src/wasm.c b/src/wasm.c new file mode 100644 index 0000000..0ecd866 --- /dev/null +++ b/src/wasm.c @@ -0,0 +1,93 @@ +#define CJS_LEXER_WASM +#include "lexer-internal.h" + +extern unsigned char __heap_base; +static Parser parser; +static cjs_lexer_result result; +static uint64_t analysis_head; +static uint64_t analysis_limit; + +static __attribute__((noinline)) void growAnalysis(uint64_t required) { + uint32_t pages = (required - analysis_limit + 65535) >> 16; + if (__builtin_wasm_memory_grow(0, pages) == (size_t)-1) __builtin_trap(); + analysis_limit += (uint64_t)pages << 16; +} + +void* cjs_lexer_allocate(cjs_lexer_result* unused, size_t size) { + uint64_t required = analysis_head + size; + if (required > analysis_limit) growAnalysis(required); + void* allocation = (void*)(uintptr_t)analysis_head; + analysis_head = required; + return allocation; +} + +__attribute__((noinline)) void cjs_lexer_add(Parser* parser, Candidates* list, Cursor start, Cursor end) { + Slice* slice = cjs_lexer_allocate(parser->result, sizeof(Slice)); + slice->start = start; + slice->end = end; + slice->next = NULL; + if (list->last) list->last->next = slice; + else list->first = slice; + list->last = slice; +} + +uint16_t* sa(uint32_t length) { + if (length > (size_t)PTRDIFF_MAX - 32) __builtin_trap(); + uint16_t* source = (uint16_t*)(void*)&__heap_base + 32; + source[length] = 0; + analysis_head = ((uintptr_t)(source + length + 1) + _Alignof(Slice) - 1) & + ~((uintptr_t)_Alignof(Slice) - 1); + analysis_limit = (uint64_t)__builtin_wasm_memory_size(0) << 16; + clearCandidates(&result.exports); + clearCandidates(&result.reexports); + clearCandidates(&result.unsafe_getters); + return source; +} + +uint32_t parseCJSWithOptions(uint16_t* source, uint32_t length, uint32_t unused1, + uint32_t unused2, uint32_t unused3, uint32_t unused4, + uint32_t flags) { + parser.input = source; + parser.sourceLen = length; + parser.pos = source - 1; + parser.end = source + length - 1; + parser.lastTokenPos = source - 1; + parser.exportObjectPos = source - 1; + parser.templateStackDepth = 0; + parser.openTokenDepth = 0; + parser.templateDepth = UINT16_MAX; + parser.lastSlashWasDivision = false; + parser.nextBraceIsClass = false; + parser.allowMinifiedEnumerable = (flags & CJS_LEXER_ALLOW_MINIFIED_ENUMERABLE) != 0; + parser.extended = (flags & CJS_LEXER_EXTENDED) != 0; + parser.error = 0; + parser.parse_error = 0; + parser.firstStarExport = NULL; + parser.lastStarExport = NULL; + parser.result = &result; + return cjs_lexer_scan(&parser); +} + +uint32_t parseCJS(uint16_t* source, uint32_t length, uint32_t unused1, + uint32_t unused2, uint32_t unused3, uint32_t unused4) { + return parseCJSWithOptions(source, length, 0, 0, 0, 0, 0); +} + +uint32_t e(void) { return parser.parse_error; } +uint32_t es(void) { return result.exports.read->start - parser.input; } +uint32_t ee(void) { return result.exports.read->end - parser.input; } +uint32_t res(void) { return result.reexports.read->start - parser.input; } +uint32_t ree(void) { return result.reexports.read->end - parser.input; } +uint32_t us(void) { return result.unsafe_getters.read->start - parser.input; } +uint32_t ue(void) { return result.unsafe_getters.read->end - parser.input; } + +static bool readCandidate(Candidates* list) { + list->read = list->read ? list->read->next : list->first; + return list->read != NULL; +} + +bool re(void) { return readCandidate(&result.exports); } +bool rre(void) { return readCandidate(&result.reexports); } +bool ru(void) { return readCandidate(&result.unsafe_getters); } + +#include "lexer.c" diff --git a/test/_unit.js b/test/_unit.js index 3eccde1..bd1a3df 100755 --- a/test/_unit.js +++ b/test/_unit.js @@ -3,6 +3,10 @@ const assert = require('node:assert/strict'); let parse; async function loadParser () { if (parse) return; + if (process.env.NATIVE) { + parse = require('./native/parser.js').parse; + return; + } if (process.env.WASM) { const m = await import('../dist/lexer.mjs'); await m.init(); @@ -930,6 +934,17 @@ suite('Lexer', () => { parse(`\nconst x = num / /'/.exec(l)[0].slice(1, -1)//'"`); }); + test('Closing tokens consumed by export helpers do not reuse earlier brace metadata', () => { + for (const source of [ + 'module.exports={a}/1;exports.b=2;', + 'class A{};module.exports={a}/1;exports.b=2;', + 'if(x){};require("x")/1;exports.b=2;', + 'if(x){};Object.defineProperty(exports,"a",{value:1})/1;exports.b=2;' + ]) { + assert.equal(parse(source).exports.at(-1), 'b'); + } + }); + test('Multiline string escapes', () => { parse("const str = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABmJLR0QA/wAAAAAzJ3zzAAAGTElEQV\\\r\n\t\tRIx+VXe1BU1xn/zjn7ugvL4sIuQnll5U0ELAQxig7WiQYz6NRHa6O206qdSXXSxs60dTK200zNY9q0dcRpMs1jkrRNWmaijCVoaU';\r\n"); }); diff --git a/test/extended.js b/test/extended.js index 9ea9a6b..7ea7043 100644 --- a/test/extended.js +++ b/test/extended.js @@ -5,6 +5,10 @@ const options = { mode: 'extended' }; suite('Extended parsing', () => { suiteSetup(async () => { + if (process.env.NATIVE) { + parse = require('./native/parser.js').parse; + return; + } if (process.env.WASM) { const lexer = await import('../dist/lexer.mjs'); await lexer.init(); diff --git a/test/integration.js b/test/integration.js index 1a99de9..2b0c8e9 100755 --- a/test/integration.js +++ b/test/integration.js @@ -4,6 +4,10 @@ const assert = require('assert'); let parse; async function loadParser () { if (parse) return; + if (process.env.NATIVE) { + parse = require('./native/parser.js').parse; + return; + } if (process.env.WASM) { const m = await import('../dist/lexer.mjs'); await m.init(); diff --git a/test/native/consumer/CMakeLists.txt b/test/native/consumer/CMakeLists.txt new file mode 100644 index 0000000..e434c41 --- /dev/null +++ b/test/native/consumer/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(consumer LANGUAGES C CXX) +find_package(cjs_module_lexer CONFIG REQUIRED) +add_executable(consumer_c main.c) +add_executable(consumer_cpp main.cc) +target_link_libraries(consumer_c PRIVATE cjs_module_lexer::cjs_module_lexer) +target_link_libraries(consumer_cpp PRIVATE cjs_module_lexer::cjs_module_lexer) +enable_testing() +add_test(NAME consumer_c COMMAND consumer_c) +add_test(NAME consumer_cpp COMMAND consumer_cpp) diff --git a/test/native/consumer/main.c b/test/native/consumer/main.c new file mode 100644 index 0000000..1809d40 --- /dev/null +++ b/test/native/consumer/main.c @@ -0,0 +1,12 @@ +#include + +int main(void) { + const uint16_t source[] = {'e', 'x', 'p', 'o', 'r', 't', 's', '.', 'a', '=', '1'}; + cjs_lexer_result* result; + if (cjs_lexer_parse_utf16(source, sizeof(source) / sizeof(source[0]), 0, &result, NULL)) return 1; + if (cjs_lexer_export_count(result) != 1 || cjs_lexer_reexport_count(result)) return 1; + cjs_lexer_string16 name = cjs_lexer_export(result, 0); + int status = name.length != 1 || name.data[0] != 'a'; + cjs_lexer_result_free(result); + return status; +} diff --git a/test/native/consumer/main.cc b/test/native/consumer/main.cc new file mode 100644 index 0000000..0f793e2 --- /dev/null +++ b/test/native/consumer/main.cc @@ -0,0 +1 @@ +#include "main.c" diff --git a/test/native/failures.c b/test/native/failures.c new file mode 100644 index 0000000..a7e8fc6 --- /dev/null +++ b/test/native/failures.c @@ -0,0 +1,63 @@ +#include "cjs-module-lexer.h" +#include +#include +#include + +static size_t calls; +static size_t fail_at; +static size_t live; + +void* cjs_test_malloc(size_t size) { + if (++calls == fail_at) return NULL; + void* result = malloc(size); + if (result) live++; + return result; +} + +void* cjs_test_realloc(void* pointer, size_t size) { + if (++calls == fail_at) return NULL; + int fresh = pointer == NULL; + void* result = realloc(pointer, size); + if (result && fresh) live++; + return result; +} + +void cjs_test_free(void* pointer) { + if (pointer) live--; + free(pointer); +} + +int main(void) { + const char* pattern = "var dep=require('dep');exports['a\\u0062']=1;" + "Object.defineProperty(exports,'ab',{get(){return effect()}});__exportStar(require('side'));"; + size_t length = strlen(pattern) * 256; + uint16_t* source = malloc(length * sizeof(uint16_t)); + assert(source); + for (size_t index = 0; index < length; index++) source[index] = (unsigned char)pattern[index % strlen(pattern)]; + size_t allocations = 0; + for (size_t failure = 0; failure <= allocations + 1; failure++) { + calls = 0; + fail_at = failure; + cjs_lexer_result* result; + cjs_lexer_error error; + uint32_t status = cjs_lexer_parse_utf16(source, length, 0, &result, &error); + if (!failure) allocations = calls; + if (failure && failure <= allocations) { + assert(status == CJS_LEXER_OUT_OF_MEMORY); + assert(!result); + assert(!error.code && !error.has_offset && !error.offset); + } else { + assert(status == CJS_LEXER_OK); + assert(cjs_lexer_export_count(result) == 0); + assert(cjs_lexer_reexport_count(result) == 256); + cjs_lexer_result_free(result); + } + assert(!live); + fail_at = 0; + assert(cjs_lexer_parse_utf16(source, length, 0, &result, NULL) == CJS_LEXER_OK); + cjs_lexer_result_free(result); + assert(!live); + } + free(source); + return 0; +} diff --git a/test/native/fuzz.c b/test/native/fuzz.c new file mode 100644 index 0000000..09c95ab --- /dev/null +++ b/test/native/fuzz.c @@ -0,0 +1,25 @@ +#include "cjs-module-lexer.h" +#include + +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + if (!size) return 0; + size_t length = (size - 1) / 2; + uint16_t* source = malloc(length * sizeof(uint16_t)); + if (!source && length) return 0; + for (size_t index = 0; index < length; index++) + source[index] = (uint16_t)(data[index * 2 + 1] | (uint16_t)data[index * 2 + 2] << 8); + cjs_lexer_result* result; + cjs_lexer_error error; + cjs_lexer_parse_utf16(source, length, data[0] & 3, &result, &error); + if (result) { + for (size_t index = 0; index < cjs_lexer_export_count(result); index++) { + cjs_lexer_string16 value = cjs_lexer_export(result, index); + volatile uint16_t unit = 0; + for (size_t offset = 0; offset < value.length; offset++) unit = value.data[offset]; + (void)unit; + } + } + cjs_lexer_result_free(result); + free(source); + return 0; +} diff --git a/test/native/parse.c b/test/native/parse.c new file mode 100644 index 0000000..24f770b --- /dev/null +++ b/test/native/parse.c @@ -0,0 +1,50 @@ +#include "cjs-module-lexer.h" +#include +#include + +static void string(cjs_lexer_string16 value) { + putchar('"'); + for (size_t index = 0; index < value.length; index++) printf("\\u%04x", value.data[index]); + putchar('"'); +} + +int main(int argc, char** argv) { + uint32_t flags = argc > 1 ? (uint32_t)strtoul(argv[1], NULL, 10) : 0; + size_t length = 0; + size_t capacity = 1024; + uint16_t* source = malloc(capacity * sizeof(uint16_t)); + if (!source) return 1; + int low; + while ((low = getchar()) != EOF) { + int high = getchar(); + if (high == EOF) return 1; + if (length == capacity) { + capacity *= 2; + uint16_t* next = realloc(source, capacity * sizeof(uint16_t)); + if (!next) { free(source); return 1; } + source = next; + } + source[length++] = (uint16_t)(low | high << 8); + } + cjs_lexer_result* result; + cjs_lexer_error error; + uint32_t status = cjs_lexer_parse_utf16(source, length, flags, &result, &error); + if (status) { + printf("{\"status\":%u,\"code\":%u,\"idx\":%zu}\n", status, error.code, error.offset); + } else { + printf("{\"exports\":["); + for (size_t index = 0; index < cjs_lexer_export_count(result); index++) { + if (index) putchar(','); + string(cjs_lexer_export(result, index)); + } + printf("],\"reexports\":["); + for (size_t index = 0; index < cjs_lexer_reexport_count(result); index++) { + if (index) putchar(','); + string(cjs_lexer_reexport(result, index)); + } + printf("]}\n"); + cjs_lexer_result_free(result); + } + free(source); + return 0; +} diff --git a/test/native/parser.js b/test/native/parser.js new file mode 100644 index 0000000..a1b0264 --- /dev/null +++ b/test/native/parser.js @@ -0,0 +1,26 @@ +const { execFileSync } = require('node:child_process'); +const path = require('node:path'); + +/** + * @param {string} source + * @param {string} name + * @param {import('../../lexer').ParseOptions} options + */ +exports.parse = function parse (source, name = '@', options) { + const mode = options?.mode; + if (mode !== undefined && mode !== 'default' && mode !== 'extended') + throw new TypeError('Expected options.mode to be "default" or "extended".'); + const flags = (options?.allowMinifiedEnumerable === true ? 1 : 0) | (mode === 'extended' ? 2 : 0); + const executable = process.env.NATIVE_LEXER || path.join(__dirname, + process.platform === 'win32' ? '../../build/native/Debug/native_parse.exe' : '../../build/native/native_parse'); + const result = JSON.parse(execFileSync(executable, [String(flags)], { + input: Buffer.from(source, 'utf16le'), maxBuffer: 16 * 1024 * 1024 + })); + if (result.status) { + const error = new Error(`Parse error ${name}${result.idx}`); + error.idx = result.idx; + if (result.code === 5 || result.code === 6 || result.code === 7) error.code = 'ERR_LEXER_ESM_SYNTAX'; + throw error; + } + return { exports: [...new Set(result.exports)], reexports: [...new Set(result.reexports)] }; +}; diff --git a/test/native/test.c b/test/native/test.c new file mode 100644 index 0000000..e8e0c7f --- /dev/null +++ b/test/native/test.c @@ -0,0 +1,108 @@ +#include "cjs-module-lexer.h" +#include +#include +#include + +static uint16_t* copy(const char* source, size_t length) { + uint16_t* data = malloc(length * sizeof(uint16_t)); + assert(data || !length); + for (size_t index = 0; index < length; index++) data[index] = (unsigned char)source[index]; + return data; +} + +static void name(cjs_lexer_string16 value, const char* expected) { + assert(value.length == strlen(expected)); + for (size_t index = 0; index < value.length; index++) assert(value.data[index] == (unsigned char)expected[index]); +} + +int main(void) { + cjs_lexer_result* result = NULL; + cjs_lexer_error error = {99, 99, 99}; + assert(cjs_lexer_parse_utf16(NULL, 0, 0, &result, &error) == CJS_LEXER_OK); + assert(cjs_lexer_export_count(result) == 0); + assert(!error.code && !error.has_offset && !error.offset); + cjs_lexer_result_free(result); + assert(cjs_lexer_parse_utf16(NULL, 1, 0, &result, &error) == CJS_LEXER_INVALID_ARGUMENT); + assert(!result && !error.has_offset); + assert(cjs_lexer_parse_utf16(NULL, 0, 4, &result, &error) == CJS_LEXER_INVALID_ARGUMENT); + assert(!result); + assert(cjs_lexer_parse_utf16(NULL, 0, 0, NULL, &error) == CJS_LEXER_INVALID_ARGUMENT); + uint16_t unit = 0; + assert(cjs_lexer_parse_utf16(&unit, SIZE_MAX, 0, &result, &error) == CJS_LEXER_LIMIT); + assert(!result && !error.has_offset); + const char* divisions[] = { + "module.exports={a}/1;exports.b=2;", + "class A{};module.exports={a}/1;exports.b=2;", + "if(x){};require('x')/1;exports.b=2;", + "if(x){};Object.defineProperty(exports,'a',{value:1})/1;exports.b=2;" + }; + for (size_t index = 0; index < sizeof(divisions) / sizeof(*divisions); index++) { + size_t count = strlen(divisions[index]); + uint16_t* division = copy(divisions[index], count); + assert(cjs_lexer_parse_utf16(division, count, 0, &result, &error) == CJS_LEXER_OK); + name(cjs_lexer_export(result, cjs_lexer_export_count(result) - 1), "b"); + cjs_lexer_result_free(result); + free(division); + } + const char* text = "exports.a=1;exports['\\u0061']=2;exports.b=3;" + "Object.defineProperty(exports,'b',{get(){return effect()}});" + "__exportStar(require('first'));module.exports=require('last');"; + size_t length = strlen(text); + uint16_t* source = copy(text, length); + assert(cjs_lexer_parse_utf16(source, length, 0, &result, &error) == CJS_LEXER_OK); + assert(cjs_lexer_export_count(result) == 2); + name(cjs_lexer_export(result, 0), "a"); + name(cjs_lexer_export(result, 1), "a"); + assert(cjs_lexer_reexport_count(result) == 1); + name(cjs_lexer_reexport(result, 0), "last"); + cjs_lexer_result* other; + assert(cjs_lexer_parse_utf16(source, length, CJS_LEXER_EXTENDED, &other, NULL) == CJS_LEXER_OK); + assert(cjs_lexer_export_count(other) == 4); + assert(cjs_lexer_reexport_count(other) == 2); + cjs_lexer_result_free(other); + name(cjs_lexer_export(result, 1), "a"); + cjs_lexer_result_free(result); + // Every prefix uses an exact allocation, including truncated lookahead and escapes. + for (size_t count = 0; count <= length; count++) { + uint16_t* prefix = copy(text, count); + uint32_t status = cjs_lexer_parse_utf16(prefix, count, 0, &result, &error); + assert(status == CJS_LEXER_OK || status == CJS_LEXER_SYNTAX_ERROR); + assert(!error.has_offset || error.offset <= count); + cjs_lexer_result_free(result); + free(prefix); + } + free(source); + // The nesting boundary and recovery share the public parse path. + for (size_t depth = 2047; depth <= 2049; depth++) { + source = malloc(depth * 4); + assert(source); + for (size_t index = 0; index < depth; index++) { + source[index] = '('; + source[depth + index] = ')'; + } + uint32_t status = cjs_lexer_parse_utf16(source, depth * 2, 0, &result, &error); + assert(status == (depth <= 2048 ? CJS_LEXER_OK : CJS_LEXER_LIMIT)); + if (depth > 2048) assert(error.has_offset && error.offset == 2048); + cjs_lexer_result_free(result); + free(source); + } + assert(cjs_lexer_parse_utf16(&unit, 1, 0, &result, NULL) == CJS_LEXER_OK); + cjs_lexer_result_free(result); + // Deterministic malformed UTF-16 exercises both modes without padding. + uint32_t random = 42; + for (size_t iteration = 0; iteration < 20000; iteration++) { + length = iteration % 128; + source = malloc(length * sizeof(uint16_t)); + for (size_t index = 0; index < length; index++) { + random = random * UINT32_C(1664525) + UINT32_C(1013904223); + source[index] = (iteration & 1) ? (uint16_t)(random >> 16) : (uint16_t)(random % 128); + } + uint32_t status = cjs_lexer_parse_utf16(source, length, (uint32_t)iteration & 3, &result, &error); + assert(status == CJS_LEXER_OK || status == CJS_LEXER_SYNTAX_ERROR || status == CJS_LEXER_LIMIT); + assert(!error.has_offset || error.offset <= length); + cjs_lexer_result_free(result); + free(source); + } + cjs_lexer_result_free(NULL); + return 0; +} diff --git a/test/native/threads.cc b/test/native/threads.cc new file mode 100644 index 0000000..8ad52c8 --- /dev/null +++ b/test/native/threads.cc @@ -0,0 +1,42 @@ +#include "cjs-module-lexer.h" +#include +#include +#include +#include +#include + +int main() { + std::mutex mutex; + std::condition_variable ready; + unsigned waiting = 0; + std::vector workers; + for (unsigned worker = 0; worker < 8; worker++) { + workers.emplace_back([&, worker]() { + std::vector source; + for (char unit : "exports['\\u0061']=1;module.exports=require('dep');") { + if (unit) source.push_back(static_cast(unit)); + } + std::unique_lock lock(mutex); + waiting++; + ready.notify_all(); + ready.wait(lock, [&]() { return waiting == 8; }); + lock.unlock(); + for (unsigned iteration = 0; iteration < 1000; iteration++) { + cjs_lexer_result* first; + cjs_lexer_result* second; + cjs_lexer_error error; + assert(cjs_lexer_parse_utf16(source.data(), source.size(), worker & 3, &first, &error) == CJS_LEXER_OK); + assert(cjs_lexer_parse_utf16(source.data(), source.size(), 0, &second, nullptr) == CJS_LEXER_OK); + auto name = cjs_lexer_export(first, 0); + assert(name.length == 1 && name.data[0] == 'a'); + auto specifier = cjs_lexer_reexport(second, 0); + assert(specifier.length == 3 && specifier.data[0] == 'd'); + cjs_lexer_result_free(iteration & 1 ? first : second); + if (!(iteration & 1)) assert(cjs_lexer_export(first, 0).data[0] == 'a'); + else assert(cjs_lexer_reexport(second, 0).data[0] == 'd'); + cjs_lexer_result_free(iteration & 1 ? second : first); + } + }); + } + for (auto& worker : workers) worker.join(); +} diff --git a/test/wasm-memory.js b/test/wasm-memory.js index a2d974f..fe4d0be 100644 --- a/test/wasm-memory.js +++ b/test/wasm-memory.js @@ -22,7 +22,7 @@ suite('Wasm analysis capacity', () => { const prefix = 'var v=0;module.exports={'; const suffix = 'v};' + tail; // Each shorthand adds 4 source bytes and a 12-byte Slice. - const available = bytes - wasm.__heap_base.value - 2 * (prefix.length + suffix.length + 1) - 12; + const available = bytes - wasm.__heap_base.value - 2 * (prefix.length + suffix.length + 33) - 12; const count = Math.floor((available - remaining) / 16); const padding = (available - count * 16 - remaining) / 2; const source = prefix + 'v,'.repeat(count) + suffix + ' '.repeat(padding); @@ -60,7 +60,7 @@ suite('Wasm binding capacity', () => { const bytes = memory.byteLength; const prefix = 'var v=0;module.exports={'; const suffix = 'v};var last=require("last");' + reexport; - const available = bytes - wasm.__heap_base.value - 2 * (prefix.length + suffix.length + 1) - 12; + const available = bytes - wasm.__heap_base.value - 2 * (prefix.length + suffix.length + 33) - 12; const count = Math.floor((available - remaining) / 16); const padding = (available - count * 16 - remaining) / 2; const source = prefix + 'v,'.repeat(count) + suffix + ' '.repeat(padding); @@ -169,7 +169,7 @@ suite('Wasm source reservation', () => { globalThis.Buffer = originalBuffer; if (mode === 'async') await lexer.init(); if (mode === 'sync') lexer.initSync(); - const length = (bytes - heap - remaining) / 2 - 1; + const length = (bytes - heap - remaining) / 2 - 33; const source = ' '.repeat(length - tail.length) + tail; const result = lexer.parse(source); assert.deepStrictEqual(result, expected); From d600d9af6e631ca253ff63b2e0a919ff24933433 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Wed, 28 Oct 2026 13:02:39 +0100 Subject: [PATCH 02/10] fix: preserve valid BMP export names Quoted names above U+DFFF were classified as unpaired surrogates because validation lacked the surrogate range's upper bound. This discarded valid BMP exports and reexports in all backends. --- lexer.js | 4 ++-- src/lexer.js | 4 ++-- src/native.c | 2 +- test/_unit.js | 21 +++++++++++++++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/lexer.js b/lexer.js index ed1e039..e63f370 100755 --- a/lexer.js +++ b/lexer.js @@ -91,7 +91,7 @@ function decode (str) { // Filter to exclude non-matching UTF-16 surrogate strings for (let i = 0; i < decoded.length; i++) { const surrogatePrefix = decoded.charCodeAt(i) & 0xFC00; - if (surrogatePrefix < 0xD800) { + if (surrogatePrefix < 0xD800 || surrogatePrefix >= 0xE000) { // Not a surrogate continue; } @@ -101,7 +101,7 @@ function decode (str) { return; } else { - // Out-of-range surrogate code (above 0xD800) + // Unpaired low surrogate return; } } diff --git a/src/lexer.js b/src/lexer.js index aeba727..a580797 100755 --- a/src/lexer.js +++ b/src/lexer.js @@ -73,7 +73,7 @@ function decode (str) { // Filter to exclude non-matching UTF-16 surrogate strings for (let i = 0; i < decoded.length; i++) { const surrogatePrefix = decoded.charCodeAt(i) & 0xFC00; - if (surrogatePrefix < 0xD800) { + if (surrogatePrefix < 0xD800 || surrogatePrefix >= 0xE000) { // Not a surrogate continue; } @@ -83,7 +83,7 @@ function decode (str) { return; } else { - // Out-of-range surrogate code (above 0xD800) + // Unpaired low surrogate return; } } diff --git a/src/native.c b/src/native.c index b967fb0..0bd3098 100644 --- a/src/native.c +++ b/src/native.c @@ -54,7 +54,7 @@ static int readHex(uint16_t code) { static bool validQuotedString(cjs_lexer_string16 value) { for (size_t index = 0; index < value.length; index++) { uint16_t prefix = value.data[index] & 0xfc00; - if (prefix < 0xd800) continue; + if (prefix < 0xd800 || prefix >= 0xe000) continue; if (prefix != 0xd800 || ++index == value.length || (value.data[index] & 0xfc00) != 0xdc00) return false; } diff --git a/test/_unit.js b/test/_unit.js index bd1a3df..6a11db4 100755 --- a/test/_unit.js +++ b/test/_unit.js @@ -1214,6 +1214,27 @@ suite('Lexer', () => { parse(`//`); }); + test('Quoted Unicode names preserve the BMP around surrogate boundaries', () => { + const accepted = ['\ud7ff', '\ue000', '\uf900', '\uff21', '\ufffd', '\uffff', '\ud800\udc00', '\udbff\udfff']; + const rejected = ['\ud800', '\udbff', '\udc00', '\udfff', '\ud800A', '\udbff\ue000']; + for (const value of [...accepted, ...rejected]) { + let escaped = ''; + for (let index = 0; index < value.length; index++) + escaped += '\\u' + value.charCodeAt(index).toString(16).padStart(4, '0'); + for (const quoted of [JSON.stringify(value), '"' + escaped + '"']) { + const expected = accepted.includes(value) ? [value] : []; + assert.deepStrictEqual(parse(`exports[${quoted}] = 1; module.exports = require(${quoted});`), { + exports: expected, + reexports: expected + }); + } + } + assert.deepStrictEqual(parse("exports['\ue000'] = 1; Object.defineProperty(exports, '\\ue000', { get() { return effect(); } });"), { + exports: [], + reexports: [] + }); + }); + test('Simple export with unicode conversions', () => { const source = `export var p𓀀s,q`; assert.throws(() => { From e2d0839b9fd9a9c05ef6fb7224e38518b3ac8c7b Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Wed, 28 Oct 2026 13:41:30 +0100 Subject: [PATCH 03/10] perf(native): reuse the current character at token-run entry Token-run entry repeats a bounds check and source read for the character already loaded by the main loop. Seven alternating macOS arm64 processes reduce warmed d3.min.js parsing from 0.569 to 0.542 ms (Node.js 27.0.0-pre, V8 15.6.75.25-node.10). --- src/lexer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lexer.c b/src/lexer.c index d20f4e4..0debb88 100755 --- a/src/lexer.c +++ b/src/lexer.c @@ -299,9 +299,17 @@ uint32_t cjs_lexer_scan (Parser* parser) { templateString(parser); break; default: +#ifndef CJS_LEXER_WASM + if (!isTokenRunChar(ch)) + break; + goto scanTokenRun; +#endif skipTokenRun: if (!isTokenRunChar(at(parser, parser->pos))) break; +#ifndef CJS_LEXER_WASM + scanTokenRun: +#endif while (parser->pos < parser->end && isTokenRunChar(scanInput(input, parser->pos + 1))) parser->pos++; From e7c05dc0432461a00681285685549d95a89e16be Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Wed, 28 Oct 2026 14:13:48 +0100 Subject: [PATCH 04/10] fix: align native arena storage without max_align_t MSVC C headers do not define max_align_t, so native builds fail on Windows. The arena needs alignment only for UTF-16 text and reexport bindings. The corpus reader must preserve their raw source bytes on Windows. --- src/lexer-internal.h | 23 ++++++++++++++--------- src/native.c | 2 +- test/_unit.js | 8 ++++++++ test/native/parse.c | 7 +++++++ 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/lexer-internal.h b/src/lexer-internal.h index 1d8dc7b..036c601 100644 --- a/src/lexer-internal.h +++ b/src/lexer-internal.h @@ -23,6 +23,14 @@ typedef ptrdiff_t Cursor; #endif #define SOURCE_BEFORE (SOURCE_START - 1) +typedef struct StarExportBinding { + Cursor specifier_start; + Cursor specifier_end; + Cursor id_start; + Cursor id_end; + struct StarExportBinding* next; +} StarExportBinding; + #ifdef CJS_LEXER_WASM typedef struct Slice { Cursor start; @@ -43,11 +51,16 @@ struct cjs_lexer_result { }; #else +typedef union { + uint16_t code; + StarExportBinding binding; +} ArenaValue; + typedef struct ArenaBlock { struct ArenaBlock* next; size_t used; size_t capacity; - max_align_t data[]; + ArenaValue data[]; } ArenaBlock; typedef struct { @@ -72,14 +85,6 @@ struct cjs_lexer_result { #endif -typedef struct StarExportBinding { - Cursor specifier_start; - Cursor specifier_end; - Cursor id_start; - Cursor id_end; - struct StarExportBinding* next; -} StarExportBinding; - typedef struct { const uint16_t* input; size_t sourceLen; diff --git a/src/native.c b/src/native.c index 0bd3098..3a24b71 100644 --- a/src/native.c +++ b/src/native.c @@ -1,7 +1,7 @@ #include "lexer-internal.h" void* cjs_lexer_allocate(cjs_lexer_result* result, size_t size) { - const size_t alignment = _Alignof(max_align_t); + const size_t alignment = _Alignof(ArenaValue); if (size > SIZE_MAX - alignment + 1) return NULL; size = (size + alignment - 1) & ~(alignment - 1); ArenaBlock* block = result->blocks; diff --git a/test/_unit.js b/test/_unit.js index 6a11db4..ad6757a 100755 --- a/test/_unit.js +++ b/test/_unit.js @@ -1214,6 +1214,14 @@ suite('Lexer', () => { parse(`//`); }); + test('Quoted names preserve raw UTF-16 code units', () => { + const value = '\u001a\u0a0d\u0d0a'; + assert.deepStrictEqual(parse(`exports['${value}'] = 1; module.exports = require('${value}');`), { + exports: [value], + reexports: [value] + }); + }); + test('Quoted Unicode names preserve the BMP around surrogate boundaries', () => { const accepted = ['\ud7ff', '\ue000', '\uf900', '\uff21', '\ufffd', '\uffff', '\ud800\udc00', '\udbff\udfff']; const rejected = ['\ud800', '\udbff', '\udc00', '\udfff', '\ud800A', '\udbff\ue000']; diff --git a/test/native/parse.c b/test/native/parse.c index 24f770b..5bd3984 100644 --- a/test/native/parse.c +++ b/test/native/parse.c @@ -1,6 +1,10 @@ #include "cjs-module-lexer.h" #include #include +#ifdef _WIN32 +#include +#include +#endif static void string(cjs_lexer_string16 value) { putchar('"'); @@ -9,6 +13,9 @@ static void string(cjs_lexer_string16 value) { } int main(int argc, char** argv) { +#ifdef _WIN32 + if (_setmode(_fileno(stdin), _O_BINARY) == -1) return 1; +#endif uint32_t flags = argc > 1 ? (uint32_t)strtoul(argv[1], NULL, 10) : 0; size_t length = 0; size_t capacity = 1024; From daa7f7c7518d2c5ee55d8e9a91c9d71098d19135 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 29 Oct 2026 17:43:11 +0100 Subject: [PATCH 05/10] fix(wasm): preserve the missing export name sentinel The shared scanner uses the source start as a missing-name marker. That pointer is nonzero in Wasm, so empty objects and trailing commas add an empty export in extended mode. --- lib/lexer.wasm | Bin 28832 -> 28805 bytes src/lexer.c | 2 +- test/extended.js | 29 +++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/lexer.wasm b/lib/lexer.wasm index 2270c54067c8300385ca2191ab83467d7b42bcc7..35240e40167daee7e3e2ff113221c1a00046aad3 100755 GIT binary patch delta 822 zcmb_av2GMG5S_7SckkAAv=kADP}nOWu1Ip66j2;V+!WcR;UB1TP>>%u3Mi3s+8+Rk z4?yGt;6H%k1PH2tfQBLxV{eWKYP2iwTYLQc{N6lU;gb~}eZ{BCZ!huj@pHUCz5pTP zk6zx9f;wk)&|O!X-91I!&ZKI1Hz0qBYiAW|&iam1UX4-lZrdYDNGiPI{NRRyD(COe zx*=mlm+i1Snp|3-2Yw3;&HfxGho#zpre_bzBVTJ}sN0A8H0yVWz@#8(uL5Y9tx2{9 z@Y>T|r@b(b5$Zy?Jq2wG;|qQVt^5{T&NqkS=2d~au4l<2kl6wME3 zZO7nYOG3yDKMK-}4o&y^*43`MO;@aRj|9XRG83cmS!$g3@iyIZvN^?l2T=x(8X2a| jp#-0~c*9fiUzmAYN)5kQqELJ3!3tv7K0iL$dv)_ST2hJ= delta 769 zcmbtSJ!=&~6uo!8cAqmVTL{tE+}S2+%p)WO(ID@F@2!m>*jd=v<=Ggpj)Il}Wq*LC zvl21?Lkl}i^Dur?Dr#dPcxUH58%tT(Ju~<0nKS3!hckRS!$)87+2e07@X6r;-X7M+ z#K*L%peb4HY$@ng*6F$$@#nNTFX5E+l?n)lsCcc-$n;1UgzVCvwd3#5Rs~~imP6tB zC`m-iYf%N&?XRC6C<1;56Eo`WUp{r~FQGROkrc1A@@m>UV>8OsSY#(r6GqS@CHsvL zs}V?(xhh^nbcoP6ktGv#aGo3=K`Tqwz1=v!S1G<1c_0>p@{F;_(v|iMvQYJju~4!J zTe}EKj#)fpNv`jvCoPm^iKQ0@k^?k~fAnW4{v@{^pos; - Cursor nameEnd = SOURCE_START; + Cursor nameEnd = 0; if (ch == '\'' || ch == '"') { stringLiteral(parser, ch); nameEnd = ++parser->pos; diff --git a/test/extended.js b/test/extended.js index 7ea7043..460d316 100644 --- a/test/extended.js +++ b/test/extended.js @@ -55,6 +55,35 @@ suite('Extended parsing', () => { }); } + test('empty export objects do not add names', () => { + for (const source of [ + 'module.exports = {};', 'module.exports = ({ /* empty */ });', + 'Object.defineProperties(exports, {});', 'Object.defineProperties(module.exports, {});', + 'Object.defineProperties(exports, ({ /* empty */ }));' + ]) { + assert.deepEqual(parse(source, 'fixture.cjs', options), { exports: [], reexports: [] }); + } + }); + + test('trailing commas do not add empty names', () => { + for (const source of [ + 'module.exports = { first: 1, };', 'module.exports = ({ first: 1, /* trailing */ });', + 'Object.defineProperties(exports, { first: { value: 1 }, });', + 'Object.defineProperties(module.exports, ({ first: { value: 1 }, /* trailing */ }));' + ]) { + assert.deepEqual(parse(source, 'fixture.cjs', options), { exports: ['first'], reexports: [] }); + } + }); + + test('empty string property names remain exports', () => { + for (const source of [ + "module.exports = { '': 1 };", "module.exports = { ['']: 1, };", + "Object.defineProperties(exports, { '': { value: 1 } });" + ]) { + assert.deepEqual(parse(source, 'fixture.cjs', options), { exports: [''], reexports: [] }); + } + }); + test('descriptors with computed constant names', () => { const result = parse(`Object.defineProperties(module.exports, { ['first']: { get() { return factory().value; } }, second: { value: 2 } From dcdb186d8a448c3c4cfa3bf2aa33500ded098b02 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 29 Oct 2026 17:49:02 +0100 Subject: [PATCH 06/10] perf(native): remove redundant string scan bounds checks String scanning checks the input length after the loop has already bounded the cursor. Seven alternating process trials on macOS arm64 reduce warmed o200k_base.cjs parsing by 19.6% (tiktoken 1.0.22) and full-versions.js parsing by 24.0% (electron-to-chromium 1.5.417), on Node 27.0.0-pre with V8 15.6.75.25-node.10. --- src/lexer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lexer.c b/src/lexer.c index 83377cc..5bb9f7a 100755 --- a/src/lexer.c +++ b/src/lexer.c @@ -1500,7 +1500,7 @@ static void lineComment(Parser* parser) { static void stringLiteral(Parser* parser, uint16_t quote) { while (parser->pos++ < parser->end) { - uint16_t ch = at(parser, parser->pos); + uint16_t ch = scanInput(parser->input, parser->pos); if (ch == quote) return; if (ch == '\\') { From b5ca7cb910a32f38879a1647c82fbafda8b989f9 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Fri, 30 Oct 2026 01:20:57 +0100 Subject: [PATCH 07/10] refactor(native): trust validated scanner ranges The existing loop and keyword guards cover each replaced read. Keep checked access for lookahead and sentinel scans that do not have that range proof. On Apple M4 Max with Clang 21, seven interleaved C API processes per file reduce geometric mean parse CPU time by 2.7% across 155 files. Seven focused Node 27 process trials with V8 15.6.75.25-node.10 reduce D3 minified parse time by 4.3% and Angular by 3.5%. Magic-string minified takes 3.6% more time, so this does not improve every input. --- src/lexer.c | 38 +++++++++++++++++++------------------- test/native/test.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/src/lexer.c b/src/lexer.c index 5bb9f7a..dab0b39 100755 --- a/src/lexer.c +++ b/src/lexer.c @@ -1090,7 +1090,7 @@ static bool tryParseRequire(Parser* parser, enum RequireType requireType) { static bool matchesKeyword(Parser* parser, const char* keyword, uint32_t length) { if (parser->pos > parser->end || (uint32_t)(parser->end - parser->pos + 1) < length) return false; for (uint32_t i = 0; i < length; i++) { - if (at(parser, parser->pos + i) != keyword[i]) return false; + if (scanInput(parser->input, parser->pos + i) != keyword[i]) return false; } return true; } @@ -1114,8 +1114,8 @@ static uint16_t readExportExpressionStart(Parser* parser) { } } else { - while (parser->pos <= parser->end && isIdentifierChar(fullCharCode(parser, at(parser, parser->pos)))) - parser->pos += charCodeByteLen(fullCharCode(parser, at(parser, parser->pos))); + while (parser->pos <= parser->end && isIdentifierChar(fullCharCode(parser, scanInput(parser->input, parser->pos)))) + parser->pos += charCodeByteLen(fullCharCode(parser, scanInput(parser->input, parser->pos))); } if (parser->pos == start || commentWhitespace(parser) != ',') { parser->pos = start; @@ -1464,7 +1464,7 @@ static uint16_t commentWhitespace(Parser* parser) { static void templateString(Parser* parser) { while (parser->pos++ < parser->end) { - uint16_t ch = at(parser, parser->pos); + uint16_t ch = scanInput(parser->input, parser->pos); if (ch == '$' && at(parser, parser->pos + 1) == '{') { parser->pos++; if (!pushTemplate(parser)) @@ -1482,7 +1482,7 @@ static void templateString(Parser* parser) { static void blockComment(Parser* parser) { parser->pos++; while (parser->pos++ < parser->end) { - uint16_t ch = at(parser, parser->pos); + uint16_t ch = scanInput(parser->input, parser->pos); if (ch == '*' && at(parser, parser->pos + 1) == '/') { parser->pos++; return; @@ -1492,7 +1492,7 @@ static void blockComment(Parser* parser) { static void lineComment(Parser* parser) { while (parser->pos++ < parser->end) { - uint16_t ch = at(parser, parser->pos); + uint16_t ch = scanInput(parser->input, parser->pos); if (ch == '\n' || ch == '\r') return; } @@ -1516,7 +1516,7 @@ static void stringLiteral(Parser* parser, uint16_t quote) { static uint16_t regexCharacterClass(Parser* parser) { while (parser->pos++ < parser->end) { - uint16_t ch = at(parser, parser->pos); + uint16_t ch = scanInput(parser->input, parser->pos); if (ch == ']') return ch; if (ch == '\\') @@ -1530,7 +1530,7 @@ static uint16_t regexCharacterClass(Parser* parser) { static void regularExpression(Parser* parser) { while (parser->pos++ < parser->end) { - uint16_t ch = at(parser, parser->pos); + uint16_t ch = scanInput(parser->input, parser->pos); if (ch == '/') return; if (ch == '[') @@ -1559,48 +1559,48 @@ static bool isBrOrWsOrPunctuatorNotDot (uint16_t c) { } static bool str_eq2(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2) { - return hasChars(parser, cursor, 2) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2; + return hasChars(parser, cursor, 2) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2; } static bool str_eq3(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3) { - return hasChars(parser, cursor, 3) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3; + return hasChars(parser, cursor, 3) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2 && scanInput(parser->input, cursor + 2) == c3; } static bool str_eq4(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4) { - return hasChars(parser, cursor, 4) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4; + return hasChars(parser, cursor, 4) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2 && scanInput(parser->input, cursor + 2) == c3 && scanInput(parser->input, cursor + 3) == c4; } static bool str_eq5(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5) { - return hasChars(parser, cursor, 5) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5; + return hasChars(parser, cursor, 5) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2 && scanInput(parser->input, cursor + 2) == c3 && scanInput(parser->input, cursor + 3) == c4 && scanInput(parser->input, cursor + 4) == c5; } static bool str_eq6(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6) { - return hasChars(parser, cursor, 6) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6; + return hasChars(parser, cursor, 6) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2 && scanInput(parser->input, cursor + 2) == c3 && scanInput(parser->input, cursor + 3) == c4 && scanInput(parser->input, cursor + 4) == c5 && scanInput(parser->input, cursor + 5) == c6; } static bool str_eq7(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7) { - return hasChars(parser, cursor, 7) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7; + return hasChars(parser, cursor, 7) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2 && scanInput(parser->input, cursor + 2) == c3 && scanInput(parser->input, cursor + 3) == c4 && scanInput(parser->input, cursor + 4) == c5 && scanInput(parser->input, cursor + 5) == c6 && scanInput(parser->input, cursor + 6) == c7; } static bool str_eq8(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8) { - return hasChars(parser, cursor, 8) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7 && at(parser, cursor + 7) == c8; + return hasChars(parser, cursor, 8) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2 && scanInput(parser->input, cursor + 2) == c3 && scanInput(parser->input, cursor + 3) == c4 && scanInput(parser->input, cursor + 4) == c5 && scanInput(parser->input, cursor + 5) == c6 && scanInput(parser->input, cursor + 6) == c7 && scanInput(parser->input, cursor + 7) == c8; } static bool str_eq9(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9) { - return hasChars(parser, cursor, 9) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7 && at(parser, cursor + 7) == c8 && at(parser, cursor + 8) == c9; + return hasChars(parser, cursor, 9) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2 && scanInput(parser->input, cursor + 2) == c3 && scanInput(parser->input, cursor + 3) == c4 && scanInput(parser->input, cursor + 4) == c5 && scanInput(parser->input, cursor + 5) == c6 && scanInput(parser->input, cursor + 6) == c7 && scanInput(parser->input, cursor + 7) == c8 && scanInput(parser->input, cursor + 8) == c9; } static bool str_eq10(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10) { - return hasChars(parser, cursor, 10) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7 && at(parser, cursor + 7) == c8 && at(parser, cursor + 8) == c9 && at(parser, cursor + 9) == c10; + return hasChars(parser, cursor, 10) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2 && scanInput(parser->input, cursor + 2) == c3 && scanInput(parser->input, cursor + 3) == c4 && scanInput(parser->input, cursor + 4) == c5 && scanInput(parser->input, cursor + 5) == c6 && scanInput(parser->input, cursor + 6) == c7 && scanInput(parser->input, cursor + 7) == c8 && scanInput(parser->input, cursor + 8) == c9 && scanInput(parser->input, cursor + 9) == c10; } static bool str_eq13(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13) { - return hasChars(parser, cursor, 13) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7 && at(parser, cursor + 7) == c8 && at(parser, cursor + 8) == c9 && at(parser, cursor + 9) == c10 && at(parser, cursor + 10) == c11 && at(parser, cursor + 11) == c12 && at(parser, cursor + 12) == c13; + return hasChars(parser, cursor, 13) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2 && scanInput(parser->input, cursor + 2) == c3 && scanInput(parser->input, cursor + 3) == c4 && scanInput(parser->input, cursor + 4) == c5 && scanInput(parser->input, cursor + 5) == c6 && scanInput(parser->input, cursor + 6) == c7 && scanInput(parser->input, cursor + 7) == c8 && scanInput(parser->input, cursor + 8) == c9 && scanInput(parser->input, cursor + 9) == c10 && scanInput(parser->input, cursor + 10) == c11 && scanInput(parser->input, cursor + 11) == c12 && scanInput(parser->input, cursor + 12) == c13; } static bool str_eq22(Parser* parser, Cursor cursor, uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4, uint16_t c5, uint16_t c6, uint16_t c7, uint16_t c8, uint16_t c9, uint16_t c10, uint16_t c11, uint16_t c12, uint16_t c13, uint16_t c14, uint16_t c15, uint16_t c16, uint16_t c17, uint16_t c18, uint16_t c19, uint16_t c20, uint16_t c21, uint16_t c22) { - return hasChars(parser, cursor, 22) && at(parser, cursor + 0) == c1 && at(parser, cursor + 1) == c2 && at(parser, cursor + 2) == c3 && at(parser, cursor + 3) == c4 && at(parser, cursor + 4) == c5 && at(parser, cursor + 5) == c6 && at(parser, cursor + 6) == c7 && at(parser, cursor + 7) == c8 && at(parser, cursor + 8) == c9 && at(parser, cursor + 9) == c10 && at(parser, cursor + 10) == c11 && at(parser, cursor + 11) == c12 && at(parser, cursor + 12) == c13 && at(parser, cursor + 13) == c14 && at(parser, cursor + 14) == c15 && at(parser, cursor + 15) == c16 && at(parser, cursor + 16) == c17 && at(parser, cursor + 17) == c18 && at(parser, cursor + 18) == c19 && at(parser, cursor + 19) == c20 && at(parser, cursor + 20) == c21 && at(parser, cursor + 21) == c22; + return hasChars(parser, cursor, 22) && scanInput(parser->input, cursor + 0) == c1 && scanInput(parser->input, cursor + 1) == c2 && scanInput(parser->input, cursor + 2) == c3 && scanInput(parser->input, cursor + 3) == c4 && scanInput(parser->input, cursor + 4) == c5 && scanInput(parser->input, cursor + 5) == c6 && scanInput(parser->input, cursor + 6) == c7 && scanInput(parser->input, cursor + 7) == c8 && scanInput(parser->input, cursor + 8) == c9 && scanInput(parser->input, cursor + 9) == c10 && scanInput(parser->input, cursor + 10) == c11 && scanInput(parser->input, cursor + 11) == c12 && scanInput(parser->input, cursor + 12) == c13 && scanInput(parser->input, cursor + 13) == c14 && scanInput(parser->input, cursor + 14) == c15 && scanInput(parser->input, cursor + 15) == c16 && scanInput(parser->input, cursor + 16) == c17 && scanInput(parser->input, cursor + 17) == c18 && scanInput(parser->input, cursor + 18) == c19 && scanInput(parser->input, cursor + 19) == c20 && scanInput(parser->input, cursor + 20) == c21 && scanInput(parser->input, cursor + 21) == c22; } static bool keywordStart(Parser* parser, Cursor cursor) { diff --git a/test/native/test.c b/test/native/test.c index e8e0c7f..8cb51b1 100644 --- a/test/native/test.c +++ b/test/native/test.c @@ -72,6 +72,34 @@ int main(void) { free(prefix); } free(source); + const char* scans[] = { + "const value=`a\\`b${1}c`;exports.after=1;", + "/* a* * / **/exports.after=1;", + "// a\\\r\nexports.after=1;", + "const value=/a\\/[b\\]c]*/;exports.after=1;", + "module.exports=(first,second,{});exports.after=1;", + "Object.defineProperty(exports,'item',{value:1});exports.after=1;", + "Object.defineProperties(exports,{item:{value:1}});exports.after=1;", + "_interopRequireWildcard(require('item'));__exportStar(require('other'));exports.after=1;" + }; + for (size_t index = 0; index < sizeof(scans) / sizeof(*scans); index++) { + length = strlen(scans[index]); + for (uint32_t flags = 0; flags <= 3; flags++) { + for (size_t count = 0; count <= length; count++) { + source = copy(scans[index], count); + uint32_t status = cjs_lexer_parse_utf16(source, count, flags, &result, &error); + assert(status == CJS_LEXER_OK || status == CJS_LEXER_SYNTAX_ERROR); + assert(!error.has_offset || error.offset <= count); + if (count == length) { + assert(status == CJS_LEXER_OK); + assert(cjs_lexer_export_count(result)); + name(cjs_lexer_export(result, cjs_lexer_export_count(result) - 1), "after"); + } + cjs_lexer_result_free(result); + free(source); + } + } + } // The nesting boundary and recovery share the public parse path. for (size_t depth = 2047; depth <= 2049; depth++) { source = malloc(depth * 4); From 997fda8c75ee32275a5a5471a272c569b1ef7ec4 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 19 Nov 2026 19:52:48 +0100 Subject: [PATCH 08/10] refactor(lexer): separate native and Wasm result storage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep storage out of the scanner without imposing an index-cursor cost. On Node.js 22, padded indices cost 7–9% on Angular and export-heavy inputs across two runs of seven alternating trials. Name native syntax codes without changing their values. Keep the offset of the first diagnostic when a malformed regex reports a second error. Use the configured header directory in the installed CMake target so consumers can find the header after a custom installation. Refs: https://github.com/nodejs/cjs-module-lexer/pull/140#pullrequestreview-5970910052 Signed-off-by: Ruben Bridgewater --- CMakeLists.txt | 7 +- README.md | 6 +- include/cjs-module-lexer.h | 16 + lexer.js | 24 +- lib/lexer.wasm | Bin 28805 -> 28802 bytes lib/lexer.wat | 12539 +++++++++++++++++------------------ src/lexer-internal.h | 98 +- src/lexer.c | 75 +- src/native.c | 91 +- src/wasm.c | 55 +- test/_unit.js | 15 +- test/native/test.c | 27 +- 12 files changed, 6482 insertions(+), 6471 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24f93ff..a4f31a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,20 @@ cmake_minimum_required(VERSION 3.15) -project(cjs_module_lexer VERSION 2.3.0 LANGUAGES C) +project(cjs_module_lexer LANGUAGES C) + +include(GNUInstallDirs) add_library(cjs_module_lexer STATIC src/lexer.c src/native.c) add_library(cjs_module_lexer::cjs_module_lexer ALIAS cjs_module_lexer) target_compile_features(cjs_module_lexer PUBLIC c_std_11) target_include_directories(cjs_module_lexer PUBLIC $ - $) + $) if(MSVC) target_compile_options(cjs_module_lexer PRIVATE /W4) else() target_compile_options(cjs_module_lexer PRIVATE -Wall -Wextra -Wno-parentheses) endif() -include(GNUInstallDirs) install(TARGETS cjs_module_lexer EXPORT cjs_module_lexer_targets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES include/cjs-module-lexer.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(EXPORT cjs_module_lexer_targets FILE cjs_module_lexer-config.cmake diff --git a/README.md b/README.md index 836bfdd..4f2229a 100755 --- a/README.md +++ b/README.md @@ -542,8 +542,10 @@ String rejection, getter filtering, and detection modes match the Wasm package. The status distinguishes invalid arguments, lexical failure, limits, and allocation failure. Every failure sets the result to null and initializes the optional error output. -`error.has_offset` identifies an available source location, and `error.code` identifies the scanner error. -Codes 5, 6, and 7 identify ESM syntax. Nesting is limited to 2048 tracked brackets or templates. +`error.has_offset` signals that `error.offset` gives a source location. +`error.code` is a `CJS_LEXER_ERROR_*` constant from the header, or `CJS_LEXER_ERROR_NONE` if there is no scanner error. +`CJS_LEXER_ERROR_UNEXPECTED_IMPORT_META`, `CJS_LEXER_ERROR_UNEXPECTED_ESM_IMPORT`, and +`CJS_LEXER_ERROR_UNEXPECTED_ESM_EXPORT` identify ESM syntax. Nesting is limited to 2048 tracked brackets or templates. Input lengths must fit `uint32_t`, `PTRDIFF_MAX - 32`, and the platform's UTF-16 allocation range. Output locations must not overlap each other or the source. diff --git a/include/cjs-module-lexer.h b/include/cjs-module-lexer.h index efb3a65..322823b 100644 --- a/include/cjs-module-lexer.h +++ b/include/cjs-module-lexer.h @@ -21,6 +21,22 @@ typedef struct { size_t offset; } cjs_lexer_error; +enum { + CJS_LEXER_ERROR_NONE = 0, + CJS_LEXER_ERROR_UNEXPECTED_EOF = 1, + CJS_LEXER_ERROR_UNEXPECTED_CLOSING_BRACE = 2, + CJS_LEXER_ERROR_UNEXPECTED_TEMPLATE_BRACE = 3, + CJS_LEXER_ERROR_INVALID_TEMPLATE_DEPTH = 4, + CJS_LEXER_ERROR_UNEXPECTED_IMPORT_META = 5, + CJS_LEXER_ERROR_UNEXPECTED_ESM_IMPORT = 6, + CJS_LEXER_ERROR_UNEXPECTED_ESM_EXPORT = 7, + CJS_LEXER_ERROR_UNBALANCED_DELIMITER = 8, + CJS_LEXER_ERROR_UNTERMINATED_STRING = 9, + CJS_LEXER_ERROR_UNTERMINATED_REGEX_CLASS = 10, + CJS_LEXER_ERROR_UNTERMINATED_REGEX = 11, + CJS_LEXER_ERROR_NESTING_LIMIT = 12 +}; + #define CJS_LEXER_OK UINT32_C(0) #define CJS_LEXER_INVALID_ARGUMENT UINT32_C(1) #define CJS_LEXER_SYNTAX_ERROR UINT32_C(2) diff --git a/lexer.js b/lexer.js index e63f370..aaeeb59 100755 --- a/lexer.js +++ b/lexer.js @@ -120,6 +120,7 @@ function parseSource (cjsSource) { pos = -1; end = source.length - 1; let ch = 0; + let lastClosedTokenPos = -1; let lastOpenTokenPos = -1; let lastOpenTokenType = 0; @@ -141,9 +142,6 @@ function parseSource (cjsSource) { if (ch === 32 || ch < 14 && ch > 8) continue; - let closedTokenPos = -1; - let closedTokenType = 0; - if (openTokenDepth === 0) { switch (ch) { case 105/*i*/: @@ -151,8 +149,6 @@ function parseSource (cjsSource) { throwIfImportStatement(); skipTokenRun(); lastTokenPos = pos; - lastOpenTokenPos = -1; - lastOpenTokenType = 0; continue; case 114/*r*/: const startPos = pos; @@ -160,8 +156,6 @@ function parseSource (cjsSource) { tryBacktrackAddStarExportBinding(startPos - 1); skipTokenRun(); lastTokenPos = pos; - lastOpenTokenPos = -1; - lastOpenTokenType = 0; continue; case 95/*_*/: if (source.startsWith('interopRequireWildcard', pos + 1) && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) { @@ -189,8 +183,6 @@ function parseSource (cjsSource) { } skipTokenRun(); lastTokenPos = pos; - lastOpenTokenPos = -1; - lastOpenTokenType = 0; continue; } } @@ -243,7 +235,8 @@ function parseSource (cjsSource) { if (openTokenDepth === 0) throw new Error('Unexpected closing bracket.'); openTokenDepth--; - closedTokenPos = openTokenPosStack[openTokenDepth]; + lastClosedTokenPos = pos; + lastOpenTokenPos = openTokenPosStack[openTokenDepth]; break; case 123/*{*/: pushOpenToken(lastTokenPos); @@ -258,8 +251,9 @@ function parseSource (cjsSource) { case 125/*}*/: if (openTokenDepth === 0) throw new Error('Unexpected closing brace.'); - closedTokenPos = openTokenPosStack[openTokenDepth - 1]; - closedTokenType = openTokenTypeStack[openTokenDepth - 1]; + lastClosedTokenPos = pos; + lastOpenTokenPos = openTokenPosStack[openTokenDepth - 1]; + lastOpenTokenType = openTokenTypeStack[openTokenDepth - 1]; if (openTokenDepth-- === templateDepth) { templateDepth = templateStack[--templateStackDepth]; templateString(); @@ -297,10 +291,10 @@ function parseSource (cjsSource) { if (isExpressionPunctuator(lastToken) && !(lastToken === 46/*.*/ && (source.charCodeAt(lastTokenPos - 1) >= 48/*0*/ && source.charCodeAt(lastTokenPos - 1) <= 57/*9*/)) && !(lastToken === 43/*+*/ && source.charCodeAt(lastTokenPos - 1) === 43/*+*/) && !(lastToken === 45/*-*/ && source.charCodeAt(lastTokenPos - 1) === 45/*-*/) || - lastToken === 41/*)*/ && isParenKeyword(lastOpenTokenPos) || + lastTokenPos === lastClosedTokenPos && (lastToken === 41/*)*/ && isParenKeyword(lastOpenTokenPos) || lastToken === 125/*}*/ && (isExpressionTerminator(lastOpenTokenPos) || (lastOpenTokenType & ClassToken) || - extended && isStatementBrace(lastOpenTokenPos, openTokenDepth)) || + extended && isStatementBrace(lastOpenTokenPos, openTokenDepth))) || lastToken === 47/*/*/ && lastSlashWasDivision || isExpressionKeyword(lastTokenPos) || !lastToken) { @@ -321,8 +315,6 @@ function parseSource (cjsSource) { skipTokenRun(); } lastTokenPos = pos; - lastOpenTokenPos = closedTokenPos; - lastOpenTokenType = closedTokenType; } if (templateDepth !== -1) diff --git a/lib/lexer.wasm b/lib/lexer.wasm index 35240e40167daee7e3e2ff113221c1a00046aad3..83454517d8e0c17334c98841bdc5526eda85a6ab 100755 GIT binary patch literal 28802 zcmchgdAwXlb?5KW-LK#4?x(gSOR{9i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ff@H@cLs>v`O%-Z{XMp|12^eMgt{ zdoH)+r7Ow51-yw{y4LknZrRQxjjF8hNH?-EU9u(N+{-;*uHrr66_4syqx4IL(!Z{s z2fuKB*iu>ci#*?g0Dqb1i@Ejgqud{&qiseppP}Lm$Ue}8KAxgYHn)#k^hjTlyZDzL zDsJ&48ingN>PXH9xSzwVd|f}sEg1yvoLltj63!nYaM{@BXe5rV_1qqxDyKWy zOM0)qsd5RAXi-|1;8gCHXi#O;@AN)BCEx#-wCK4ArsXfhgW5~>xsNs_(^D{#kMUGL z`8jUMN!NQJFwrer5*?CDqF?WHDJ{9`naTqW%83SDvPE5~{^(P%?vvp^S-q4$zh0sv z$v36bGu2CUt52u0q9f@^`8yHVSKi_Maw{3KsjqMg*8w`4`qTLsYsHH*sC+MsK8Mcm zq=@3W*B{v%c?$12mhV+v<%NoA4_AgP49tOz+~UccMShmuM$zke}#yIeCeW#D~hsuL=KpZsiM~ z@F-80_|q+4D%*M^jU`>_DH*8jCERIzRhz%TE&3!YU5U;lZ#{LXu5Rg5Wk<^?o!&o( zc172o%RTRgSYCcYbjv5G>?10~B|Ne%$y`~IuP(`0^7^b%a-A zl;AgT3+JmSBwE?eBQ1G; wG1h;v%EVi3zKH=x&xv{~dw}PE*!>@0_~PBaxbGz|-M#OsUmH)paQBt}2dHU*S^xk5 diff --git a/lib/lexer.wat b/lib/lexer.wat index fc66779..5595394 100644 --- a/lib/lexer.wat +++ b/lib/lexer.wat @@ -4,100 +4,30 @@ (type (;2;) (func (param i32))) (type (;3;) (func (param i32 i32) (result i32))) (type (;4;) (func (param i32 i32 i32))) - (type (;5;) (func (param i64))) - (type (;6;) (func (param i32 i32 i32) (result i32))) - (type (;7;) (func)) + (type (;5;) (func (param i32 i32 i32) (result i32))) + (type (;6;) (func)) + (type (;7;) (func (param i64))) (type (;8;) (func (param i32 i32 i32 i32 i32 i32 i32) (result i32))) (type (;9;) (func (param i32 i32 i32 i32 i32 i32) (result i32))) - (func (;0;) (type 4) (param i32 i32 i32) - (local i32 i64 i64) - i32.const 4136 - i64.load - local.tee 5 - i64.const 12 - i64.add - local.tee 4 - i32.const 4144 - i64.load - i64.gt_u - if (result i64) ;; label = @1 - local.get 4 - call 1 - i32.const 4136 - i64.load - else - local.get 5 - end - i32.wrap_i64 - local.tee 3 - i32.const 0 - i32.store offset=8 - local.get 3 - local.get 2 - i32.store offset=4 - local.get 3 - local.get 1 - i32.store - local.get 0 - i32.load offset=4 - local.tee 1 - i32.const 8 - i32.add - local.get 0 - local.get 1 - select - local.get 3 - i32.store - i32.const 4136 - local.get 4 - i64.store - local.get 0 - local.get 3 - i32.store offset=4) - (func (;1;) (type 5) (param i64) - local.get 0 - i32.const 4144 - i64.load - i64.sub - i64.const 65535 - i64.add - local.tee 0 - i64.const 16 - i64.shr_u - i32.wrap_i64 - memory.grow - i32.const -1 - i32.eq - if ;; label = @1 - unreachable - end - i32.const 4144 - i32.const 4144 - i64.load - local.get 0 - i64.const 281474976645120 - i64.and - i64.add - i64.store) - (func (;2;) (type 2) (param i32) + (func (;0;) (type 2) (param i32) local.get 0 i32.const 0 i32.store offset=8 local.get 0 i64.const 0 i64.store align=4) - (func (;3;) (type 0) (result i32) + (func (;1;) (type 0) (result i32) (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i64 i64) block ;; label = @1 block ;; label = @2 i32.const 4188 i32.load - local.tee 1 + local.tee 3 i32.load16_u i32.const 35 i32.ne br_if 0 (;@2;) - local.get 1 + local.get 3 i32.load16_u offset=2 i32.const 33 i32.ne @@ -111,21 +41,21 @@ i32.load i32.const 6 i32.add - local.set 2 + local.set 1 i32.const 4200 i32.load - local.set 3 + local.set 2 loop ;; label = @3 block ;; label = @4 - local.get 2 + local.get 1 local.tee 0 - local.get 3 + local.get 2 i32.gt_u br_if 0 (;@4;) local.get 0 i32.const 2 i32.add - local.set 2 + local.set 1 local.get 0 i32.load16_u i32.const 10 @@ -140,15 +70,15 @@ i32.const 4196 i32.load local.set 0 - local.get 1 + local.get 3 i32.const 2 i32.sub - local.tee 11 - local.set 12 + local.tee 12 + local.set 8 loop ;; label = @2 i32.const 4196 local.get 0 - local.tee 1 + local.tee 2 i32.const 2 i32.add local.tee 0 @@ -173,7 +103,28 @@ block ;; label = @19 block ;; label = @20 block ;; label = @21 - block ;; label = @22 + i32.const 4200 + i32.load + local.tee 10 + local.get 0 + i32.ge_u + if ;; label = @22 + local.get 0 + i32.load16_u + local.tee 4 + i32.const 9 + i32.sub + local.tee 3 + i32.const 23 + i32.le_u + i32.const 0 + i32.const 1 + local.get 3 + i32.shl + i32.const 8388639 + i32.and + select + br_if 20 (;@2;) block ;; label = @23 block ;; label = @24 block ;; label = @25 @@ -186,28 +137,7 @@ block ;; label = @32 block ;; label = @33 block ;; label = @34 - i32.const 4200 - i32.load - local.tee 9 - local.get 0 - i32.ge_u - if ;; label = @35 - local.get 0 - i32.load16_u - local.tee 3 - i32.const 9 - i32.sub - local.tee 2 - i32.const 23 - i32.le_u - i32.const 0 - i32.const 1 - local.get 2 - i32.shl - i32.const 8388639 - i32.and - select - br_if 33 (;@2;) + block ;; label = @35 block ;; label = @36 block ;; label = @37 block ;; label = @38 @@ -215,4895 +145,3902 @@ block ;; label = @40 block ;; label = @41 block ;; label = @42 - block ;; label = @43 + i32.const 4214 + i32.load16_u + local.tee 1 + i32.eqz + if ;; label = @43 block ;; label = @44 + block ;; label = @45 + block ;; label = @46 + local.get 4 + i32.const 91 + i32.sub + br_table 11 (;@35;) 42 (;@4;) 14 (;@32;) 42 (;@4;) 2 (;@44;) 27 (;@19;) 42 (;@4;) 42 (;@4;) 6 (;@40;) 42 (;@4;) 5 (;@41;) 42 (;@4;) 42 (;@4;) 42 (;@4;) 1 (;@45;) 42 (;@4;) 42 (;@4;) 42 (;@4;) 4 (;@42;) 0 (;@46;) + end + block ;; label = @46 + local.get 4 + i32.const 34 + i32.sub + br_table 22 (;@24;) 42 (;@4;) 42 (;@4;) 42 (;@4;) 42 (;@4;) 22 (;@24;) 25 (;@21;) 16 (;@30;) 42 (;@4;) 42 (;@4;) 43 (;@3;) 42 (;@4;) 42 (;@4;) 23 (;@23;) 0 (;@46;) + end + block ;; label = @46 + local.get 4 + i32.const 123 + i32.sub + br_table 19 (;@27;) 42 (;@4;) 20 (;@26;) 0 (;@46;) + end + local.get 4 + i32.const 60 + i32.eq + br_if 42 (;@3;) + local.get 4 + i32.const 79 + i32.eq + br_if 7 (;@38;) + local.get 4 + i32.const 114 + i32.ne + br_if 41 (;@4;) + i32.const 0 + call 2 + i32.eqz + br_if 41 (;@4;) + i32.const 4188 + i32.load + local.get 0 + i32.eq + br_if 40 (;@5;) + local.get 2 + i32.load16_u + call 3 + i32.eqz + br_if 41 (;@4;) + br 40 (;@5;) + end + local.get 2 + i32.load16_u offset=4 + i32.const 109 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=6 + i32.const 112 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=8 + i32.const 111 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=10 + i32.const 114 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=12 + i32.const 116 + i32.ne + br_if 40 (;@4;) + local.get 0 + i32.const 4188 + i32.load + i32.ne + if ;; label = @45 + local.get 2 + i32.load16_u + call 3 + i32.eqz + br_if 41 (;@4;) + end + i32.const 4196 + local.get 2 + i32.const 14 + i32.add + local.tee 1 + i32.store block ;; label = @45 block ;; label = @46 block ;; label = @47 block ;; label = @48 block ;; label = @49 block ;; label = @50 - block ;; label = @51 - block ;; label = @52 - block ;; label = @53 - block ;; label = @54 - block ;; label = @55 - i32.const 4214 - i32.load16_u - local.tee 2 - i32.eqz - if ;; label = @56 - block ;; label = @57 - block ;; label = @58 - block ;; label = @59 - local.get 3 - i32.const 91 - i32.sub - br_table 11 (;@48;) 55 (;@4;) 14 (;@45;) 55 (;@4;) 2 (;@57;) 27 (;@32;) 55 (;@4;) 55 (;@4;) 6 (;@53;) 55 (;@4;) 5 (;@54;) 55 (;@4;) 55 (;@4;) 55 (;@4;) 1 (;@58;) 55 (;@4;) 55 (;@4;) 55 (;@4;) 4 (;@55;) 0 (;@59;) - end - block ;; label = @59 - local.get 3 - i32.const 34 - i32.sub - br_table 22 (;@37;) 55 (;@4;) 55 (;@4;) 55 (;@4;) 55 (;@4;) 22 (;@37;) 25 (;@34;) 16 (;@43;) 55 (;@4;) 55 (;@4;) 56 (;@3;) 55 (;@4;) 55 (;@4;) 23 (;@36;) 0 (;@59;) - end - block ;; label = @59 - local.get 3 - i32.const 123 - i32.sub - br_table 19 (;@40;) 55 (;@4;) 20 (;@39;) 0 (;@59;) - end - local.get 3 - i32.const 60 - i32.eq - br_if 55 (;@3;) - local.get 3 - i32.const 79 - i32.eq - br_if 7 (;@51;) - local.get 3 - i32.const 114 - i32.ne - br_if 54 (;@4;) - i32.const 0 - call 4 - i32.eqz - br_if 54 (;@4;) - i32.const 4188 - i32.load - local.get 0 - i32.eq - br_if 53 (;@5;) - local.get 1 - i32.load16_u - call 5 - i32.eqz - br_if 54 (;@4;) - br 53 (;@5;) - end - local.get 1 - i32.load16_u offset=4 - i32.const 109 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=6 - i32.const 112 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=8 - i32.const 111 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=10 - i32.const 114 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=12 - i32.const 116 - i32.ne - br_if 53 (;@4;) - local.get 0 - i32.const 4188 - i32.load - i32.ne - if ;; label = @58 - local.get 1 - i32.load16_u - call 5 - i32.eqz - br_if 54 (;@4;) - end - i32.const 4196 - local.get 1 - i32.const 14 - i32.add - local.tee 2 - i32.store - block ;; label = @58 - block ;; label = @59 - block ;; label = @60 - block ;; label = @61 - block ;; label = @62 - block ;; label = @63 - call 6 - local.tee 1 - i32.const 39 - i32.sub - br_table 2 (;@61;) 3 (;@60;) 1 (;@62;) 2 (;@61;) 1 (;@62;) 1 (;@62;) 1 (;@62;) 4 (;@59;) 0 (;@63;) - end - local.get 1 - i32.const 34 - i32.eq - local.get 1 - i32.const 123 - i32.eq - i32.or - br_if 1 (;@61;) - end - i32.const 4196 - i32.load - local.get 2 - i32.eq - br_if 57 (;@4;) - end - i32.const 4214 - i32.load16_u - i32.eqz - br_if 2 (;@58;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.sub - i32.store - br 56 (;@4;) - end - i32.const 4214 - i32.load16_u - local.tee 1 - i32.const 2048 - i32.ne - br_if 26 (;@33;) - i32.const 4224 - i32.load - i32.eqz - if ;; label = @60 - i32.const 4224 - i32.const 12 - i32.store - end - i32.const 4196 - i32.load - local.set 0 - i32.const 4196 - i32.const 4200 - i32.load - i32.const 2 - i32.add - i32.store - i32.const 4228 - local.get 0 - i32.const 4188 - i32.load - i32.sub - i32.const 1 - i32.shr_s - i32.store - br 55 (;@4;) - end - i32.const 4224 - i32.load - i32.eqz - if ;; label = @59 - i32.const 4224 - i32.const 5 - i32.store - end - i32.const 4196 - i32.load - local.set 0 - i32.const 4196 - i32.const 4200 - i32.load - i32.const 2 - i32.add - i32.store - i32.const 4228 - local.get 0 - i32.const 4188 - i32.load - i32.sub - i32.const 1 - i32.shr_s - i32.store - br 54 (;@4;) - end - i32.const 4224 - i32.load - i32.eqz - if ;; label = @58 - i32.const 4224 - i32.const 6 - i32.store - end - i32.const 4196 - i32.load - local.set 0 - i32.const 4196 - i32.const 4200 - i32.load - i32.const 2 - i32.add - i32.store - i32.const 4228 - local.get 0 - i32.const 4188 - i32.load - i32.sub - i32.const 1 - i32.shr_s - i32.store - br 53 (;@4;) - end - local.get 1 - i32.load16_u offset=4 - local.tee 2 - i32.const 95 - i32.ne - if ;; label = @57 - local.get 2 - i32.const 105 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=6 - i32.const 110 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=8 - i32.const 116 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=10 - i32.const 101 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=12 - i32.const 114 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=14 - i32.const 111 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=16 - i32.const 112 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=18 - i32.const 82 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=20 - i32.const 101 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=22 - i32.const 113 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=24 - i32.const 117 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=26 - i32.const 105 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=28 - i32.const 114 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=30 - i32.const 101 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=32 - i32.const 87 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=34 - i32.const 105 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=36 - i32.const 108 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=38 - i32.const 100 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=40 - i32.const 99 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=42 - i32.const 97 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=44 - i32.const 114 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=46 - i32.const 100 - i32.ne - br_if 53 (;@4;) - block ;; label = @58 - i32.const 4188 - i32.load - local.get 0 - i32.eq - br_if 0 (;@58;) - local.get 1 - i32.load16_u - local.tee 2 - call 5 - br_if 0 (;@58;) - local.get 2 - i32.const 46 - i32.ne - br_if 54 (;@4;) - end - i32.const 4196 - local.get 1 - i32.const 48 - i32.add - i32.store - local.get 1 - i32.load16_u offset=48 - i32.const 40 - i32.ne - br_if 53 (;@4;) - i32.const 4214 - i32.const 1 - i32.store16 - i32.const 4196 - local.get 1 - i32.const 50 - i32.add - i32.store - i32.const 8328 - i32.const 4204 - i32.load - i32.store - i32.const 16520 - i32.const 0 - i32.store8 - i32.const 0 - call 4 - i32.eqz - br_if 53 (;@4;) - i32.const 4188 - i32.load - local.get 0 - i32.eq - br_if 52 (;@5;) - local.get 1 - i32.load16_u - call 5 - br_if 52 (;@5;) - br 53 (;@4;) - end - local.get 1 - i32.load16_u offset=6 - i32.const 101 - i32.ne - br_if 52 (;@4;) - local.get 1 - i32.load16_u offset=8 - i32.const 120 - i32.ne - br_if 52 (;@4;) - local.get 1 - i32.load16_u offset=10 - i32.const 112 - i32.ne - br_if 52 (;@4;) - local.get 1 - i32.load16_u offset=12 - i32.const 111 - i32.ne - br_if 52 (;@4;) - local.get 1 - i32.load16_u offset=14 - i32.const 114 - i32.ne - br_if 52 (;@4;) - local.get 1 - i32.load16_u offset=16 - i32.const 116 - i32.ne - br_if 52 (;@4;) - block ;; label = @57 - i32.const 4188 - i32.load - local.get 0 - i32.eq - br_if 0 (;@57;) - local.get 1 - i32.load16_u - local.tee 0 - call 5 - br_if 0 (;@57;) - local.get 0 - i32.const 46 - i32.ne - br_if 53 (;@4;) - end - i32.const 4196 - local.get 1 - i32.const 18 - i32.add - i32.store - i32.const 9 - local.set 2 - local.get 1 - i32.load16_u offset=18 - local.tee 0 - i32.const 83 - i32.eq - if (result i32) ;; label = @57 - local.get 1 - i32.load16_u offset=20 - i32.const 116 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=22 - i32.const 97 - i32.ne - br_if 53 (;@4;) - local.get 1 - i32.load16_u offset=24 - i32.const 114 - i32.ne - br_if 53 (;@4;) - i32.const 4196 - local.get 1 - i32.const 26 - i32.add - i32.store - i32.const 13 - local.set 2 - local.get 1 - i32.load16_u offset=26 - else - local.get 0 - end - i32.const 65535 - i32.and - i32.const 40 - i32.ne - br_if 52 (;@4;) - i32.const 4214 - i32.const 1 - i32.store16 - i32.const 8328 - i32.const 4204 - i32.load - i32.store - i32.const 16520 - i32.const 0 - i32.store8 - local.get 1 - local.get 2 - i32.const 1 - i32.shl - i32.add - local.tee 0 - i32.load16_u offset=2 - i32.const 114 - i32.ne - br_if 52 (;@4;) - i32.const 4196 - local.get 0 - i32.const 2 - i32.add - i32.store - i32.const 2 - call 4 - drop - br 52 (;@4;) - end - block ;; label = @56 - local.get 3 - i32.const 34 - i32.sub - br_table 19 (;@37;) 52 (;@4;) 52 (;@4;) 52 (;@4;) 52 (;@4;) 19 (;@37;) 6 (;@50;) 14 (;@42;) 52 (;@4;) 52 (;@4;) 12 (;@44;) 52 (;@4;) 52 (;@4;) 20 (;@36;) 0 (;@56;) - end - block ;; label = @56 - local.get 3 - i32.const 91 - i32.sub - br_table 7 (;@49;) 52 (;@4;) 10 (;@46;) 52 (;@4;) 52 (;@4;) 24 (;@32;) 52 (;@4;) 52 (;@4;) 3 (;@53;) 52 (;@4;) 2 (;@54;) 0 (;@56;) - end - block ;; label = @56 - local.get 3 - i32.const 123 - i32.sub - br_table 15 (;@41;) 52 (;@4;) 18 (;@38;) 0 (;@56;) - end - local.get 3 - i32.const 60 - i32.eq - br_if 52 (;@3;) - local.get 3 - i32.const 79 - i32.eq - br_if 4 (;@51;) - local.get 3 - i32.const 109 - i32.ne - br_if 51 (;@4;) - end - local.get 1 - i32.load16_u offset=4 - i32.const 111 - i32.ne - br_if 50 (;@4;) - local.get 1 - i32.load16_u offset=6 - i32.const 100 - i32.ne - br_if 50 (;@4;) - local.get 1 - i32.load16_u offset=8 - i32.const 117 - i32.ne - br_if 50 (;@4;) - local.get 1 - i32.load16_u offset=10 - i32.const 108 - i32.ne - br_if 50 (;@4;) - local.get 1 - i32.load16_u offset=12 - i32.const 101 - i32.ne - br_if 50 (;@4;) - local.get 0 - i32.const 4188 - i32.load - i32.ne - if ;; label = @55 - local.get 1 - i32.load16_u - call 5 - i32.eqz - br_if 51 (;@4;) - end - i32.const 4196 - local.get 1 - i32.const 14 - i32.add - i32.store - call 6 - i32.const 46 - i32.ne - br_if 2 (;@52;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 101 - i32.ne - br_if 2 (;@52;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 120 - i32.ne - br_if 2 (;@52;) - local.get 0 - i32.load16_u offset=4 - i32.const 112 - i32.ne - br_if 2 (;@52;) - local.get 0 - i32.load16_u offset=6 - i32.const 111 - i32.ne - br_if 2 (;@52;) - local.get 0 - i32.load16_u offset=8 - i32.const 114 - i32.ne - br_if 2 (;@52;) - local.get 0 - i32.load16_u offset=10 - i32.const 116 - i32.ne - br_if 2 (;@52;) - local.get 0 - i32.load16_u offset=12 - i32.const 115 - i32.ne - br_if 2 (;@52;) - i32.const 1 - call 7 - br 50 (;@4;) - end - local.get 1 - i32.load16_u offset=4 - i32.const 120 - i32.ne - br_if 49 (;@4;) - local.get 1 - i32.load16_u offset=6 - i32.const 112 - i32.ne - br_if 49 (;@4;) - local.get 1 - i32.load16_u offset=8 - i32.const 111 - i32.ne - br_if 49 (;@4;) - local.get 1 - i32.load16_u offset=10 - i32.const 114 - i32.ne - br_if 49 (;@4;) - local.get 1 - i32.load16_u offset=12 - i32.const 116 - i32.ne - br_if 49 (;@4;) - local.get 0 - i32.const 4188 - i32.load - i32.ne - if ;; label = @54 - local.get 1 - i32.load16_u - call 5 - i32.eqz - br_if 50 (;@4;) - end - local.get 1 - i32.load16_u offset=14 - i32.const 115 - i32.eq - if ;; label = @54 - i32.const 0 - call 7 - br 50 (;@4;) - end - local.get 2 - br_if 49 (;@4;) - i32.const 4196 - local.get 1 - i32.const 14 - i32.add - local.tee 1 - i32.store - call 6 - local.set 0 - block ;; label = @54 - local.get 1 - i32.const 4196 - i32.load - local.tee 2 - i32.ne - br_if 0 (;@54;) - local.get 0 - i32.const 65528 - i32.and - i32.const 40 - i32.eq - local.get 0 - i32.const 58 - i32.sub - i32.const 6 - i32.lt_u - i32.or - local.get 0 - i32.const 33 - i32.sub - local.tee 1 - i32.const 5 - i32.le_u - i32.const 0 - i32.const 1 - local.get 1 - i32.shl - i32.const 49 - i32.and - select - i32.or - br_if 0 (;@54;) - local.get 0 - i32.const 91 - i32.sub - local.tee 1 - i32.const 3 - i32.le_u - local.get 1 - i32.const 1 - i32.ne - i32.and - br_if 0 (;@54;) - local.get 0 - i32.const 123 - i32.sub - i32.const 65535 - i32.and - i32.const 3 - i32.gt_u - br_if 50 (;@4;) - end - i32.const 4224 - i32.load - i32.eqz - if ;; label = @54 - i32.const 4224 - i32.const 7 - i32.store - end - i32.const 4196 - i32.const 4200 - i32.load - i32.const 2 - i32.add - i32.store - i32.const 4228 - local.get 2 - i32.const 4188 - i32.load - i32.sub - i32.const 1 - i32.shr_s - i32.store - br 49 (;@4;) - end - local.get 0 - i32.const 4188 - i32.load - i32.ne - if ;; label = @53 - local.get 1 - i32.load16_u - call 5 - i32.eqz - br_if 49 (;@4;) - end - local.get 1 - i32.load16_u offset=4 - i32.const 108 - i32.ne - br_if 48 (;@4;) - local.get 1 - i32.load16_u offset=6 - i32.const 97 - i32.ne - br_if 48 (;@4;) - local.get 1 - i32.load16_u offset=8 - i32.const 115 - i32.ne - br_if 48 (;@4;) - local.get 1 - i32.load16_u offset=10 - i32.const 115 - i32.ne - br_if 48 (;@4;) - local.get 1 - i32.load16_u offset=12 - local.tee 0 - i32.const 9 - i32.sub - local.tee 1 - i32.const 23 - i32.gt_u - i32.const 1 - local.get 1 - i32.shl - i32.const 8388639 - i32.and - i32.eqz - i32.or - br_if 45 (;@7;) - br 46 (;@6;) - end - i32.const 4196 - local.get 1 - i32.const 12 - i32.add - i32.store - br 47 (;@4;) - end - local.get 1 - i32.load16_u offset=4 - i32.const 98 - i32.ne - br_if 46 (;@4;) - local.get 1 - i32.load16_u offset=6 - i32.const 106 - i32.ne - br_if 46 (;@4;) - local.get 1 - i32.load16_u offset=8 - i32.const 101 - i32.ne - br_if 46 (;@4;) - local.get 1 - i32.load16_u offset=10 - i32.const 99 - i32.ne - br_if 46 (;@4;) - local.get 1 - i32.load16_u offset=12 - i32.const 116 - i32.ne - br_if 46 (;@4;) - local.get 0 - i32.const 4188 - i32.load - i32.ne - if ;; label = @51 - local.get 1 - i32.load16_u - call 5 - i32.eqz - br_if 47 (;@4;) - end - local.get 1 - i32.const 12 - i32.add - local.set 5 - i32.const 4196 - local.get 1 - i32.const 14 - i32.add - i32.store - call 6 - i32.const 46 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.set 0 - i32.const 4221 - i32.load8_u - i32.eqz - local.get 0 - i32.const 100 - i32.ne - i32.or - i32.eqz - if ;; label = @51 - i32.const 4196 - i32.load - local.tee 3 - i32.const 4200 - i32.load - local.tee 0 - i32.gt_u - br_if 43 (;@8;) - local.get 0 - local.get 3 - i32.sub - i32.const 1 - i32.shr_s - i32.const 1 - i32.add - local.tee 4 - i32.const 14 - i32.lt_u - br_if 43 (;@8;) - i32.const -1 - local.set 0 - local.get 3 - local.set 2 - loop ;; label = @52 - block ;; label = @53 - local.get 0 - i32.const 13 - i32.eq - if ;; label = @54 - i32.const 14 - local.set 1 - br 1 (;@53;) - end - local.get 0 - i32.const 4105 - i32.add - local.set 7 - local.get 2 - i32.load16_u - local.get 2 - i32.const 2 - i32.add - local.set 2 - local.get 0 - i32.const 1 - i32.add - local.tee 1 - local.set 0 - local.get 7 - i32.load8_s - i32.eq - br_if 1 (;@52;) - end - end - block ;; label = @52 - local.get 4 - i32.const 16 - i32.ge_u - if ;; label = @53 - i32.const -1 - local.set 0 - local.get 3 - local.set 2 - loop ;; label = @54 - local.get 0 - i32.const 15 - i32.eq - if ;; label = @55 - i32.const 14 - i32.const 16 - local.get 1 - i32.const 13 - i32.gt_u - select - local.set 0 - i32.const 1 - local.set 2 - br 3 (;@52;) - end - local.get 0 - i32.const 4120 - i32.add - local.set 4 - local.get 2 - i32.load16_u - local.get 2 - i32.const 2 - i32.add - local.set 2 - local.get 0 - i32.const 1 - i32.add - local.tee 6 - local.set 0 - local.get 4 - i32.load8_s - i32.eq - br_if 0 (;@54;) - end - i32.const 14 - i32.const 16 - local.get 1 - i32.const 13 - i32.gt_u - local.tee 1 - select - local.set 0 - local.get 1 - local.get 6 - i32.const 15 - i32.gt_u - local.tee 2 - i32.or - br_if 1 (;@52;) - br 45 (;@8;) - end - i32.const 14 - local.set 0 - i32.const 0 - local.set 2 - local.get 1 - i32.const 14 - i32.lt_u - br_if 44 (;@8;) - end - i32.const 4196 - local.get 3 - local.get 0 - i32.const 1 - i32.shl - i32.add - i32.store - call 6 - i32.const 40 - i32.ne - br_if 43 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - call 8 - i32.eqz - br_if 43 (;@8;) - call 6 - i32.const 44 - i32.ne - br_if 43 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.set 3 - local.get 2 - if ;; label = @52 - local.get 3 - i32.const 40 - i32.eq - if (result i32) ;; label = @53 - call 9 - else - local.get 3 - end - i32.const 123 - i32.ne - br_if 44 (;@8;) - i32.const 4208 - i32.const 4196 - i32.load - i32.store - br 44 (;@8;) - end - local.get 3 - i32.const 39 - i32.ne - local.get 3 - i32.const 34 - i32.ne - i32.and - br_if 43 (;@8;) - i32.const 4200 - i32.load - local.set 1 - i32.const 4196 - i32.load - local.tee 7 - local.set 0 - block ;; label = @52 - loop ;; label = @53 - block ;; label = @54 - local.get 0 - local.tee 2 - i32.const 2 - i32.add - local.set 0 - local.get 1 - local.get 2 - i32.le_u - br_if 0 (;@54;) - local.get 3 - local.get 0 - i32.load16_u - local.tee 4 - i32.eq - if ;; label = @55 - local.get 2 - local.set 1 - br 3 (;@52;) - end - local.get 4 - i32.const 92 - i32.ne - if ;; label = @55 - local.get 4 - i32.const 10 - i32.sub - br_table 1 (;@54;) 2 (;@53;) 2 (;@53;) 1 (;@54;) 2 (;@53;) - end - local.get 2 - i32.const 4 - i32.add - local.set 0 - local.get 2 - i32.load16_u offset=4 - i32.const 13 - i32.ne - br_if 1 (;@53;) - local.get 2 - i32.const 6 - i32.add - local.get 0 - local.get 2 - i32.load16_u offset=6 - i32.const 10 - i32.eq - select - local.set 0 - br 1 (;@53;) - end - end - i32.const 4224 - i32.load - i32.eqz - if ;; label = @53 - i32.const 4224 - i32.const 9 - i32.store - end - i32.const 4228 - local.get 0 - i32.const 4188 - i32.load - i32.sub - i32.const 1 - i32.shr_s - i32.store - end - i32.const 4196 - local.get 1 - i32.const 4 - i32.add - local.tee 0 - i32.store - call 6 - i32.const 44 - i32.ne - br_if 43 (;@8;) - i32.const 18596 - i32.load - local.get 7 - local.get 0 - call 0 - br 43 (;@8;) - end - local.get 0 - i32.const 100 - i32.eq - if ;; label = @51 - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 102 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 105 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 110 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 101 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=12 - i32.const 80 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=14 - i32.const 114 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=16 - i32.const 111 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=18 - i32.const 112 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=20 - i32.const 101 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=22 - i32.const 114 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=24 - i32.const 116 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.load16_u offset=26 - i32.const 121 - i32.ne - br_if 43 (;@8;) - local.get 0 - i32.const 26 - i32.add - local.set 5 - i32.const 4196 - local.get 0 - i32.const 28 - i32.add - i32.store - i32.const 4188 - i32.load - local.set 0 - call 6 - i32.const 40 - i32.ne - br_if 41 (;@10;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - call 8 - i32.eqz - br_if 41 (;@10;) - call 6 - i32.const 44 - i32.ne - br_if 41 (;@10;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.tee 2 - i32.const 39 - i32.ne - if ;; label = @52 - local.get 0 - local.set 4 - local.get 2 - i32.const 34 - i32.ne - br_if 43 (;@9;) - end - i32.const 4200 - i32.load - local.set 3 - i32.const 4196 - i32.load - local.tee 4 - local.set 0 - block ;; label = @52 - loop ;; label = @53 - block ;; label = @54 - local.get 0 - local.tee 1 - i32.const 2 - i32.add - local.set 0 - local.get 1 - local.get 3 - i32.ge_u - br_if 0 (;@54;) - local.get 2 - local.get 0 - i32.load16_u - local.tee 7 - i32.eq - if ;; label = @55 - local.get 1 - local.set 3 - br 3 (;@52;) - end - local.get 7 - i32.const 92 - i32.ne - if ;; label = @55 - local.get 7 - i32.const 10 - i32.sub - br_table 1 (;@54;) 2 (;@53;) 2 (;@53;) 1 (;@54;) 2 (;@53;) - end - local.get 1 - i32.const 4 - i32.add - local.set 0 - local.get 1 - i32.load16_u offset=4 - i32.const 13 - i32.ne - br_if 1 (;@53;) - local.get 1 - i32.const 6 - i32.add - local.get 0 - local.get 1 - i32.load16_u offset=6 - i32.const 10 - i32.eq - select - local.set 0 - br 1 (;@53;) - end - end - i32.const 4224 - i32.load - i32.eqz - if ;; label = @53 - i32.const 4224 - i32.const 9 - i32.store - end - i32.const 4228 - local.get 0 - i32.const 4188 - i32.load - i32.sub - i32.const 1 - i32.shr_s - i32.store - end - i32.const 4196 - local.get 3 - i32.const 4 - i32.add - local.tee 0 - i32.store - call 6 - i32.const 44 - i32.ne - br_if 42 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 123 - i32.ne - br_if 42 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.tee 2 - i32.const 101 - i32.eq - if ;; label = @52 - i32.const 4196 - i32.load - local.tee 1 - i32.load16_u offset=2 - i32.const 110 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=4 - i32.const 117 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=6 - i32.const 109 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=8 - i32.const 101 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=10 - i32.const 114 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=12 - i32.const 97 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=14 - i32.const 98 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=16 - i32.const 108 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=18 - i32.const 101 - i32.ne - br_if 43 (;@9;) - i32.const 4196 - local.get 1 - i32.const 20 - i32.add - i32.store - call 6 - i32.const 58 - i32.ne - br_if 43 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - i32.const 4196 - block (result i32) ;; label = @53 - block ;; label = @54 - call 6 - local.tee 2 - i32.const 116 - i32.ne - br_if 0 (;@54;) - i32.const 4196 - i32.load - local.tee 1 - i32.load16_u offset=2 - i32.const 114 - i32.ne - br_if 0 (;@54;) - local.get 1 - i32.load16_u offset=4 - i32.const 117 - i32.ne - br_if 0 (;@54;) - local.get 1 - i32.load16_u offset=6 - i32.const 101 - i32.ne - br_if 0 (;@54;) - local.get 1 - i32.const 8 - i32.add - br 1 (;@53;) - end - local.get 2 - i32.const 33 - i32.ne - br_if 44 (;@9;) - i32.const 4220 - i32.load8_u - i32.eqz - br_if 44 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 48 - i32.ne - br_if 44 (;@9;) - i32.const 4196 - i32.load - i32.const 2 - i32.add - end - i32.store - call 6 - i32.const 44 - i32.ne - br_if 43 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.set 2 - end - local.get 2 - i32.const 103 - i32.ne - if ;; label = @52 - local.get 2 - i32.const 118 - i32.ne - br_if 43 (;@9;) - i32.const 4196 - i32.load - local.tee 1 - i32.load16_u offset=2 - i32.const 97 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=4 - i32.const 108 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=6 - i32.const 117 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=8 - i32.const 101 - i32.ne - br_if 43 (;@9;) - i32.const 4196 - local.get 1 - i32.const 10 - i32.add - i32.store - call 6 - i32.const 58 - i32.ne - br_if 43 (;@9;) - i32.const 18596 - i32.load - local.get 4 - local.get 0 - call 0 - br 44 (;@8;) - end - i32.const 4196 - i32.load - local.tee 1 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 42 (;@9;) - local.get 1 - i32.load16_u offset=4 - i32.const 116 - i32.ne - br_if 42 (;@9;) - i32.const 4196 - local.get 1 - i32.const 6 - i32.add - i32.store - call 6 - local.tee 1 - i32.const 58 - i32.eq - if (result i32) ;; label = @52 - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 102 - i32.ne - br_if 43 (;@9;) - i32.const 4196 - i32.load - local.tee 1 - i32.load16_u offset=2 - i32.const 117 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=4 - i32.const 110 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=6 - i32.const 99 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=8 - i32.const 116 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=10 - i32.const 105 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=12 - i32.const 111 - i32.ne - br_if 43 (;@9;) - local.get 1 - i32.load16_u offset=14 - i32.const 110 - i32.ne - br_if 43 (;@9;) - i32.const 4196 - local.get 1 - i32.const 16 - i32.add - local.tee 1 - i32.store - call 6 - local.tee 2 - i32.const 40 - i32.ne - if ;; label = @53 - local.get 1 - i32.const 4196 - i32.load - i32.eq - br_if 44 (;@9;) - local.get 2 - call 10 - i32.eqz - br_if 44 (;@9;) - end - call 6 - else - local.get 1 - end - i32.const 40 - i32.ne - br_if 42 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 41 - i32.ne - br_if 42 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 123 - i32.ne - br_if 42 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 114 - i32.ne - br_if 42 (;@9;) - i32.const 4196 - i32.load - local.tee 1 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 42 (;@9;) - local.get 1 - i32.load16_u offset=4 - i32.const 116 - i32.ne - br_if 42 (;@9;) - local.get 1 - i32.load16_u offset=6 - i32.const 117 - i32.ne - br_if 42 (;@9;) - local.get 1 - i32.load16_u offset=8 - i32.const 114 - i32.ne - br_if 42 (;@9;) - local.get 1 - i32.load16_u offset=10 - i32.const 110 - i32.ne - br_if 42 (;@9;) - i32.const 4196 - local.get 1 - i32.const 12 - i32.add - i32.store - call 6 - call 10 - i32.eqz - br_if 42 (;@9;) - block ;; label = @52 - block ;; label = @53 - call 6 - local.tee 2 - i32.const 91 - i32.ne - if ;; label = @54 - local.get 2 - i32.const 46 - i32.ne - br_if 2 (;@52;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - call 10 - i32.eqz - br_if 45 (;@9;) - br 1 (;@53;) - end - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.tee 7 - i32.const 39 - i32.ne - local.get 7 - i32.const 34 - i32.ne - i32.and - br_if 44 (;@9;) - i32.const 4196 - i32.load - local.set 2 - i32.const 4200 - i32.load - local.set 3 - block ;; label = @54 - loop ;; label = @55 - block ;; label = @56 - local.get 2 - local.tee 1 - i32.const 2 - i32.add - local.set 2 - local.get 1 - local.get 3 - i32.ge_u - br_if 0 (;@56;) - local.get 7 - local.get 2 - i32.load16_u - local.tee 6 - i32.eq - if ;; label = @57 - local.get 1 - local.set 3 - br 3 (;@54;) - end - local.get 6 - i32.const 92 - i32.ne - if ;; label = @57 - local.get 6 - i32.const 10 - i32.sub - br_table 1 (;@56;) 2 (;@55;) 2 (;@55;) 1 (;@56;) 2 (;@55;) - end - local.get 1 - i32.const 4 - i32.add - local.set 2 - local.get 1 - i32.load16_u offset=4 - i32.const 13 - i32.ne - br_if 1 (;@55;) - local.get 1 - i32.const 6 - i32.add - local.get 2 - local.get 1 - i32.load16_u offset=6 - i32.const 10 - i32.eq - select - local.set 2 - br 1 (;@55;) - end - end - i32.const 4224 - i32.load - i32.eqz - if ;; label = @55 - i32.const 4224 - i32.const 9 - i32.store - end - i32.const 4228 - local.get 2 - i32.const 4188 - i32.load - i32.sub - i32.const 1 - i32.shr_s - i32.store - end - i32.const 4196 - local.get 3 - i32.const 4 - i32.add - i32.store - call 6 - i32.const 93 - i32.ne - br_if 44 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - end - call 6 - local.set 2 - end - local.get 2 - i32.const 59 - i32.eq - if (result i32) ;; label = @52 - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - else - local.get 2 - end - i32.const 125 - i32.ne - br_if 42 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.tee 1 - i32.const 44 - i32.eq - if (result i32) ;; label = @52 - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - else - local.get 1 - end - i32.const 125 - i32.ne - br_if 42 (;@9;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 41 - i32.ne - br_if 42 (;@9;) - i32.const 18596 - i32.load - local.get 4 - local.get 0 - call 0 - br 47 (;@4;) - end - local.get 2 - local.get 0 - i32.const 107 - i32.ne - i32.or - br_if 42 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 121 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 115 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.const 6 - i32.add - local.set 5 - i32.const 4196 - local.get 0 - i32.const 8 - i32.add - i32.store - call 6 - i32.const 40 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 4196 - i32.load - local.set 7 - call 10 - i32.eqz - br_if 42 (;@8;) - i32.const 4196 - i32.load - call 6 - i32.const 41 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - local.tee 5 - i32.const 2 - i32.add - i32.store - call 6 - i32.const 46 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 102 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 111 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 114 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 69 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 97 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 99 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=12 - i32.const 104 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - local.get 0 - i32.const 14 - i32.add - i32.store - call 6 - i32.const 4196 - i32.load - local.tee 1 - i32.const 2 - i32.sub - local.set 5 - i32.const 40 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - local.get 1 - i32.const 2 - i32.add - i32.store - call 6 - i32.const 102 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 117 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 110 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 99 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 116 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 105 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=12 - i32.const 111 - i32.ne - br_if 42 (;@8;) - local.get 0 - i32.load16_u offset=14 - i32.const 110 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - local.get 0 - i32.const 16 - i32.add - i32.store - call 6 - i32.const 40 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 4196 - i32.load - local.set 1 - call 10 - i32.eqz - br_if 42 (;@8;) - i32.const 4196 - i32.load - local.set 0 - call 6 - i32.const 41 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 123 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 105 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.load - local.tee 2 - i32.load16_u offset=2 - i32.const 102 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - local.get 2 - i32.const 4 - i32.add - i32.store - call 6 - i32.const 40 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 6 - local.get 1 - local.get 0 - local.get 1 - i32.sub - i32.const 1 - i32.shr_s - local.tee 2 - call 11 - i32.eqz - br_if 42 (;@8;) - local.get 7 - i32.sub - i32.const 1 - i32.shr_s - local.set 4 - i32.const 4196 - local.get 6 - local.get 2 - i32.const 1 - i32.shl + call 4 local.tee 3 - i32.add - i32.store - block ;; label = @51 - block ;; label = @52 - block ;; label = @53 - call 6 - local.tee 0 - i32.const 33 - i32.ne - if ;; label = @54 - local.get 0 - i32.const 61 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 61 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 61 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 6 - i32.add - i32.store - call 6 - local.tee 6 - i32.const 39 - i32.ne - local.get 6 - i32.const 34 - i32.ne - i32.and - br_if 46 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 100 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 101 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 102 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 97 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 117 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=12 - i32.const 108 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=14 - i32.const 116 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 16 - i32.add - i32.store - call 6 - local.get 6 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 124 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 124 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 4 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 1 - local.get 2 - call 11 - i32.eqz - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - local.get 3 - i32.add - i32.store - call 6 - i32.const 61 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 61 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 61 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 6 - i32.add - i32.store - call 6 - local.tee 6 - i32.const 39 - i32.ne - local.get 6 - i32.const 34 - i32.ne - i32.and - br_if 46 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 95 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 95 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 101 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 115 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 77 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=12 - i32.const 111 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=14 - i32.const 100 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=16 - i32.const 117 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=18 - i32.const 108 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=20 - i32.const 101 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 22 - i32.add - i32.store - call 6 - local.get 6 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 41 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 114 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 116 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 117 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 114 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 110 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 12 - i32.add - i32.store - call 6 - i32.const 59 - i32.eq - if ;; label = @55 - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - end - call 6 - local.tee 0 - i32.const 105 - i32.ne - br_if 3 (;@51;) - i32.const 105 - local.set 0 - i32.const 4196 - i32.load - local.tee 6 - i32.load16_u offset=2 - i32.const 102 - i32.ne - br_if 3 (;@51;) - i32.const 4196 - local.get 6 - i32.const 4 - i32.add - i32.store - call 6 - i32.const 40 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - local.tee 0 - i32.store - local.get 1 - local.get 2 - call 12 - if ;; label = @55 - call 6 - i32.const 41 - i32.ne - br_if 47 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 114 - i32.ne - br_if 47 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 116 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 117 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 114 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 110 - i32.ne - br_if 47 (;@8;) - i32.const 4196 - local.get 0 - i32.const 12 - i32.add - i32.store - call 6 - i32.const 59 - i32.eq - if ;; label = @56 - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - end - call 6 - local.tee 0 - i32.const 105 - i32.ne - br_if 4 (;@51;) - i32.const 105 - local.set 0 - i32.const 4196 - i32.load - local.tee 6 - i32.load16_u offset=2 - i32.const 102 - i32.ne - br_if 4 (;@51;) - i32.const 4196 - local.get 6 - i32.const 4 - i32.add - i32.store - call 6 - i32.const 40 - i32.ne - br_if 47 (;@8;) - i32.const 4196 - i32.load - i32.const 2 - i32.add - local.set 0 - end - i32.const 4196 - local.get 0 - i32.store - local.get 0 - local.get 1 - local.get 2 - call 11 - i32.eqz - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - local.get 3 - i32.add - i32.store - call 6 - i32.const 105 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 110 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 32 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 6 - i32.add - i32.store - call 6 - call 8 - i32.eqz - br_if 46 (;@8;) - call 6 - i32.const 38 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 38 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 4 - i32.add - i32.store - call 6 - call 8 - i32.eqz - br_if 46 (;@8;) - call 6 - i32.const 91 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 1 - local.get 2 - call 11 - i32.eqz - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - local.get 3 - i32.add - i32.store - call 6 - i32.const 93 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 61 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 61 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 61 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 6 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 7 - local.get 4 - call 11 - i32.eqz - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - local.get 4 - i32.const 1 - i32.shl - i32.add - i32.store - call 6 - i32.const 91 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 1 - local.get 2 - call 11 - i32.eqz - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - local.get 3 - i32.add - i32.store - call 6 - i32.const 93 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 41 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 114 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 116 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 117 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 114 - i32.ne - br_if 46 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 110 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 12 - i32.add - i32.store - call 6 - i32.const 59 - i32.eq - br_if 1 (;@53;) - br 2 (;@52;) - end - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 61 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 61 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - local.get 0 - i32.const 6 - i32.add - i32.store - call 6 - local.tee 6 - i32.const 39 - i32.ne - local.get 6 - i32.const 34 - i32.ne - i32.and - br_if 45 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 100 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 101 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 102 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 97 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 117 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=12 - i32.const 108 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=14 - i32.const 116 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - local.get 0 - i32.const 16 - i32.add - i32.store - call 6 - local.get 6 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.tee 0 - i32.const 38 - i32.eq - if (result i32) ;; label = @54 - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 38 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - local.get 0 - i32.const 4 - i32.add - i32.store - call 6 - i32.const 33 - i32.ne - br_if 46 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - block ;; label = @55 - block ;; label = @56 - call 6 - local.tee 6 - i32.const 79 - i32.ne - br_if 0 (;@56;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 98 - i32.ne - br_if 0 (;@56;) - local.get 0 - i32.load16_u offset=4 - i32.const 106 - i32.ne - br_if 0 (;@56;) - local.get 0 - i32.load16_u offset=6 - i32.const 101 - i32.ne - br_if 0 (;@56;) - local.get 0 - i32.load16_u offset=8 - i32.const 99 - i32.ne - br_if 0 (;@56;) - local.get 0 - i32.load16_u offset=10 - i32.const 116 - i32.ne - br_if 0 (;@56;) - local.get 0 - i32.load16_u offset=12 - i32.const 46 - i32.ne - br_if 0 (;@56;) - local.get 1 - local.get 2 - call 12 - br_if 1 (;@55;) - br 48 (;@8;) - end - local.get 6 - call 10 - i32.eqz - br_if 0 (;@55;) - call 6 - i32.const 46 - i32.ne - br_if 47 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 104 - i32.ne - br_if 47 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 97 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 115 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 79 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 119 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 110 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=12 - i32.const 80 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=14 - i32.const 114 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=16 - i32.const 111 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=18 - i32.const 112 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=20 - i32.const 101 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=22 - i32.const 114 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=24 - i32.const 116 - i32.ne - br_if 47 (;@8;) - local.get 0 - i32.load16_u offset=26 - i32.const 121 - i32.ne - br_if 47 (;@8;) - i32.const 4196 - local.get 0 - i32.const 28 - i32.add - i32.store - call 6 - i32.const 40 - i32.ne - br_if 47 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 1 - local.get 2 - call 11 - i32.eqz - br_if 47 (;@8;) - i32.const 4196 - local.get 0 - local.get 3 - i32.add - i32.store - call 6 - i32.const 41 - i32.ne - br_if 47 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - end - call 6 - else - local.get 0 - end - i32.const 41 - i32.ne - br_if 45 (;@8;) - end - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - end - call 6 - local.set 0 - end - block ;; label = @51 - block ;; label = @52 - local.get 0 - call 8 - if ;; label = @53 - call 6 - i32.const 91 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 1 - local.get 2 - call 11 - i32.eqz - br_if 45 (;@8;) - i32.const 4196 - local.get 0 - local.get 3 - i32.add - i32.store - call 6 - i32.const 93 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 61 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 7 - local.get 4 - call 11 - i32.eqz - br_if 45 (;@8;) - i32.const 4196 - local.get 0 - local.get 4 - i32.const 1 - i32.shl - i32.add - i32.store - call 6 - i32.const 91 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 1 - local.get 2 - call 11 - i32.eqz - br_if 45 (;@8;) - i32.const 4196 - local.get 0 - local.get 3 - i32.add - i32.store - call 6 - i32.const 93 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.tee 0 - i32.const 59 - i32.eq - br_if 1 (;@52;) - br 2 (;@51;) - end - local.get 0 - i32.const 79 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 98 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 106 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 101 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 99 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 116 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - local.get 0 - i32.const 12 - i32.add - i32.store - call 6 - i32.const 46 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 100 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 102 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 105 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 110 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 101 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=12 - i32.const 80 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=14 - i32.const 114 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=16 - i32.const 111 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=18 - i32.const 112 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=20 - i32.const 101 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=22 - i32.const 114 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=24 - i32.const 116 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=26 - i32.const 121 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - local.get 0 - i32.const 28 - i32.add - i32.store - call 6 - i32.const 40 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - call 8 - i32.eqz - br_if 44 (;@8;) - call 6 - i32.const 44 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 1 - local.get 2 - call 11 - i32.eqz - br_if 44 (;@8;) - i32.const 4196 - local.get 0 - local.get 3 - i32.add - i32.store - call 6 - i32.const 44 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 123 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 101 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 110 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 117 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 109 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 101 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 114 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=12 - i32.const 97 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=14 - i32.const 98 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=16 - i32.const 108 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=18 - i32.const 101 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - local.get 0 - i32.const 20 - i32.add - i32.store - call 6 - i32.const 58 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - i32.const 4196 - block (result i32) ;; label = @53 - block ;; label = @54 - call 6 - local.tee 6 - i32.const 116 - i32.ne - br_if 0 (;@54;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 114 - i32.ne - br_if 0 (;@54;) - local.get 0 - i32.load16_u offset=4 - i32.const 117 - i32.ne - br_if 0 (;@54;) - local.get 0 - i32.load16_u offset=6 - i32.const 101 - i32.ne - br_if 0 (;@54;) - local.get 0 - i32.const 8 - i32.add - br 1 (;@53;) - end - local.get 6 - i32.const 33 - i32.ne - br_if 45 (;@8;) - i32.const 4220 - i32.load8_u - i32.eqz - br_if 45 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 48 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - i32.load - i32.const 2 - i32.add - end - i32.store - call 6 - i32.const 44 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 103 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 116 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - local.get 0 - i32.const 6 - i32.add - i32.store - call 6 - local.tee 0 - i32.const 58 - i32.eq - if (result i32) ;; label = @53 - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 102 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 117 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 110 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 99 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 116 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 105 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=12 - i32.const 111 - i32.ne - br_if 45 (;@8;) - local.get 0 - i32.load16_u offset=14 - i32.const 110 - i32.ne - br_if 45 (;@8;) - i32.const 4196 - local.get 0 - i32.const 16 - i32.add - local.tee 0 - i32.store - call 6 - local.tee 6 - i32.const 40 - i32.ne - if ;; label = @54 - local.get 0 - i32.const 4196 - i32.load - i32.eq - br_if 46 (;@8;) - local.get 6 - call 10 - i32.eqz - br_if 46 (;@8;) - end - call 6 - else - local.get 0 - end - i32.const 40 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 41 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 123 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 114 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.load - local.tee 0 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=4 - i32.const 116 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=6 - i32.const 117 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=8 - i32.const 114 - i32.ne - br_if 44 (;@8;) - local.get 0 - i32.load16_u offset=10 - i32.const 110 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - local.get 0 - i32.const 12 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 7 - local.get 4 - call 11 - i32.eqz - br_if 44 (;@8;) - i32.const 4196 - local.get 0 - local.get 4 - i32.const 1 - i32.shl - i32.add - i32.store - call 6 - i32.const 91 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - drop - i32.const 4196 - i32.load - local.tee 0 - local.get 1 - local.get 2 - call 11 - i32.eqz - br_if 44 (;@8;) - i32.const 4196 - local.get 0 - local.get 3 - i32.add - i32.store - call 6 - i32.const 93 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.tee 0 - i32.const 59 - i32.eq - if (result i32) ;; label = @53 - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - else - local.get 0 - end - i32.const 125 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.tee 0 - i32.const 44 - i32.eq - if (result i32) ;; label = @53 - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - else - local.get 0 - end - i32.const 125 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 41 - i32.ne - br_if 44 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.tee 0 - i32.const 59 - i32.ne - br_if 1 (;@51;) - end - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.set 0 - end - local.get 0 - i32.const 125 - i32.ne - br_if 42 (;@8;) - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - i32.const 41 - i32.ne - br_if 42 (;@8;) - i32.const 18588 - local.set 0 - loop ;; label = @51 - local.get 0 - i32.load - local.tee 0 - i32.eqz - br_if 47 (;@4;) - block ;; label = @52 - local.get 4 - local.get 0 - i32.load offset=12 - local.get 0 - i32.load offset=8 - local.tee 1 - i32.sub - i32.const 1 - i32.shr_s - i32.ne - br_if 0 (;@52;) - local.get 7 - local.get 1 - local.get 4 - call 11 - i32.eqz - br_if 0 (;@52;) - i32.const 18596 - i32.load - i32.const 12 - i32.add - local.get 0 - i32.load - local.get 0 - i32.load offset=4 - call 0 - br 44 (;@8;) - end - local.get 0 - i32.const 16 - i32.add - local.set 0 - br 0 (;@51;) - end - unreachable + i32.const 39 + i32.sub + br_table 2 (;@48;) 3 (;@47;) 1 (;@49;) 2 (;@48;) 1 (;@49;) 1 (;@49;) 1 (;@49;) 4 (;@46;) 0 (;@50;) end - local.get 2 - i32.const 2048 - i32.ne - br_if 15 (;@34;) - i32.const 4224 - i32.load - local.tee 2 - br_if 38 (;@11;) - br 36 (;@13;) + local.get 3 + i32.const 34 + i32.eq + local.get 3 + i32.const 123 + i32.eq + i32.or + br_if 1 (;@48;) end - i32.const 4221 - i32.load8_u - i32.eqz - br_if 45 (;@3;) - local.get 2 - i32.const 2048 - i32.ne - br_if 1 (;@47;) - i32.const 4224 + i32.const 4196 i32.load - local.tee 2 - i32.eqz - br_if 35 (;@13;) - br 37 (;@11;) + local.get 1 + i32.eq + br_if 44 (;@4;) end - i32.const 4221 - i32.load8_u + i32.const 4214 + i32.load16_u i32.eqz - br_if 44 (;@3;) + br_if 2 (;@45;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.sub + i32.store + br 43 (;@4;) end - local.get 2 - i32.const 16520 - i32.add - i32.const 0 - i32.store8 i32.const 4214 - local.get 2 - i32.const 1 - i32.add - i32.store16 - local.get 2 + i32.load16_u + local.tee 3 + i32.const 2048 + i32.ne + br_if 26 (;@20;) + i32.const 4224 + i32.load + i32.eqz + if ;; label = @47 + i32.const 4224 + i32.const 12 + i32.store + i32.const 4228 + i32.const 4196 + i32.load + i32.const 4188 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store + end + i32.const 4196 + i32.const 4200 + i32.load i32.const 2 - i32.shl - i32.const 8328 i32.add - i32.const 4204 - i32.load i32.store - br 43 (;@3;) + br 42 (;@4;) end - i32.const 4221 - i32.load8_u + i32.const 4224 + i32.load i32.eqz - br_if 42 (;@3;) - i32.const 4214 - local.get 2 - i32.const 1 + if ;; label = @46 + i32.const 4224 + i32.const 5 + i32.store + i32.const 4228 + i32.const 4196 + i32.load + i32.const 4188 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store + end + i32.const 4196 + i32.const 4200 + i32.load + i32.const 2 + i32.add + i32.store + br 41 (;@4;) + end + i32.const 4224 + i32.load + i32.eqz + if ;; label = @45 + i32.const 4224 + i32.const 6 + i32.store + i32.const 4228 + i32.const 4196 + i32.load + i32.const 4188 + i32.load i32.sub - i32.store16 - br 42 (;@3;) + i32.const 1 + i32.shr_s + i32.store + end + i32.const 4196 + i32.const 4200 + i32.load + i32.const 2 + i32.add + i32.store + br 40 (;@4;) + end + local.get 2 + i32.load16_u offset=4 + local.tee 3 + i32.const 95 + i32.ne + if ;; label = @44 + local.get 3 + i32.const 105 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=6 + i32.const 110 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=8 + i32.const 116 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=10 + i32.const 101 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=12 + i32.const 114 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=14 + i32.const 111 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=16 + i32.const 112 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=18 + i32.const 82 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=20 + i32.const 101 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=22 + i32.const 113 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=24 + i32.const 117 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=26 + i32.const 105 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=28 + i32.const 114 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=30 + i32.const 101 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=32 + i32.const 87 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=34 + i32.const 105 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=36 + i32.const 108 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=38 + i32.const 100 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=40 + i32.const 99 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=42 + i32.const 97 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=44 + i32.const 114 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=46 + i32.const 100 + i32.ne + br_if 40 (;@4;) + block ;; label = @45 + i32.const 4188 + i32.load + local.get 0 + i32.eq + br_if 0 (;@45;) + local.get 2 + i32.load16_u + local.tee 3 + call 3 + br_if 0 (;@45;) + local.get 3 + i32.const 46 + i32.ne + br_if 41 (;@4;) end - i32.const 4221 - i32.load8_u + i32.const 4196 + local.get 2 + i32.const 48 + i32.add + i32.store + local.get 2 + i32.load16_u offset=48 + i32.const 40 + i32.ne + br_if 40 (;@4;) + i32.const 4214 + i32.const 1 + i32.store16 + i32.const 4196 + local.get 2 + i32.const 50 + i32.add + i32.store + i32.const 8328 + i32.const 4204 + i32.load + i32.store + i32.const 16520 + i32.const 0 + i32.store8 + i32.const 0 + call 2 i32.eqz - br_if 41 (;@3;) - i32.const 4224 + br_if 40 (;@4;) + i32.const 4188 + i32.load + local.get 0 + i32.eq + br_if 39 (;@5;) + local.get 2 + i32.load16_u + call 3 + br_if 39 (;@5;) + br 40 (;@4;) + end + local.get 2 + i32.load16_u offset=6 + i32.const 101 + i32.ne + br_if 39 (;@4;) + local.get 2 + i32.load16_u offset=8 + i32.const 120 + i32.ne + br_if 39 (;@4;) + local.get 2 + i32.load16_u offset=10 + i32.const 112 + i32.ne + br_if 39 (;@4;) + local.get 2 + i32.load16_u offset=12 + i32.const 111 + i32.ne + br_if 39 (;@4;) + local.get 2 + i32.load16_u offset=14 + i32.const 114 + i32.ne + br_if 39 (;@4;) + local.get 2 + i32.load16_u offset=16 + i32.const 116 + i32.ne + br_if 39 (;@4;) + block ;; label = @44 + i32.const 4188 i32.load - local.tee 2 - br_if 33 (;@11;) - br 30 (;@14;) + local.get 0 + i32.eq + br_if 0 (;@44;) + local.get 2 + i32.load16_u + local.tee 0 + call 3 + br_if 0 (;@44;) + local.get 0 + i32.const 46 + i32.ne + br_if 40 (;@4;) end - i32.const 4221 - i32.load8_u - i32.eqz - br_if 40 (;@3;) + i32.const 4196 local.get 2 - i32.const 16519 + i32.const 18 i32.add - i32.load8_u - i32.const 2 + i32.store + i32.const 9 + local.set 1 + local.get 2 + i32.load16_u offset=18 + local.tee 0 + i32.const 83 + i32.eq + if (result i32) ;; label = @44 + local.get 2 + i32.load16_u offset=20 + i32.const 116 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=22 + i32.const 97 + i32.ne + br_if 40 (;@4;) + local.get 2 + i32.load16_u offset=24 + i32.const 114 + i32.ne + br_if 40 (;@4;) + i32.const 4196 + local.get 2 + i32.const 26 + i32.add + i32.store + i32.const 13 + local.set 1 + local.get 2 + i32.load16_u offset=26 + else + local.get 0 + end + i32.const 65535 i32.and - i32.eqz - br_if 40 (;@3;) - br 28 (;@15;) + i32.const 40 + i32.ne + br_if 39 (;@4;) + i32.const 4214 + i32.const 1 + i32.store16 + i32.const 8328 + i32.const 4204 + i32.load + i32.store + i32.const 16520 + i32.const 0 + i32.store8 + local.get 2 + local.get 1 + i32.const 1 + i32.shl + i32.add + local.tee 0 + i32.load16_u offset=2 + i32.const 114 + i32.ne + br_if 39 (;@4;) + i32.const 4196 + local.get 0 + i32.const 2 + i32.add + i32.store + i32.const 2 + call 2 + drop + br 39 (;@4;) end - i32.const 4224 - i32.load - local.tee 2 + block ;; label = @43 + local.get 4 + i32.const 34 + i32.sub + br_table 19 (;@24;) 39 (;@4;) 39 (;@4;) 39 (;@4;) 39 (;@4;) 19 (;@24;) 6 (;@37;) 14 (;@29;) 39 (;@4;) 39 (;@4;) 12 (;@31;) 39 (;@4;) 39 (;@4;) 20 (;@23;) 0 (;@43;) + end + block ;; label = @43 + local.get 4 + i32.const 91 + i32.sub + br_table 7 (;@36;) 39 (;@4;) 10 (;@33;) 39 (;@4;) 39 (;@4;) 24 (;@19;) 39 (;@4;) 39 (;@4;) 3 (;@40;) 39 (;@4;) 2 (;@41;) 0 (;@43;) + end + block ;; label = @43 + local.get 4 + i32.const 123 + i32.sub + br_table 15 (;@28;) 39 (;@4;) 18 (;@25;) 0 (;@43;) + end + local.get 4 + i32.const 60 + i32.eq + br_if 39 (;@3;) + local.get 4 + i32.const 79 + i32.eq + br_if 4 (;@38;) + local.get 4 + i32.const 109 + i32.ne + br_if 38 (;@4;) + end + local.get 2 + i32.load16_u offset=4 + i32.const 111 + i32.ne + br_if 37 (;@4;) + local.get 2 + i32.load16_u offset=6 + i32.const 100 + i32.ne + br_if 37 (;@4;) + local.get 2 + i32.load16_u offset=8 + i32.const 117 + i32.ne + br_if 37 (;@4;) + local.get 2 + i32.load16_u offset=10 + i32.const 108 + i32.ne + br_if 37 (;@4;) + local.get 2 + i32.load16_u offset=12 + i32.const 101 + i32.ne + br_if 37 (;@4;) + local.get 0 + i32.const 4188 + i32.load + i32.ne + if ;; label = @42 + local.get 2 + i32.load16_u + call 3 i32.eqz - br_if 28 (;@14;) - br 31 (;@11;) + br_if 38 (;@4;) end - i32.const 0 - local.set 13 - i32.const 4214 + i32.const 4196 local.get 2 - i32.const 1 - i32.sub - local.tee 1 - i32.store16 - local.get 1 - i32.const 65535 - i32.and + i32.const 14 + i32.add + i32.store + call 4 + i32.const 46 + i32.ne + br_if 2 (;@39;) + i32.const 4196 + i32.const 4196 + i32.load i32.const 2 - i32.shl - i32.const 8328 i32.add + i32.store + call 4 + i32.const 101 + i32.ne + br_if 2 (;@39;) + i32.const 4196 i32.load - local.set 12 - br 25 (;@16;) + local.tee 0 + i32.load16_u offset=2 + i32.const 120 + i32.ne + br_if 2 (;@39;) + local.get 0 + i32.load16_u offset=4 + i32.const 112 + i32.ne + br_if 2 (;@39;) + local.get 0 + i32.load16_u offset=6 + i32.const 111 + i32.ne + br_if 2 (;@39;) + local.get 0 + i32.load16_u offset=8 + i32.const 114 + i32.ne + br_if 2 (;@39;) + local.get 0 + i32.load16_u offset=10 + i32.const 116 + i32.ne + br_if 2 (;@39;) + local.get 0 + i32.load16_u offset=12 + i32.const 115 + i32.ne + br_if 2 (;@39;) + i32.const 1 + call 5 + br 37 (;@4;) end local.get 2 - i32.const 2048 + i32.load16_u offset=4 + i32.const 120 i32.ne - br_if 0 (;@40;) + br_if 36 (;@4;) + local.get 2 + i32.load16_u offset=6 + i32.const 112 + i32.ne + br_if 36 (;@4;) + local.get 2 + i32.load16_u offset=8 + i32.const 111 + i32.ne + br_if 36 (;@4;) + local.get 2 + i32.load16_u offset=10 + i32.const 114 + i32.ne + br_if 36 (;@4;) + local.get 2 + i32.load16_u offset=12 + i32.const 116 + i32.ne + br_if 36 (;@4;) + local.get 0 + i32.const 4188 + i32.load + i32.ne + if ;; label = @41 + local.get 2 + i32.load16_u + call 3 + i32.eqz + br_if 37 (;@4;) + end + local.get 2 + i32.load16_u offset=14 + i32.const 115 + i32.eq + if ;; label = @41 + i32.const 0 + call 5 + br 37 (;@4;) + end + local.get 1 + br_if 36 (;@4;) + i32.const 4196 + local.get 2 + i32.const 14 + i32.add + local.tee 3 + i32.store + call 4 + local.set 0 + block ;; label = @41 + local.get 3 + i32.const 4196 + i32.load + local.tee 1 + i32.ne + br_if 0 (;@41;) + local.get 0 + i32.const 65528 + i32.and + i32.const 40 + i32.eq + local.get 0 + i32.const 58 + i32.sub + i32.const 6 + i32.lt_u + i32.or + local.get 0 + i32.const 33 + i32.sub + local.tee 3 + i32.const 5 + i32.le_u + i32.const 0 + i32.const 1 + local.get 3 + i32.shl + i32.const 49 + i32.and + select + i32.or + br_if 0 (;@41;) + local.get 0 + i32.const 91 + i32.sub + local.tee 3 + i32.const 3 + i32.le_u + local.get 3 + i32.const 1 + i32.ne + i32.and + br_if 0 (;@41;) + local.get 0 + i32.const 123 + i32.sub + i32.const 65535 + i32.and + i32.const 3 + i32.gt_u + br_if 37 (;@4;) + end i32.const 4224 i32.load - local.tee 2 i32.eqz - br_if 27 (;@13;) - br 29 (;@11;) + if ;; label = @41 + i32.const 4224 + i32.const 7 + i32.store + i32.const 4228 + local.get 1 + i32.const 4188 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store + end + i32.const 4196 + i32.const 4200 + i32.load + i32.const 2 + i32.add + i32.store + br 36 (;@4;) end - local.get 2 - i32.const 16520 - i32.add - i32.const 0 - i32.store8 - local.get 2 - i32.const 2 - i32.shl - i32.const 8328 - i32.add - i32.const 4204 - i32.load - i32.store - i32.const 4214 - local.get 2 - i32.const 1 - i32.add - local.tee 1 - i32.store16 - local.get 1 - i32.const 65535 - i32.and - i32.const 16519 - i32.add - local.tee 1 - i32.const 4219 - i32.load8_u - local.tee 2 - i32.store8 - i32.const 4219 - i32.const 0 - i32.store8 - i32.const 4221 - i32.load8_u - i32.eqz - br_if 36 (;@3;) local.get 0 - i32.const 4208 - i32.load - i32.ne - br_if 36 (;@3;) - local.get 1 - local.get 2 - i32.const 2 - i32.or - i32.store8 - i32.const 4208 i32.const 4188 i32.load - i32.const 2 - i32.sub - i32.store - br 24 (;@15;) - end - i32.const 4224 - i32.load - local.tee 2 - br_if 27 (;@11;) - i32.const 2 - br 26 (;@12;) - end - i32.const 4214 - local.get 2 - i32.const 1 - i32.sub - local.tee 3 - i32.store16 - local.get 2 - i32.const 16519 - i32.add - i32.load8_u - local.set 13 - local.get 2 - i32.const 2 - i32.shl - i32.const 8324 - i32.add - i32.load - local.set 12 - i32.const 4216 - i32.load16_u - local.tee 1 - local.get 2 - i32.eq - if ;; label = @38 - i32.const 4212 - i32.const 4212 - i32.load16_u - i32.const 1 - i32.sub - local.tee 1 - i32.store16 - i32.const 4216 - local.get 1 - i32.const 65535 - i32.and - i32.const 1 - i32.shl - i32.const 4232 - i32.add - i32.load16_u - i32.store16 - call 13 - br 22 (;@16;) - end - local.get 1 - i32.const 65535 - i32.eq - local.get 3 - i32.const 65535 - i32.and - local.get 1 - i32.ge_u - i32.or - br_if 21 (;@16;) - i32.const 4224 - i32.load - local.tee 2 - br_if 26 (;@11;) - i32.const 3 - br 25 (;@12;) - end - block ;; label = @37 - loop ;; label = @38 - block ;; label = @39 - local.get 0 - local.tee 1 - i32.const 2 - i32.add - local.set 0 - local.get 1 - local.get 9 - i32.ge_u - br_if 0 (;@39;) - local.get 0 - i32.load16_u - local.tee 2 - local.get 3 - i32.eq - br_if 2 (;@37;) - local.get 2 - i32.const 92 i32.ne if ;; label = @40 local.get 2 - i32.const 10 - i32.sub - br_table 1 (;@39;) 2 (;@38;) 2 (;@38;) 1 (;@39;) 2 (;@38;) + i32.load16_u + call 3 + i32.eqz + br_if 36 (;@4;) end - local.get 1 - i32.const 4 - i32.add - local.set 0 - local.get 1 + local.get 2 i32.load16_u offset=4 - i32.const 13 + i32.const 108 i32.ne - br_if 1 (;@38;) - local.get 1 - i32.const 6 - i32.add - local.get 0 - local.get 1 + br_if 35 (;@4;) + local.get 2 i32.load16_u offset=6 - i32.const 10 - i32.eq - select - local.set 0 - br 1 (;@38;) + i32.const 97 + i32.ne + br_if 35 (;@4;) + local.get 2 + i32.load16_u offset=8 + i32.const 115 + i32.ne + br_if 35 (;@4;) + local.get 2 + i32.load16_u offset=10 + i32.const 115 + i32.ne + br_if 35 (;@4;) + local.get 2 + i32.load16_u offset=12 + local.tee 0 + i32.const 9 + i32.sub + local.tee 3 + i32.const 23 + i32.gt_u + i32.const 1 + local.get 3 + i32.shl + i32.const 8388639 + i32.and + i32.eqz + i32.or + br_if 32 (;@7;) + br 33 (;@6;) end - end - i32.const 4224 - i32.load - i32.eqz - if ;; label = @38 - i32.const 4224 - i32.const 9 + i32.const 4196 + local.get 2 + i32.const 12 + i32.add i32.store + br 34 (;@4;) end - i32.const 4228 + local.get 2 + i32.load16_u offset=4 + i32.const 98 + i32.ne + br_if 33 (;@4;) + local.get 2 + i32.load16_u offset=6 + i32.const 106 + i32.ne + br_if 33 (;@4;) + local.get 2 + i32.load16_u offset=8 + i32.const 101 + i32.ne + br_if 33 (;@4;) + local.get 2 + i32.load16_u offset=10 + i32.const 99 + i32.ne + br_if 33 (;@4;) + local.get 2 + i32.load16_u offset=12 + i32.const 116 + i32.ne + br_if 33 (;@4;) local.get 0 i32.const 4188 i32.load - i32.sub - i32.const 1 - i32.shr_s + i32.ne + if ;; label = @38 + local.get 2 + i32.load16_u + call 3 + i32.eqz + br_if 34 (;@4;) + end + local.get 2 + i32.const 12 + i32.add + local.set 7 + i32.const 4196 + local.get 2 + i32.const 14 + i32.add i32.store - local.get 9 + call 4 + i32.const 46 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load i32.const 2 i32.add + i32.store + call 4 local.set 0 - end - i32.const 4196 - local.get 0 - i32.store - br 33 (;@3;) - end - local.get 1 - i32.const 4 - i32.add - local.set 4 - block ;; label = @36 - block ;; label = @37 - block ;; label = @38 - block ;; label = @39 - local.get 1 - i32.load16_u offset=4 - local.tee 1 - i32.const 47 - i32.ne - if ;; label = @40 - local.get 1 - i32.const 42 + i32.const 4221 + i32.load8_u + i32.eqz + local.get 0 + i32.const 100 + i32.ne + i32.or + i32.eqz + if ;; label = @38 + i32.const 4196 + i32.load + local.tee 3 + i32.const 4200 + i32.load + local.tee 0 + i32.gt_u + br_if 30 (;@8;) + local.get 0 + local.get 3 + i32.sub + i32.const 1 + i32.shr_s + i32.const 1 + i32.add + local.tee 2 + i32.const 14 + i32.lt_u + br_if 30 (;@8;) + i32.const -1 + local.set 0 + local.get 3 + local.set 1 + loop ;; label = @39 + block ;; label = @40 + local.get 0 + i32.const 13 i32.eq - br_if 1 (;@39;) - i32.const 4188 - i32.load - local.set 3 - i32.const 4204 - i32.load - local.tee 1 - i32.load16_u - local.tee 8 - i32.const 33 - i32.sub - local.tee 4 - i32.const 5 - i32.le_u - i32.const 0 - i32.const 1 - local.get 4 - i32.shl - i32.const 49 - i32.and - select - br_if 22 (;@18;) - local.get 8 - i32.const 41 - i32.ne - local.get 8 - i32.const 40 - i32.sub - i32.const 65535 - i32.and - i32.const 7 - i32.lt_u - i32.and - br_if 3 (;@37;) - local.get 8 - i32.const 58 - i32.sub - i32.const 6 - i32.lt_u - br_if 22 (;@18;) - local.get 8 - i32.const 91 - i32.sub - br_table 22 (;@18;) 2 (;@38;) 2 (;@38;) 22 (;@18;) 2 (;@38;) - end - loop ;; label = @40 - local.get 4 - local.tee 0 - i32.const 2 - i32.sub - local.get 9 - i32.ge_u - br_if 10 (;@30;) + if ;; label = @41 + i32.const 14 + local.set 4 + br 1 (;@40;) + end local.get 0 + i32.const 4105 + i32.add + local.set 5 + local.get 1 + i32.load16_u + local.get 1 i32.const 2 i32.add - local.set 4 + local.set 1 local.get 0 - i32.load16_u - i32.const 10 - i32.sub - br_table 10 (;@30;) 0 (;@40;) 0 (;@40;) 10 (;@30;) 0 (;@40;) + i32.const 1 + i32.add + local.tee 4 + local.set 0 + local.get 5 + i32.load8_s + i32.eq + br_if 1 (;@39;) end - unreachable end - loop ;; label = @39 - local.get 4 - local.tee 0 - local.get 9 + block ;; label = @39 + local.get 2 + i32.const 16 i32.ge_u - br_if 8 (;@31;) - local.get 0 - i32.const 2 - i32.add - local.tee 1 - local.set 4 - local.get 1 - i32.load16_u - i32.const 42 + if ;; label = @40 + i32.const -1 + local.set 0 + local.get 3 + local.set 1 + loop ;; label = @41 + local.get 0 + i32.const 15 + i32.eq + if ;; label = @42 + i32.const 14 + i32.const 16 + local.get 4 + i32.const 13 + i32.gt_u + select + local.set 0 + i32.const 1 + local.set 1 + br 3 (;@39;) + end + local.get 0 + i32.const 4120 + i32.add + local.set 2 + local.get 1 + i32.load16_u + local.get 1 + i32.const 2 + i32.add + local.set 1 + local.get 0 + i32.const 1 + i32.add + local.tee 6 + local.set 0 + local.get 2 + i32.load8_s + i32.eq + br_if 0 (;@41;) + end + i32.const 14 + i32.const 16 + local.get 4 + i32.const 13 + i32.gt_u + local.tee 2 + select + local.set 0 + local.get 2 + local.get 6 + i32.const 15 + i32.gt_u + local.tee 1 + i32.or + br_if 1 (;@39;) + br 32 (;@8;) + end + i32.const 14 + local.set 0 + i32.const 0 + local.set 1 + local.get 4 + i32.const 14 + i32.lt_u + br_if 31 (;@8;) + end + i32.const 4196 + local.get 3 + local.get 0 + i32.const 1 + i32.shl + i32.add + i32.store + call 4 + i32.const 40 + i32.ne + br_if 30 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + call 6 + i32.eqz + br_if 30 (;@8;) + call 4 + i32.const 44 + i32.ne + br_if 30 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.set 2 + local.get 1 + if ;; label = @39 + local.get 2 + i32.const 40 + i32.eq + if (result i32) ;; label = @40 + call 7 + else + local.get 2 + end + i32.const 123 i32.ne + br_if 31 (;@8;) + i32.const 4208 + i32.const 4196 + i32.load + i32.store + br 31 (;@8;) + end + local.get 2 + i32.const 39 + i32.ne + local.get 2 + i32.const 34 + i32.ne + i32.and + br_if 30 (;@8;) + i32.const 4200 + i32.load + local.set 4 + i32.const 4196 + i32.load + local.tee 5 + local.set 0 + block ;; label = @39 + loop ;; label = @40 + block ;; label = @41 + local.get 0 + local.tee 3 + i32.const 2 + i32.add + local.set 0 + local.get 3 + local.get 4 + i32.ge_u + br_if 0 (;@41;) + local.get 2 + local.get 0 + i32.load16_u + local.tee 1 + i32.eq + if ;; label = @42 + local.get 3 + local.set 4 + br 3 (;@39;) + end + local.get 1 + i32.const 92 + i32.ne + if ;; label = @42 + local.get 1 + i32.const 10 + i32.sub + br_table 1 (;@41;) 2 (;@40;) 2 (;@40;) 1 (;@41;) 2 (;@40;) + end + local.get 3 + i32.const 4 + i32.add + local.set 0 + local.get 3 + i32.load16_u offset=4 + i32.const 13 + i32.ne + br_if 1 (;@40;) + local.get 3 + i32.const 6 + i32.add + local.get 0 + local.get 3 + i32.load16_u offset=6 + i32.const 10 + i32.eq + select + local.set 0 + br 1 (;@40;) + end + end + i32.const 4224 + i32.load br_if 0 (;@39;) + i32.const 4224 + i32.const 9 + i32.store + i32.const 4228 local.get 0 - i32.const 4 - i32.add - local.tee 0 - i32.load16_u - i32.const 47 - i32.ne - br_if 0 (;@39;) + i32.const 4188 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store end - br 8 (;@30;) + i32.const 4196 + local.get 4 + i32.const 4 + i32.add + local.tee 0 + i32.store + call 4 + i32.const 44 + i32.ne + br_if 30 (;@8;) + i32.const 18596 + i32.load + local.get 5 + local.get 0 + call 8 + br 30 (;@8;) end - local.get 8 - i32.const 125 + local.get 0 + i32.const 100 i32.eq - local.tee 5 - local.get 8 - i32.const 123 - i32.sub - i32.const 65535 - i32.and - i32.const 3 - i32.gt_u - i32.or - br_if 1 (;@36;) - end - block ;; label = @37 - block ;; label = @38 + if ;; label = @38 + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 102 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 105 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 110 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 101 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=12 + i32.const 80 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=14 + i32.const 114 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=16 + i32.const 111 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=18 + i32.const 112 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=20 + i32.const 101 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=22 + i32.const 114 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=24 + i32.const 116 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.load16_u offset=26 + i32.const 121 + i32.ne + br_if 30 (;@8;) + local.get 0 + i32.const 26 + i32.add + local.set 7 + i32.const 4196 + local.get 0 + i32.const 28 + i32.add + i32.store + i32.const 4188 + i32.load + local.set 0 + call 4 + i32.const 40 + i32.ne + br_if 28 (;@10;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + call 6 + i32.eqz + br_if 28 (;@10;) + call 4 + i32.const 44 + i32.ne + br_if 28 (;@10;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.tee 4 + i32.const 39 + i32.ne + if ;; label = @39 + local.get 0 + local.set 3 + local.get 4 + i32.const 34 + i32.ne + br_if 30 (;@9;) + end + i32.const 4200 + i32.load + local.set 2 + i32.const 4196 + i32.load + local.tee 3 + local.set 0 block ;; label = @39 - local.get 8 - i32.const 43 + loop ;; label = @40 + block ;; label = @41 + local.get 0 + local.tee 1 + i32.const 2 + i32.add + local.set 0 + local.get 1 + local.get 2 + i32.ge_u + br_if 0 (;@41;) + local.get 4 + local.get 0 + i32.load16_u + local.tee 5 + i32.eq + if ;; label = @42 + local.get 1 + local.set 2 + br 3 (;@39;) + end + local.get 5 + i32.const 92 + i32.ne + if ;; label = @42 + local.get 5 + i32.const 10 + i32.sub + br_table 1 (;@41;) 2 (;@40;) 2 (;@40;) 1 (;@41;) 2 (;@40;) + end + local.get 1 + i32.const 4 + i32.add + local.set 0 + local.get 1 + i32.load16_u offset=4 + i32.const 13 + i32.ne + br_if 1 (;@40;) + local.get 1 + i32.const 6 + i32.add + local.get 0 + local.get 1 + i32.load16_u offset=6 + i32.const 10 + i32.eq + select + local.set 0 + br 1 (;@40;) + end + end + i32.const 4224 + i32.load + br_if 0 (;@39;) + i32.const 4224 + i32.const 9 + i32.store + i32.const 4228 + local.get 0 + i32.const 4188 + i32.load i32.sub - br_table 1 (;@38;) 21 (;@18;) 2 (;@37;) 0 (;@39;) 21 (;@18;) + i32.const 1 + i32.shr_s + i32.store end - i32.const 0 - local.set 4 - local.get 1 + i32.const 4196 + local.get 2 + i32.const 4 + i32.add + local.tee 0 + i32.store + call 4 + i32.const 44 + i32.ne + br_if 29 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load i32.const 2 - i32.sub - i32.load16_u - i32.const 48 - i32.sub - i32.const 65535 - i32.and - i32.const 10 - i32.lt_u - br_if 19 (;@19;) - br 20 (;@18;) - end - i32.const 0 - local.set 4 - local.get 1 - i32.const 2 - i32.sub - i32.load16_u - i32.const 43 - i32.eq - br_if 18 (;@19;) - br 19 (;@18;) - end - i32.const 0 - local.set 4 - local.get 1 - i32.const 2 - i32.sub - i32.load16_u - i32.const 45 - i32.eq - br_if 17 (;@19;) - br 18 (;@18;) - end - i32.const 0 - local.set 4 - block ;; label = @36 - local.get 8 - i32.const 100 - i32.sub - br_table 14 (;@22;) 13 (;@23;) 12 (;@24;) 17 (;@19;) 17 (;@19;) 17 (;@19;) 17 (;@19;) 17 (;@19;) 17 (;@19;) 17 (;@19;) 11 (;@25;) 10 (;@26;) 17 (;@19;) 17 (;@19;) 9 (;@27;) 17 (;@19;) 8 (;@28;) 17 (;@19;) 17 (;@19;) 7 (;@29;) 0 (;@36;) - end - local.get 12 - local.get 3 - i32.const 2 - i32.sub - local.get 1 - local.get 11 - i32.eq - select - local.set 3 - local.get 5 - i32.eqz - if ;; label = @36 - local.get 8 - i32.const 47 - i32.eq - br_if 16 (;@20;) - local.get 8 - i32.const 41 - i32.ne - br_if 17 (;@19;) - block ;; label = @37 - local.get 3 - i32.const 8 - i32.sub - local.tee 2 - i32.const 4188 - i32.load - local.tee 1 - i32.lt_u - br_if 0 (;@37;) - local.get 2 - i32.load16_u - i32.const 119 - i32.ne - br_if 0 (;@37;) - local.get 3 - i32.const 6 - i32.sub - i32.load16_u - i32.const 104 - i32.ne - br_if 0 (;@37;) - local.get 3 - i32.const 4 - i32.sub - i32.load16_u - i32.const 105 - i32.ne - br_if 0 (;@37;) - local.get 3 - i32.const 2 - i32.sub - i32.load16_u - i32.const 108 - i32.ne - br_if 0 (;@37;) - local.get 3 - i32.load16_u - i32.const 101 - i32.ne - br_if 0 (;@37;) - local.get 1 - local.get 2 - i32.eq - br_if 19 (;@18;) - local.get 3 - i32.const 10 - i32.sub - i32.load16_u - call 5 - br_if 19 (;@18;) - end - block ;; label = @37 - local.get 3 - i32.const 4 - i32.sub - local.tee 2 - local.get 1 - i32.lt_u - br_if 0 (;@37;) - local.get 2 - i32.load16_u - i32.const 102 - i32.ne - br_if 0 (;@37;) - local.get 3 - i32.const 2 - i32.sub - i32.load16_u - i32.const 111 - i32.ne - br_if 0 (;@37;) - local.get 3 - i32.load16_u - i32.const 114 - i32.ne - br_if 0 (;@37;) - local.get 1 - local.get 2 - i32.eq - br_if 19 (;@18;) - local.get 3 - i32.const 6 - i32.sub - i32.load16_u - call 5 - br_if 19 (;@18;) - end - local.get 3 - i32.const 2 - i32.sub - local.tee 5 - local.get 1 - i32.lt_u - br_if 17 (;@19;) - local.get 5 - i32.load16_u - i32.const 105 - i32.ne - br_if 17 (;@19;) - local.get 3 - i32.load16_u - i32.const 102 - i32.ne - br_if 17 (;@19;) - local.get 1 - local.get 5 - i32.eq - br_if 18 (;@18;) - local.get 2 - i32.load16_u - call 5 - i32.eqz - br_if 17 (;@19;) - br 18 (;@18;) - end - local.get 3 - call 14 - local.get 13 - i32.const 1 - i32.and - local.get 1 - local.get 11 - i32.eq - i32.and - i32.or - br_if 17 (;@18;) - i32.const 4221 - i32.load8_u - i32.eqz - br_if 16 (;@19;) - i32.const 4188 - i32.load - local.tee 6 - i32.const 6 - i32.add - local.set 14 - local.get 6 - i32.const 2 - i32.sub - local.set 7 - loop ;; label = @36 - local.get 3 - local.get 6 - i32.lt_u - br_if 18 (;@18;) - local.get 2 - i32.const 65535 - i32.and - i32.eqz - local.get 3 - i32.load16_u - local.tee 1 - i32.const 123 - i32.ne - i32.or - i32.eqz - if ;; label = @37 - local.get 2 - i32.const 1 - i32.sub - local.tee 2 - i32.const 65535 - i32.and - i32.const 2 - i32.shl - i32.const 8328 - i32.add - i32.load - local.set 3 - br 1 (;@36;) - end - local.get 1 - i32.const 58 - i32.ne - if ;; label = @37 - local.get 1 - i32.const 125 - i32.eq - br_if 19 (;@18;) - local.get 3 - call 14 - i32.eqz - br_if 18 (;@19;) - br 19 (;@18;) - end - local.get 3 - local.get 6 - i32.eq - br_if 17 (;@19;) - local.get 3 - i32.const 2 - i32.sub - call 15 - local.tee 5 - local.get 6 - i32.lt_u - br_if 17 (;@19;) - block ;; label = @37 - local.get 5 - i32.load16_u - local.tee 10 - i32.const 34 - i32.eq - local.get 10 - i32.const 39 - i32.eq - i32.or - i32.eqz - if ;; label = @38 - i32.const 0 - local.set 10 - loop ;; label = @39 - local.get 5 - local.get 6 - i32.lt_u - br_if 2 (;@37;) - local.get 5 - i32.load16_u + i32.add + i32.store + call 4 + i32.const 123 + i32.ne + br_if 29 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.tee 1 + i32.const 101 + i32.eq + if ;; label = @39 + i32.const 4196 + i32.load local.tee 1 - i32.const 64512 - i32.and - i32.const 56320 + i32.load16_u offset=2 + i32.const 110 i32.ne - local.tee 3 - if (result i32) ;; label = @40 - local.get 1 - else - local.get 1 - i32.const 1023 - i32.and - local.get 5 + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=4 + i32.const 117 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=6 + i32.const 109 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=8 + i32.const 101 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=10 + i32.const 114 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=12 + i32.const 97 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=14 + i32.const 98 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=16 + i32.const 108 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=18 + i32.const 101 + i32.ne + br_if 30 (;@9;) + i32.const 4196 + local.get 1 + i32.const 20 + i32.add + i32.store + call 4 + i32.const 58 + i32.ne + br_if 30 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + i32.const 4196 + block (result i32) ;; label = @40 + block ;; label = @41 + call 4 + local.tee 2 + i32.const 116 + i32.ne + br_if 0 (;@41;) + i32.const 4196 + i32.load + local.tee 1 + i32.load16_u offset=2 + i32.const 114 + i32.ne + br_if 0 (;@41;) + local.get 1 + i32.load16_u offset=4 + i32.const 117 + i32.ne + br_if 0 (;@41;) + local.get 1 + i32.load16_u offset=6 + i32.const 101 + i32.ne + br_if 0 (;@41;) + local.get 1 + i32.const 8 + i32.add + br 1 (;@40;) + end + local.get 2 + i32.const 33 + i32.ne + br_if 31 (;@9;) + i32.const 4220 + i32.load8_u + i32.eqz + br_if 31 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load i32.const 2 - i32.sub - i32.load16_u - i32.const 1023 - i32.and - i32.const 10 - i32.shl - i32.or - i32.const 65536 i32.add - end - call 16 - i32.eqz - br_if 2 (;@37;) - local.get 3 - i32.eqz - if ;; label = @40 - local.get 1 - i32.const 1023 - i32.and - local.get 5 + i32.store + call 4 + i32.const 48 + i32.ne + br_if 31 (;@9;) + i32.const 4196 + i32.load i32.const 2 - i32.sub - i32.load16_u - i32.const 1023 - i32.and - i32.const 10 - i32.shl - i32.or - i32.const 65536 i32.add - local.set 1 end - local.get 5 - local.get 6 - i32.sub - local.get 5 - i32.const -2 - i32.const -4 - local.get 1 - i32.const 65536 - i32.lt_u - local.tee 15 - select - i32.add - local.set 5 - local.get 1 - call 17 - local.set 10 - i32.const 1 - i32.shr_s - i32.const 1 + i32.store + call 4 + i32.const 44 + i32.ne + br_if 30 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load i32.const 2 - local.get 15 - select - i32.ge_u - br_if 0 (;@39;) + i32.add + i32.store + call 4 + local.set 1 end - local.get 10 - i32.eqz - br_if 19 (;@19;) - br 20 (;@18;) - end - loop ;; label = @38 - local.get 5 - local.get 6 - i32.gt_u + local.get 1 + i32.const 103 + i32.ne if ;; label = @39 - local.get 5 - i32.const 2 - i32.sub - local.tee 5 - i32.load16_u - local.get 10 + local.get 1 + i32.const 118 i32.ne - br_if 1 (;@38;) - local.get 5 - local.set 1 - loop ;; label = @40 - local.get 6 - local.get 1 - local.tee 3 - i32.lt_u - if ;; label = @41 - local.get 1 - i32.const 2 - i32.sub - local.tee 1 - i32.load16_u - i32.const 92 - i32.eq - br_if 1 (;@40;) - end - end - local.get 5 + br_if 30 (;@9;) + i32.const 4196 + i32.load + local.tee 1 + i32.load16_u offset=2 + i32.const 97 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=4 + i32.const 108 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=6 + i32.const 117 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=8 + i32.const 101 + i32.ne + br_if 30 (;@9;) + i32.const 4196 + local.get 1 + i32.const 10 + i32.add + i32.store + call 4 + i32.const 58 + i32.ne + br_if 30 (;@9;) + i32.const 18596 + i32.load local.get 3 - i32.sub - i32.const 2 - i32.and - br_if 1 (;@38;) + local.get 0 + call 8 + br 31 (;@8;) end - end - local.get 5 - local.get 6 - i32.eq - br_if 18 (;@19;) - local.get 5 - i32.const 2 - i32.sub - local.set 5 - i32.const 0 - local.set 10 - end - block ;; label = @37 - block ;; label = @38 - local.get 5 - call 15 + i32.const 4196 + i32.load local.tee 1 - local.get 6 - i32.lt_u - br_if 0 (;@38;) - block ;; label = @39 - local.get 1 - i32.load16_u - i32.const 43 - i32.sub - br_table 0 (;@39;) 1 (;@38;) 0 (;@39;) 1 (;@38;) - end - local.get 7 - local.set 3 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 29 (;@9;) local.get 1 - local.get 6 - i32.eq - br_if 1 (;@37;) + i32.load16_u offset=4 + i32.const 116 + i32.ne + br_if 29 (;@9;) + i32.const 4196 local.get 1 + i32.const 6 + i32.add + i32.store + call 4 + local.tee 1 + i32.const 58 + i32.eq + if (result i32) ;; label = @39 + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 102 + i32.ne + br_if 30 (;@9;) + i32.const 4196 + i32.load + local.tee 1 + i32.load16_u offset=2 + i32.const 117 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=4 + i32.const 110 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=6 + i32.const 99 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=8 + i32.const 116 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=10 + i32.const 105 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=12 + i32.const 111 + i32.ne + br_if 30 (;@9;) + local.get 1 + i32.load16_u offset=14 + i32.const 110 + i32.ne + br_if 30 (;@9;) + i32.const 4196 + local.get 1 + i32.const 16 + i32.add + local.tee 1 + i32.store + call 4 + local.tee 2 + i32.const 40 + i32.ne + if ;; label = @40 + local.get 1 + i32.const 4196 + i32.load + i32.eq + br_if 31 (;@9;) + local.get 2 + call 9 + i32.eqz + br_if 31 (;@9;) + end + call 4 + else + local.get 1 + end + i32.const 40 + i32.ne + br_if 29 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load i32.const 2 - i32.sub - call 15 - local.set 1 - end - block ;; label = @38 - local.get 1 - local.get 6 - i32.lt_u - local.get 1 - local.get 14 - i32.lt_u - i32.or - br_if 0 (;@38;) + i32.add + i32.store + call 4 + i32.const 41 + i32.ne + br_if 29 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 123 + i32.ne + br_if 29 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 114 + i32.ne + br_if 29 (;@9;) + i32.const 4196 + i32.load + local.tee 1 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 29 (;@9;) local.get 1 - i32.const 6 - i32.sub - i32.load16_u - i32.const 99 + i32.load16_u offset=4 + i32.const 116 i32.ne - br_if 0 (;@38;) + br_if 29 (;@9;) local.get 1 - i32.const 4 - i32.sub - i32.load16_u - i32.const 97 + i32.load16_u offset=6 + i32.const 117 i32.ne - br_if 0 (;@38;) + br_if 29 (;@9;) local.get 1 - i32.const 2 - i32.sub - i32.load16_u - i32.const 115 + i32.load16_u offset=8 + i32.const 114 i32.ne - br_if 0 (;@38;) + br_if 29 (;@9;) local.get 1 - i32.load16_u - i32.const 101 + i32.load16_u offset=10 + i32.const 110 i32.ne - br_if 0 (;@38;) + br_if 29 (;@9;) + i32.const 4196 local.get 1 - local.get 14 - i32.eq - br_if 20 (;@18;) + i32.const 12 + i32.add + i32.store + call 4 + call 9 + i32.eqz + br_if 29 (;@9;) + block ;; label = @39 + block ;; label = @40 + call 4 + local.tee 1 + i32.const 91 + i32.ne + if ;; label = @41 + local.get 1 + i32.const 46 + i32.ne + br_if 2 (;@39;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + call 9 + i32.eqz + br_if 32 (;@9;) + br 1 (;@40;) + end + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.tee 5 + i32.const 39 + i32.ne + local.get 5 + i32.const 34 + i32.ne + i32.and + br_if 31 (;@9;) + i32.const 4196 + i32.load + local.set 1 + i32.const 4200 + i32.load + local.set 4 + block ;; label = @41 + loop ;; label = @42 + block ;; label = @43 + local.get 1 + local.tee 2 + i32.const 2 + i32.add + local.set 1 + local.get 2 + local.get 4 + i32.ge_u + br_if 0 (;@43;) + local.get 5 + local.get 1 + i32.load16_u + local.tee 6 + i32.eq + if ;; label = @44 + local.get 2 + local.set 4 + br 3 (;@41;) + end + local.get 6 + i32.const 92 + i32.ne + if ;; label = @44 + local.get 6 + i32.const 10 + i32.sub + br_table 1 (;@43;) 2 (;@42;) 2 (;@42;) 1 (;@43;) 2 (;@42;) + end + local.get 2 + i32.const 4 + i32.add + local.set 1 + local.get 2 + i32.load16_u offset=4 + i32.const 13 + i32.ne + br_if 1 (;@42;) + local.get 2 + i32.const 6 + i32.add + local.get 1 + local.get 2 + i32.load16_u offset=6 + i32.const 10 + i32.eq + select + local.set 1 + br 1 (;@42;) + end + end + i32.const 4224 + i32.load + br_if 0 (;@41;) + i32.const 4224 + i32.const 9 + i32.store + i32.const 4228 + local.get 1 + i32.const 4188 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store + end + i32.const 4196 + local.get 4 + i32.const 4 + i32.add + i32.store + call 4 + i32.const 93 + i32.ne + br_if 31 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + end + call 4 + local.set 1 + end local.get 1 - i32.const 8 - i32.sub - i32.load16_u - local.tee 3 - i32.const 64512 - i32.and - i32.const 56320 + i32.const 59 i32.eq if (result i32) ;; label = @39 - local.get 3 - i32.const 1023 - i32.and + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + else local.get 1 - i32.const 10 - i32.sub - i32.load16_u - i32.const 1023 - i32.and - i32.const 10 - i32.shl - i32.or - i32.const 65536 + end + i32.const 125 + i32.ne + br_if 29 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.tee 1 + i32.const 44 + i32.eq + if (result i32) ;; label = @39 + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 i32.add + i32.store + call 4 else - local.get 3 + local.get 1 end - call 16 + i32.const 125 + i32.ne + br_if 29 (;@9;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 41 + i32.ne + br_if 29 (;@9;) + i32.const 18596 + i32.load local.get 3 - i32.const 46 - i32.eq - br_if 0 (;@38;) - local.get 1 - local.set 3 - i32.eqz - br_if 20 (;@18;) - br 1 (;@37;) + local.get 0 + call 8 + br 34 (;@4;) end local.get 1 - local.set 3 - end - local.get 10 - i32.const 1 - i32.and - br_if 0 (;@36;) - end - br 16 (;@19;) - end - block ;; label = @35 - i32.const 4216 - i32.load16_u - i32.const 65535 - i32.ne - if ;; label = @36 - i32.const 4224 - i32.load - local.set 2 - br 1 (;@35;) - end + local.get 0 + i32.const 107 + i32.ne + i32.or + br_if 29 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 121 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 115 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.const 6 + i32.add + local.set 7 + i32.const 4196 + local.get 0 + i32.const 8 + i32.add + i32.store + call 4 + i32.const 40 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 4196 + i32.load + local.set 5 + call 9 + i32.eqz + br_if 29 (;@8;) + i32.const 4196 + i32.load + call 4 + i32.const 41 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + local.tee 7 + i32.const 2 + i32.add + i32.store + call 4 + i32.const 46 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 102 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 111 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 114 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 69 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 97 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 99 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=12 + i32.const 104 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + local.get 0 + i32.const 14 + i32.add + i32.store + call 4 + i32.const 4196 + i32.load + local.tee 3 + i32.const 2 + i32.sub + local.set 7 + i32.const 40 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + local.get 3 + i32.const 2 + i32.add + i32.store + call 4 + i32.const 102 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 117 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 110 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 99 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 116 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 105 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=12 + i32.const 111 + i32.ne + br_if 29 (;@8;) + local.get 0 + i32.load16_u offset=14 + i32.const 110 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + local.get 0 + i32.const 16 + i32.add + i32.store + call 4 + i32.const 40 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 4196 + i32.load + local.set 3 + call 9 + i32.eqz + br_if 29 (;@8;) + i32.const 4196 + i32.load + local.set 0 + call 4 + i32.const 41 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 123 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 105 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.load + local.tee 1 + i32.load16_u offset=2 + i32.const 102 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + local.get 1 + i32.const 4 + i32.add + i32.store + call 4 + i32.const 40 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 6 + local.get 3 + local.get 0 + local.get 3 + i32.sub + i32.const 1 + i32.shr_s + local.tee 1 + call 10 + i32.eqz + br_if 29 (;@8;) + local.get 5 + i32.sub + i32.const 1 + i32.shr_s + local.set 4 + i32.const 4196 + local.get 6 + local.get 1 + i32.const 1 + i32.shl + local.tee 2 + i32.add + i32.store + block ;; label = @38 + block ;; label = @39 + block ;; label = @40 + call 4 + local.tee 0 + i32.const 33 + i32.ne + if ;; label = @41 + local.get 0 + i32.const 61 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 61 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 61 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 6 + i32.add + i32.store + call 4 + local.tee 6 + i32.const 39 + i32.ne + local.get 6 + i32.const 34 + i32.ne + i32.and + br_if 33 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 100 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 101 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 102 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 97 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 117 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=12 + i32.const 108 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=14 + i32.const 116 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 16 + i32.add + i32.store + call 4 + local.get 6 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 124 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 124 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 4 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 3 + local.get 1 + call 10 + i32.eqz + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + local.get 2 + i32.add + i32.store + call 4 + i32.const 61 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 61 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 61 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 6 + i32.add + i32.store + call 4 + local.tee 6 + i32.const 39 + i32.ne + local.get 6 + i32.const 34 + i32.ne + i32.and + br_if 33 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 95 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 95 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 101 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 115 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 77 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=12 + i32.const 111 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=14 + i32.const 100 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=16 + i32.const 117 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=18 + i32.const 108 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=20 + i32.const 101 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 22 + i32.add + i32.store + call 4 + local.get 6 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 41 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 114 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 116 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 117 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 114 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 110 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 12 + i32.add + i32.store + call 4 + i32.const 59 + i32.eq + if ;; label = @42 + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + end + call 4 + local.tee 0 + i32.const 105 + i32.ne + br_if 3 (;@38;) + i32.const 105 + local.set 0 + i32.const 4196 + i32.load + local.tee 6 + i32.load16_u offset=2 + i32.const 102 + i32.ne + br_if 3 (;@38;) + i32.const 4196 + local.get 6 + i32.const 4 + i32.add + i32.store + call 4 + i32.const 40 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + local.tee 0 + i32.store + local.get 3 + local.get 1 + call 11 + if ;; label = @42 + call 4 + i32.const 41 + i32.ne + br_if 34 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 114 + i32.ne + br_if 34 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 116 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 117 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 114 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 110 + i32.ne + br_if 34 (;@8;) + i32.const 4196 + local.get 0 + i32.const 12 + i32.add + i32.store + call 4 + i32.const 59 + i32.eq + if ;; label = @43 + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + end + call 4 + local.tee 0 + i32.const 105 + i32.ne + br_if 4 (;@38;) + i32.const 105 + local.set 0 + i32.const 4196 + i32.load + local.tee 6 + i32.load16_u offset=2 + i32.const 102 + i32.ne + br_if 4 (;@38;) + i32.const 4196 + local.get 6 + i32.const 4 + i32.add + i32.store + call 4 + i32.const 40 + i32.ne + br_if 34 (;@8;) + i32.const 4196 + i32.load + i32.const 2 + i32.add + local.set 0 + end + i32.const 4196 + local.get 0 + i32.store + local.get 0 + local.get 3 + local.get 1 + call 10 + i32.eqz + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + local.get 2 + i32.add + i32.store + call 4 + i32.const 105 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 110 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 32 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 6 + i32.add + i32.store + call 4 + call 6 + i32.eqz + br_if 33 (;@8;) + call 4 + i32.const 38 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 38 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 4 + i32.add + i32.store + call 4 + call 6 + i32.eqz + br_if 33 (;@8;) + call 4 + i32.const 91 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 3 + local.get 1 + call 10 + i32.eqz + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + local.get 2 + i32.add + i32.store + call 4 + i32.const 93 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 61 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 61 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 61 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 6 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 5 + local.get 4 + call 10 + i32.eqz + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + local.get 4 + i32.const 1 + i32.shl + i32.add + i32.store + call 4 + i32.const 91 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 3 + local.get 1 + call 10 + i32.eqz + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + local.get 2 + i32.add + i32.store + call 4 + i32.const 93 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 41 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 114 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 116 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 117 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 114 + i32.ne + br_if 33 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 110 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 12 + i32.add + i32.store + call 4 + i32.const 59 + i32.eq + br_if 1 (;@40;) + br 2 (;@39;) + end + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 61 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 61 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + local.get 0 + i32.const 6 + i32.add + i32.store + call 4 + local.tee 6 + i32.const 39 + i32.ne + local.get 6 + i32.const 34 + i32.ne + i32.and + br_if 32 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 100 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 101 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 102 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 97 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 117 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=12 + i32.const 108 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=14 + i32.const 116 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + local.get 0 + i32.const 16 + i32.add + i32.store + call 4 + local.get 6 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.tee 0 + i32.const 38 + i32.eq + if (result i32) ;; label = @41 + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 38 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + local.get 0 + i32.const 4 + i32.add + i32.store + call 4 + i32.const 33 + i32.ne + br_if 33 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + block ;; label = @42 + block ;; label = @43 + call 4 + local.tee 6 + i32.const 79 + i32.ne + br_if 0 (;@43;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 98 + i32.ne + br_if 0 (;@43;) + local.get 0 + i32.load16_u offset=4 + i32.const 106 + i32.ne + br_if 0 (;@43;) + local.get 0 + i32.load16_u offset=6 + i32.const 101 + i32.ne + br_if 0 (;@43;) + local.get 0 + i32.load16_u offset=8 + i32.const 99 + i32.ne + br_if 0 (;@43;) + local.get 0 + i32.load16_u offset=10 + i32.const 116 + i32.ne + br_if 0 (;@43;) + local.get 0 + i32.load16_u offset=12 + i32.const 46 + i32.ne + br_if 0 (;@43;) + local.get 3 + local.get 1 + call 11 + br_if 1 (;@42;) + br 35 (;@8;) + end + local.get 6 + call 9 + i32.eqz + br_if 0 (;@42;) + call 4 + i32.const 46 + i32.ne + br_if 34 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 104 + i32.ne + br_if 34 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 97 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 115 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 79 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 119 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 110 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=12 + i32.const 80 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=14 + i32.const 114 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=16 + i32.const 111 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=18 + i32.const 112 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=20 + i32.const 101 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=22 + i32.const 114 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=24 + i32.const 116 + i32.ne + br_if 34 (;@8;) + local.get 0 + i32.load16_u offset=26 + i32.const 121 + i32.ne + br_if 34 (;@8;) + i32.const 4196 + local.get 0 + i32.const 28 + i32.add + i32.store + call 4 + i32.const 40 + i32.ne + br_if 34 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 3 + local.get 1 + call 10 + i32.eqz + br_if 34 (;@8;) + i32.const 4196 + local.get 0 + local.get 2 + i32.add + i32.store + call 4 + i32.const 41 + i32.ne + br_if 34 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + end + call 4 + else + local.get 0 + end + i32.const 41 + i32.ne + br_if 32 (;@8;) + end + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + end + call 4 + local.set 0 + end + block ;; label = @38 + block ;; label = @39 + local.get 0 + call 6 + if ;; label = @40 + call 4 + i32.const 91 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 3 + local.get 1 + call 10 + i32.eqz + br_if 32 (;@8;) + i32.const 4196 + local.get 0 + local.get 2 + i32.add + i32.store + call 4 + i32.const 93 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 61 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 5 + local.get 4 + call 10 + i32.eqz + br_if 32 (;@8;) + i32.const 4196 + local.get 0 + local.get 4 + i32.const 1 + i32.shl + i32.add + i32.store + call 4 + i32.const 91 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 3 + local.get 1 + call 10 + i32.eqz + br_if 32 (;@8;) + i32.const 4196 + local.get 0 + local.get 2 + i32.add + i32.store + call 4 + i32.const 93 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.tee 0 + i32.const 59 + i32.eq + br_if 1 (;@39;) + br 2 (;@38;) + end + local.get 0 + i32.const 79 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 98 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 106 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 101 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 99 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 116 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + local.get 0 + i32.const 12 + i32.add + i32.store + call 4 + i32.const 46 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 100 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 102 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 105 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 110 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 101 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=12 + i32.const 80 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=14 + i32.const 114 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=16 + i32.const 111 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=18 + i32.const 112 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=20 + i32.const 101 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=22 + i32.const 114 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=24 + i32.const 116 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=26 + i32.const 121 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + local.get 0 + i32.const 28 + i32.add + i32.store + call 4 + i32.const 40 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + call 6 + i32.eqz + br_if 31 (;@8;) + call 4 + i32.const 44 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 3 + local.get 1 + call 10 + i32.eqz + br_if 31 (;@8;) + i32.const 4196 + local.get 0 + local.get 2 + i32.add + i32.store + call 4 + i32.const 44 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 123 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 101 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 110 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 117 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 109 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 101 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 114 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=12 + i32.const 97 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=14 + i32.const 98 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=16 + i32.const 108 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=18 + i32.const 101 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + local.get 0 + i32.const 20 + i32.add + i32.store + call 4 + i32.const 58 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + i32.const 4196 + block (result i32) ;; label = @40 + block ;; label = @41 + call 4 + local.tee 6 + i32.const 116 + i32.ne + br_if 0 (;@41;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 114 + i32.ne + br_if 0 (;@41;) + local.get 0 + i32.load16_u offset=4 + i32.const 117 + i32.ne + br_if 0 (;@41;) + local.get 0 + i32.load16_u offset=6 + i32.const 101 + i32.ne + br_if 0 (;@41;) + local.get 0 + i32.const 8 + i32.add + br 1 (;@40;) + end + local.get 6 + i32.const 33 + i32.ne + br_if 32 (;@8;) + i32.const 4220 + i32.load8_u + i32.eqz + br_if 32 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 48 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + i32.load + i32.const 2 + i32.add + end + i32.store + call 4 + i32.const 44 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 103 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 116 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + local.get 0 + i32.const 6 + i32.add + i32.store + call 4 + local.tee 0 + i32.const 58 + i32.eq + if (result i32) ;; label = @40 + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 102 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 117 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 110 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 99 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 116 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 105 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=12 + i32.const 111 + i32.ne + br_if 32 (;@8;) + local.get 0 + i32.load16_u offset=14 + i32.const 110 + i32.ne + br_if 32 (;@8;) + i32.const 4196 + local.get 0 + i32.const 16 + i32.add + local.tee 0 + i32.store + call 4 + local.tee 6 + i32.const 40 + i32.ne + if ;; label = @41 + local.get 0 + i32.const 4196 + i32.load + i32.eq + br_if 33 (;@8;) + local.get 6 + call 9 + i32.eqz + br_if 33 (;@8;) + end + call 4 + else + local.get 0 + end + i32.const 40 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 41 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 123 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 114 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.load + local.tee 0 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=4 + i32.const 116 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=6 + i32.const 117 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=8 + i32.const 114 + i32.ne + br_if 31 (;@8;) + local.get 0 + i32.load16_u offset=10 + i32.const 110 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + local.get 0 + i32.const 12 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 5 + local.get 4 + call 10 + i32.eqz + br_if 31 (;@8;) + i32.const 4196 + local.get 0 + local.get 4 + i32.const 1 + i32.shl + i32.add + i32.store + call 4 + i32.const 91 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + drop + i32.const 4196 + i32.load + local.tee 0 + local.get 3 + local.get 1 + call 10 + i32.eqz + br_if 31 (;@8;) + i32.const 4196 + local.get 0 + local.get 2 + i32.add + i32.store + call 4 + i32.const 93 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.tee 0 + i32.const 59 + i32.eq + if (result i32) ;; label = @40 + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + else + local.get 0 + end + i32.const 125 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.tee 0 + i32.const 44 + i32.eq + if (result i32) ;; label = @40 + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + else + local.get 0 + end + i32.const 125 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 41 + i32.ne + br_if 31 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.tee 0 + i32.const 59 + i32.ne + br_if 1 (;@38;) + end + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.set 0 + end + local.get 0 + i32.const 125 + i32.ne + br_if 29 (;@8;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + i32.const 41 + i32.ne + br_if 29 (;@8;) + i32.const 18588 + local.set 0 + loop ;; label = @38 + local.get 0 + i32.load + local.tee 0 + i32.eqz + br_if 34 (;@4;) + block ;; label = @39 + local.get 4 + local.get 0 + i32.load offset=12 + local.get 0 + i32.load offset=8 + local.tee 3 + i32.sub + i32.const 1 + i32.shr_s + i32.ne + br_if 0 (;@39;) + local.get 5 + local.get 3 + local.get 4 + call 10 + i32.eqz + br_if 0 (;@39;) + i32.const 18596 + i32.load + i32.const 12 + i32.add + local.get 0 + i32.load + local.get 0 + i32.load offset=4 + call 8 + br 31 (;@8;) + end + local.get 0 + i32.const 16 + i32.add + local.set 0 + br 0 (;@38;) + end + unreachable + end + local.get 1 + i32.const 2048 + i32.ne + br_if 15 (;@21;) + i32.const 4224 + i32.load + local.tee 1 + br_if 25 (;@11;) + br 23 (;@13;) + end + i32.const 4221 + i32.load8_u + i32.eqz + br_if 32 (;@3;) + local.get 1 + i32.const 2048 + i32.ne + br_if 1 (;@34;) i32.const 4224 i32.load - local.set 2 - i32.const 4214 - i32.load16_u + local.tee 1 i32.eqz - br_if 34 (;@1;) + br_if 22 (;@13;) + br 24 (;@11;) end - local.get 2 - br_if 33 (;@1;) - i32.const 1 - br 22 (;@12;) + i32.const 4221 + i32.load8_u + i32.eqz + br_if 31 (;@3;) end - local.get 2 + local.get 1 i32.const 16520 i32.add i32.const 0 i32.store8 i32.const 4214 - local.get 2 + local.get 1 i32.const 1 i32.add i32.store16 - local.get 2 + local.get 1 i32.const 2 i32.shl i32.const 8328 @@ -5113,778 +4050,1757 @@ i32.store br 30 (;@3;) end - local.get 1 - i32.const 16520 - i32.add - i32.const 0 - i32.store8 + i32.const 4221 + i32.load8_u + i32.eqz + br_if 29 (;@3;) i32.const 4214 local.get 1 i32.const 1 - i32.add + i32.sub i32.store16 - local.get 1 - i32.const 2 - i32.shl - i32.const 8328 - i32.add - local.get 0 - i32.store - br 28 (;@4;) - end - i32.const 4216 - i32.load16_u - i32.const 65534 - i32.eq - if ;; label = @32 - i32.const 4224 - i32.load - local.tee 2 - br_if 21 (;@11;) - i32.const 4 - br 20 (;@12;) + br 29 (;@3;) end - call 13 - br 28 (;@3;) + i32.const 4221 + i32.load8_u + i32.eqz + br_if 28 (;@3;) + i32.const 4224 + i32.load + local.tee 1 + br_if 20 (;@11;) + br 17 (;@14;) end - local.get 0 - i32.const 2 + i32.const 4221 + i32.load8_u + i32.eqz + br_if 27 (;@3;) + local.get 1 + i32.const 16519 i32.add - local.set 0 + i32.load8_u + i32.const 2 + i32.and + i32.eqz + br_if 27 (;@3;) + br 15 (;@15;) end - i32.const 4196 - local.get 0 - i32.store - br 27 (;@2;) - end - local.get 1 - i32.const 2 - i32.sub - i32.load16_u - local.tee 2 - i32.const 111 - i32.ne - if ;; label = @29 - local.get 2 - i32.const 101 - i32.ne - br_if 10 (;@19;) - i32.const 4188 + i32.const 4224 i32.load - local.tee 3 - local.get 1 - i32.const 4 - i32.sub - local.tee 2 - i32.gt_u - br_if 10 (;@19;) - local.get 2 - i32.load16_u - i32.const 110 - i32.ne - br_if 10 (;@19;) - i32.const -3 - local.set 4 - local.get 2 - local.get 3 - i32.ne - br_if 8 (;@21;) - br 11 (;@18;) + local.tee 1 + i32.eqz + br_if 15 (;@14;) + br 18 (;@11;) end + i32.const 4214 local.get 1 - i32.const 8 + i32.const 1 i32.sub - local.tee 2 - i32.const 4188 - i32.load local.tee 3 - i32.lt_u - br_if 9 (;@19;) - local.get 2 - i32.load16_u - i32.const 116 - i32.ne - br_if 9 (;@19;) - local.get 1 - i32.const 6 - i32.sub - i32.load16_u - i32.const 104 - i32.ne - br_if 9 (;@19;) - local.get 1 - i32.const 4 - i32.sub - i32.load16_u - i32.const 114 - i32.ne - br_if 9 (;@19;) - i32.const -5 - local.set 4 - local.get 2 + i32.store16 local.get 3 - i32.eq - br_if 10 (;@18;) - br 7 (;@21;) + i32.const 65535 + i32.and + i32.const 2 + i32.shl + i32.const 8328 + i32.add + i32.load + local.set 8 + br 12 (;@16;) end local.get 1 - i32.const 8 - i32.sub - local.tee 2 - i32.const 4188 - i32.load - local.tee 3 - i32.lt_u - br_if 8 (;@19;) - local.get 2 - i32.load16_u - i32.const 97 - i32.ne - br_if 8 (;@19;) - local.get 1 - i32.const 6 - i32.sub - i32.load16_u - i32.const 119 - i32.ne - br_if 8 (;@19;) - local.get 1 - i32.const 4 - i32.sub - i32.load16_u - i32.const 97 - i32.ne - br_if 8 (;@19;) - local.get 1 - i32.const 2 - i32.sub - i32.load16_u - i32.const 105 - i32.ne - br_if 8 (;@19;) - i32.const -5 - local.set 4 - local.get 2 - local.get 3 + i32.const 2048 i32.ne - br_if 6 (;@21;) - br 9 (;@18;) + br_if 0 (;@27;) + i32.const 4224 + i32.load + local.tee 1 + i32.eqz + br_if 14 (;@13;) + br 16 (;@11;) end local.get 1 - i32.const 14 - i32.sub - local.tee 2 - i32.const 4188 - i32.load - local.tee 3 - i32.lt_u - br_if 7 (;@19;) - local.get 2 - i32.load16_u - i32.const 100 - i32.ne - br_if 7 (;@19;) - local.get 1 - i32.const 12 - i32.sub - i32.load16_u - i32.const 101 - i32.ne - br_if 7 (;@19;) - local.get 1 - i32.const 10 - i32.sub - i32.load16_u - i32.const 98 - i32.ne - br_if 7 (;@19;) - local.get 1 - i32.const 8 - i32.sub - i32.load16_u - i32.const 117 - i32.ne - br_if 7 (;@19;) - local.get 1 - i32.const 6 - i32.sub - i32.load16_u - i32.const 103 - i32.ne - br_if 7 (;@19;) - local.get 1 - i32.const 4 - i32.sub - i32.load16_u - i32.const 103 - i32.ne - br_if 7 (;@19;) + i32.const 16520 + i32.add + i32.const 0 + i32.store8 local.get 1 - i32.const 2 - i32.sub - i32.load16_u - i32.const 101 - i32.ne - br_if 7 (;@19;) - i32.const -8 - local.set 4 - local.get 2 - local.get 3 - i32.ne - br_if 5 (;@21;) - br 8 (;@18;) - end - i32.const 4188 - i32.load - local.tee 3 - local.get 1 - i32.const 2 - i32.sub - local.tee 2 - i32.gt_u - br_if 6 (;@19;) - local.get 2 - i32.load16_u - i32.const 100 - i32.ne - br_if 6 (;@19;) - i32.const -2 - local.set 4 - local.get 2 - local.get 3 - i32.ne - br_if 4 (;@21;) - br 7 (;@18;) - end - block ;; label = @25 - i32.const 4188 - i32.load - local.tee 2 - local.get 1 - i32.const 2 - i32.sub - local.tee 3 - i32.gt_u - br_if 0 (;@25;) - local.get 3 - i32.load16_u - i32.const 105 - i32.ne - br_if 0 (;@25;) - local.get 2 - local.get 3 - i32.eq - br_if 7 (;@18;) - local.get 1 - i32.const 4 - i32.sub - i32.load16_u - call 5 - br_if 7 (;@18;) - end - local.get 1 - i32.const 10 - i32.sub - local.tee 5 - local.get 2 - i32.lt_u - br_if 5 (;@19;) - local.get 5 - i32.load16_u - i32.const 114 - i32.ne - br_if 5 (;@19;) - local.get 1 - i32.const 8 - i32.sub - i32.load16_u - i32.const 101 - i32.ne - br_if 5 (;@19;) - local.get 1 - i32.const 6 - i32.sub - i32.load16_u - i32.const 116 - i32.ne - br_if 5 (;@19;) - local.get 1 - i32.const 4 - i32.sub - i32.load16_u - i32.const 117 - i32.ne - br_if 5 (;@19;) - local.get 3 - i32.load16_u - i32.const 114 - i32.ne - br_if 5 (;@19;) - i32.const -6 - local.set 4 - local.get 2 - local.get 5 - i32.ne - br_if 3 (;@21;) - br 6 (;@18;) - end - local.get 1 - i32.const 2 - i32.sub - i32.load16_u - i32.const 111 - i32.ne - br_if 4 (;@19;) - local.get 1 - i32.const 4 - i32.sub - i32.load16_u - i32.const 101 - i32.ne - br_if 4 (;@19;) - local.get 1 - i32.const 6 - i32.sub - i32.load16_u - local.tee 2 - i32.const 112 - i32.ne - if ;; label = @24 - local.get 2 - i32.const 99 - i32.ne - br_if 5 (;@19;) + i32.const 2 + i32.shl + i32.const 8328 + i32.add + i32.const 4204 + i32.load + i32.store + i32.const 4214 + local.get 1 + i32.const 1 + i32.add + local.tee 3 + i32.store16 + local.get 3 + i32.const 65535 + i32.and + i32.const 16519 + i32.add + local.tee 3 + i32.const 4219 + i32.load8_u + local.tee 1 + i32.store8 + i32.const 4219 + i32.const 0 + i32.store8 + i32.const 4221 + i32.load8_u + i32.eqz + br_if 23 (;@3;) + local.get 0 + i32.const 4208 + i32.load + i32.ne + br_if 23 (;@3;) + local.get 3 + local.get 1 + i32.const 2 + i32.or + i32.store8 + i32.const 4208 + i32.const 4188 + i32.load + i32.const 2 + i32.sub + i32.store + br 11 (;@15;) + end + i32.const 4224 + i32.load + local.tee 1 + br_if 14 (;@11;) + i32.const 2 + br 13 (;@12;) + end + i32.const 4214 local.get 1 - i32.const 18 + i32.const 1 i32.sub local.tee 2 - i32.const 4188 - i32.load - local.tee 3 - i32.lt_u - br_if 5 (;@19;) - local.get 2 - i32.load16_u - i32.const 105 - i32.ne - br_if 5 (;@19;) - local.get 1 - i32.const 16 - i32.sub - i32.load16_u - i32.const 110 - i32.ne - br_if 5 (;@19;) - local.get 1 - i32.const 14 - i32.sub - i32.load16_u - i32.const 115 - i32.ne - br_if 5 (;@19;) + i32.store16 local.get 1 - i32.const 12 - i32.sub - i32.load16_u - i32.const 116 - i32.ne - br_if 5 (;@19;) + i32.const 16519 + i32.add + i32.load8_u + local.set 14 local.get 1 - i32.const 10 - i32.sub + i32.const 2 + i32.shl + i32.const 8324 + i32.add + i32.load + local.set 8 + i32.const 4216 i32.load16_u - i32.const 97 - i32.ne - br_if 5 (;@19;) + local.tee 3 local.get 1 - i32.const 8 - i32.sub - i32.load16_u - i32.const 110 - i32.ne - br_if 5 (;@19;) - i32.const -10 - local.set 4 + i32.eq + if ;; label = @25 + i32.const 4212 + i32.const 4212 + i32.load16_u + i32.const 1 + i32.sub + local.tee 3 + i32.store16 + i32.const 4216 + local.get 3 + i32.const 65535 + i32.and + i32.const 1 + i32.shl + i32.const 4232 + i32.add + i32.load16_u + i32.store16 + call 12 + br 9 (;@16;) + end + local.get 3 + i32.const 65535 + i32.eq local.get 2 + i32.const 65535 + i32.and local.get 3 - i32.ne - br_if 3 (;@21;) - br 6 (;@18;) + i32.ge_u + i32.or + br_if 8 (;@16;) + i32.const 4224 + i32.load + local.tee 1 + br_if 13 (;@11;) + i32.const 3 + br 12 (;@12;) end - local.get 1 - i32.const 10 - i32.sub - local.tee 2 - i32.const 4188 - i32.load - local.tee 3 - i32.lt_u - br_if 4 (;@19;) - local.get 2 - i32.load16_u - i32.const 116 - i32.ne - br_if 4 (;@19;) - local.get 1 - i32.const 8 - i32.sub - i32.load16_u - i32.const 121 - i32.ne - br_if 4 (;@19;) - i32.const -6 - local.set 4 - local.get 2 - local.get 3 - i32.ne - br_if 2 (;@21;) - br 5 (;@18;) - end - block ;; label = @23 block ;; label = @24 - local.get 1 - i32.const 2 - i32.sub - i32.load16_u - i32.const 115 - i32.sub - br_table 0 (;@24;) 1 (;@23;) 5 (;@19;) - end - local.get 1 - i32.const 4 - i32.sub - i32.load16_u - local.tee 2 - i32.const 97 - i32.ne - if ;; label = @24 - local.get 2 - i32.const 108 - i32.ne - br_if 5 (;@19;) - i32.const 4188 + loop ;; label = @25 + block ;; label = @26 + local.get 0 + local.tee 3 + i32.const 2 + i32.add + local.set 0 + local.get 3 + local.get 10 + i32.ge_u + br_if 0 (;@26;) + local.get 0 + i32.load16_u + local.tee 1 + local.get 4 + i32.eq + br_if 2 (;@24;) + local.get 1 + i32.const 92 + i32.ne + if ;; label = @27 + local.get 1 + i32.const 10 + i32.sub + br_table 1 (;@26;) 2 (;@25;) 2 (;@25;) 1 (;@26;) 2 (;@25;) + end + local.get 3 + i32.const 4 + i32.add + local.set 0 + local.get 3 + i32.load16_u offset=4 + i32.const 13 + i32.ne + br_if 1 (;@25;) + local.get 3 + i32.const 6 + i32.add + local.get 0 + local.get 3 + i32.load16_u offset=6 + i32.const 10 + i32.eq + select + local.set 0 + br 1 (;@25;) + end + end + i32.const 4224 i32.load - local.tee 3 - local.get 1 - i32.const 6 - i32.sub - local.tee 2 - i32.gt_u - br_if 5 (;@19;) - local.get 2 - i32.load16_u - i32.const 101 - i32.ne - br_if 5 (;@19;) - i32.const -4 - local.set 4 - local.get 2 - local.get 3 - i32.ne - br_if 3 (;@21;) - br 6 (;@18;) + i32.eqz + if ;; label = @25 + i32.const 4224 + i32.const 9 + i32.store + i32.const 4228 + local.get 0 + i32.const 4188 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store + end + local.get 10 + i32.const 2 + i32.add + local.set 0 end - i32.const 4188 - i32.load - local.tee 3 - local.get 1 - i32.const 6 - i32.sub - local.tee 2 - i32.gt_u - br_if 4 (;@19;) - local.get 2 - i32.load16_u - i32.const 99 - i32.ne - br_if 4 (;@19;) - i32.const -4 - local.set 4 - local.get 2 - local.get 3 - i32.ne - br_if 2 (;@21;) - br 5 (;@18;) - end - local.get 1 - i32.const 10 - i32.sub - local.tee 2 - i32.const 4188 - i32.load - local.tee 3 - i32.lt_u - br_if 3 (;@19;) - local.get 2 - i32.load16_u - i32.const 100 - i32.ne - br_if 3 (;@19;) - local.get 1 - i32.const 8 - i32.sub - i32.load16_u - i32.const 101 - i32.ne - br_if 3 (;@19;) - local.get 1 - i32.const 6 - i32.sub - i32.load16_u - i32.const 108 - i32.ne - br_if 3 (;@19;) - local.get 1 - i32.const 4 - i32.sub - i32.load16_u - i32.const 101 - i32.ne - br_if 3 (;@19;) - i32.const -6 - local.set 4 - local.get 2 - local.get 3 - i32.ne - br_if 1 (;@21;) - br 4 (;@18;) - end - block ;; label = @22 - block ;; label = @23 - local.get 1 - i32.const 2 - i32.sub - i32.load16_u - i32.const 105 - i32.sub - br_table 0 (;@23;) 4 (;@19;) 4 (;@19;) 1 (;@22;) 4 (;@19;) + i32.const 4196 + local.get 0 + i32.store + br 20 (;@3;) end - local.get 1 - i32.const 6 - i32.sub - local.tee 2 - i32.const 4188 - i32.load - local.tee 3 - i32.lt_u - br_if 3 (;@19;) local.get 2 - i32.load16_u - i32.const 118 - i32.ne - br_if 3 (;@19;) - local.get 1 i32.const 4 - i32.sub - i32.load16_u - i32.const 111 - i32.ne - br_if 3 (;@19;) - i32.const -4 - local.set 4 - local.get 2 - local.get 3 - i32.ne - br_if 1 (;@21;) - br 4 (;@18;) - end - local.get 1 - i32.const 8 - i32.sub - local.tee 2 - i32.const 4188 - i32.load - local.tee 3 - i32.lt_u - br_if 2 (;@19;) - local.get 2 - i32.load16_u - i32.const 121 - i32.ne - br_if 2 (;@19;) - local.get 1 - i32.const 6 - i32.sub - i32.load16_u - i32.const 105 - i32.ne - br_if 2 (;@19;) - local.get 1 - i32.const 4 - i32.sub - i32.load16_u - i32.const 101 - i32.ne - br_if 2 (;@19;) - i32.const -5 - local.set 4 - local.get 2 - local.get 3 - i32.eq - br_if 3 (;@18;) - end - local.get 1 - local.get 4 - i32.const 1 - i32.shl - i32.add - i32.load16_u - call 5 - local.set 4 - br 1 (;@19;) - end - i32.const 4218 - i32.load8_u - br_if 1 (;@18;) - end - local.get 4 - br_if 0 (;@18;) - local.get 8 - br_if 1 (;@17;) - end - local.get 9 - i32.const 2 - i32.add - local.set 1 - i32.const 4224 - i32.load - local.set 4 - i32.const 4188 - i32.load - local.set 3 - block ;; label = @18 - loop ;; label = @19 - local.get 0 - i32.const 2 - i32.add - local.set 2 - block ;; label = @20 - block ;; label = @21 - local.get 0 - local.get 9 - i32.ge_u - br_if 0 (;@21;) - block ;; label = @22 + i32.add + local.set 3 block ;; label = @23 block ;; label = @24 - local.get 2 - i32.load16_u - local.tee 5 - i32.const 91 - i32.sub - br_table 1 (;@23;) 2 (;@22;) 0 (;@24;) + block ;; label = @25 + block ;; label = @26 + block ;; label = @27 + block ;; label = @28 + local.get 2 + i32.load16_u offset=4 + local.tee 2 + i32.const 47 + i32.ne + if ;; label = @29 + local.get 2 + i32.const 42 + i32.eq + br_if 1 (;@28;) + i32.const 4204 + i32.load + local.tee 5 + i32.load16_u + local.tee 6 + i32.const 33 + i32.sub + local.tee 3 + i32.const 5 + i32.le_u + i32.const 0 + i32.const 1 + local.get 3 + i32.shl + i32.const 49 + i32.and + select + br_if 5 (;@24;) + local.get 6 + i32.const 41 + i32.ne + local.get 6 + i32.const 40 + i32.sub + i32.const 65535 + i32.and + i32.const 7 + i32.lt_u + i32.and + br_if 3 (;@26;) + local.get 6 + i32.const 58 + i32.sub + i32.const 6 + i32.lt_u + br_if 5 (;@24;) + local.get 6 + i32.const 91 + i32.sub + br_table 5 (;@24;) 2 (;@27;) 2 (;@27;) 5 (;@24;) 2 (;@27;) + end + loop ;; label = @29 + local.get 3 + local.tee 0 + i32.const 2 + i32.sub + local.get 10 + i32.ge_u + br_if 12 (;@17;) + local.get 0 + i32.const 2 + i32.add + local.set 3 + local.get 0 + i32.load16_u + i32.const 10 + i32.sub + br_table 12 (;@17;) 0 (;@29;) 0 (;@29;) 12 (;@17;) 0 (;@29;) + end + unreachable + end + loop ;; label = @28 + local.get 3 + local.tee 0 + local.get 10 + i32.ge_u + br_if 10 (;@18;) + local.get 0 + i32.const 2 + i32.add + local.tee 3 + i32.load16_u + i32.const 42 + i32.ne + br_if 0 (;@28;) + local.get 0 + i32.const 4 + i32.add + local.tee 0 + i32.load16_u + i32.const 47 + i32.ne + br_if 0 (;@28;) + end + br 10 (;@17;) + end + local.get 6 + i32.const 125 + i32.eq + local.get 6 + i32.const 123 + i32.sub + i32.const 65535 + i32.and + i32.const 3 + i32.gt_u + i32.or + br_if 1 (;@25;) + end + block ;; label = @26 + block ;; label = @27 + block ;; label = @28 + local.get 6 + i32.const 43 + i32.sub + br_table 1 (;@27;) 4 (;@24;) 2 (;@26;) 0 (;@28;) 4 (;@24;) + end + local.get 5 + i32.const 2 + i32.sub + i32.load16_u + i32.const 48 + i32.sub + i32.const 65535 + i32.and + i32.const 10 + i32.lt_u + br_if 2 (;@25;) + br 3 (;@24;) + end + local.get 5 + i32.const 2 + i32.sub + i32.load16_u + i32.const 43 + i32.eq + br_if 1 (;@25;) + br 2 (;@24;) + end + local.get 5 + i32.const 2 + i32.sub + i32.load16_u + i32.const 45 + i32.ne + br_if 1 (;@24;) + end + block ;; label = @25 + block ;; label = @26 + block ;; label = @27 + block ;; label = @28 + block ;; label = @29 + block ;; label = @30 + block ;; label = @31 + block ;; label = @32 + block ;; label = @33 + block ;; label = @34 + block ;; label = @35 + block ;; label = @36 + local.get 5 + local.get 12 + i32.ne + br_if 0 (;@36;) + i32.const 0 + local.set 3 + block ;; label = @37 + local.get 6 + i32.const 100 + i32.sub + br_table 3 (;@34;) 4 (;@33;) 5 (;@32;) 12 (;@25;) 12 (;@25;) 12 (;@25;) 12 (;@25;) 12 (;@25;) 12 (;@25;) 12 (;@25;) 6 (;@31;) 7 (;@30;) 12 (;@25;) 12 (;@25;) 8 (;@29;) 12 (;@25;) 9 (;@28;) 12 (;@25;) 12 (;@25;) 10 (;@27;) 0 (;@37;) + end + local.get 6 + i32.const 125 + i32.ne + if ;; label = @37 + local.get 6 + i32.const 47 + i32.eq + br_if 2 (;@35;) + local.get 6 + i32.const 41 + i32.ne + br_if 12 (;@25;) + block ;; label = @38 + local.get 8 + i32.const 8 + i32.sub + local.tee 2 + i32.const 4188 + i32.load + local.tee 1 + i32.lt_u + br_if 0 (;@38;) + local.get 2 + i32.load16_u + i32.const 119 + i32.ne + br_if 0 (;@38;) + local.get 8 + i32.const 6 + i32.sub + i32.load16_u + i32.const 104 + i32.ne + br_if 0 (;@38;) + local.get 8 + i32.const 4 + i32.sub + i32.load16_u + i32.const 105 + i32.ne + br_if 0 (;@38;) + local.get 8 + i32.const 2 + i32.sub + i32.load16_u + i32.const 108 + i32.ne + br_if 0 (;@38;) + local.get 8 + i32.load16_u + i32.const 101 + i32.ne + br_if 0 (;@38;) + local.get 1 + local.get 2 + i32.eq + br_if 14 (;@24;) + local.get 8 + i32.const 10 + i32.sub + i32.load16_u + call 3 + br_if 14 (;@24;) + end + block ;; label = @38 + local.get 8 + i32.const 4 + i32.sub + local.tee 2 + local.get 1 + i32.lt_u + br_if 0 (;@38;) + local.get 2 + i32.load16_u + i32.const 102 + i32.ne + br_if 0 (;@38;) + local.get 8 + i32.const 2 + i32.sub + i32.load16_u + i32.const 111 + i32.ne + br_if 0 (;@38;) + local.get 8 + i32.load16_u + i32.const 114 + i32.ne + br_if 0 (;@38;) + local.get 1 + local.get 2 + i32.eq + br_if 14 (;@24;) + local.get 8 + i32.const 6 + i32.sub + i32.load16_u + call 3 + br_if 14 (;@24;) + end + local.get 8 + i32.const 2 + i32.sub + local.tee 4 + local.get 1 + i32.lt_u + br_if 12 (;@25;) + local.get 4 + i32.load16_u + i32.const 105 + i32.ne + br_if 12 (;@25;) + local.get 8 + i32.load16_u + i32.const 102 + i32.ne + br_if 12 (;@25;) + local.get 1 + local.get 4 + i32.eq + br_if 13 (;@24;) + local.get 2 + i32.load16_u + call 3 + i32.eqz + br_if 12 (;@25;) + br 13 (;@24;) + end + local.get 8 + call 13 + local.get 14 + i32.const 1 + i32.and + i32.or + br_if 12 (;@24;) + i32.const 4221 + i32.load8_u + i32.eqz + br_if 11 (;@25;) + i32.const 4188 + i32.load + local.tee 9 + i32.const 6 + i32.add + local.set 13 + local.get 9 + i32.const 2 + i32.sub + local.set 7 + local.get 8 + local.set 3 + loop ;; label = @37 + local.get 3 + local.get 9 + i32.lt_u + br_if 13 (;@24;) + local.get 1 + i32.const 65535 + i32.and + i32.eqz + local.get 3 + i32.load16_u + local.tee 2 + i32.const 123 + i32.ne + i32.or + i32.eqz + if ;; label = @38 + local.get 1 + i32.const 1 + i32.sub + local.tee 1 + i32.const 65535 + i32.and + i32.const 2 + i32.shl + i32.const 8328 + i32.add + i32.load + local.set 3 + br 1 (;@37;) + end + local.get 2 + i32.const 58 + i32.ne + if ;; label = @38 + local.get 2 + i32.const 125 + i32.eq + br_if 14 (;@24;) + local.get 3 + call 13 + i32.eqz + br_if 2 (;@36;) + br 14 (;@24;) + end + local.get 3 + local.get 9 + i32.eq + br_if 1 (;@36;) + local.get 3 + i32.const 2 + i32.sub + call 14 + local.tee 4 + local.get 9 + i32.lt_u + br_if 1 (;@36;) + block ;; label = @38 + local.get 4 + i32.load16_u + local.tee 11 + i32.const 34 + i32.eq + local.get 11 + i32.const 39 + i32.eq + i32.or + i32.eqz + if ;; label = @39 + i32.const 0 + local.set 11 + loop ;; label = @40 + local.get 4 + local.get 9 + i32.lt_u + br_if 2 (;@38;) + local.get 4 + i32.load16_u + local.tee 3 + i32.const 64512 + i32.and + i32.const 56320 + i32.ne + local.tee 2 + if (result i32) ;; label = @41 + local.get 3 + else + local.get 3 + i32.const 1023 + i32.and + local.get 4 + i32.const 2 + i32.sub + i32.load16_u + i32.const 1023 + i32.and + i32.const 10 + i32.shl + i32.or + i32.const 65536 + i32.add + end + call 15 + i32.eqz + br_if 2 (;@38;) + local.get 2 + i32.eqz + if ;; label = @41 + local.get 3 + i32.const 1023 + i32.and + local.get 4 + i32.const 2 + i32.sub + i32.load16_u + i32.const 1023 + i32.and + i32.const 10 + i32.shl + i32.or + i32.const 65536 + i32.add + local.set 3 + end + local.get 4 + local.get 9 + i32.sub + local.get 4 + i32.const -2 + i32.const -4 + local.get 3 + i32.const 65536 + i32.lt_u + local.tee 15 + select + i32.add + local.set 4 + local.get 3 + call 16 + local.set 11 + i32.const 1 + i32.shr_s + i32.const 1 + i32.const 2 + local.get 15 + select + i32.ge_u + br_if 0 (;@40;) + end + local.get 11 + i32.eqz + br_if 3 (;@36;) + br 15 (;@24;) + end + loop ;; label = @39 + local.get 4 + local.get 9 + i32.gt_u + if ;; label = @40 + local.get 4 + i32.const 2 + i32.sub + local.tee 4 + i32.load16_u + local.get 11 + i32.ne + br_if 1 (;@39;) + local.get 4 + local.set 3 + loop ;; label = @41 + local.get 9 + local.get 3 + local.tee 2 + i32.lt_u + if ;; label = @42 + local.get 2 + i32.const 2 + i32.sub + local.tee 3 + i32.load16_u + i32.const 92 + i32.eq + br_if 1 (;@41;) + end + end + local.get 4 + local.get 2 + i32.sub + i32.const 2 + i32.and + br_if 1 (;@39;) + end + end + local.get 4 + local.get 9 + i32.eq + br_if 2 (;@36;) + local.get 4 + i32.const 2 + i32.sub + local.set 4 + i32.const 0 + local.set 11 + end + block ;; label = @38 + block ;; label = @39 + local.get 4 + call 14 + local.tee 2 + local.get 9 + i32.lt_u + br_if 0 (;@39;) + block ;; label = @40 + local.get 2 + i32.load16_u + i32.const 43 + i32.sub + br_table 0 (;@40;) 1 (;@39;) 0 (;@40;) 1 (;@39;) + end + local.get 7 + local.set 3 + local.get 2 + local.get 9 + i32.eq + br_if 1 (;@38;) + local.get 2 + i32.const 2 + i32.sub + call 14 + local.set 2 + end + block ;; label = @39 + local.get 2 + local.get 9 + i32.lt_u + local.get 2 + local.get 13 + i32.lt_u + i32.or + br_if 0 (;@39;) + local.get 2 + i32.const 6 + i32.sub + i32.load16_u + i32.const 99 + i32.ne + br_if 0 (;@39;) + local.get 2 + i32.const 4 + i32.sub + i32.load16_u + i32.const 97 + i32.ne + br_if 0 (;@39;) + local.get 2 + i32.const 2 + i32.sub + i32.load16_u + i32.const 115 + i32.ne + br_if 0 (;@39;) + local.get 2 + i32.load16_u + i32.const 101 + i32.ne + br_if 0 (;@39;) + local.get 2 + local.get 13 + i32.eq + br_if 15 (;@24;) + local.get 2 + i32.const 8 + i32.sub + i32.load16_u + local.tee 3 + i32.const 64512 + i32.and + i32.const 56320 + i32.eq + if (result i32) ;; label = @40 + local.get 3 + i32.const 1023 + i32.and + local.get 2 + i32.const 10 + i32.sub + i32.load16_u + i32.const 1023 + i32.and + i32.const 10 + i32.shl + i32.or + i32.const 65536 + i32.add + else + local.get 3 + end + call 15 + local.get 3 + i32.const 46 + i32.eq + br_if 0 (;@39;) + local.get 2 + local.set 3 + i32.eqz + br_if 15 (;@24;) + br 1 (;@38;) + end + local.get 2 + local.set 3 + end + local.get 11 + i32.const 1 + i32.and + br_if 0 (;@37;) + end + end + i32.const 0 + local.set 3 + block ;; label = @36 + local.get 6 + i32.const 100 + i32.sub + br_table 2 (;@34;) 3 (;@33;) 4 (;@32;) 11 (;@25;) 11 (;@25;) 11 (;@25;) 11 (;@25;) 11 (;@25;) 11 (;@25;) 11 (;@25;) 5 (;@31;) 6 (;@30;) 11 (;@25;) 11 (;@25;) 7 (;@29;) 11 (;@25;) 8 (;@28;) 11 (;@25;) 11 (;@25;) 9 (;@27;) 0 (;@36;) + end + local.get 6 + i32.const 47 + i32.ne + br_if 10 (;@25;) + end + i32.const 4218 + i32.load8_u + i32.eqz + br_if 9 (;@25;) + br 10 (;@24;) + end + block ;; label = @34 + block ;; label = @35 + local.get 5 + i32.const 2 + i32.sub + i32.load16_u + i32.const 105 + i32.sub + br_table 0 (;@35;) 10 (;@25;) 10 (;@25;) 1 (;@34;) 10 (;@25;) + end + local.get 5 + i32.const 6 + i32.sub + local.tee 1 + i32.const 4188 + i32.load + local.tee 2 + i32.lt_u + br_if 9 (;@25;) + local.get 1 + i32.load16_u + i32.const 118 + i32.ne + br_if 9 (;@25;) + local.get 5 + i32.const 4 + i32.sub + i32.load16_u + i32.const 111 + i32.ne + br_if 9 (;@25;) + i32.const -4 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 8 (;@26;) + br 10 (;@24;) + end + local.get 5 + i32.const 8 + i32.sub + local.tee 1 + i32.const 4188 + i32.load + local.tee 2 + i32.lt_u + br_if 8 (;@25;) + local.get 1 + i32.load16_u + i32.const 121 + i32.ne + br_if 8 (;@25;) + local.get 5 + i32.const 6 + i32.sub + i32.load16_u + i32.const 105 + i32.ne + br_if 8 (;@25;) + local.get 5 + i32.const 4 + i32.sub + i32.load16_u + i32.const 101 + i32.ne + br_if 8 (;@25;) + i32.const -5 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 7 (;@26;) + br 9 (;@24;) + end + block ;; label = @33 + block ;; label = @34 + local.get 5 + i32.const 2 + i32.sub + i32.load16_u + i32.const 115 + i32.sub + br_table 0 (;@34;) 1 (;@33;) 9 (;@25;) + end + local.get 5 + i32.const 4 + i32.sub + i32.load16_u + local.tee 1 + i32.const 97 + i32.ne + if ;; label = @34 + local.get 1 + i32.const 108 + i32.ne + br_if 9 (;@25;) + i32.const 4188 + i32.load + local.tee 2 + local.get 5 + i32.const 6 + i32.sub + local.tee 1 + i32.gt_u + br_if 9 (;@25;) + local.get 1 + i32.load16_u + i32.const 101 + i32.ne + br_if 9 (;@25;) + i32.const -4 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 8 (;@26;) + br 10 (;@24;) + end + i32.const 4188 + i32.load + local.tee 2 + local.get 5 + i32.const 6 + i32.sub + local.tee 1 + i32.gt_u + br_if 8 (;@25;) + local.get 1 + i32.load16_u + i32.const 99 + i32.ne + br_if 8 (;@25;) + i32.const -4 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 7 (;@26;) + br 9 (;@24;) + end + local.get 5 + i32.const 10 + i32.sub + local.tee 1 + i32.const 4188 + i32.load + local.tee 2 + i32.lt_u + br_if 7 (;@25;) + local.get 1 + i32.load16_u + i32.const 100 + i32.ne + br_if 7 (;@25;) + local.get 5 + i32.const 8 + i32.sub + i32.load16_u + i32.const 101 + i32.ne + br_if 7 (;@25;) + local.get 5 + i32.const 6 + i32.sub + i32.load16_u + i32.const 108 + i32.ne + br_if 7 (;@25;) + local.get 5 + i32.const 4 + i32.sub + i32.load16_u + i32.const 101 + i32.ne + br_if 7 (;@25;) + i32.const -6 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 6 (;@26;) + br 8 (;@24;) + end + local.get 5 + i32.const 2 + i32.sub + i32.load16_u + i32.const 111 + i32.ne + br_if 6 (;@25;) + local.get 5 + i32.const 4 + i32.sub + i32.load16_u + i32.const 101 + i32.ne + br_if 6 (;@25;) + local.get 5 + i32.const 6 + i32.sub + i32.load16_u + local.tee 1 + i32.const 112 + i32.ne + if ;; label = @32 + local.get 1 + i32.const 99 + i32.ne + br_if 7 (;@25;) + local.get 5 + i32.const 18 + i32.sub + local.tee 1 + i32.const 4188 + i32.load + local.tee 2 + i32.lt_u + br_if 7 (;@25;) + local.get 1 + i32.load16_u + i32.const 105 + i32.ne + br_if 7 (;@25;) + local.get 5 + i32.const 16 + i32.sub + i32.load16_u + i32.const 110 + i32.ne + br_if 7 (;@25;) + local.get 5 + i32.const 14 + i32.sub + i32.load16_u + i32.const 115 + i32.ne + br_if 7 (;@25;) + local.get 5 + i32.const 12 + i32.sub + i32.load16_u + i32.const 116 + i32.ne + br_if 7 (;@25;) + local.get 5 + i32.const 10 + i32.sub + i32.load16_u + i32.const 97 + i32.ne + br_if 7 (;@25;) + local.get 5 + i32.const 8 + i32.sub + i32.load16_u + i32.const 110 + i32.ne + br_if 7 (;@25;) + i32.const -10 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 6 (;@26;) + br 8 (;@24;) + end + local.get 5 + i32.const 10 + i32.sub + local.tee 1 + i32.const 4188 + i32.load + local.tee 2 + i32.lt_u + br_if 6 (;@25;) + local.get 1 + i32.load16_u + i32.const 116 + i32.ne + br_if 6 (;@25;) + local.get 5 + i32.const 8 + i32.sub + i32.load16_u + i32.const 121 + i32.ne + br_if 6 (;@25;) + i32.const -6 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 5 (;@26;) + br 7 (;@24;) + end + block ;; label = @31 + i32.const 4188 + i32.load + local.tee 1 + local.get 5 + i32.const 2 + i32.sub + local.tee 2 + i32.gt_u + br_if 0 (;@31;) + local.get 2 + i32.load16_u + i32.const 105 + i32.ne + br_if 0 (;@31;) + local.get 1 + local.get 2 + i32.eq + br_if 7 (;@24;) + local.get 5 + i32.const 4 + i32.sub + i32.load16_u + call 3 + br_if 7 (;@24;) + end + local.get 5 + i32.const 10 + i32.sub + local.tee 4 + local.get 1 + i32.lt_u + br_if 5 (;@25;) + local.get 4 + i32.load16_u + i32.const 114 + i32.ne + br_if 5 (;@25;) + local.get 5 + i32.const 8 + i32.sub + i32.load16_u + i32.const 101 + i32.ne + br_if 5 (;@25;) + local.get 5 + i32.const 6 + i32.sub + i32.load16_u + i32.const 116 + i32.ne + br_if 5 (;@25;) + local.get 5 + i32.const 4 + i32.sub + i32.load16_u + i32.const 117 + i32.ne + br_if 5 (;@25;) + local.get 2 + i32.load16_u + i32.const 114 + i32.ne + br_if 5 (;@25;) + i32.const -6 + local.set 3 + local.get 1 + local.get 4 + i32.ne + br_if 4 (;@26;) + br 6 (;@24;) + end + i32.const 4188 + i32.load + local.tee 2 + local.get 5 + i32.const 2 + i32.sub + local.tee 1 + i32.gt_u + br_if 4 (;@25;) + local.get 1 + i32.load16_u + i32.const 100 + i32.ne + br_if 4 (;@25;) + i32.const -2 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 3 (;@26;) + br 5 (;@24;) + end + local.get 5 + i32.const 14 + i32.sub + local.tee 1 + i32.const 4188 + i32.load + local.tee 2 + i32.lt_u + br_if 3 (;@25;) + local.get 1 + i32.load16_u + i32.const 100 + i32.ne + br_if 3 (;@25;) + local.get 5 + i32.const 12 + i32.sub + i32.load16_u + i32.const 101 + i32.ne + br_if 3 (;@25;) + local.get 5 + i32.const 10 + i32.sub + i32.load16_u + i32.const 98 + i32.ne + br_if 3 (;@25;) + local.get 5 + i32.const 8 + i32.sub + i32.load16_u + i32.const 117 + i32.ne + br_if 3 (;@25;) + local.get 5 + i32.const 6 + i32.sub + i32.load16_u + i32.const 103 + i32.ne + br_if 3 (;@25;) + local.get 5 + i32.const 4 + i32.sub + i32.load16_u + i32.const 103 + i32.ne + br_if 3 (;@25;) + local.get 5 + i32.const 2 + i32.sub + i32.load16_u + i32.const 101 + i32.ne + br_if 3 (;@25;) + i32.const -8 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 2 (;@26;) + br 4 (;@24;) + end + local.get 5 + i32.const 8 + i32.sub + local.tee 1 + i32.const 4188 + i32.load + local.tee 2 + i32.lt_u + br_if 2 (;@25;) + local.get 1 + i32.load16_u + i32.const 97 + i32.ne + br_if 2 (;@25;) + local.get 5 + i32.const 6 + i32.sub + i32.load16_u + i32.const 119 + i32.ne + br_if 2 (;@25;) + local.get 5 + i32.const 4 + i32.sub + i32.load16_u + i32.const 97 + i32.ne + br_if 2 (;@25;) + local.get 5 + i32.const 2 + i32.sub + i32.load16_u + i32.const 105 + i32.ne + br_if 2 (;@25;) + i32.const -5 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 1 (;@26;) + br 3 (;@24;) + end + local.get 5 + i32.const 2 + i32.sub + i32.load16_u + local.tee 1 + i32.const 111 + i32.ne + if ;; label = @27 + local.get 1 + i32.const 101 + i32.ne + br_if 2 (;@25;) + i32.const 4188 + i32.load + local.tee 2 + local.get 5 + i32.const 4 + i32.sub + local.tee 1 + i32.gt_u + br_if 2 (;@25;) + local.get 1 + i32.load16_u + i32.const 110 + i32.ne + br_if 2 (;@25;) + i32.const -3 + local.set 3 + local.get 1 + local.get 2 + i32.ne + br_if 1 (;@26;) + br 3 (;@24;) + end + local.get 5 + i32.const 8 + i32.sub + local.tee 1 + i32.const 4188 + i32.load + local.tee 2 + i32.lt_u + br_if 1 (;@25;) + local.get 1 + i32.load16_u + i32.const 116 + i32.ne + br_if 1 (;@25;) + local.get 5 + i32.const 6 + i32.sub + i32.load16_u + i32.const 104 + i32.ne + br_if 1 (;@25;) + local.get 5 + i32.const 4 + i32.sub + i32.load16_u + i32.const 114 + i32.ne + br_if 1 (;@25;) + i32.const -5 + local.set 3 + local.get 1 + local.get 2 + i32.eq + br_if 2 (;@24;) + end + local.get 5 + local.get 3 + i32.const 1 + i32.shl + i32.add + i32.load16_u + call 3 + local.set 3 + end + local.get 6 + i32.eqz + br_if 0 (;@24;) + local.get 3 + i32.eqz + br_if 1 (;@23;) end - local.get 2 - local.set 0 - local.get 5 - i32.const 10 - i32.sub - br_table 2 (;@21;) 4 (;@19;) 4 (;@19;) 2 (;@21;) 3 (;@20;) - end - loop ;; label = @23 + local.get 10 + i32.const 2 + i32.add + local.set 2 + i32.const 4224 + i32.load + local.set 4 + i32.const 4188 + i32.load + local.set 7 block ;; label = @24 - local.get 2 - i32.const 2 - i32.add - local.set 0 - local.get 2 - local.get 9 - i32.ge_u - br_if 0 (;@24;) - block ;; label = @25 + loop ;; label = @25 + local.get 0 + i32.const 2 + i32.add + local.set 1 block ;; label = @26 - local.get 0 - i32.load16_u - local.tee 5 - i32.const 92 + block ;; label = @27 + local.get 0 + local.get 10 + i32.ge_u + br_if 0 (;@27;) + block ;; label = @28 + block ;; label = @29 + block ;; label = @30 + block ;; label = @31 + local.get 1 + i32.load16_u + local.tee 3 + i32.const 91 + i32.sub + br_table 1 (;@30;) 2 (;@29;) 0 (;@31;) + end + local.get 1 + local.set 0 + local.get 3 + i32.const 10 + i32.sub + br_table 3 (;@27;) 5 (;@25;) 5 (;@25;) 3 (;@27;) 4 (;@26;) + end + loop ;; label = @30 + block ;; label = @31 + local.get 1 + i32.const 2 + i32.add + local.set 3 + local.get 1 + local.get 10 + i32.ge_u + br_if 0 (;@31;) + block ;; label = @32 + block ;; label = @33 + local.get 3 + i32.load16_u + local.tee 0 + i32.const 92 + i32.sub + br_table 0 (;@33;) 5 (;@28;) 1 (;@32;) + end + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 2 (;@30;) + end + local.get 3 + local.set 1 + local.get 0 + i32.const 10 + i32.sub + br_table 0 (;@31;) 1 (;@30;) 1 (;@30;) 0 (;@31;) 1 (;@30;) + end + end + local.get 2 + local.set 0 + local.get 4 + br_if 4 (;@25;) + i32.const 10 + local.set 4 + i32.const 4224 + i32.const 10 + i32.store + i32.const 4228 + local.get 3 + local.get 7 + i32.sub + i32.const 1 + i32.shr_s + i32.store + br 4 (;@25;) + end + local.get 0 + i32.const 4 + i32.add + local.set 0 + br 3 (;@25;) + end + local.get 3 + local.set 0 + br 2 (;@25;) + end + local.get 4 + br_if 2 (;@24;) + i32.const 4224 + i32.const 11 + i32.store + i32.const 4228 + local.get 1 + local.get 7 i32.sub - br_table 0 (;@26;) 7 (;@19;) 1 (;@25;) + i32.const 1 + i32.shr_s + i32.store + br 2 (;@24;) end - local.get 2 - i32.const 4 - i32.add - local.set 2 - br 2 (;@23;) + local.get 3 + i32.const 47 + i32.ne + br_if 0 (;@25;) end local.get 0 local.set 2 - local.get 5 - i32.const 10 - i32.sub - br_table 0 (;@24;) 1 (;@23;) 1 (;@23;) 0 (;@24;) 1 (;@23;) end + i32.const 4196 + local.get 2 + i32.store + i32.const 4218 + i32.const 0 + i32.store8 + br 20 (;@3;) end - local.get 4 - i32.eqz + i32.const 4218 + i32.const 1 + i32.store8 + br 19 (;@3;) + end + block ;; label = @22 + i32.const 4216 + i32.load16_u + i32.const 65535 + i32.ne if ;; label = @23 i32.const 4224 - i32.const 10 - i32.store - i32.const 10 - local.set 4 + i32.load + local.set 1 + br 1 (;@22;) end - i32.const 4228 - local.get 0 - local.get 3 - i32.sub - i32.const 1 - i32.shr_s - i32.store - local.get 1 - local.set 0 - br 3 (;@19;) + i32.const 4224 + i32.load + local.set 1 + i32.const 4214 + i32.load16_u + i32.eqz + br_if 21 (;@1;) end - local.get 0 - i32.const 4 - i32.add - local.set 0 - br 2 (;@19;) - end - local.get 4 - i32.eqz - if ;; label = @21 - i32.const 4224 - i32.const 11 - i32.store + local.get 1 + br_if 20 (;@1;) + i32.const 1 + br 9 (;@12;) end - i32.const 4228 - local.get 2 - local.get 3 - i32.sub + local.get 1 + i32.const 16520 + i32.add + i32.const 0 + i32.store8 + i32.const 4214 + local.get 1 i32.const 1 - i32.shr_s + i32.add + i32.store16 + local.get 1 + i32.const 2 + i32.shl + i32.const 8328 + i32.add + i32.const 4204 + i32.load i32.store - br 2 (;@18;) + br 17 (;@3;) end - local.get 5 - i32.const 47 - i32.ne - br_if 0 (;@19;) + local.get 3 + i32.const 16520 + i32.add + i32.const 0 + i32.store8 + i32.const 4214 + local.get 3 + i32.const 1 + i32.add + i32.store16 + local.get 3 + i32.const 2 + i32.shl + i32.const 8328 + i32.add + local.get 0 + i32.store + br 15 (;@4;) end - local.get 0 - local.set 1 + i32.const 4216 + i32.load16_u + i32.const 65534 + i32.eq + if ;; label = @19 + i32.const 4224 + i32.load + local.tee 1 + br_if 8 (;@11;) + i32.const 4 + br 7 (;@12;) + end + call 12 + br 15 (;@3;) end - i32.const 4196 - local.get 1 - i32.store - i32.const 4218 - i32.const 0 - i32.store8 - br 14 (;@3;) + local.get 0 + i32.const 2 + i32.add + local.set 0 end - i32.const 4218 - i32.const 1 - i32.store8 - br 13 (;@3;) + i32.const 4196 + local.get 0 + i32.store + br 14 (;@2;) end local.get 0 - local.set 11 + local.set 12 br 12 (;@3;) end + i32.const 0 + local.set 7 i32.const 4196 i32.const 4196 i32.load - local.tee 8 + local.tee 6 i32.const 2 i32.add i32.store @@ -5896,428 +5812,414 @@ block ;; label = @20 block ;; label = @21 block ;; label = @22 - call 6 - local.tee 0 - i32.const 42 - i32.sub - br_table 1 (;@21;) 2 (;@20;) 2 (;@20;) 2 (;@20;) 0 (;@22;) 2 (;@20;) - end - block ;; label = @22 - i32.const 4200 - i32.load - i32.const 4196 - i32.load - local.tee 1 - i32.sub - i32.const 3 - i32.lt_s - br_if 0 (;@22;) - local.get 1 - i32.load16_u offset=2 - i32.const 46 - i32.ne - br_if 0 (;@22;) - local.get 1 - i32.load16_u offset=4 - i32.const 46 - i32.ne - br_if 0 (;@22;) - i32.const 4196 - local.get 1 - i32.const 6 - i32.add - i32.store - call 6 - i32.const 114 - i32.ne - br_if 7 (;@15;) - i32.const 1 - call 4 - drop - br 7 (;@15;) - end - i32.const 4188 - i32.load - local.set 5 - i32.const 46 - local.set 2 - br 2 (;@19;) - end - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.set 0 - end - local.get 0 - local.set 2 - local.get 0 - i32.const 91 - i32.eq - if ;; label = @20 - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.set 2 - end - i32.const 4188 - i32.load - local.set 5 - i32.const 4196 - i32.load - local.set 1 - local.get 2 - i32.const 39 - i32.ne - local.get 2 - i32.const 34 - i32.ne - i32.and - i32.eqz - if ;; label = @20 - local.get 0 - i32.const 91 - i32.eq - local.set 7 - i32.const 4200 - i32.load - local.set 3 - local.get 1 - local.set 0 - loop ;; label = @21 - block ;; label = @22 - local.get 0 - local.tee 4 - i32.const 2 - i32.add - local.set 0 - local.get 3 - local.get 4 - i32.le_u - br_if 0 (;@22;) - local.get 2 - local.get 0 - i32.load16_u - local.tee 6 - i32.eq - if ;; label = @23 - local.get 4 + block ;; label = @23 + block ;; label = @24 + call 4 + local.tee 0 + i32.const 42 + i32.sub + br_table 1 (;@23;) 2 (;@22;) 2 (;@22;) 2 (;@22;) 0 (;@24;) 2 (;@22;) + end + i32.const 46 local.set 3 - br 6 (;@17;) - end - local.get 6 - i32.const 92 - i32.ne - if ;; label = @23 - local.get 6 - i32.const 10 + i32.const 4200 + i32.load + i32.const 4196 + i32.load + local.tee 1 i32.sub - br_table 1 (;@22;) 2 (;@21;) 2 (;@21;) 1 (;@22;) 2 (;@21;) + i32.const 3 + i32.lt_s + br_if 2 (;@21;) + local.get 1 + i32.load16_u offset=2 + i32.const 46 + i32.ne + br_if 2 (;@21;) + local.get 1 + i32.load16_u offset=4 + i32.const 46 + i32.ne + br_if 2 (;@21;) + i32.const 4196 + local.get 1 + i32.const 6 + i32.add + i32.store + call 4 + i32.const 114 + i32.ne + br_if 8 (;@15;) + i32.const 1 + call 2 + drop + br 8 (;@15;) end - local.get 4 - i32.const 4 + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 i32.add + i32.store + call 4 local.set 0 - local.get 4 - i32.load16_u offset=4 - i32.const 13 - i32.ne - br_if 1 (;@21;) - local.get 4 - i32.const 6 + end + local.get 0 + local.set 3 + local.get 0 + i32.const 91 + i32.eq + if ;; label = @22 + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 i32.add + i32.store + call 4 + local.set 3 + end + i32.const 4196 + i32.load + local.set 1 + local.get 3 + i32.const 39 + i32.ne + local.get 3 + i32.const 34 + i32.ne + i32.and + i32.eqz + if ;; label = @22 local.get 0 - local.get 4 - i32.load16_u offset=6 - i32.const 10 + i32.const 91 i32.eq - select + local.set 7 + i32.const 4200 + i32.load + local.set 2 + local.get 1 local.set 0 - br 1 (;@21;) + loop ;; label = @23 + local.get 0 + local.tee 4 + i32.const 2 + i32.add + local.set 0 + local.get 2 + local.get 4 + i32.le_u + br_if 3 (;@20;) + local.get 3 + local.get 0 + i32.load16_u + local.tee 5 + i32.eq + if ;; label = @24 + local.get 4 + local.set 2 + br 6 (;@18;) + end + local.get 5 + i32.const 92 + i32.ne + if ;; label = @24 + local.get 5 + i32.const 10 + i32.sub + br_table 4 (;@20;) 1 (;@23;) 1 (;@23;) 4 (;@20;) 1 (;@23;) + end + local.get 4 + i32.const 4 + i32.add + local.set 0 + local.get 4 + i32.load16_u offset=4 + i32.const 13 + i32.ne + br_if 0 (;@23;) + local.get 4 + i32.const 6 + i32.add + local.get 0 + local.get 4 + i32.load16_u offset=6 + i32.const 10 + i32.eq + select + local.set 0 + br 0 (;@23;) + end + unreachable end + local.get 0 + i32.const 91 + i32.eq + br_if 4 (;@17;) + end + local.get 3 + call 9 + i32.eqz + if ;; label = @21 + i32.const 0 + local.set 3 + br 5 (;@16;) end - i32.const 4224 + i32.const 4196 i32.load - br_if 2 (;@18;) - i32.const 4224 - i32.const 9 - i32.store - br 2 (;@18;) - end - i32.const 1 - local.set 7 - local.get 0 - i32.const 91 - i32.eq - br_if 3 (;@16;) - end - i32.const 0 - local.set 7 - local.get 2 - call 10 - i32.eqz - br_if 2 (;@16;) - i32.const 4196 - i32.load - local.set 5 - call 6 - local.set 0 - block ;; label = @19 - block ;; label = @20 + local.set 3 + call 4 + local.set 0 block ;; label = @21 block ;; label = @22 block ;; label = @23 block ;; label = @24 - local.get 5 - local.get 1 - i32.sub - i32.const 6 - i32.sub - br_table 0 (;@24;) 8 (;@16;) 8 (;@16;) 8 (;@16;) 1 (;@23;) 8 (;@16;) - end - block ;; label = @24 + block ;; label = @25 + block ;; label = @26 + local.get 3 + local.get 1 + i32.sub + i32.const 6 + i32.sub + br_table 0 (;@26;) 10 (;@16;) 10 (;@16;) 10 (;@16;) 1 (;@25;) 10 (;@16;) + end + block ;; label = @26 + local.get 1 + i32.load16_u + local.tee 2 + i32.const 115 + i32.ne + if ;; label = @27 + local.get 2 + i32.const 103 + i32.ne + br_if 11 (;@16;) + local.get 1 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 11 (;@16;) + local.get 1 + i32.load16_u offset=4 + i32.const 116 + i32.eq + br_if 1 (;@26;) + br 11 (;@16;) + end + local.get 1 + i32.load16_u offset=2 + i32.const 101 + i32.ne + br_if 10 (;@16;) + local.get 1 + i32.load16_u offset=4 + i32.const 116 + i32.ne + br_if 10 (;@16;) + end + local.get 0 + i32.const 40 + i32.sub + br_table 9 (;@16;) 4 (;@21;) 3 (;@22;) 4 (;@21;) 9 (;@16;) 1 (;@24;) + end local.get 1 i32.load16_u - local.tee 2 - i32.const 115 + i32.const 97 i32.ne - if ;; label = @25 - local.get 2 - i32.const 103 - i32.ne - br_if 9 (;@16;) - local.get 1 - i32.load16_u offset=2 - i32.const 101 - i32.ne - br_if 9 (;@16;) - local.get 1 - i32.load16_u offset=4 - i32.const 116 - i32.eq - br_if 1 (;@24;) - br 9 (;@16;) - end + br_if 8 (;@16;) local.get 1 i32.load16_u offset=2 - i32.const 101 + i32.const 115 i32.ne br_if 8 (;@16;) local.get 1 i32.load16_u offset=4 - i32.const 116 + i32.const 121 + i32.ne + br_if 8 (;@16;) + local.get 1 + i32.load16_u offset=6 + i32.const 110 + i32.ne + br_if 8 (;@16;) + local.get 0 + i32.const 58 + i32.eq + local.get 1 + i32.load16_u offset=8 + i32.const 99 i32.ne + i32.or br_if 8 (;@16;) + local.get 0 + i32.const 40 + i32.sub + br_table 8 (;@16;) 3 (;@21;) 2 (;@22;) 3 (;@21;) 8 (;@16;) 1 (;@23;) end local.get 0 - i32.const 40 - i32.sub - br_table 7 (;@16;) 4 (;@19;) 3 (;@20;) 4 (;@19;) 7 (;@16;) 1 (;@22;) + i32.const 58 + i32.eq + br_if 7 (;@16;) + local.get 0 + i32.const 125 + i32.ne + br_if 2 (;@21;) + br 7 (;@16;) end - local.get 1 - i32.load16_u - i32.const 97 - i32.ne - br_if 6 (;@16;) - local.get 1 - i32.load16_u offset=2 - i32.const 115 - i32.ne - br_if 6 (;@16;) - local.get 1 - i32.load16_u offset=4 - i32.const 121 - i32.ne - br_if 6 (;@16;) - local.get 1 - i32.load16_u offset=6 - i32.const 110 - i32.ne - br_if 6 (;@16;) local.get 0 - i32.const 58 - i32.eq - local.get 1 - i32.load16_u offset=8 - i32.const 99 + i32.const 125 i32.ne - i32.or - br_if 6 (;@16;) - local.get 0 - i32.const 40 - i32.sub - br_table 6 (;@16;) 3 (;@19;) 2 (;@20;) 3 (;@19;) 6 (;@16;) 1 (;@21;) + br_if 1 (;@21;) + br 6 (;@16;) end - local.get 0 - i32.const 58 - i32.eq - br_if 5 (;@16;) - local.get 0 - i32.const 125 - i32.ne - br_if 2 (;@19;) - br 5 (;@16;) + i32.const 4196 + i32.const 4196 + i32.load + i32.const 2 + i32.add + i32.store + call 4 + local.set 0 end local.get 0 - i32.const 125 - i32.ne - br_if 1 (;@19;) - br 4 (;@16;) - end - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.set 0 - end - local.get 0 - local.set 2 - local.get 0 - i32.const 91 - i32.eq - if ;; label = @19 - i32.const 4196 - i32.const 4196 - i32.load - i32.const 2 - i32.add - i32.store - call 6 - local.set 2 - end - i32.const 4196 - i32.load - local.set 1 - local.get 2 - i32.const 39 - i32.ne - local.get 2 - i32.const 34 - i32.ne - i32.and - i32.eqz - if ;; label = @19 - local.get 0 - i32.const 91 - i32.eq - local.set 7 - i32.const 4200 - i32.load - local.set 3 - local.get 1 - local.set 0 - loop ;; label = @20 - block ;; label = @21 - local.get 0 - local.tee 4 + local.set 3 + local.get 0 + i32.const 91 + i32.eq + if ;; label = @21 + i32.const 4196 + i32.const 4196 + i32.load i32.const 2 i32.add - local.set 0 - local.get 3 - local.get 4 - i32.le_u - br_if 0 (;@21;) - local.get 2 + i32.store + call 4 + local.set 3 + end + i32.const 4196 + i32.load + local.set 1 + local.get 3 + i32.const 39 + i32.ne + local.get 3 + i32.const 34 + i32.ne + i32.and + i32.eqz + if ;; label = @21 local.get 0 - i32.load16_u - local.tee 5 + i32.const 91 i32.eq - if ;; label = @22 - local.get 4 - local.set 3 - br 5 (;@17;) - end - local.get 5 - i32.const 92 - i32.ne - if ;; label = @22 - local.get 5 - i32.const 10 - i32.sub - br_table 1 (;@21;) 2 (;@20;) 2 (;@20;) 1 (;@21;) 2 (;@20;) + local.set 7 + i32.const 4200 + i32.load + local.set 2 + local.get 1 + local.set 0 + loop ;; label = @22 + block ;; label = @23 + local.get 0 + local.tee 4 + i32.const 2 + i32.add + local.set 0 + local.get 2 + local.get 4 + i32.le_u + br_if 0 (;@23;) + local.get 3 + local.get 0 + i32.load16_u + local.tee 5 + i32.eq + if ;; label = @24 + local.get 4 + local.set 2 + br 6 (;@18;) + end + local.get 5 + i32.const 92 + i32.ne + if ;; label = @24 + local.get 5 + i32.const 10 + i32.sub + br_table 1 (;@23;) 2 (;@22;) 2 (;@22;) 1 (;@23;) 2 (;@22;) + end + local.get 4 + i32.const 4 + i32.add + local.set 0 + local.get 4 + i32.load16_u offset=4 + i32.const 13 + i32.ne + br_if 1 (;@22;) + local.get 4 + i32.const 6 + i32.add + local.get 0 + local.get 4 + i32.load16_u offset=6 + i32.const 10 + i32.eq + select + local.set 0 + br 1 (;@22;) + end end - local.get 4 - i32.const 4 - i32.add - local.set 0 - local.get 4 - i32.load16_u offset=4 - i32.const 13 - i32.ne - br_if 1 (;@20;) - local.get 4 - i32.const 6 - i32.add - local.get 0 - local.get 4 - i32.load16_u offset=6 - i32.const 10 - i32.eq - select - local.set 0 - br 1 (;@20;) + i32.const 4224 + i32.load + i32.eqz + br_if 2 (;@19;) + br 3 (;@18;) end + local.get 0 + i32.const 91 + i32.eq + br_if 3 (;@17;) + local.get 3 + call 9 + local.set 0 + i32.const 4196 + i32.load + i32.const 0 + local.get 0 + select + local.set 3 + br 4 (;@16;) end i32.const 4224 i32.load - i32.eqz - if ;; label = @20 - i32.const 4224 - i32.const 9 - i32.store - end - i32.const 4188 - i32.load - local.set 5 - br 1 (;@18;) + br_if 1 (;@18;) end + i32.const 4224 + i32.const 9 + i32.store + i32.const 4228 local.get 0 - i32.const 91 - i32.eq - if ;; label = @19 - i32.const 0 - local.set 5 - i32.const 1 - local.set 7 - br 3 (;@16;) - end - local.get 2 - call 10 - local.set 0 - i32.const 4196 + i32.const 4188 i32.load - i32.const 0 - local.get 0 - select - local.set 5 - br 2 (;@16;) + i32.sub + i32.const 1 + i32.shr_s + i32.store end - i32.const 4228 - local.get 0 - local.get 5 - i32.sub - i32.const 1 - i32.shr_s + i32.const 4196 + local.get 2 + i32.const 4 + i32.add + local.tee 3 i32.store + br 1 (;@16;) end - i32.const 4196 - local.get 3 - i32.const 4 - i32.add - local.tee 5 - i32.store + i32.const 0 + local.set 3 + i32.const 1 + local.set 7 end - call 6 + call 4 local.set 0 local.get 7 if ;; label = @16 @@ -6331,10 +6233,10 @@ i32.const 2 i32.add i32.store - call 6 + call 4 local.set 0 end - local.get 5 + local.get 3 i32.eqz br_if 0 (;@15;) block ;; label = @16 @@ -6360,11 +6262,11 @@ i32.const 18596 i32.load local.get 1 - local.get 5 - call 0 + local.get 3 + call 8 end i32.const 4196 - local.get 8 + local.get 6 i32.store br 11 (;@3;) end @@ -6373,26 +6275,26 @@ end i32.const 12 end - local.tee 2 + local.tee 1 + i32.store + i32.const 4228 + local.get 0 + i32.const 4188 + i32.load + i32.sub + i32.const 1 + i32.shr_s i32.store end i32.const 4196 - local.get 9 + local.get 10 i32.const 2 i32.add i32.store - i32.const 4228 - local.get 0 - i32.const 4188 - i32.load - i32.sub - i32.const 1 - i32.shr_s - i32.store br 9 (;@1;) end local.get 0 - local.set 4 + local.set 3 end local.get 0 i32.const 4188 @@ -6403,12 +6305,12 @@ i32.load i32.const 24 i32.add - local.get 4 + local.get 3 local.get 0 - call 0 + call 8 end i32.const 4196 - local.get 5 + local.get 7 i32.store br 3 (;@4;) end @@ -6426,12 +6328,12 @@ local.set 4 i32.const 4188 i32.load - local.set 3 + local.set 1 block ;; label = @5 block (result i32) ;; label = @6 loop ;; label = @7 block ;; label = @8 - local.get 1 + local.get 2 i32.load16_u local.tee 0 i32.const 32 @@ -6441,15 +6343,15 @@ i32.const 61 i32.ne br_if 4 (;@5;) - local.get 1 + local.get 2 i32.const 2 i32.sub local.set 0 loop ;; label = @10 local.get 0 - local.tee 1 - i32.load16_u local.tee 2 + i32.load16_u + local.tee 3 i32.const 32 i32.ne br_if 2 (;@8;) @@ -6458,36 +6360,36 @@ i32.sub local.set 0 local.get 1 - local.get 3 - i32.gt_u + local.get 2 + i32.lt_u br_if 0 (;@10;) end i32.const 32 - local.set 2 - local.get 1 + local.set 3 + local.get 2 i32.const 2 i32.add br 3 (;@6;) end local.get 1 - local.get 3 - i32.le_u + local.get 2 + i32.ge_u br_if 3 (;@5;) - local.get 1 + local.get 2 i32.const 2 i32.sub - local.set 1 + local.set 2 br 1 (;@7;) end end - local.get 1 + local.get 2 i32.const 2 i32.add end - local.set 5 + local.set 7 loop ;; label = @6 block ;; label = @7 - local.get 2 + local.get 3 local.tee 0 i32.const 64512 i32.and @@ -6497,7 +6399,7 @@ local.get 0 i32.const 1023 i32.and - local.get 1 + local.get 2 i32.const 2 i32.sub i32.load16_u @@ -6511,27 +6413,27 @@ local.set 0 br 1 (;@7;) end - local.get 2 + local.get 3 i32.eqz br_if 2 (;@5;) end block ;; label = @7 local.get 1 - local.get 3 - i32.le_u + local.get 2 + i32.ge_u br_if 0 (;@7;) local.get 0 i32.const 92 i32.eq br_if 2 (;@5;) local.get 0 - call 16 + call 15 i32.eqz br_if 0 (;@7;) local.get 0 - call 17 + call 16 local.set 4 - local.get 1 + local.get 2 i32.const -2 i32.const -4 local.get 0 @@ -6539,16 +6441,16 @@ i32.lt_u select i32.add - local.tee 1 + local.tee 2 i32.load16_u - local.set 2 + local.set 3 br 1 (;@6;) end end local.get 4 i32.const -1 i32.xor - local.get 2 + local.get 3 i32.const 32 i32.ne i32.or @@ -6556,10 +6458,10 @@ i32.and br_if 0 (;@5;) i32.const 18580 - local.get 5 + local.get 7 i32.store i32.const 18576 - local.get 1 + local.get 2 i32.const 2 i32.add i32.store @@ -6582,23 +6484,23 @@ br_table 1 (;@9;) 5 (;@5;) 3 (;@7;) 5 (;@5;) end local.get 1 - local.get 3 - i32.le_u + local.get 2 + i32.ge_u br_if 4 (;@5;) - local.get 1 + local.get 2 i32.const 2 i32.sub - local.tee 1 + local.tee 2 i32.load16_u local.set 0 br 1 (;@8;) end end - local.get 1 + local.get 2 i32.const 4 i32.sub local.tee 0 - local.get 3 + local.get 1 i32.lt_u br_if 2 (;@5;) local.get 0 @@ -6606,7 +6508,7 @@ i32.const 118 i32.ne br_if 2 (;@5;) - local.get 1 + local.get 2 i32.const 2 i32.sub i32.load16_u @@ -6614,27 +6516,27 @@ i32.ne br_if 2 (;@5;) local.get 0 - local.get 3 + local.get 1 i32.eq br_if 1 (;@6;) - local.get 1 + local.get 2 i32.const 6 i32.sub i32.load16_u - call 5 + call 3 br_if 1 (;@6;) br 2 (;@5;) end - local.get 1 + local.get 2 i32.const 2 i32.sub - local.set 2 + local.set 3 block ;; label = @7 - local.get 1 + local.get 2 i32.const 4 i32.sub local.tee 0 - local.get 3 + local.get 1 i32.lt_u br_if 0 (;@7;) local.get 0 @@ -6642,27 +6544,27 @@ i32.const 108 i32.ne br_if 0 (;@7;) - local.get 2 + local.get 3 i32.load16_u i32.const 101 i32.ne br_if 0 (;@7;) local.get 0 - local.get 3 + local.get 1 i32.eq br_if 1 (;@6;) - local.get 1 + local.get 2 i32.const 6 i32.sub i32.load16_u - call 5 + call 3 br_if 1 (;@6;) end - local.get 1 + local.get 2 i32.const 8 i32.sub local.tee 4 - local.get 3 + local.get 1 i32.lt_u br_if 1 (;@5;) local.get 4 @@ -6670,7 +6572,7 @@ i32.const 99 i32.ne br_if 1 (;@5;) - local.get 1 + local.get 2 i32.const 6 i32.sub i32.load16_u @@ -6682,20 +6584,20 @@ i32.const 110 i32.ne br_if 1 (;@5;) - local.get 2 + local.get 3 i32.load16_u i32.const 115 i32.ne br_if 1 (;@5;) - local.get 3 + local.get 1 local.get 4 i32.eq br_if 0 (;@6;) - local.get 1 + local.get 2 i32.const 10 i32.sub i32.load16_u - call 5 + call 3 i32.eqz br_if 1 (;@5;) end @@ -6710,7 +6612,7 @@ i64.gt_u if ;; label = @6 local.get 17 - call 1 + call 17 i32.const 4136 i64.load local.set 16 @@ -6730,24 +6632,22 @@ i32.const 4224 i32.const 13 i32.store + i32.const 4228 + i32.const 4196 + i32.load + i32.const 4188 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store end i32.const 4196 - i32.load - local.set 0 - i32.const 4196 i32.const 4200 i32.load i32.const 2 i32.add i32.store - i32.const 4228 - local.get 0 - i32.const 4188 - i32.load - i32.sub - i32.const 1 - i32.shr_s - i32.store br 1 (;@5;) end local.get 0 @@ -6765,11 +6665,11 @@ i32.store offset=16 i32.const 18592 i32.load - local.tee 1 + local.tee 3 i32.const 16 i32.add i32.const 18588 - local.get 1 + local.get 3 select local.get 0 i32.store @@ -6781,7 +6681,7 @@ block ;; label = @4 i32.const 4196 i32.load - local.tee 1 + local.tee 3 i32.load16_u local.tee 0 i32.const 127 @@ -6799,35 +6699,35 @@ i32.eq br_if 1 (;@3;) end - local.get 1 + local.get 3 i32.const 2 i32.add local.set 0 i32.const 4200 i32.load - local.set 2 + local.set 1 loop ;; label = @4 local.get 0 i32.const 2 i32.sub - local.get 2 + local.get 1 i32.ge_u br_if 1 (;@3;) block ;; label = @5 local.get 0 i32.load16_u - local.tee 1 + local.tee 3 i32.const 127 i32.le_u if ;; label = @6 - local.get 1 + local.get 3 i32.const 1024 i32.add i32.load8_u br_if 1 (;@5;) br 3 (;@3;) end - local.get 1 + local.get 3 i32.const 160 i32.eq br_if 2 (;@3;) @@ -6852,8 +6752,8 @@ end unreachable end - local.get 2) - (func (;4;) (type 1) (param i32) (result i32) + local.get 1) + (func (;2;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32 i32 i32 i32) block ;; label = @1 block ;; label = @2 @@ -6895,7 +6795,7 @@ i32.add i32.store block ;; label = @3 - call 6 + call 4 i32.const 40 i32.ne br_if 0 (;@3;) @@ -6905,7 +6805,7 @@ i32.const 2 i32.add i32.store - call 6 + call 4 local.set 5 i32.const 4196 i32.load @@ -6978,12 +6878,10 @@ end i32.const 4224 i32.load - i32.eqz - if ;; label = @5 - i32.const 4224 - i32.const 9 - i32.store - end + br_if 0 (;@4;) + i32.const 4224 + i32.const 9 + i32.store i32.const 4228 local.get 1 i32.const 4188 @@ -6999,7 +6897,7 @@ i32.add local.tee 1 i32.store - call 6 + call 4 i32.const 41 i32.ne br_if 0 (;@3;) @@ -7031,9 +6929,9 @@ i32.add local.get 4 local.get 1 - call 0 + call 8 i32.const 1) - (func (;5;) (type 1) (param i32) (result i32) + (func (;3;) (type 1) (param i32) (result i32) (local i32 i32) i32.const 1 local.set 1 @@ -7098,7 +6996,7 @@ local.set 1 end local.get 1) - (func (;6;) (type 0) (result i32) + (func (;4;) (type 0) (result i32) (local i32 i32 i32 i32 i32) i32.const 4200 i32.load @@ -7227,7 +7125,7 @@ end end local.get 4) - (func (;7;) (type 2) (param i32) + (func (;5;) (type 2) (param i32) (local i32 i32 i32 i32 i32 i32) i32.const 4196 i32.const 4196 @@ -7243,7 +7141,7 @@ block ;; label = @1 block ;; label = @2 block ;; label = @3 - call 6 + call 4 local.tee 1 i32.const 91 i32.ne @@ -7262,17 +7160,17 @@ i32.const 2 i32.add i32.store - call 6 + call 4 i32.const 4196 i32.load local.set 1 - call 10 + call 9 i32.eqz br_if 2 (;@2;) i32.const 4196 i32.load local.set 0 - call 6 + call 4 i32.const 61 i32.ne br_if 2 (;@2;) @@ -7280,7 +7178,7 @@ i32.load local.get 1 local.get 0 - call 0 + call 8 return end i32.const 4196 @@ -7289,7 +7187,7 @@ i32.const 2 i32.add i32.store - call 6 + call 4 local.tee 4 i32.const 39 i32.ne @@ -7360,12 +7258,10 @@ end i32.const 4224 i32.load - i32.eqz - if ;; label = @5 - i32.const 4224 - i32.const 9 - i32.store - end + br_if 0 (;@4;) + i32.const 4224 + i32.const 9 + i32.store i32.const 4228 local.get 0 i32.const 4188 @@ -7381,7 +7277,7 @@ i32.add local.tee 0 i32.store - call 6 + call 4 i32.const 93 i32.ne br_if 1 (;@2;) @@ -7391,7 +7287,7 @@ i32.const 2 i32.add i32.store - call 6 + call 4 i32.const 61 i32.ne br_if 1 (;@2;) @@ -7399,7 +7295,7 @@ i32.load local.get 6 local.get 0 - call 0 + call 8 br 1 (;@2;) end local.get 0 @@ -7413,7 +7309,7 @@ i32.load i32.const 12 i32.add - call 2 + call 0 end i32.const 4196 i32.const 4196 @@ -7421,7 +7317,7 @@ i32.const 2 i32.add i32.store - call 6 + call 4 local.set 0 i32.const 4221 i32.load8_u @@ -7430,7 +7326,7 @@ i32.const 40 i32.eq if ;; label = @4 - call 9 + call 7 local.set 0 end block ;; label = @4 @@ -7449,7 +7345,7 @@ br 1 (;@4;) end i32.const 1 - call 4 + call 2 drop end i32.const 4196 @@ -7484,21 +7380,21 @@ i32.load i32.ge_u br_if 4 (;@1;) - call 6 + call 4 local.set 2 i32.const 4196 i32.load local.set 1 block ;; label = @6 local.get 2 - call 10 + call 9 if ;; label = @7 i32.const 4196 i32.load local.set 3 block ;; label = @8 block ;; label = @9 - call 6 + call 4 local.tee 0 i32.const 40 i32.sub @@ -7523,8 +7419,8 @@ i32.const 2 i32.add i32.store - call 6 - call 10 + call 4 + call 9 i32.const 4196 i32.load i32.load16_u @@ -7543,7 +7439,7 @@ i32.load local.get 1 local.get 3 - call 0 + call 8 br 1 (;@6;) end block ;; label = @7 @@ -7622,12 +7518,10 @@ end i32.const 4224 i32.load - i32.eqz - if ;; label = @9 - i32.const 4224 - i32.const 9 - i32.store - end + br_if 0 (;@8;) + i32.const 4224 + i32.const 9 + i32.store i32.const 4228 local.get 0 i32.const 4188 @@ -7643,7 +7537,7 @@ i32.add local.tee 1 i32.store - call 6 + call 4 local.tee 0 i32.const 58 i32.ne @@ -7654,8 +7548,8 @@ i32.const 2 i32.add i32.store - call 6 - call 10 + call 4 + call 9 i32.eqz i32.const 4196 i32.load @@ -7669,7 +7563,7 @@ i32.load local.get 6 local.get 1 - call 0 + call 8 br 1 (;@6;) end i32.const 4196 @@ -7698,7 +7592,7 @@ i32.eq if (result i32) ;; label = @9 i32.const 1 - call 4 + call 2 i32.const 4196 i32.load local.set 0 @@ -7710,7 +7604,7 @@ end i32.const 65535 i32.and - call 10 + call 9 i32.eqz br_if 4 (;@4;) br 1 (;@7;) @@ -7721,7 +7615,7 @@ i32.add i32.store end - call 6 + call 4 local.set 0 end local.get 0 @@ -7743,14 +7637,14 @@ return end i32.const 1 - call 4 + call 2 drop end i32.const 4196 local.get 2 i32.store end) - (func (;8;) (type 1) (param i32) (result i32) + (func (;6;) (type 1) (param i32) (result i32) (local i32 i32) i32.const 4196 i32.load @@ -7790,7 +7684,7 @@ i32.const 12 i32.add i32.store - call 6 + call 4 i32.const 46 i32.ne if ;; label = @3 @@ -7802,7 +7696,7 @@ i32.const 2 i32.add i32.store - call 6 + call 4 else local.get 0 end @@ -7852,7 +7746,7 @@ local.get 1 i32.store local.get 2) - (func (;9;) (type 0) (result i32) + (func (;7;) (type 0) (result i32) (local i32 i32 i32 i32 i32 i32 i32) loop ;; label = @1 i32.const 4196 @@ -7861,7 +7755,7 @@ i32.const 2 i32.add i32.store - call 6 + call 4 local.tee 2 i32.const 40 i32.eq @@ -7923,7 +7817,7 @@ i32.const 65536 i32.add end - call 16 + call 15 i32.eqz br_if 4 (;@3;) i32.const 4196 @@ -8017,12 +7911,10 @@ end i32.const 4224 i32.load - i32.eqz - if ;; label = @7 - i32.const 4224 - i32.const 9 - i32.store - end + br_if 0 (;@6;) + i32.const 4224 + i32.const 9 + i32.store i32.const 4228 local.get 0 i32.const 4188 @@ -8042,7 +7934,7 @@ i32.const 2 i32.add i32.store - call 6 + call 4 i32.const 125 i32.ne if ;; label = @5 @@ -8062,7 +7954,7 @@ local.get 3 i32.eq br_if 0 (;@2;) - call 6 + call 4 i32.const 44 i32.eq br_if 1 (;@1;) @@ -8072,7 +7964,52 @@ local.get 3 i32.store local.get 2) - (func (;10;) (type 1) (param i32) (result i32) + (func (;8;) (type 4) (param i32 i32 i32) + (local i32 i64 i64) + i32.const 4136 + i64.load + local.tee 5 + i64.const 12 + i64.add + local.tee 4 + i32.const 4144 + i64.load + i64.gt_u + if (result i64) ;; label = @1 + local.get 4 + call 17 + i32.const 4136 + i64.load + else + local.get 5 + end + i32.wrap_i64 + local.tee 3 + i32.const 0 + i32.store offset=8 + local.get 3 + local.get 2 + i32.store offset=4 + local.get 3 + local.get 1 + i32.store + local.get 0 + i32.load offset=4 + local.tee 1 + i32.const 8 + i32.add + local.get 0 + local.get 1 + select + local.get 3 + i32.store + i32.const 4136 + local.get 4 + i64.store + local.get 0 + local.get 3 + i32.store offset=4) + (func (;9;) (type 1) (param i32) (result i32) (local i32) block (result i32) ;; label = @1 local.get 0 @@ -8098,7 +8035,7 @@ end i32.const 0 local.get 0 - call 17 + call 16 i32.eqz br_if 0 (;@1;) drop @@ -8146,7 +8083,7 @@ br_if 2 (;@2;) end local.get 0 - call 16 + call 15 if ;; label = @4 local.get 1 i32.const 2 @@ -8169,7 +8106,7 @@ end i32.const 1 end) - (func (;11;) (type 6) (param i32 i32 i32) (result i32) + (func (;10;) (type 5) (param i32 i32 i32) (result i32) (local i32 i32 i32) i32.const 4200 i32.load @@ -8231,10 +8168,10 @@ local.get 3 end i32.eqz) - (func (;12;) (type 3) (param i32 i32) (result i32) + (func (;11;) (type 3) (param i32 i32) (result i32) (local i32 i32) block ;; label = @1 - call 6 + call 4 i32.const 79 i32.ne br_if 0 (;@1;) @@ -8270,7 +8207,7 @@ i32.const 12 i32.add i32.store - call 6 + call 4 i32.const 46 i32.ne br_if 0 (;@1;) @@ -8280,7 +8217,7 @@ i32.const 2 i32.add i32.store - call 6 + call 4 local.tee 2 i32.const 112 i32.eq @@ -8332,7 +8269,7 @@ i32.const 18 i32.add i32.store - call 6 + call 4 i32.const 46 i32.ne br_if 1 (;@1;) @@ -8342,7 +8279,7 @@ i32.const 2 i32.add i32.store - call 6 + call 4 local.set 2 end local.get 2 @@ -8421,7 +8358,7 @@ i32.const 28 i32.add i32.store - call 6 + call 4 i32.const 46 i32.ne br_if 0 (;@1;) @@ -8431,7 +8368,7 @@ i32.const 2 i32.add i32.store - call 6 + call 4 i32.const 99 i32.ne br_if 0 (;@1;) @@ -8457,7 +8394,7 @@ i32.const 8 i32.add i32.store - call 6 + call 4 i32.const 40 i32.ne br_if 0 (;@1;) @@ -8467,11 +8404,11 @@ i32.const 2 i32.add i32.store - call 6 - call 10 + call 4 + call 9 i32.eqz br_if 0 (;@1;) - call 6 + call 4 i32.const 44 i32.ne br_if 0 (;@1;) @@ -8481,14 +8418,14 @@ i32.const 2 i32.add i32.store - call 6 + call 4 drop i32.const 4196 i32.load local.tee 2 local.get 0 local.get 1 - call 11 + call 10 i32.eqz br_if 0 (;@1;) i32.const 4196 @@ -8498,7 +8435,7 @@ i32.shl i32.add i32.store - call 6 + call 4 i32.const 41 i32.ne br_if 0 (;@1;) @@ -8512,7 +8449,7 @@ local.set 3 end local.get 3) - (func (;13;) (type 7) + (func (;12;) (type 6) (local i32 i32 i32 i32) i32.const 4196 i32.load @@ -8521,151 +8458,149 @@ i32.load local.set 3 block ;; label = @1 - loop ;; label = @2 - block ;; label = @3 - local.get 0 - local.tee 1 - i32.const 2 - i32.add - local.set 0 - local.get 1 - local.get 3 - i32.ge_u - br_if 0 (;@3;) + block ;; label = @2 + loop ;; label = @3 block ;; label = @4 - block ;; label = @5 - local.get 0 - i32.load16_u - local.tee 2 - i32.const 92 - i32.sub - br_table 1 (;@4;) 3 (;@2;) 3 (;@2;) 3 (;@2;) 4 (;@1;) 0 (;@5;) - end - local.get 2 - i32.const 36 - i32.ne - br_if 2 (;@2;) - local.get 1 - i32.load16_u offset=4 - i32.const 123 - i32.ne - br_if 2 (;@2;) - i32.const 4196 - local.get 1 - i32.const 4 - i32.add + local.get 0 local.tee 1 - i32.store + i32.const 2 + i32.add + local.set 0 + local.get 1 + local.get 3 + i32.ge_u + br_if 0 (;@4;) block ;; label = @5 - i32.const 4212 - i32.load16_u - local.tee 0 - i32.const 2048 - i32.ne - if ;; label = @6 - i32.const 4214 + block ;; label = @6 + local.get 0 i32.load16_u local.tee 2 + i32.const 92 + i32.sub + br_table 1 (;@5;) 3 (;@3;) 3 (;@3;) 3 (;@3;) 4 (;@2;) 0 (;@6;) + end + local.get 2 + i32.const 36 + i32.ne + br_if 2 (;@3;) + local.get 1 + i32.load16_u offset=4 + i32.const 123 + i32.ne + br_if 2 (;@3;) + i32.const 4196 + local.get 1 + i32.const 4 + i32.add + local.tee 1 + i32.store + block ;; label = @6 + i32.const 4212 + i32.load16_u + local.tee 0 i32.const 2048 i32.ne - br_if 1 (;@5;) - end - i32.const 4224 - i32.load - i32.eqz - if ;; label = @6 + if ;; label = @7 + i32.const 4214 + i32.load16_u + local.tee 2 + i32.const 2048 + i32.ne + br_if 1 (;@6;) + end i32.const 4224 - i32.const 12 - i32.store + i32.load + i32.eqz + if ;; label = @7 + i32.const 4224 + i32.const 12 + i32.store + i32.const 4228 + local.get 1 + i32.const 4188 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store + end + br 5 (;@1;) end - i32.const 4196 - local.get 3 - i32.const 2 + local.get 0 + i32.const 1 + i32.shl + i32.const 4232 i32.add - i32.store - i32.const 4228 + i32.const 4216 + i32.load16_u + i32.store16 + local.get 2 + i32.const 16520 + i32.add + i32.const 0 + i32.store8 + i32.const 4212 + local.get 0 + i32.const 1 + i32.add + i32.store16 + i32.const 4216 + local.get 2 + i32.const 1 + i32.add + local.tee 1 + i32.store16 + i32.const 4214 local.get 1 + i32.store16 + local.get 2 + i32.const 2 + i32.shl + i32.const 8328 + i32.add i32.const 4188 i32.load + i32.const 2 i32.sub - i32.const 1 - i32.shr_s i32.store return end - local.get 0 - i32.const 1 - i32.shl - i32.const 4232 - i32.add - i32.const 4216 - i32.load16_u - i32.store16 - local.get 2 - i32.const 16520 - i32.add - i32.const 0 - i32.store8 - i32.const 4212 - local.get 0 - i32.const 1 - i32.add - i32.store16 - i32.const 4216 - local.get 2 - i32.const 1 - i32.add - local.tee 1 - i32.store16 - i32.const 4214 local.get 1 - i32.store16 - local.get 2 - i32.const 2 - i32.shl - i32.const 8328 + i32.const 4 i32.add - i32.const 4188 - i32.load - i32.const 2 - i32.sub - i32.store - return + local.set 0 + br 1 (;@3;) end - local.get 1 - i32.const 4 - i32.add - local.set 0 - br 1 (;@2;) end - end - i32.const 4224 - i32.load - i32.eqz - if ;; label = @2 i32.const 4224 - i32.const 8 - i32.store + i32.load + i32.eqz + if ;; label = @3 + i32.const 4224 + i32.const 8 + i32.store + i32.const 4228 + local.get 0 + i32.const 4188 + i32.load + i32.sub + i32.const 1 + i32.shr_s + i32.store + end + br 1 (;@1;) end i32.const 4196 - local.get 3 - i32.const 2 - i32.add - i32.store - i32.const 4228 local.get 0 - i32.const 4188 - i32.load - i32.sub - i32.const 1 - i32.shr_s i32.store return end i32.const 4196 - local.get 0 + local.get 3 + i32.const 2 + i32.add i32.store) - (func (;14;) (type 1) (param i32) (result i32) + (func (;13;) (type 1) (param i32) (result i32) (local i32 i32 i32) i32.const 1 local.set 2 @@ -8752,7 +8687,7 @@ i32.const 10 i32.sub i32.load16_u - call 5 + call 3 return end i32.const 0 @@ -8795,7 +8730,7 @@ i32.const 8 i32.sub i32.load16_u - call 5 + call 3 return end local.get 1 @@ -8868,11 +8803,11 @@ i32.const 14 i32.sub i32.load16_u - call 5 + call 3 return end local.get 2) - (func (;15;) (type 1) (param i32) (result i32) + (func (;14;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32) i32.const 4188 i32.load @@ -8997,7 +8932,7 @@ local.get 1 i32.const 2 i32.sub) - (func (;16;) (type 1) (param i32) (result i32) + (func (;15;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32) local.get 0 i32.const 47 @@ -10290,7 +10225,7 @@ return end i32.const 1) - (func (;17;) (type 1) (param i32) (result i32) + (func (;16;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32) local.get 0 i32.const 64 @@ -10391,6 +10326,31 @@ return end local.get 1) + (func (;17;) (type 7) (param i64) + local.get 0 + i32.const 4144 + i64.load + i64.sub + i64.const 65535 + i64.add + local.tee 0 + i64.const 16 + i64.shr_u + i32.wrap_i64 + memory.grow + i32.const -1 + i32.eq + if ;; label = @1 + unreachable + end + i32.const 4144 + i32.const 4144 + i64.load + local.get 0 + i64.const 281474976645120 + i64.and + i64.add + i64.store) (func (;18;) (type 1) (param i32) (result i32) (local i32 i32 i32 i32 i32) block ;; label = @1 @@ -12312,40 +12272,55 @@ end i32.const 1) (func (;19;) (type 1) (param i32) (result i32) - local.get 0 - i32.const 2147483616 - i32.ge_u - if ;; label = @1 + (local i32) + block ;; label = @1 + local.get 0 + i32.const 2147483616 + i32.lt_u + if ;; label = @2 + local.get 0 + i32.const 1 + i32.shl + i32.const 31920 + i32.add + local.tee 0 + i32.const -64 + i32.sub + i32.const 0 + i32.store16 + i32.const 4136 + local.get 0 + i32.const 69 + i32.add + i32.const -4 + i32.and + i64.extend_i32_u + i64.store + i32.const 4144 + memory.size + i64.extend_i32_u + i64.const 16 + i64.shl + i64.store + loop ;; label = @3 + local.get 1 + i32.const 36 + i32.eq + br_if 2 (;@1;) + local.get 1 + i32.const 4152 + i32.add + call 0 + local.get 1 + i32.const 12 + i32.add + local.set 1 + br 0 (;@3;) + end + unreachable + end unreachable end - local.get 0 - i32.const 1 - i32.shl - i32.const 31984 - i32.add - local.tee 0 - i32.const 0 - i32.store16 - i32.const 4136 - local.get 0 - i32.const 5 - i32.add - i32.const -4 - i32.and - i64.extend_i32_u - i64.store - i32.const 4144 - memory.size - i64.extend_i32_u - i64.const 16 - i64.shl - i64.store - i32.const 4152 - call 2 - i32.const 4164 - call 2 - i32.const 4176 - call 2 i32.const 31984) (func (;20;) (type 8) (param i32 i32 i32 i32 i32 i32 i32) (result i32) i32.const 18596 @@ -12397,7 +12372,7 @@ i32.shl i32.add i32.store - call 3) + call 1) (func (;21;) (type 9) (param i32 i32 i32 i32 i32 i32) (result i32) i32.const 18588 i64.const 0 @@ -12442,7 +12417,7 @@ i32.const 4218 i32.const 0 i32.store align=2 - call 3) + call 1) (func (;22;) (type 0) (result i32) i32.const 4228 i32.load) diff --git a/src/lexer-internal.h b/src/lexer-internal.h index 036c601..cec418d 100644 --- a/src/lexer-internal.h +++ b/src/lexer-internal.h @@ -8,6 +8,8 @@ #include #define STACK_DEPTH 2048 +#define CJS_LEXER_ERROR_ALLOCATION 13 + #ifdef CJS_LEXER_WASM #define CJS_INLINE inline __attribute__((always_inline)) #else @@ -17,12 +19,21 @@ #ifdef CJS_LEXER_WASM typedef const uint16_t* Cursor; #define SOURCE_START parser->input +#define scanInput(input, cursor) (*(cursor)) #else typedef ptrdiff_t Cursor; #define SOURCE_START ((Cursor)0) +#define scanInput(input, cursor) ((input)[cursor]) #endif #define SOURCE_BEFORE (SOURCE_START - 1) +typedef enum { + ExportCandidate, + ReexportCandidate, + UnsafeGetterCandidate, + CandidateKindCount +} CandidateKind; + typedef struct StarExportBinding { Cursor specifier_start; Cursor specifier_end; @@ -31,60 +42,6 @@ typedef struct StarExportBinding { struct StarExportBinding* next; } StarExportBinding; -#ifdef CJS_LEXER_WASM -typedef struct Slice { - Cursor start; - Cursor end; - struct Slice* next; -} Slice; - -typedef struct { - Slice* first; - Slice* last; - Slice* read; -} Candidates; - -struct cjs_lexer_result { - Candidates exports; - Candidates reexports; - Candidates unsafe_getters; -}; - -#else -typedef union { - uint16_t code; - StarExportBinding binding; -} ArenaValue; - -typedef struct ArenaBlock { - struct ArenaBlock* next; - size_t used; - size_t capacity; - ArenaValue data[]; -} ArenaBlock; - -typedef struct { - Cursor start; - Cursor end; - cjs_lexer_string16 value; - uint32_t hash; -} Candidate; - -typedef struct { - Candidate* data; - size_t count; - size_t capacity; -} Candidates; - -struct cjs_lexer_result { - Candidates exports; - Candidates reexports; - Candidates unsafe_getters; - ArenaBlock* blocks; -}; - -#endif - typedef struct { const uint16_t* input; size_t sourceLen; @@ -110,12 +67,6 @@ typedef struct { cjs_lexer_result* result; } Parser; -#ifdef CJS_LEXER_WASM -#define scanInput(input, cursor) (*(cursor)) -#else -#define scanInput(input, cursor) ((input)[cursor]) -#endif - enum RequireType { Import, ExportAssign, ExportStar }; static inline ptrdiff_t sourceIndex(const Parser* parser, Cursor cursor) { @@ -139,7 +90,7 @@ static inline bool hasChars(const Parser* parser, Cursor cursor, size_t length) #ifdef CJS_LEXER_WASM return true; #else - return cursor >= 0 && (size_t)cursor <= parser->sourceLen && + return (size_t)cursor <= parser->sourceLen && length <= parser->sourceLen - (size_t)cursor; #endif } @@ -147,36 +98,19 @@ static inline bool hasChars(const Parser* parser, Cursor cursor, size_t length) #ifdef CJS_LEXER_WASM __attribute__((noinline)) #endif - static inline bool matches(const Parser* parser, Cursor left, Cursor right, size_t length) { #ifdef CJS_LEXER_WASM if (left > parser->end + 1 || length > (size_t)(parser->end + 1 - left)) return false; return memcmp(left, right, length * sizeof(uint16_t)) == 0; #else - ptrdiff_t leftIndex = sourceIndex(parser, left); - ptrdiff_t rightIndex = sourceIndex(parser, right); - return leftIndex >= 0 && rightIndex >= 0 && (size_t)leftIndex <= parser->sourceLen && - (size_t)rightIndex <= parser->sourceLen && length <= parser->sourceLen - (size_t)leftIndex && - length <= parser->sourceLen - (size_t)rightIndex && - memcmp(parser->input + leftIndex, parser->input + rightIndex, length * sizeof(uint16_t)) == 0; -#endif -} - -#ifdef CJS_LEXER_WASM -__attribute__((noinline)) -#endif -static inline void clearCandidates(Candidates* list) { -#ifdef CJS_LEXER_WASM - list->first = NULL; - list->last = NULL; - list->read = NULL; -#else - list->count = 0; + return hasChars(parser, left, length) && hasChars(parser, right, length) && + memcmp(parser->input + left, parser->input + right, length * sizeof(uint16_t)) == 0; #endif } void* cjs_lexer_allocate(cjs_lexer_result* result, size_t size); -void cjs_lexer_add(Parser* parser, Candidates* list, Cursor start, Cursor end); +void cjs_lexer_add(Parser* parser, CandidateKind kind, Cursor start, Cursor end); +void cjs_lexer_clear_reexports(cjs_lexer_result* result); uint32_t cjs_lexer_scan(Parser* parser); #endif diff --git a/src/lexer.c b/src/lexer.c index dab0b39..c56d878 100755 --- a/src/lexer.c +++ b/src/lexer.c @@ -85,7 +85,7 @@ static CJS_INLINE bool isTokenRunChar (uint16_t ch) { static CJS_INLINE bool pushOpenToken(Parser* parser, Cursor tokenPos) { if (parser->openTokenDepth == STACK_DEPTH) { - syntaxError(parser, 12); + syntaxError(parser, CJS_LEXER_ERROR_NESTING_LIMIT); return false; } parser->openTokenTypeStack[parser->openTokenDepth] = 0; @@ -95,7 +95,7 @@ static CJS_INLINE bool pushOpenToken(Parser* parser, Cursor tokenPos) { static CJS_INLINE bool pushTemplate(Parser* parser) { if (parser->templateStackDepth == STACK_DEPTH || parser->openTokenDepth == STACK_DEPTH) { - syntaxError(parser, 12); + syntaxError(parser, CJS_LEXER_ERROR_NESTING_LIMIT); return false; } parser->templateStack[parser->templateStackDepth++] = parser->templateDepth; @@ -205,7 +205,7 @@ uint32_t cjs_lexer_scan (Parser* parser) { case ']': if (parser->extended) { if (parser->openTokenDepth == 0) - return syntaxError(parser, 8), parser->error; + return syntaxError(parser, CJS_LEXER_ERROR_UNBALANCED_DELIMITER), parser->error; parser->openTokenDepth--; } break; @@ -215,10 +215,9 @@ uint32_t cjs_lexer_scan (Parser* parser) { break; case ')': if (parser->openTokenDepth == 0) - return syntaxError(parser, 8), parser->error; + return syntaxError(parser, CJS_LEXER_ERROR_UNBALANCED_DELIMITER), parser->error; parser->openTokenDepth--; lastOpenTokenPos = parser->openTokenPosStack[parser->openTokenDepth]; - lastOpenTokenType = 0; lastClosedTokenPos = parser->pos; break; case '{': @@ -234,7 +233,7 @@ uint32_t cjs_lexer_scan (Parser* parser) { break; case '}': if (parser->openTokenDepth == 0) - return syntaxError(parser, 2), parser->error; + return syntaxError(parser, CJS_LEXER_ERROR_UNEXPECTED_CLOSING_BRACE), parser->error; lastOpenTokenPos = parser->openTokenPosStack[parser->openTokenDepth - 1]; lastOpenTokenType = parser->openTokenTypeStack[parser->openTokenDepth - 1]; lastClosedTokenPos = parser->pos; @@ -244,7 +243,7 @@ uint32_t cjs_lexer_scan (Parser* parser) { } else { if (parser->templateDepth != UINT16_MAX && parser->openTokenDepth < parser->templateDepth) - return syntaxError(parser, 3), parser->error; + return syntaxError(parser, CJS_LEXER_ERROR_UNEXPECTED_TEMPLATE_BRACE), parser->error; } break; case '<': @@ -272,15 +271,13 @@ uint32_t cjs_lexer_scan (Parser* parser) { // - if a closing brace or paren, what token came before the corresponding // opening brace or paren (lastOpenTokenIndex) uint16_t lastToken = at(parser, parser->lastTokenPos); - Cursor preceding = parser->lastTokenPos == lastClosedTokenPos ? lastOpenTokenPos : SOURCE_BEFORE; - uint8_t closingType = parser->lastTokenPos == lastClosedTokenPos ? lastOpenTokenType : 0; if (isExpressionPunctuator(lastToken) && !(lastToken == '.' && (at(parser, parser->lastTokenPos - 1) >= '0' && at(parser, parser->lastTokenPos - 1) <= '9')) && !(lastToken == '+' && at(parser, parser->lastTokenPos - 1) == '+') && !(lastToken == '-' && at(parser, parser->lastTokenPos - 1) == '-') || - lastToken == ')' && isParenKeyword(parser, preceding) || - lastToken == '}' && (isExpressionTerminator(parser, preceding) || - (closingType & ClassToken) || - parser->extended && isStatementBrace(parser, preceding, parser->openTokenDepth)) || + parser->lastTokenPos == lastClosedTokenPos && (lastToken == ')' && isParenKeyword(parser, lastOpenTokenPos) || + lastToken == '}' && (isExpressionTerminator(parser, lastOpenTokenPos) || + (lastOpenTokenType & ClassToken) || + parser->extended && isStatementBrace(parser, lastOpenTokenPos, parser->openTokenDepth))) || lastToken == '/' && parser->lastSlashWasDivision || isExpressionKeyword(parser, parser->lastTokenPos) || !lastToken) { @@ -295,7 +292,7 @@ uint32_t cjs_lexer_scan (Parser* parser) { } case '`': if (parser->templateDepth == UINT16_MAX - 1) - return syntaxError(parser, 4), parser->error; + return syntaxError(parser, CJS_LEXER_ERROR_INVALID_TEMPLATE_DEPTH), parser->error; templateString(parser); break; default: @@ -319,7 +316,7 @@ uint32_t cjs_lexer_scan (Parser* parser) { if (parser->templateDepth != UINT16_MAX || parser->openTokenDepth || parser->error) { if (!parser->error) - syntaxError(parser, 1); + syntaxError(parser, CJS_LEXER_ERROR_UNEXPECTED_EOF); return parser->error; } @@ -363,7 +360,7 @@ static void tryBacktrackAddStarExportBinding(Parser* parser, Cursor bPos) { } StarExportBinding* binding = cjs_lexer_allocate(parser->result, sizeof(StarExportBinding)); if (!binding) { - syntaxError(parser, 13); + syntaxError(parser, CJS_LEXER_ERROR_ALLOCATION); return; } *binding = parser->starExportBinding_; @@ -486,7 +483,7 @@ static void tryParseObjectDefineOrKeys(Parser* parser, bool keys) { parser->pos += 5; ch = commentWhitespace(parser); if (ch != ':') break; - cjs_lexer_add(parser, &parser->result->exports, exportStart, exportEnd); + cjs_lexer_add(parser, ExportCandidate, exportStart, exportEnd); parser->pos = revertPos; return; } @@ -552,13 +549,13 @@ static void tryParseObjectDefineOrKeys(Parser* parser, bool keys) { parser->pos++; ch = commentWhitespace(parser); if (ch != ')') break; - cjs_lexer_add(parser, &parser->result->exports, exportStart, exportEnd); + cjs_lexer_add(parser, ExportCandidate, exportStart, exportEnd); return; } break; } if (exportEnd > SOURCE_START) { - cjs_lexer_add(parser, &parser->result->unsafe_getters, exportStart, exportEnd); + cjs_lexer_add(parser, UnsafeGetterCandidate, exportStart, exportEnd); } } else if (keys && ch == 'k' && str_eq3(parser, parser->pos + 1, 'e', 'y', 's')) { @@ -937,7 +934,7 @@ static void tryParseObjectDefineOrKeys(Parser* parser, bool keys) { while (binding) { if (id_len == binding->id_end - binding->id_start && matches(parser, id_start, binding->id_start, (size_t)id_len)) { - cjs_lexer_add(parser, &parser->result->reexports, binding->specifier_start, binding->specifier_end); + cjs_lexer_add(parser, ReexportCandidate, binding->specifier_start, binding->specifier_end); parser->pos = revertPos; return; } @@ -1001,7 +998,7 @@ static void tryParseExportsDotAssign(Parser* parser, bool assign) { Cursor endPos = parser->pos; ch = commentWhitespace(parser); if (ch == '=') { - cjs_lexer_add(parser, &parser->result->exports, startPos, endPos); + cjs_lexer_add(parser, ExportCandidate, startPos, endPos); return; } } @@ -1020,14 +1017,14 @@ static void tryParseExportsDotAssign(Parser* parser, bool assign) { parser->pos++; ch = commentWhitespace(parser); if (ch != '=') break; - cjs_lexer_add(parser, &parser->result->exports, startPos, endPos); + cjs_lexer_add(parser, ExportCandidate, startPos, endPos); } break; } // module.exports = case '=': { if (assign) { - if (!parser->extended) clearCandidates(&parser->result->reexports); + if (!parser->extended) cjs_lexer_clear_reexports(parser->result); parser->pos++; ch = commentWhitespace(parser); if (parser->extended) { @@ -1069,10 +1066,10 @@ static bool tryParseRequire(Parser* parser, enum RequireType requireType) { if (ch == ')') { switch (requireType) { case ExportStar: - cjs_lexer_add(parser, &parser->result->reexports, reexportStart, reexportEnd); + cjs_lexer_add(parser, ReexportCandidate, reexportStart, reexportEnd); return true; case ExportAssign: - cjs_lexer_add(parser, &parser->result->reexports, reexportStart, reexportEnd); + cjs_lexer_add(parser, ReexportCandidate, reexportStart, reexportEnd); return true; default: parser->starExportBinding_.specifier_start = reexportStart; @@ -1145,7 +1142,7 @@ static void readExportDefinition(Parser* parser) { Cursor nameStart = parser->pos; stringLiteral(parser, ch); Cursor nameEnd = ++parser->pos; - if (commentWhitespace(parser) == ',') cjs_lexer_add(parser, &parser->result->exports, nameStart, nameEnd); + if (commentWhitespace(parser) == ',') cjs_lexer_add(parser, ExportCandidate, nameStart, nameEnd); } } @@ -1208,7 +1205,7 @@ static void readExportProperty(Parser* parser) { } } if (nameEnd && (ch == ':' || ch == '(' || !computed && (ch == ',' || ch == '}'))) - cjs_lexer_add(parser, &parser->result->exports, nameStart, nameEnd); + cjs_lexer_add(parser, ExportCandidate, nameStart, nameEnd); parser->pos = revertPos; } @@ -1234,7 +1231,7 @@ static void tryParseLiteralExports(Parser* parser) { parser->pos = revertPos; return; } - cjs_lexer_add(parser, &parser->result->exports, startPos, endPos); + cjs_lexer_add(parser, ExportCandidate, startPos, endPos); } else if (ch == '\'' || ch == '"') { Cursor startPos = parser->pos; @@ -1250,7 +1247,7 @@ static void tryParseLiteralExports(Parser* parser) { return; } ch = at(parser, parser->pos); - cjs_lexer_add(parser, &parser->result->exports, startPos, endPos); + cjs_lexer_add(parser, ExportCandidate, startPos, endPos); } } else if (ch == '.' && str_eq2(parser, parser->pos + 1, '.', '.')) { @@ -1412,7 +1409,7 @@ static void throwIfImportStatement(Parser* parser) { return; // import.meta case '.': - syntaxError(parser, 5); + syntaxError(parser, CJS_LEXER_ERROR_UNEXPECTED_IMPORT_META); return; default: @@ -1429,7 +1426,7 @@ static void throwIfImportStatement(Parser* parser) { return; } // import statements are a syntax error in CommonJS - syntaxError(parser, 6); + syntaxError(parser, CJS_LEXER_ERROR_UNEXPECTED_ESM_IMPORT); } } @@ -1439,7 +1436,7 @@ static void throwIfExportStatement(Parser* parser) { uint16_t ch = commentWhitespace(parser); if (parser->pos == curPos && !isPunctuator(ch)) return; - syntaxError(parser, 7); + syntaxError(parser, CJS_LEXER_ERROR_UNEXPECTED_ESM_EXPORT); } static uint16_t commentWhitespace(Parser* parser) { @@ -1476,7 +1473,7 @@ static void templateString(Parser* parser) { if (ch == '\\') parser->pos++; } - syntaxError(parser, 8); + syntaxError(parser, CJS_LEXER_ERROR_UNBALANCED_DELIMITER); } static void blockComment(Parser* parser) { @@ -1511,7 +1508,7 @@ static void stringLiteral(Parser* parser, uint16_t quote) { else if (isBr(ch)) break; } - syntaxError(parser, 9); + syntaxError(parser, CJS_LEXER_ERROR_UNTERMINATED_STRING); } static uint16_t regexCharacterClass(Parser* parser) { @@ -1524,7 +1521,7 @@ static uint16_t regexCharacterClass(Parser* parser) { else if (ch == '\n' || ch == '\r') break; } - syntaxError(parser, 10); + syntaxError(parser, CJS_LEXER_ERROR_UNTERMINATED_REGEX_CLASS); return '\0'; } @@ -1540,7 +1537,7 @@ static void regularExpression(Parser* parser) { else if (ch == '\n' || ch == '\r') break; } - syntaxError(parser, 11); + syntaxError(parser, CJS_LEXER_ERROR_UNTERMINATED_REGEX); } @@ -1816,7 +1813,9 @@ static bool isExpressionTerminator(Parser* parser, Cursor curPos) { } static void syntaxError(Parser* parser, uint32_t code) { - if (parser->error == 0) parser->error = code; - parser->parse_error = sourceIndex(parser, parser->pos); + if (parser->error == 0) { + parser->error = code; + parser->parse_error = sourceIndex(parser, parser->pos); + } parser->pos = parser->end + 1; } diff --git a/src/native.c b/src/native.c index 3a24b71..2c3d305 100644 --- a/src/native.c +++ b/src/native.c @@ -1,5 +1,39 @@ #include "lexer-internal.h" +typedef union { + uint16_t code; + StarExportBinding binding; +} ArenaValue; + +typedef struct ArenaBlock { + struct ArenaBlock* next; + size_t used; + size_t capacity; + ArenaValue data[]; +} ArenaBlock; + +typedef struct { + Cursor start; + Cursor end; + cjs_lexer_string16 value; + uint32_t hash; +} Candidate; + +typedef struct { + Candidate* data; + size_t count; + size_t capacity; +} Candidates; + +struct cjs_lexer_result { + Candidates candidates[CandidateKindCount]; + ArenaBlock* blocks; +}; + +void cjs_lexer_clear_reexports(cjs_lexer_result* result) { + result->candidates[ReexportCandidate].count = 0; +} + void* cjs_lexer_allocate(cjs_lexer_result* result, size_t size) { const size_t alignment = _Alignof(ArenaValue); if (size > SIZE_MAX - alignment + 1) return NULL; @@ -20,19 +54,20 @@ void* cjs_lexer_allocate(cjs_lexer_result* result, size_t size) { return value; } -void cjs_lexer_add(Parser* parser, Candidates* list, ptrdiff_t start, ptrdiff_t end) { +void cjs_lexer_add(Parser* parser, CandidateKind kind, Cursor start, Cursor end) { if (parser->error) return; if (start < 0 || end < start || (size_t)end > parser->sourceLen) return; + Candidates* list = &parser->result->candidates[kind]; if (list->count == list->capacity) { size_t capacity = list->capacity ? list->capacity * 2 : 16; if (capacity < list->capacity || capacity > SIZE_MAX / sizeof(Candidate)) { - parser->error = 13; + parser->error = CJS_LEXER_ERROR_ALLOCATION; parser->pos = parser->end + 1; return; } Candidate* data = realloc(list->data, capacity * sizeof(Candidate)); if (!data) { - parser->error = 13; + parser->error = CJS_LEXER_ERROR_ALLOCATION; parser->pos = parser->end + 1; return; } @@ -210,55 +245,58 @@ uint32_t cjs_lexer_parse_utf16(const uint16_t* source, size_t length, parser.firstStarExport = NULL; parser.lastStarExport = NULL; parser.result = output; + Candidates* exports = &output->candidates[ExportCandidate]; + Candidates* reexports = &output->candidates[ReexportCandidate]; + Candidates* unsafe_getters = &output->candidates[UnsafeGetterCandidate]; uint32_t status = cjs_lexer_scan(&parser); if (status) { - if (error && status != 13) { + if (error && status != CJS_LEXER_ERROR_ALLOCATION) { error->code = status; error->has_offset = 1; error->offset = parser.parse_error > length ? length : parser.parse_error; } - status = status == 13 ? CJS_LEXER_OUT_OF_MEMORY : - status == 12 ? CJS_LEXER_LIMIT : CJS_LEXER_SYNTAX_ERROR; - } else if (!normalize(output, source, &output->exports) || - !normalize(output, source, &output->reexports) || - !normalize(output, source, &output->unsafe_getters)) { + status = status == CJS_LEXER_ERROR_ALLOCATION ? CJS_LEXER_OUT_OF_MEMORY : + status == CJS_LEXER_ERROR_NESTING_LIMIT ? CJS_LEXER_LIMIT : CJS_LEXER_SYNTAX_ERROR; + } else if (!normalize(output, source, exports) || + !normalize(output, source, reexports) || + !normalize(output, source, unsafe_getters)) { status = CJS_LEXER_OUT_OF_MEMORY; - } else if (output->unsafe_getters.count) { - hashNames(&output->exports); - hashNames(&output->unsafe_getters); - qsort(output->unsafe_getters.data, output->unsafe_getters.count, sizeof(Candidate), compareNames); + } else if (unsafe_getters->count) { + hashNames(exports); + hashNames(unsafe_getters); + qsort(unsafe_getters->data, unsafe_getters->count, sizeof(Candidate), compareNames); size_t count = 0; - for (size_t index = 0; index < output->exports.count; index++) { - Candidate candidate = output->exports.data[index]; - if (!bsearch(&candidate, output->unsafe_getters.data, output->unsafe_getters.count, - sizeof(Candidate), compareNames)) output->exports.data[count++] = candidate; + for (size_t index = 0; index < exports->count; index++) { + Candidate candidate = exports->data[index]; + if (!bsearch(&candidate, unsafe_getters->data, unsafe_getters->count, + sizeof(Candidate), compareNames)) exports->data[count++] = candidate; } - output->exports.count = count; + exports->count = count; } if (status) { cjs_lexer_result_free(output); return status; } - free(output->unsafe_getters.data); - output->unsafe_getters = (Candidates){0}; + free(unsafe_getters->data); + *unsafe_getters = (Candidates){0}; *result = output; return CJS_LEXER_OK; } size_t cjs_lexer_export_count(const cjs_lexer_result* result) { - return result->exports.count; + return result->candidates[ExportCandidate].count; } size_t cjs_lexer_reexport_count(const cjs_lexer_result* result) { - return result->reexports.count; + return result->candidates[ReexportCandidate].count; } cjs_lexer_string16 cjs_lexer_export(const cjs_lexer_result* result, size_t index) { - return result->exports.data[index].value; + return result->candidates[ExportCandidate].data[index].value; } cjs_lexer_string16 cjs_lexer_reexport(const cjs_lexer_result* result, size_t index) { - return result->reexports.data[index].value; + return result->candidates[ReexportCandidate].data[index].value; } void cjs_lexer_result_free(cjs_lexer_result* result) { @@ -269,8 +307,7 @@ void cjs_lexer_result_free(cjs_lexer_result* result) { free(block); block = next; } - free(result->exports.data); - free(result->reexports.data); - free(result->unsafe_getters.data); + for (size_t index = 0; index < CandidateKindCount; index++) + free(result->candidates[index].data); free(result); } diff --git a/src/wasm.c b/src/wasm.c index 0ecd866..1c2004e 100644 --- a/src/wasm.c +++ b/src/wasm.c @@ -1,6 +1,22 @@ #define CJS_LEXER_WASM #include "lexer-internal.h" +typedef struct Slice { + Cursor start; + Cursor end; + struct Slice* next; +} Slice; + +typedef struct { + Slice* first; + Slice* last; + Slice* read; +} Candidates; + +struct cjs_lexer_result { + Candidates candidates[CandidateKindCount]; +}; + extern unsigned char __heap_base; static Parser parser; static cjs_lexer_result result; @@ -21,8 +37,8 @@ void* cjs_lexer_allocate(cjs_lexer_result* unused, size_t size) { return allocation; } -__attribute__((noinline)) void cjs_lexer_add(Parser* parser, Candidates* list, Cursor start, Cursor end) { - Slice* slice = cjs_lexer_allocate(parser->result, sizeof(Slice)); +static __attribute__((noinline)) void appendCandidate(Candidates* list, Cursor start, Cursor end) { + Slice* slice = cjs_lexer_allocate(NULL, sizeof(Slice)); slice->start = start; slice->end = end; slice->next = NULL; @@ -31,6 +47,18 @@ __attribute__((noinline)) void cjs_lexer_add(Parser* parser, Candidates* list, C list->last = slice; } +__attribute__((always_inline)) void cjs_lexer_add(Parser* parser, CandidateKind kind, Cursor start, Cursor end) { + appendCandidate(&parser->result->candidates[kind], start, end); +} + +static __attribute__((noinline)) void clearCandidates(Candidates* list) { + *list = (Candidates){0}; +} + +void cjs_lexer_clear_reexports(cjs_lexer_result* result) { + clearCandidates(&result->candidates[ReexportCandidate]); +} + uint16_t* sa(uint32_t length) { if (length > (size_t)PTRDIFF_MAX - 32) __builtin_trap(); uint16_t* source = (uint16_t*)(void*)&__heap_base + 32; @@ -38,9 +66,8 @@ uint16_t* sa(uint32_t length) { analysis_head = ((uintptr_t)(source + length + 1) + _Alignof(Slice) - 1) & ~((uintptr_t)_Alignof(Slice) - 1); analysis_limit = (uint64_t)__builtin_wasm_memory_size(0) << 16; - clearCandidates(&result.exports); - clearCandidates(&result.reexports); - clearCandidates(&result.unsafe_getters); + for (size_t index = 0; index < CandidateKindCount; index++) + clearCandidates(&result.candidates[index]); return source; } @@ -74,20 +101,20 @@ uint32_t parseCJS(uint16_t* source, uint32_t length, uint32_t unused1, } uint32_t e(void) { return parser.parse_error; } -uint32_t es(void) { return result.exports.read->start - parser.input; } -uint32_t ee(void) { return result.exports.read->end - parser.input; } -uint32_t res(void) { return result.reexports.read->start - parser.input; } -uint32_t ree(void) { return result.reexports.read->end - parser.input; } -uint32_t us(void) { return result.unsafe_getters.read->start - parser.input; } -uint32_t ue(void) { return result.unsafe_getters.read->end - parser.input; } +uint32_t es(void) { return result.candidates[ExportCandidate].read->start - parser.input; } +uint32_t ee(void) { return result.candidates[ExportCandidate].read->end - parser.input; } +uint32_t res(void) { return result.candidates[ReexportCandidate].read->start - parser.input; } +uint32_t ree(void) { return result.candidates[ReexportCandidate].read->end - parser.input; } +uint32_t us(void) { return result.candidates[UnsafeGetterCandidate].read->start - parser.input; } +uint32_t ue(void) { return result.candidates[UnsafeGetterCandidate].read->end - parser.input; } static bool readCandidate(Candidates* list) { list->read = list->read ? list->read->next : list->first; return list->read != NULL; } -bool re(void) { return readCandidate(&result.exports); } -bool rre(void) { return readCandidate(&result.reexports); } -bool ru(void) { return readCandidate(&result.unsafe_getters); } +bool re(void) { return readCandidate(&result.candidates[ExportCandidate]); } +bool rre(void) { return readCandidate(&result.candidates[ReexportCandidate]); } +bool ru(void) { return readCandidate(&result.candidates[UnsafeGetterCandidate]); } #include "lexer.c" diff --git a/test/_unit.js b/test/_unit.js index ad6757a..db0faa1 100755 --- a/test/_unit.js +++ b/test/_unit.js @@ -937,11 +937,15 @@ suite('Lexer', () => { test('Closing tokens consumed by export helpers do not reuse earlier brace metadata', () => { for (const source of [ 'module.exports={a}/1;exports.b=2;', - 'class A{};module.exports={a}/1;exports.b=2;', - 'if(x){};require("x")/1;exports.b=2;', - 'if(x){};Object.defineProperty(exports,"a",{value:1})/1;exports.b=2;' + 'class A{};module.exports={a}/* comment *//1;exports.b=2;', + 'if(x) require("x")/1;exports.b=2;', + 'if(x){};Object.defineProperty(exports,"a",{value:1})/1;exports.b=2;', + 'class A{}/* comment *//[}]/.test("}");exports.b=2;', + 'if(x)/* comment *//[)]/.test(")");exports.b=2;' ]) { - assert.equal(parse(source).exports.at(-1), 'b'); + for (const mode of ['default', 'extended']) { + assert.equal(parse(source, '@', { mode }).exports.at(-1), 'b'); + } } }); @@ -1227,8 +1231,9 @@ suite('Lexer', () => { const rejected = ['\ud800', '\udbff', '\udc00', '\udfff', '\ud800A', '\udbff\ue000']; for (const value of [...accepted, ...rejected]) { let escaped = ''; - for (let index = 0; index < value.length; index++) + for (let index = 0; index < value.length; index++) { escaped += '\\u' + value.charCodeAt(index).toString(16).padStart(4, '0'); + } for (const quoted of [JSON.stringify(value), '"' + escaped + '"']) { const expected = accepted.includes(value) ? [value] : []; assert.deepStrictEqual(parse(`exports[${quoted}] = 1; module.exports = require(${quoted});`), { diff --git a/test/native/test.c b/test/native/test.c index 8cb51b1..024089b 100644 --- a/test/native/test.c +++ b/test/native/test.c @@ -30,10 +30,33 @@ int main(void) { uint16_t unit = 0; assert(cjs_lexer_parse_utf16(&unit, SIZE_MAX, 0, &result, &error) == CJS_LEXER_LIMIT); assert(!result && !error.has_offset); + const struct { + const char* text; + uint32_t flags; + uint32_t code; + size_t offset; + } syntax_errors[] = { + {"}", 0, CJS_LEXER_ERROR_UNEXPECTED_CLOSING_BRACE, 0}, + {")", 0, CJS_LEXER_ERROR_UNBALANCED_DELIMITER, 0}, + {"]", CJS_LEXER_EXTENDED, CJS_LEXER_ERROR_UNBALANCED_DELIMITER, 0}, + {"`", 0, CJS_LEXER_ERROR_UNBALANCED_DELIMITER, 1}, + {"/[\nexports.b=2;", 0, CJS_LEXER_ERROR_UNTERMINATED_REGEX_CLASS, 2}, + {"import.meta", 0, CJS_LEXER_ERROR_UNEXPECTED_IMPORT_META, 6}, + {"import x from 'package'", 0, CJS_LEXER_ERROR_UNEXPECTED_ESM_IMPORT, 7}, + {"export const x = 1", 0, CJS_LEXER_ERROR_UNEXPECTED_ESM_EXPORT, 7} + }; + for (size_t index = 0; index < sizeof(syntax_errors) / sizeof(*syntax_errors); index++) { + size_t count = strlen(syntax_errors[index].text); + uint16_t* source = copy(syntax_errors[index].text, count); + assert(cjs_lexer_parse_utf16(source, count, syntax_errors[index].flags, &result, &error) == CJS_LEXER_SYNTAX_ERROR); + assert(!result && error.code == syntax_errors[index].code && error.has_offset); + assert(error.offset == syntax_errors[index].offset); + free(source); + } const char* divisions[] = { "module.exports={a}/1;exports.b=2;", "class A{};module.exports={a}/1;exports.b=2;", - "if(x){};require('x')/1;exports.b=2;", + "if(x) require('x')/1;exports.b=2;", "if(x){};Object.defineProperty(exports,'a',{value:1})/1;exports.b=2;" }; for (size_t index = 0; index < sizeof(divisions) / sizeof(*divisions); index++) { @@ -110,7 +133,7 @@ int main(void) { } uint32_t status = cjs_lexer_parse_utf16(source, depth * 2, 0, &result, &error); assert(status == (depth <= 2048 ? CJS_LEXER_OK : CJS_LEXER_LIMIT)); - if (depth > 2048) assert(error.has_offset && error.offset == 2048); + if (depth > 2048) assert(error.code == CJS_LEXER_ERROR_NESTING_LIMIT && error.has_offset && error.offset == 2048); cjs_lexer_result_free(result); free(source); } From 4a1a98ba3f63235dd886184dca99f34e11ba2791 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 23 Nov 2026 12:32:11 +0100 Subject: [PATCH 09/10] fix(lexer): distinguish unterminated template text EOF in template text previously reported an unbalanced delimiter. Give it a separate diagnostic without renumbering the existing codes. The nesting limit makes the old template-depth check unreachable, so leave its code reserved. Pin the first regex diagnostic offset across backends so a later scanner error cannot replace it. Refs: https://github.com/nodejs/cjs-module-lexer/pull/140 --- README.md | 2 ++ include/cjs-module-lexer.h | 4 ++-- lib/lexer.wasm | Bin 28802 -> 28774 bytes lib/lexer.wat | 14 +------------- src/lexer.c | 4 +--- test/_unit.js | 5 +++++ test/native/test.c | 4 +++- 7 files changed, 14 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 4f2229a..3f4e493 100755 --- a/README.md +++ b/README.md @@ -546,6 +546,8 @@ Every failure sets the result to null and initializes the optional error output. `error.code` is a `CJS_LEXER_ERROR_*` constant from the header, or `CJS_LEXER_ERROR_NONE` if there is no scanner error. `CJS_LEXER_ERROR_UNEXPECTED_IMPORT_META`, `CJS_LEXER_ERROR_UNEXPECTED_ESM_IMPORT`, and `CJS_LEXER_ERROR_UNEXPECTED_ESM_EXPORT` identify ESM syntax. Nesting is limited to 2048 tracked brackets or templates. +Reaching the end of input while scanning template text reports `CJS_LEXER_ERROR_UNTERMINATED_TEMPLATE`. +Diagnostic code `4` is reserved. Input lengths must fit `uint32_t`, `PTRDIFF_MAX - 32`, and the platform's UTF-16 allocation range. Output locations must not overlap each other or the source. diff --git a/include/cjs-module-lexer.h b/include/cjs-module-lexer.h index 322823b..7caff4c 100644 --- a/include/cjs-module-lexer.h +++ b/include/cjs-module-lexer.h @@ -26,7 +26,6 @@ enum { CJS_LEXER_ERROR_UNEXPECTED_EOF = 1, CJS_LEXER_ERROR_UNEXPECTED_CLOSING_BRACE = 2, CJS_LEXER_ERROR_UNEXPECTED_TEMPLATE_BRACE = 3, - CJS_LEXER_ERROR_INVALID_TEMPLATE_DEPTH = 4, CJS_LEXER_ERROR_UNEXPECTED_IMPORT_META = 5, CJS_LEXER_ERROR_UNEXPECTED_ESM_IMPORT = 6, CJS_LEXER_ERROR_UNEXPECTED_ESM_EXPORT = 7, @@ -34,7 +33,8 @@ enum { CJS_LEXER_ERROR_UNTERMINATED_STRING = 9, CJS_LEXER_ERROR_UNTERMINATED_REGEX_CLASS = 10, CJS_LEXER_ERROR_UNTERMINATED_REGEX = 11, - CJS_LEXER_ERROR_NESTING_LIMIT = 12 + CJS_LEXER_ERROR_NESTING_LIMIT = 12, + CJS_LEXER_ERROR_UNTERMINATED_TEMPLATE = 14 }; #define CJS_LEXER_OK UINT32_C(0) diff --git a/lib/lexer.wasm b/lib/lexer.wasm index 83454517d8e0c17334c98841bdc5526eda85a6ab..993c8e8c97815f05e639eb4e14c9bc5fab24b94d 100755 GIT binary patch delta 37 vcmV+=0NVe8;Q{900g&$k?#7Yv69L?_1pzBBvrI6676A^Ep)(e<<3^t;O8*br delta 61 zcmV-D0K)&~-~oc+0g&$kipP=h69M?M1pzBB8$tLWF985S{{I6;1VBN6At(X>A^{Bu TK?Dp3voA1#76Ayeu|~Bi&59G` diff --git a/lib/lexer.wat b/lib/lexer.wat index 5595394..7cd1311 100644 --- a/lib/lexer.wat +++ b/lib/lexer.wat @@ -5766,18 +5766,6 @@ i32.store br 15 (;@4;) end - i32.const 4216 - i32.load16_u - i32.const 65534 - i32.eq - if ;; label = @19 - i32.const 4224 - i32.load - local.tee 1 - br_if 8 (;@11;) - i32.const 4 - br 7 (;@12;) - end call 12 br 15 (;@3;) end @@ -8577,7 +8565,7 @@ i32.eqz if ;; label = @3 i32.const 4224 - i32.const 8 + i32.const 14 i32.store i32.const 4228 local.get 0 diff --git a/src/lexer.c b/src/lexer.c index c56d878..e894255 100755 --- a/src/lexer.c +++ b/src/lexer.c @@ -291,8 +291,6 @@ uint32_t cjs_lexer_scan (Parser* parser) { break; } case '`': - if (parser->templateDepth == UINT16_MAX - 1) - return syntaxError(parser, CJS_LEXER_ERROR_INVALID_TEMPLATE_DEPTH), parser->error; templateString(parser); break; default: @@ -1473,7 +1471,7 @@ static void templateString(Parser* parser) { if (ch == '\\') parser->pos++; } - syntaxError(parser, CJS_LEXER_ERROR_UNBALANCED_DELIMITER); + syntaxError(parser, CJS_LEXER_ERROR_UNTERMINATED_TEMPLATE); } static void blockComment(Parser* parser) { diff --git a/test/_unit.js b/test/_unit.js index db0faa1..cc9239b 100755 --- a/test/_unit.js +++ b/test/_unit.js @@ -1414,6 +1414,11 @@ function x() { }); }); + test('Reports the first syntax error offset', () => { + const offsetKey = process.env.NATIVE || process.env.WASM || process.env.WASM_SYNC ? 'idx' : 'loc'; + assert.throws(() => parse('/[\nexports.b=2;'), { [offsetKey]: 2 }); + }); + test('Bracket matching', () => { assert.ok(parse(` instance.extend('parseExprAtom', function (nextMethod) { diff --git a/test/native/test.c b/test/native/test.c index 024089b..bb6da57 100644 --- a/test/native/test.c +++ b/test/native/test.c @@ -39,7 +39,9 @@ int main(void) { {"}", 0, CJS_LEXER_ERROR_UNEXPECTED_CLOSING_BRACE, 0}, {")", 0, CJS_LEXER_ERROR_UNBALANCED_DELIMITER, 0}, {"]", CJS_LEXER_EXTENDED, CJS_LEXER_ERROR_UNBALANCED_DELIMITER, 0}, - {"`", 0, CJS_LEXER_ERROR_UNBALANCED_DELIMITER, 1}, + {"`", 0, CJS_LEXER_ERROR_UNTERMINATED_TEMPLATE, 1}, + {"`${0}", 0, CJS_LEXER_ERROR_UNTERMINATED_TEMPLATE, 5}, + {"`${0", 0, CJS_LEXER_ERROR_UNEXPECTED_EOF, 4}, {"/[\nexports.b=2;", 0, CJS_LEXER_ERROR_UNTERMINATED_REGEX_CLASS, 2}, {"import.meta", 0, CJS_LEXER_ERROR_UNEXPECTED_IMPORT_META, 6}, {"import x from 'package'", 0, CJS_LEXER_ERROR_UNEXPECTED_ESM_IMPORT, 7}, From 6a0fa4d6ddbbb24c2d29c22f8a10b0f2a3ffa195 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 23 Nov 2026 12:32:37 +0100 Subject: [PATCH 10/10] build(native): require C11-capable MSVC tooling CMake 3.15 can build the lexer with GCC and Clang, but cannot select C11 with MSVC. Diagnose that unsupported combination at configure time without raising the minimum for other compilers. Refs: https://github.com/nodejs/cjs-module-lexer/pull/140 --- CMakeLists.txt | 5 +++++ README.md | 2 ++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4f31a6..e603224 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required(VERSION 3.15) project(cjs_module_lexer LANGUAGES C) +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND + (CMAKE_VERSION VERSION_LESS 3.18.2 OR CMAKE_C_COMPILER_VERSION VERSION_LESS 19.28)) + message(FATAL_ERROR "The native lexer requires CMake 3.18.2 and MSVC 19.28 or newer when building with MSVC.") +endif() + include(GNUInstallDirs) add_library(cjs_module_lexer STATIC src/lexer.c src/native.c) diff --git a/README.md b/README.md index 3f4e493..f1cfa66 100755 --- a/README.md +++ b/README.md @@ -498,6 +498,8 @@ test/samples/*.js (3635 KiB) The source distribution provides a C11 static library with no dependencies beyond the C library. JavaScript installation does not require a native compiler. +The native build requires CMake 3.15 or later. With MSVC, use CMake 3.18.2 or later, +Visual Studio 2019 version 16.8 or later, and Windows SDK 10.0.20348.0 or later. ```sh cmake -S . -B build/native -DBUILD_TESTING=OFF