diff --git a/.github/workflows/auto-start-ci.yml b/.github/workflows/auto-start-ci.yml index 72d248dea093a3..a1940a0a78f8d0 100644 --- a/.github/workflows/auto-start-ci.yml +++ b/.github/workflows/auto-start-ci.yml @@ -21,7 +21,7 @@ jobs: permissions: pull-requests: read if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim outputs: numbers: ${{ steps.get_prs_for_ci.outputs.numbers }} steps: @@ -43,7 +43,7 @@ jobs: pull-requests: write needs: get-prs-for-ci if: needs.get-prs-for-ci.outputs.numbers != '' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/build-tarball.yml b/.github/workflows/build-tarball.yml index 27027c49d9f93c..e9fb3343b777b0 100644 --- a/.github/workflows/build-tarball.yml +++ b/.github/workflows/build-tarball.yml @@ -28,7 +28,7 @@ concurrency: cancel-in-progress: true env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying permissions: @@ -37,7 +37,7 @@ permissions: jobs: build-tarball: if: github.event.pull_request.draft == false - runs-on: ubuntu-24.04 + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -66,9 +66,10 @@ jobs: needs: build-tarball runs-on: ubuntu-24.04 env: - CC: sccache clang - CXX: sccache clang++ - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++ + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} + SCCACHE_IDLE_TIMEOUT: '0' steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -78,6 +79,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.10.0 diff --git a/.github/workflows/close-stale-feature-requests.yml b/.github/workflows/close-stale-feature-requests.yml index 17bac3b83f50d9..82c47590280f29 100644 --- a/.github/workflows/close-stale-feature-requests.yml +++ b/.github/workflows/close-stale-feature-requests.yml @@ -39,7 +39,7 @@ jobs: issues: write # for actions/stale to close stale issues pull-requests: write # for actions/stale to close stale PRs if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0 with: diff --git a/.github/workflows/close-stale-pull-requests.yml b/.github/workflows/close-stale-pull-requests.yml index b18cd5c37e69c4..de565c9051328d 100644 --- a/.github/workflows/close-stale-pull-requests.yml +++ b/.github/workflows/close-stale-pull-requests.yml @@ -33,7 +33,7 @@ jobs: permissions: pull-requests: write # for actions/stale to close stale PRs if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - name: Set default end date which is 1 year ago run: echo "END_DATE=$(date --date='525600 minutes ago' --rfc-2822)" >> "$GITHUB_ENV" diff --git a/.github/workflows/close-stalled.yml b/.github/workflows/close-stalled.yml index 6bf526baf01034..d6b4451d91b41e 100644 --- a/.github/workflows/close-stalled.yml +++ b/.github/workflows/close-stalled.yml @@ -18,7 +18,7 @@ jobs: issues: write # for actions/stale to close stale issues pull-requests: write # for actions/stale to close stale PRs if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0 with: diff --git a/.github/workflows/comment-labeled.yml b/.github/workflows/comment-labeled.yml index 7e3a19c6afd13c..e6652507484154 100644 --- a/.github/workflows/comment-labeled.yml +++ b/.github/workflows/comment-labeled.yml @@ -24,7 +24,7 @@ jobs: issues: write pull-requests: write if: github.repository == 'nodejs/node' && github.event.label.name == 'stalled' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - name: Post stalled comment env: @@ -36,7 +36,7 @@ jobs: permissions: pull-requests: write if: github.repository == 'nodejs/node' && github.event_name == 'pull_request_target' && github.event.label.name == 'fast-track' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - name: Request Fast-Track env: @@ -47,7 +47,7 @@ jobs: permissions: pull-requests: write if: github.repository == 'nodejs/node' && github.event_name == 'pull_request_target' && github.event.label.name == 'notable-change' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - name: Add notable change description env: diff --git a/.github/workflows/commit-lint.yml b/.github/workflows/commit-lint.yml index f6cee24f6507cc..3d378a27e28631 100644 --- a/.github/workflows/commit-lint.yml +++ b/.github/workflows/commit-lint.yml @@ -10,7 +10,7 @@ permissions: jobs: lint-commit-message: - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - name: Compute number of commits in the PR id: nb-of-commits diff --git a/.github/workflows/commit-queue.yml b/.github/workflows/commit-queue.yml index 651d9c9dcbbaf5..11699d13403a4a 100644 --- a/.github/workflows/commit-queue.yml +++ b/.github/workflows/commit-queue.yml @@ -26,7 +26,7 @@ jobs: permissions: pull-requests: read if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim outputs: numbers: ${{ steps.get_mergeable_prs.outputs.numbers }} steps: @@ -57,7 +57,7 @@ jobs: commitQueue: needs: get_mergeable_prs if: needs.get_mergeable_prs.outputs.numbers != '' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/coverage-linux-without-intl.yml b/.github/workflows/coverage-linux-without-intl.yml index 4de0a5e4abc2e0..9a35ae234e1e7f 100644 --- a/.github/workflows/coverage-linux-without-intl.yml +++ b/.github/workflows/coverage-linux-without-intl.yml @@ -34,11 +34,12 @@ concurrency: cancel-in-progress: true env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying - CC: sccache clang - CXX: sccache clang++ - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++ + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} + SCCACHE_IDLE_TIMEOUT: '0' permissions: contents: read @@ -57,6 +58,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.10.0 @@ -64,11 +66,11 @@ jobs: run: npx envinfo - name: Install gcovr run: pip install gcovr==7.2 - - name: Build - run: make build-ci -j4 V=1 CONFIG_FLAGS="--error-on-warn --coverage --without-intl" + - name: Configure + run: ./configure --verbose --error-on-warn --coverage --without-intl # TODO(bcoe): fix the couple tests that fail with the inspector enabled. # The cause is most likely coverage's use of the inspector. - - name: Test + - name: Build and test run: NODE_V8_COVERAGE=coverage/tmp make test-cov -j4 V=1 TEST_CI_ARGS="-p dots --measure-flakiness 9" || exit 0 - name: Report JS run: npx c8 report --check-coverage diff --git a/.github/workflows/coverage-linux.yml b/.github/workflows/coverage-linux.yml index 0abe2092084156..eb26e2f84b384e 100644 --- a/.github/workflows/coverage-linux.yml +++ b/.github/workflows/coverage-linux.yml @@ -34,11 +34,12 @@ concurrency: cancel-in-progress: true env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying - CC: sccache clang - CXX: sccache clang++ - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++ + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} + SCCACHE_IDLE_TIMEOUT: '0' permissions: contents: read @@ -47,7 +48,7 @@ jobs: coverage-linux: # Disabled because "Report JS" step was crashing. if: false - runs-on: ubuntu-24.04 + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -57,6 +58,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.10.0 @@ -64,11 +66,11 @@ jobs: run: npx envinfo - name: Install gcovr run: pip install gcovr==7.2 - - name: Build - run: make build-ci -j4 V=1 CONFIG_FLAGS="--error-on-warn --coverage" + - name: Configure + run: ./configure --verbose --error-on-warn --coverage # TODO(bcoe): fix the couple tests that fail with the inspector enabled. # The cause is most likely coverage's use of the inspector. - - name: Test + - name: Build and test run: NODE_V8_COVERAGE=coverage/tmp make test-cov -j4 V=1 TEST_CI_ARGS="-p dots --measure-flakiness 9" || exit 0 - name: Report JS run: npx c8 report --check-coverage diff --git a/.github/workflows/coverage-windows.yml b/.github/workflows/coverage-windows.yml index c085931e5c37f3..ddc5afae3d78ef 100644 --- a/.github/workflows/coverage-windows.yml +++ b/.github/workflows/coverage-windows.yml @@ -34,7 +34,7 @@ concurrency: cancel-in-progress: true env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying permissions: diff --git a/.github/workflows/create-release-proposal.yml b/.github/workflows/create-release-proposal.yml index b9aa3517f3147b..8c466e0339f99f 100644 --- a/.github/workflows/create-release-proposal.yml +++ b/.github/workflows/create-release-proposal.yml @@ -31,7 +31,7 @@ jobs: RELEASE_BRANCH: v${{ inputs.release-line }}.x RELEASE_DATE: ${{ inputs.release-date }} RELEASE_LINE: ${{ inputs.release-line }} - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/daily-wpt-fyi.yml b/.github/workflows/daily-wpt-fyi.yml index cf438f775dd449..d9c3d8cadd2540 100644 --- a/.github/workflows/daily-wpt-fyi.yml +++ b/.github/workflows/daily-wpt-fyi.yml @@ -13,7 +13,7 @@ on: - cron: 30 0 * * * env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' permissions: contents: read @@ -21,7 +21,7 @@ permissions: jobs: collect-versions: if: github.repository == 'nodejs/node' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest + runs-on: ubuntu-slim outputs: matrix: ${{ steps.query.outputs.matrix }} steps: @@ -36,7 +36,7 @@ jobs: matrix: node-version: ${{ fromJSON(needs.collect-versions.outputs.matrix) }} fail-fast: false - runs-on: ubuntu-latest + runs-on: ubuntu-24.04-arm steps: - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index b7933bf92b58f2..00c35a468f3e86 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -13,7 +13,7 @@ permissions: jobs: build-lto: - runs-on: ubuntu-24.04 + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 3066023aaaa8e2..fff0439dd53149 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -22,7 +22,7 @@ permissions: jobs: build-docs: if: github.event.pull_request.draft == false - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/find-inactive-collaborators.yml b/.github/workflows/find-inactive-collaborators.yml index 3eb121f023b4fa..4f656aaea06af0 100644 --- a/.github/workflows/find-inactive-collaborators.yml +++ b/.github/workflows/find-inactive-collaborators.yml @@ -16,7 +16,7 @@ permissions: jobs: find: if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 diff --git a/.github/workflows/find-inactive-tsc.yml b/.github/workflows/find-inactive-tsc.yml index 91852746f45efa..57c96e5de40983 100644 --- a/.github/workflows/find-inactive-tsc.yml +++ b/.github/workflows/find-inactive-tsc.yml @@ -16,7 +16,7 @@ permissions: jobs: find: if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - name: Checkout the repo diff --git a/.github/workflows/label-flaky-test-issue.yml b/.github/workflows/label-flaky-test-issue.yml index 3bca41c5e4d526..b623d9eaae2cd4 100644 --- a/.github/workflows/label-flaky-test-issue.yml +++ b/.github/workflows/label-flaky-test-issue.yml @@ -10,7 +10,7 @@ permissions: jobs: label: if: github.event.label.name == 'flaky-test' - runs-on: ubuntu-latest + runs-on: ubuntu-slim permissions: issues: write steps: diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml index 95fdd42a4c700a..03aa1fa9a8d0e6 100644 --- a/.github/workflows/label-pr.yml +++ b/.github/workflows/label-pr.yml @@ -9,7 +9,7 @@ permissions: jobs: label: - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: nodejs/node-pr-labeler@d4cf1b8b9f23189c37917000e5e17e796c770a6b # v1 diff --git a/.github/workflows/license-builder.yml b/.github/workflows/license-builder.yml index c62e9b1f08fe54..6ece8739ba9e63 100644 --- a/.github/workflows/license-builder.yml +++ b/.github/workflows/license-builder.yml @@ -15,7 +15,7 @@ jobs: contents: write # for gr2m/create-or-update-pull-request-action to push local changes pull-requests: write # for gr2m/create-or-update-pull-request-action to create a PR if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/lint-release-proposal.yml b/.github/workflows/lint-release-proposal.yml index 9d8ba5998a7a5c..d7d085cc14bb2c 100644 --- a/.github/workflows/lint-release-proposal.yml +++ b/.github/workflows/lint-release-proposal.yml @@ -10,7 +10,7 @@ concurrency: cancel-in-progress: true env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' NODE_VERSION: lts/* permissions: @@ -18,13 +18,15 @@ permissions: jobs: lint-release-commit: - runs-on: ubuntu-latest + runs-on: ubuntu-slim permissions: + contents: read pull-requests: read steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false + fetch-depth: 2 - name: Lint release commit title format run: | EXPECTED_TITLE='^[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}, Version [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ (\(Current|'.+' \(LTS)\)$' @@ -50,6 +52,29 @@ jobs: - name: Verify it's release-ready run: | SKIP_XZ=1 make release-only + - name: Lint release commit content + run: | + MAJOR="$(awk '/^#define NODE_MAJOR_VERSION / { print $3 }' src/node_version.h)" + + echo "Checking for expected files in the release commit:" + missing_expected= + for expected in CHANGELOG.md src/node_version.h doc/changelogs/; do + if git diff --exit-code --quiet --diff-filter=M HEAD^ -- "$expected"; then + echo "Missing expected file in diff: $expected" + missing_expected=1 + fi + done + [ -z "$missing_expected" ] || exit 1 + + echo "Checking for unexpected files in the release commit:" + set -ex + [ -z "$(git diff-tree --no-commit-id --name-only -r HEAD --\ + . \ + ':(exclude)CHANGELOG.md' \ + ':(exclude)src/node_version.h' \ + ':(exclude)test/parallel/test-process-release.js' \ + ':(exclude)doc/api/' \ + ":(exclude)doc/changelogs/CHANGELOG_V$MAJOR.md")" ] - name: Validate CHANGELOG id: releaser-info run: | @@ -67,9 +92,15 @@ jobs: "/repos/${GITHUB_REPOSITORY}/compare/v${MAJOR}.x...$GITHUB_SHA" --paginate \ | node tools/actions/lint-release-proposal-commit-list.mjs "$CHANGELOG_PATH" "$GITHUB_SHA" \ | while IFS= read -r PR_URL; do - LABEL="dont-land-on-v${MAJOR}.x" gh pr view \ + DONT_LAND_LABEL="dont-land-on-v${MAJOR}.x" LTS_WATCH_LABEL="lts-watch-v${MAJOR}.x" gh pr view \ --json labels,url \ - --jq 'if (.labels|map(.name==env.LABEL)|any) then error("\(.url) has the \(env.LABEL) label, forbidding it to be in this release proposal") end' \ + --jq ' + if (.labels|any(.name==env.DONT_LAND_LABEL)) then + error("\(.url) has the \(env.DONT_LAND_LABEL) label, forbidding it to be in this release proposal") + elif (.labels|any(.name==env.LTS_WATCH_LABEL)) then + error("\(.url) has the \(env.LTS_WATCH_LABEL) label, please remove the label now that the PR is included in a release proposal") + end + ' \ "$PR_URL" > /dev/null done shell: bash # See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference, we want the pipefail option. diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index bd462ae1a84e7d..c04a08c8b73383 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: true env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' NODE_VERSION: lts/* permissions: @@ -23,7 +23,7 @@ permissions: jobs: lint-addon-docs: if: github.event.pull_request.draft == false - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -38,7 +38,7 @@ jobs: run: NODE=$(command -v node) make lint-addon-docs lint-cpp: if: github.event.pull_request.draft == false - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -53,7 +53,7 @@ jobs: run: make lint-cpp format-cpp: if: ${{ github.event.pull_request && github.event.pull_request.draft == false && github.base_ref == github.event.repository.default_branch }} - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -91,7 +91,7 @@ jobs: fi lint-js-and-md: if: github.event.pull_request.draft == false - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -116,7 +116,7 @@ jobs: NODE_RELEASED_VERSIONS: ${{ steps.get-released-versions.outputs.NODE_RELEASED_VERSIONS }} lint-py: if: github.event.pull_request.draft == false - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -133,7 +133,7 @@ jobs: make lint-py lint-yaml: if: github.event.pull_request.draft == false - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -151,7 +151,7 @@ jobs: lint-sh: if: github.event.pull_request.draft == false - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -161,6 +161,8 @@ jobs: run: tools/lint-sh.mjs . lint-codeowners: if: github.event.pull_request.draft == false + # cannot use ubuntu-slim here because mszostok/codeowners-validator is dockerized + # cannot use ubuntu-24.04-arm here because the docker image is x86 only runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -171,7 +173,7 @@ jobs: checks: files,duppatterns lint-pr-url: if: ${{ github.event.pull_request }} - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -180,7 +182,7 @@ jobs: # GH Actions squashes all PR commits, HEAD^ refers to the base branch. - run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }} lint-readme: - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/major-release.yml b/.github/workflows/major-release.yml index a90be1798fac85..b65917f89e74b2 100644 --- a/.github/workflows/major-release.yml +++ b/.github/workflows/major-release.yml @@ -9,7 +9,8 @@ permissions: jobs: create-issue: - runs-on: ubuntu-latest + if: github.repository == 'nodejs/node' + runs-on: ubuntu-slim permissions: issues: write steps: diff --git a/.github/workflows/notify-on-push.yml b/.github/workflows/notify-on-push.yml index a05738f0c5d3f5..bbb7f98f84578a 100644 --- a/.github/workflows/notify-on-push.yml +++ b/.github/workflows/notify-on-push.yml @@ -11,7 +11,8 @@ jobs: notifyOnForcePush: name: Notify on Force Push on `main` if: github.repository == 'nodejs/node' && github.event.forced - runs-on: ubuntu-latest + # cannot use ubuntu-slim here because rtCamp/action-slack-notify is dockerized + runs-on: ubuntu-24.04-arm steps: - name: Slack Notification uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # 2.3.3 @@ -30,9 +31,11 @@ jobs: notifyOnMissingMetadata: name: Notify on Push on `main` that lacks metadata if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest permissions: + contents: read pull-requests: write + # cannot use ubuntu-slim here because rtCamp/action-slack-notify is dockerized + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/notify-on-review-wanted.yml b/.github/workflows/notify-on-review-wanted.yml index 96eee3096d8b69..1d3124e336b80b 100644 --- a/.github/workflows/notify-on-review-wanted.yml +++ b/.github/workflows/notify-on-review-wanted.yml @@ -12,7 +12,8 @@ jobs: notifyOnReviewWanted: name: Notify on Review Wanted if: github.repository == 'nodejs/node' && github.event.label.name == 'review wanted' - runs-on: ubuntu-latest + # cannot use ubuntu-slim here because rtCamp/action-slack-notify is dockerized + runs-on: ubuntu-24.04-arm steps: - name: Determine PR or Issue id: define-message diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 0f877b3c639bed..87320f3f51da45 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -16,7 +16,7 @@ permissions: jobs: post-release-actions: if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - name: Trigger update-links workflow on nodejs/release-cloudflare-worker run: | diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index c3e579d3be0c9d..851d55a1e36d12 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -21,7 +21,8 @@ permissions: read-all jobs: analysis: name: Scorecard analysis - runs-on: ubuntu-latest + # cannot use ubuntu-slim here because ossf/scorecard-action is dockerized + runs-on: ubuntu-24.04-arm permissions: # Needed to upload the results to code-scanning dashboard. security-events: write diff --git a/.github/workflows/test-internet.yml b/.github/workflows/test-internet.yml index f3b782fc1af4dd..778c0ca4596128 100644 --- a/.github/workflows/test-internet.yml +++ b/.github/workflows/test-internet.yml @@ -31,7 +31,7 @@ concurrency: cancel-in-progress: true env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying CC: clang CXX: clang++ @@ -42,7 +42,7 @@ permissions: jobs: test-internet: if: github.repository == 'nodejs/node' || github.event_name != 'schedule' - runs-on: ubuntu-24.04 + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index bd0591bcf1f1c0..0d3b4e1d1c83d2 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -25,11 +25,12 @@ concurrency: cancel-in-progress: true env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying - CC: sccache clang - CXX: sccache clang++ - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++ + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} + SCCACHE_IDLE_TIMEOUT: '0' permissions: contents: read @@ -47,6 +48,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.10.0 diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 182c6c8d600418..fa1d07127e3e0e 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -29,7 +29,7 @@ concurrency: cancel-in-progress: true env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying permissions: @@ -40,9 +40,10 @@ jobs: if: github.event.pull_request.draft == false runs-on: macos-14 env: - CC: sccache gcc - CXX: sccache g++ - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} gcc + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} g++ + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} + SCCACHE_IDLE_TIMEOUT: '0' steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -52,6 +53,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.10.0 diff --git a/.github/workflows/timezone-update.yml b/.github/workflows/timezone-update.yml index e951b848ad4155..d9e80500c25794 100644 --- a/.github/workflows/timezone-update.yml +++ b/.github/workflows/timezone-update.yml @@ -16,7 +16,7 @@ jobs: pull-requests: write # to create a PR (gr2m/create-or-update-pull-request-action) if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - name: Checkout nodejs/node diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index a7a597d040c300..1813db9a2b9119 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -42,7 +42,7 @@ on: - zlib env: - PYTHON_VERSION: '3.12' + PYTHON_VERSION: '3.14' permissions: contents: read @@ -50,7 +50,7 @@ permissions: jobs: tools-deps-update: if: github.repository == 'nodejs/node' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest + runs-on: ubuntu-slim strategy: fail-fast: false # Prevent other jobs from aborting if one fails matrix: diff --git a/.github/workflows/update-openssl.yml b/.github/workflows/update-openssl.yml index 37f25011eaa3f9..bcb2f471d49d8d 100644 --- a/.github/workflows/update-openssl.yml +++ b/.github/workflows/update-openssl.yml @@ -12,7 +12,7 @@ permissions: jobs: openssl-update: if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/update-v8.yml b/.github/workflows/update-v8.yml index 3089efd725ce3a..431532aba6fdbe 100644 --- a/.github/workflows/update-v8.yml +++ b/.github/workflows/update-v8.yml @@ -14,7 +14,7 @@ permissions: jobs: v8-update: if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/update-wpt.yml b/.github/workflows/update-wpt.yml index 7df33029bcdf65..96a37b58eb671d 100644 --- a/.github/workflows/update-wpt.yml +++ b/.github/workflows/update-wpt.yml @@ -20,7 +20,7 @@ env: jobs: wpt-subsystem-update: if: github.repository == 'nodejs/node' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest + runs-on: ubuntu-slim strategy: fail-fast: false matrix: diff --git a/BUILDING.md b/BUILDING.md index f99862462c5941..d0b4f4f48a5f57 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -155,11 +155,11 @@ platforms. This is true regardless of entries in the table below. Depending on the host platform, the selection of toolchains may vary. -| Operating System | Compiler Versions | -| ---------------- | -------------------------------------------------------------- | -| Linux | GCC >= 10.1 | -| Windows | Visual Studio >= 2019 with the Windows 10 SDK on a 64-bit host | -| macOS | Xcode >= 11 (Apple LLVM >= 11) | +| Operating System | Compiler Versions | +| ---------------- | ------------------------------------------------------------------- | +| Linux | GCC >= 10.1 | +| Windows | Visual Studio 2019 or 2022 with the Windows 10 SDK on a 64-bit host | +| macOS | Xcode >= 11 (Apple LLVM >= 11) | ### Official binary platforms and toolchains @@ -654,7 +654,7 @@ Optional requirements to build the MSI installer package: Optional requirements for compiling for Windows 10 on ARM (ARM64): -* Visual Studio 17.6.0 or newer +* Visual Studio 2022 (17.6.0 or newer) > **Note:** There is [a bug](https://github.com/nodejs/build/issues/3739) in `17.10.x` > preventing Node.js from compiling. * Visual Studio optional components diff --git a/CHANGELOG.md b/CHANGELOG.md index 73afe4d8089419..52becc19495b2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,8 @@ release. -20.20.0
+20.20.1
+20.20.0
20.19.6
20.19.5
20.19.4
diff --git a/LICENSE b/LICENSE index a64a3c60861524..f3c6b825da2755 100644 --- a/LICENSE +++ b/LICENSE @@ -1385,21 +1385,61 @@ The externally maintained libraries used by Node.js are: - minimatch, located at deps/minimatch, is licensed as follows: """ - The ISC License + # Blue Oak Model License - Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors + Version 1.0.0 - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. + ## Purpose - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + This license gives everyone as much permission to work with + this software as possible, while protecting contributors + from liability. + + ## Acceptance + + In order to receive this license, you must agree to its + rules. The rules of this license are both obligations + under that agreement and conditions to your license. + You must not do anything with this software that triggers + a rule that you cannot or will not follow. + + ## Copyright + + Each contributor licenses you to do everything with this + software that would otherwise infringe that contributor's + copyright in it. + + ## Notices + + You must ensure that everyone who gets a copy of + any part of this software from you, with or without + changes, also gets the text of this license or a link to + . + + ## Excuse + + If anyone notifies you in writing that you have not + complied with [Notices](#notices), you can keep your + license by taking all practical steps to comply within 30 + days after the notice. If you do not do so, your license + ends immediately. + + ## Patent + + Each contributor licenses you to do everything with this + software that would otherwise infringe any patent claims + they can license or become able to license. + + ## Reliability + + No contributor can revoke this license. + + ## No Liability + + **_As far as the law allows, this software comes as is, + without any warranty or condition, and no contributor + will be liable to anyone for any damages related to this + software or this license, under any kind of legal claim._** """ - npm, located at deps/npm, is licensed as follows: diff --git a/android-configure b/android-configure index 2731e48d708a4a..a86065ca8a057e 100755 --- a/android-configure +++ b/android-configure @@ -4,6 +4,9 @@ # Note that the mix of single and double quotes is intentional, # as is the fact that the ] goes on a new line. _=[ 'exec' '/bin/sh' '-c' ''' +command -v python3.14 >/dev/null && exec python3.14 "$0" "$@" +command -v python3.13 >/dev/null && exec python3.13 "$0" "$@" +command -v python3.12 >/dev/null && exec python3.12 "$0" "$@" command -v python3.11 >/dev/null && exec python3.11 "$0" "$@" command -v python3.10 >/dev/null && exec python3.10 "$0" "$@" command -v python3.9 >/dev/null && exec python3.9 "$0" "$@" @@ -23,7 +26,7 @@ except ImportError: from distutils.spawn import find_executable as which print('Node.js android configure: Found Python {}.{}.{}...'.format(*sys.version_info)) -acceptable_pythons = ((3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6)) +acceptable_pythons = ((3, 14), (3, 13), (3, 12), (3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6)) if sys.version_info[:2] in acceptable_pythons: import android_configure else: diff --git a/common.gypi b/common.gypi index 311b2036002d55..dca22b881c1f08 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.33', + 'v8_embedder_string': '-node.34', ##### V8 defaults for Node.js ##### diff --git a/configure b/configure index 29ebe882b092cd..5400072bec5c0d 100755 --- a/configure +++ b/configure @@ -4,6 +4,7 @@ # Note that the mix of single and double quotes is intentional, # as is the fact that the ] goes on a new line. _=[ 'exec' '/bin/sh' '-c' ''' +command -v python3.14 >/dev/null && exec python3.14 "$0" "$@" command -v python3.13 >/dev/null && exec python3.13 "$0" "$@" command -v python3.12 >/dev/null && exec python3.12 "$0" "$@" command -v python3.11 >/dev/null && exec python3.11 "$0" "$@" @@ -25,7 +26,7 @@ except ImportError: from distutils.spawn import find_executable as which print('Node.js configure: Found Python {}.{}.{}...'.format(*sys.version_info)) -acceptable_pythons = ((3, 13), (3, 12), (3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6)) +acceptable_pythons = ((3, 14), (3, 13), (3, 12), (3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6)) if sys.version_info[:2] in acceptable_pythons: import configure else: diff --git a/deps/acorn/acorn-walk/CHANGELOG.md b/deps/acorn/acorn-walk/CHANGELOG.md index 7aeae8fd5c8622..de4168f21a4508 100644 --- a/deps/acorn/acorn-walk/CHANGELOG.md +++ b/deps/acorn/acorn-walk/CHANGELOG.md @@ -1,3 +1,13 @@ +## 8.3.5 (2026-02-19) + +### Bug fixes + +Emit a more informative error message when trying to walk a node type that has no walker function. + +Specify callbacks in types to receive `AnyNode` type, so that they can be narrowed more easily. + +Support import attributes. + ## 8.3.4 (2024-09-09) ### Bug fixes diff --git a/deps/acorn/acorn-walk/README.md b/deps/acorn/acorn-walk/README.md index 3c18a2c76a938e..eaec57fda3b3ff 100644 --- a/deps/acorn/acorn-walk/README.md +++ b/deps/acorn/acorn-walk/README.md @@ -47,8 +47,8 @@ produce a meaningful state. (An example of a use of state is to track scope at each point in the tree.) ```js -const acorn = require("acorn") -const walk = require("acorn-walk") +import * as acorn from "acorn" +import * as walk from "acorn-walk" walk.simple(acorn.parse("let x = 10"), { Literal(node) { @@ -62,8 +62,8 @@ a tree, building up an array of ancestor nodes (including the current node) and passing the array to the callbacks as a third parameter. ```js -const acorn = require("acorn") -const walk = require("acorn-walk") +import * as acorn from "acorn" +import * as walk from "acorn-walk" walk.ancestor(acorn.parse("foo('hi')"), { Literal(_node, _state, ancestors) { @@ -97,8 +97,8 @@ current node) and passing the array to the callbacks as a third parameter. ```js -const acorn = require("acorn") -const walk = require("acorn-walk") +import * as acorn from "acorn" +import * as walk from "acorn-walk" walk.full(acorn.parse("1 + 1"), node => { console.log(`There's a ${node.type} node at ${node.ch}`) diff --git a/deps/acorn/acorn-walk/dist/walk.d.mts b/deps/acorn/acorn-walk/dist/walk.d.mts index e07a6afaf8e336..199c8a0159b8f2 100644 --- a/deps/acorn/acorn-walk/dist/walk.d.mts +++ b/deps/acorn/acorn-walk/dist/walk.d.mts @@ -1,15 +1,15 @@ import * as acorn from "acorn" export type FullWalkerCallback = ( - node: acorn.Node, + node: acorn.AnyNode, state: TState, type: string ) => void export type FullAncestorWalkerCallback = ( - node: acorn.Node, + node: acorn.AnyNode, state: TState, - ancestors: acorn.Node[], + ancestors: acorn.AnyNode[], type: string ) => void @@ -29,13 +29,13 @@ export type SimpleVisitors = { } export type AncestorVisitors = { - [type in acorn.AnyNode["type"]]?: ( node: Extract, state: TState, ancestors: acorn.Node[] + [type in acorn.AnyNode["type"]]?: ( node: Extract, state: TState, ancestors: acorn.AnyNode[] ) => void } & { - [type in keyof AggregateType]?: (node: AggregateType[type], state: TState, ancestors: acorn.Node[]) => void + [type in keyof AggregateType]?: (node: AggregateType[type], state: TState, ancestors: acorn.AnyNode[]) => void } -export type WalkerCallback = (node: acorn.Node, state: TState) => void +export type WalkerCallback = (node: acorn.AnyNode, state: TState) => void export type RecursiveVisitors = { [type in acorn.AnyNode["type"]]?: ( node: Extract, state: TState, callback: WalkerCallback) => void @@ -43,10 +43,10 @@ export type RecursiveVisitors = { [type in keyof AggregateType]?: (node: AggregateType[type], state: TState, callback: WalkerCallback) => void } -export type FindPredicate = (type: string, node: acorn.Node) => boolean +export type FindPredicate = (type: string, node: acorn.AnyNode) => boolean export interface Found { - node: acorn.Node, + node: acorn.AnyNode, state: TState } @@ -66,10 +66,6 @@ export function simple( /** * does a 'simple' walk over a tree, building up an array of ancestor nodes (including the current node) and passing the array to the callbacks as a third parameter. - * @param node - * @param visitors - * @param base - * @param state */ export function ancestor( node: acorn.Node, @@ -94,10 +90,6 @@ export function recursive( /** * does a 'full' walk over a tree, calling the {@link callback} with the arguments (node, state, type) for each node - * @param node - * @param callback - * @param base - * @param state */ export function full( node: acorn.Node, @@ -108,10 +100,6 @@ export function full( /** * does a 'full' walk over a tree, building up an array of ancestor nodes (including the current node) and passing the array to the callbacks as a third parameter. - * @param node - * @param callback - * @param base - * @param state */ export function fullAncestor( node: acorn.Node, @@ -122,8 +110,6 @@ export function fullAncestor( /** * builds a new walker object by using the walker functions in {@link functions} and filling in the missing ones by taking defaults from {@link base}. - * @param functions - * @param base */ export function make( functions: RecursiveVisitors, @@ -132,17 +118,11 @@ export function make( /** * tries to locate a node in a tree at the given start and/or end offsets, which satisfies the predicate test. {@link start} and {@link end} can be either `null` (as wildcard) or a `number`. {@link test} may be a string (indicating a node type) or a function that takes (nodeType, node) arguments and returns a boolean indicating whether this node is interesting. {@link base} and {@link state} are optional, and can be used to specify a custom walker. Nodes are tested from inner to outer, so if two nodes match the boundaries, the inner one will be preferred. - * @param node - * @param start - * @param end - * @param type - * @param base - * @param state */ export function findNodeAt( node: acorn.Node, - start: number | undefined, - end?: number | undefined, + start: number | undefined | null, + end?: number | undefined | null, type?: FindPredicate | string, base?: RecursiveVisitors, state?: TState @@ -150,15 +130,10 @@ export function findNodeAt( /** * like {@link findNodeAt}, but will match any node that exists 'around' (spanning) the given position. - * @param node - * @param start - * @param type - * @param base - * @param state */ export function findNodeAround( node: acorn.Node, - start: number | undefined, + start: number | undefined | null, type?: FindPredicate | string, base?: RecursiveVisitors, state?: TState diff --git a/deps/acorn/acorn-walk/dist/walk.d.ts b/deps/acorn/acorn-walk/dist/walk.d.ts index e07a6afaf8e336..199c8a0159b8f2 100644 --- a/deps/acorn/acorn-walk/dist/walk.d.ts +++ b/deps/acorn/acorn-walk/dist/walk.d.ts @@ -1,15 +1,15 @@ import * as acorn from "acorn" export type FullWalkerCallback = ( - node: acorn.Node, + node: acorn.AnyNode, state: TState, type: string ) => void export type FullAncestorWalkerCallback = ( - node: acorn.Node, + node: acorn.AnyNode, state: TState, - ancestors: acorn.Node[], + ancestors: acorn.AnyNode[], type: string ) => void @@ -29,13 +29,13 @@ export type SimpleVisitors = { } export type AncestorVisitors = { - [type in acorn.AnyNode["type"]]?: ( node: Extract, state: TState, ancestors: acorn.Node[] + [type in acorn.AnyNode["type"]]?: ( node: Extract, state: TState, ancestors: acorn.AnyNode[] ) => void } & { - [type in keyof AggregateType]?: (node: AggregateType[type], state: TState, ancestors: acorn.Node[]) => void + [type in keyof AggregateType]?: (node: AggregateType[type], state: TState, ancestors: acorn.AnyNode[]) => void } -export type WalkerCallback = (node: acorn.Node, state: TState) => void +export type WalkerCallback = (node: acorn.AnyNode, state: TState) => void export type RecursiveVisitors = { [type in acorn.AnyNode["type"]]?: ( node: Extract, state: TState, callback: WalkerCallback) => void @@ -43,10 +43,10 @@ export type RecursiveVisitors = { [type in keyof AggregateType]?: (node: AggregateType[type], state: TState, callback: WalkerCallback) => void } -export type FindPredicate = (type: string, node: acorn.Node) => boolean +export type FindPredicate = (type: string, node: acorn.AnyNode) => boolean export interface Found { - node: acorn.Node, + node: acorn.AnyNode, state: TState } @@ -66,10 +66,6 @@ export function simple( /** * does a 'simple' walk over a tree, building up an array of ancestor nodes (including the current node) and passing the array to the callbacks as a third parameter. - * @param node - * @param visitors - * @param base - * @param state */ export function ancestor( node: acorn.Node, @@ -94,10 +90,6 @@ export function recursive( /** * does a 'full' walk over a tree, calling the {@link callback} with the arguments (node, state, type) for each node - * @param node - * @param callback - * @param base - * @param state */ export function full( node: acorn.Node, @@ -108,10 +100,6 @@ export function full( /** * does a 'full' walk over a tree, building up an array of ancestor nodes (including the current node) and passing the array to the callbacks as a third parameter. - * @param node - * @param callback - * @param base - * @param state */ export function fullAncestor( node: acorn.Node, @@ -122,8 +110,6 @@ export function fullAncestor( /** * builds a new walker object by using the walker functions in {@link functions} and filling in the missing ones by taking defaults from {@link base}. - * @param functions - * @param base */ export function make( functions: RecursiveVisitors, @@ -132,17 +118,11 @@ export function make( /** * tries to locate a node in a tree at the given start and/or end offsets, which satisfies the predicate test. {@link start} and {@link end} can be either `null` (as wildcard) or a `number`. {@link test} may be a string (indicating a node type) or a function that takes (nodeType, node) arguments and returns a boolean indicating whether this node is interesting. {@link base} and {@link state} are optional, and can be used to specify a custom walker. Nodes are tested from inner to outer, so if two nodes match the boundaries, the inner one will be preferred. - * @param node - * @param start - * @param end - * @param type - * @param base - * @param state */ export function findNodeAt( node: acorn.Node, - start: number | undefined, - end?: number | undefined, + start: number | undefined | null, + end?: number | undefined | null, type?: FindPredicate | string, base?: RecursiveVisitors, state?: TState @@ -150,15 +130,10 @@ export function findNodeAt( /** * like {@link findNodeAt}, but will match any node that exists 'around' (spanning) the given position. - * @param node - * @param start - * @param type - * @param base - * @param state */ export function findNodeAround( node: acorn.Node, - start: number | undefined, + start: number | undefined | null, type?: FindPredicate | string, base?: RecursiveVisitors, state?: TState diff --git a/deps/acorn/acorn-walk/dist/walk.js b/deps/acorn/acorn-walk/dist/walk.js index 40b7aa1b078a18..fe4d19759b7da3 100644 --- a/deps/acorn/acorn-walk/dist/walk.js +++ b/deps/acorn/acorn-walk/dist/walk.js @@ -26,7 +26,7 @@ if (!baseVisitor) { baseVisitor = base ; }(function c(node, st, override) { var type = override || node.type; - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); if (visitors[type]) { visitors[type](node, st); } })(node, state, override); } @@ -41,7 +41,7 @@ var type = override || node.type; var isNew = node !== ancestors[ancestors.length - 1]; if (isNew) { ancestors.push(node); } - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); if (visitors[type]) { visitors[type](node, st || ancestors, ancestors); } if (isNew) { ancestors.pop(); } })(node, state, override); @@ -76,7 +76,7 @@ var last ;(function c(node, st, override) { var type = override || node.type; - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); if (last !== node) { callback(node, st, type); last = node; @@ -93,7 +93,7 @@ var type = override || node.type; var isNew = node !== ancestors[ancestors.length - 1]; if (isNew) { ancestors.push(node); } - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); if (last !== node) { callback(node, st || ancestors, ancestors, type); last = node; @@ -113,7 +113,7 @@ var type = override || node.type; if ((start == null || node.start <= start) && (end == null || node.end >= end)) - { baseVisitor[type](node, st, c); } + { visitNode(baseVisitor, type, node, st, c); } if ((start == null || node.start === start) && (end == null || node.end === end) && test(type, node)) @@ -134,7 +134,7 @@ (function c(node, st, override) { var type = override || node.type; if (node.start > pos || node.end < pos) { return } - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); if (test(type, node)) { throw new Found(node, st) } })(node, state); } catch (e) { @@ -152,7 +152,7 @@ if (node.end < pos) { return } var type = override || node.type; if (node.start >= pos && test(type, node)) { throw new Found(node, st) } - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); })(node, state); } catch (e) { if (e instanceof Found) { return e } @@ -170,7 +170,7 @@ var type = override || node.type; if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) { max = new Found(node, st); } - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); })(node, state); return max } @@ -186,6 +186,11 @@ function skipThrough(node, st, c) { c(node, st); } function ignore(_node, _st, _c) {} + function visitNode(baseVisitor, type, node, st, c) { + if (baseVisitor[type] == null) { throw new Error(("No walker function defined for node type " + type)) } + baseVisitor[type](node, st, c); + } + // Node walkers. var base = {}; @@ -397,11 +402,28 @@ if (node.declaration) { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); } if (node.source) { c(node.source, st, "Expression"); } + if (node.attributes) + { for (var i = 0, list = node.attributes; i < list.length; i += 1) + { + var attr = list[i]; + + c(attr, st); + } } }; base.ExportAllDeclaration = function (node, st, c) { if (node.exported) { c(node.exported, st); } c(node.source, st, "Expression"); + if (node.attributes) + { for (var i = 0, list = node.attributes; i < list.length; i += 1) + { + var attr = list[i]; + + c(attr, st); + } } + }; + base.ImportAttribute = function (node, st, c) { + c(node.value, st, "Expression"); }; base.ImportDeclaration = function (node, st, c) { for (var i = 0, list = node.specifiers; i < list.length; i += 1) @@ -411,9 +433,17 @@ c(spec, st); } c(node.source, st, "Expression"); + if (node.attributes) + { for (var i$1 = 0, list$1 = node.attributes; i$1 < list$1.length; i$1 += 1) + { + var attr = list$1[i$1]; + + c(attr, st); + } } }; base.ImportExpression = function (node, st, c) { c(node.source, st, "Expression"); + if (node.options) { c(node.options, st, "Expression"); } }; base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore; diff --git a/deps/acorn/acorn-walk/dist/walk.mjs b/deps/acorn/acorn-walk/dist/walk.mjs index c475ababc7ac30..88f18bb616e1d9 100644 --- a/deps/acorn/acorn-walk/dist/walk.mjs +++ b/deps/acorn/acorn-walk/dist/walk.mjs @@ -20,7 +20,7 @@ function simple(node, visitors, baseVisitor, state, override) { if (!baseVisitor) { baseVisitor = base ; }(function c(node, st, override) { var type = override || node.type; - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); if (visitors[type]) { visitors[type](node, st); } })(node, state, override); } @@ -35,7 +35,7 @@ function ancestor(node, visitors, baseVisitor, state, override) { var type = override || node.type; var isNew = node !== ancestors[ancestors.length - 1]; if (isNew) { ancestors.push(node); } - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); if (visitors[type]) { visitors[type](node, st || ancestors, ancestors); } if (isNew) { ancestors.pop(); } })(node, state, override); @@ -70,7 +70,7 @@ function full(node, callback, baseVisitor, state, override) { var last ;(function c(node, st, override) { var type = override || node.type; - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); if (last !== node) { callback(node, st, type); last = node; @@ -87,7 +87,7 @@ function fullAncestor(node, callback, baseVisitor, state) { var type = override || node.type; var isNew = node !== ancestors[ancestors.length - 1]; if (isNew) { ancestors.push(node); } - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); if (last !== node) { callback(node, st || ancestors, ancestors, type); last = node; @@ -107,7 +107,7 @@ function findNodeAt(node, start, end, test, baseVisitor, state) { var type = override || node.type; if ((start == null || node.start <= start) && (end == null || node.end >= end)) - { baseVisitor[type](node, st, c); } + { visitNode(baseVisitor, type, node, st, c); } if ((start == null || node.start === start) && (end == null || node.end === end) && test(type, node)) @@ -128,7 +128,7 @@ function findNodeAround(node, pos, test, baseVisitor, state) { (function c(node, st, override) { var type = override || node.type; if (node.start > pos || node.end < pos) { return } - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); if (test(type, node)) { throw new Found(node, st) } })(node, state); } catch (e) { @@ -146,7 +146,7 @@ function findNodeAfter(node, pos, test, baseVisitor, state) { if (node.end < pos) { return } var type = override || node.type; if (node.start >= pos && test(type, node)) { throw new Found(node, st) } - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); })(node, state); } catch (e) { if (e instanceof Found) { return e } @@ -164,7 +164,7 @@ function findNodeBefore(node, pos, test, baseVisitor, state) { var type = override || node.type; if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) { max = new Found(node, st); } - baseVisitor[type](node, st, c); + visitNode(baseVisitor, type, node, st, c); })(node, state); return max } @@ -180,6 +180,11 @@ function make(funcs, baseVisitor) { function skipThrough(node, st, c) { c(node, st); } function ignore(_node, _st, _c) {} +function visitNode(baseVisitor, type, node, st, c) { + if (baseVisitor[type] == null) { throw new Error(("No walker function defined for node type " + type)) } + baseVisitor[type](node, st, c); +} + // Node walkers. var base = {}; @@ -391,11 +396,28 @@ base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st if (node.declaration) { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); } if (node.source) { c(node.source, st, "Expression"); } + if (node.attributes) + { for (var i = 0, list = node.attributes; i < list.length; i += 1) + { + var attr = list[i]; + + c(attr, st); + } } }; base.ExportAllDeclaration = function (node, st, c) { if (node.exported) { c(node.exported, st); } c(node.source, st, "Expression"); + if (node.attributes) + { for (var i = 0, list = node.attributes; i < list.length; i += 1) + { + var attr = list[i]; + + c(attr, st); + } } +}; +base.ImportAttribute = function (node, st, c) { + c(node.value, st, "Expression"); }; base.ImportDeclaration = function (node, st, c) { for (var i = 0, list = node.specifiers; i < list.length; i += 1) @@ -405,9 +427,17 @@ base.ImportDeclaration = function (node, st, c) { c(spec, st); } c(node.source, st, "Expression"); + if (node.attributes) + { for (var i$1 = 0, list$1 = node.attributes; i$1 < list$1.length; i$1 += 1) + { + var attr = list$1[i$1]; + + c(attr, st); + } } }; base.ImportExpression = function (node, st, c) { c(node.source, st, "Expression"); + if (node.options) { c(node.options, st, "Expression"); } }; base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore; diff --git a/deps/acorn/acorn-walk/package.json b/deps/acorn/acorn-walk/package.json index 133059576956d8..362add83801045 100644 --- a/deps/acorn/acorn-walk/package.json +++ b/deps/acorn/acorn-walk/package.json @@ -16,7 +16,7 @@ ], "./package.json": "./package.json" }, - "version": "8.3.4", + "version": "8.3.5", "engines": { "node": ">=0.4.0" }, diff --git a/deps/acorn/acorn/CHANGELOG.md b/deps/acorn/acorn/CHANGELOG.md index c86068cd71ab47..d18759aeaa3d5e 100644 --- a/deps/acorn/acorn/CHANGELOG.md +++ b/deps/acorn/acorn/CHANGELOG.md @@ -1,3 +1,21 @@ +## 8.16.0 (2026-02-19) + +### New features + +The `sourceType` option can now be set to `"commonjs"` to have the parser treat the top level scope as a function scope. + +Add support for Unicode 17. + +### Bug fixes + +Don't recognize `await using` as contextual keywords when followed directly by a backslash. + +Fix an issue where the parser would allow `return` statements in `static` blocks when `allowReturnOutsideFunction` was enabled. + +Properly reject `using` declarations that appear directly in `switch` or `for` head scopes. + +Fix some corner case issues in the recognition of `using` syntax. + ## 8.15.0 (2025-06-08) ### New features diff --git a/deps/acorn/acorn/README.md b/deps/acorn/acorn/README.md index f7ff9662419308..962de027264563 100644 --- a/deps/acorn/acorn/README.md +++ b/deps/acorn/acorn/README.md @@ -26,6 +26,24 @@ git clone https://github.com/acornjs/acorn.git cd acorn npm install ``` +## Importing acorn + +ESM as well as CommonJS is supported for all 3: `acorn`, `acorn-walk` and `acorn-loose`. + +ESM example for `acorn`: + +```js +import * as acorn from "acorn" +``` + +CommonJS example for `acorn`: + +```js +let acorn = require("acorn") +``` + +ESM is preferred, as it allows better editor auto-completions by offering TypeScript support. +For this reason, following examples will use ESM imports. ## Interface @@ -36,8 +54,8 @@ syntax tree object as specified by the [ESTree spec](https://github.com/estree/estree). ```javascript -let acorn = require("acorn"); -console.log(acorn.parse("1 + 1", {ecmaVersion: 2020})); +import * as acorn from "acorn" +console.log(acorn.parse("1 + 1", {ecmaVersion: 2020})) ``` When encountering a syntax error, the parser will raise a @@ -61,11 +79,12 @@ required): implemented through plugins. - **sourceType**: Indicate the mode the code should be parsed in. Can be - either `"script"` or `"module"`. This influences global strict mode + either `"script"`, `"module"` or `"commonjs"`. This influences global strict mode and parsing of `import` and `export` declarations. **NOTE**: If set to `"module"`, then static `import` / `export` syntax - will be valid, even if `ecmaVersion` is less than 6. + will be valid, even if `ecmaVersion` is less than 6. If set to `"commonjs"`, + it is the same as `"script"` except that the top-level scope behaves like a function. - **onInsertedSemicolon**: If given a callback, that callback will be called whenever a missing semicolon is inserted by the parser. The @@ -97,7 +116,7 @@ required): for `ecmaVersion` 2022 and later, `false` for lower versions. Setting this option to `true` allows to have top-level `await` expressions. They are still not allowed in non-`async` functions, - though. + though. Setting this option to `true` is not allowed when `sourceType: "commonjs"`. - **allowSuperOutsideMethod**: By default, `super` outside a method raises an error. Set this to `true` to accept such code. @@ -217,7 +236,7 @@ for (let token of acorn.tokenizer(str)) { } // transform code to array of tokens: -var tokens = [...acorn.tokenizer(str)]; +var tokens = [...acorn.tokenizer(str)] ``` **tokTypes** holds an object mapping names to the token type objects @@ -238,10 +257,10 @@ on the extended version of the class. To extend a parser with plugins, you can use its static `extend` method. ```javascript -var acorn = require("acorn"); -var jsx = require("acorn-jsx"); -var JSXParser = acorn.Parser.extend(jsx()); -JSXParser.parse("foo()", {ecmaVersion: 2020}); +var acorn = require("acorn") +var jsx = require("acorn-jsx") +var JSXParser = acorn.Parser.extend(jsx()) +JSXParser.parse("foo()", {ecmaVersion: 2020}) ``` The `extend` method takes any number of plugin values, and returns a diff --git a/deps/acorn/acorn/dist/acorn.d.mts b/deps/acorn/acorn/dist/acorn.d.mts index f2ec5243bcb262..afbd9139eb5f2f 100644 --- a/deps/acorn/acorn/dist/acorn.d.mts +++ b/deps/acorn/acorn/dist/acorn.d.mts @@ -614,10 +614,10 @@ export interface Options { /** * `sourceType` indicates the mode the code should be parsed in. - * Can be either `"script"` or `"module"`. This influences global + * Can be either `"script"`, `"module"` or `"commonjs"`. This influences global * strict mode and parsing of `import` and `export` declarations. */ - sourceType?: "script" | "module" + sourceType?: "script" | "module" | "commonjs" /** * a callback that will be called when a semicolon is automatically inserted. diff --git a/deps/acorn/acorn/dist/acorn.d.ts b/deps/acorn/acorn/dist/acorn.d.ts index f2ec5243bcb262..afbd9139eb5f2f 100644 --- a/deps/acorn/acorn/dist/acorn.d.ts +++ b/deps/acorn/acorn/dist/acorn.d.ts @@ -614,10 +614,10 @@ export interface Options { /** * `sourceType` indicates the mode the code should be parsed in. - * Can be either `"script"` or `"module"`. This influences global + * Can be either `"script"`, `"module"` or `"commonjs"`. This influences global * strict mode and parsing of `import` and `export` declarations. */ - sourceType?: "script" | "module" + sourceType?: "script" | "module" | "commonjs" /** * a callback that will be called when a semicolon is automatically inserted. diff --git a/deps/acorn/acorn/dist/acorn.js b/deps/acorn/acorn/dist/acorn.js index cb5628bf83cf0b..b4f281a46f85fe 100644 --- a/deps/acorn/acorn/dist/acorn.js +++ b/deps/acorn/acorn/dist/acorn.js @@ -5,16 +5,16 @@ })(this, (function (exports) { 'use strict'; // This file was generated. Do not modify manually! - var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; + var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; // This file was generated. Do not modify manually! - var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191]; + var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489]; // This file was generated. Do not modify manually! - var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65"; + var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65"; // This file was generated. Do not modify manually! - var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; + var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; // These are a run-length and offset encoded representation of the // >0xffff code points that are a valid part of identifiers. The @@ -339,7 +339,7 @@ // for new syntax features. ecmaVersion: null, // `sourceType` indicates the mode the code should be parsed in. - // Can be either `"script"` or `"module"`. This influences global + // Can be either `"script"`, `"module"` or `"commonjs"`. This influences global // strict mode and parsing of `import` and `export` declarations. sourceType: "script", // `onInsertedSemicolon` can be a callback that will be called when @@ -463,6 +463,9 @@ if (isArray(options.onComment)) { options.onComment = pushComment(options, options.onComment); } + if (options.sourceType === "commonjs" && options.allowAwaitOutsideFunction) + { throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs") } + return options } @@ -494,6 +497,7 @@ SCOPE_DIRECT_SUPER = 128, SCOPE_CLASS_STATIC_BLOCK = 256, SCOPE_CLASS_FIELD_INIT = 512, + SCOPE_SWITCH = 1024, SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK; function functionFlags(async, generator) { @@ -583,7 +587,12 @@ // Scope tracking for duplicate variable names (see scope.js) this.scopeStack = []; - this.enterScope(SCOPE_TOP); + this.enterScope( + this.options.sourceType === "commonjs" + // In commonjs, the top-level scope behaves like a function scope + ? SCOPE_FUNCTION + : SCOPE_TOP + ); // For RegExp validation this.regexpState = null; @@ -594,7 +603,7 @@ this.privateNameStack = []; }; - var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } }; + var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowReturn: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },allowUsing: { configurable: true },inClassStaticBlock: { configurable: true } }; Parser.prototype.parse = function parse () { var node = this.options.program || this.startNode(); @@ -618,6 +627,12 @@ return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction }; + prototypeAccessors.allowReturn.get = function () { + if (this.inFunction) { return true } + if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) { return true } + return false + }; + prototypeAccessors.allowSuper.get = function () { var ref = this.currentThisScope(); var flags = ref.flags; @@ -638,6 +653,14 @@ return false }; + prototypeAccessors.allowUsing.get = function () { + var ref = this.currentScope(); + var flags = ref.flags; + if (flags & SCOPE_SWITCH) { return false } + if (!this.inModule && flags & SCOPE_TOP) { return false } + return true + }; + prototypeAccessors.inClassStaticBlock.get = function () { return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0 }; @@ -842,7 +865,7 @@ } } this.adaptDirectivePrologue(node.body); this.next(); - node.sourceType = this.options.sourceType; + node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType; return this.finishNode(node, "Program") }; @@ -852,7 +875,7 @@ if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false } skipWhiteSpace.lastIndex = this.pos; var skip = skipWhiteSpace.exec(this.input); - var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); + var next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next); // For ambiguous cases, determine if a LexicalDeclaration (or only a // Statement) is allowed here. If context is not empty then only a Statement // is allowed. However, `let [` is an explicit negative lookahead for @@ -860,12 +883,13 @@ if (nextCh === 91 || nextCh === 92) { return true } // '[', '\' if (context) { return false } - if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral - if (isIdentifierStart(nextCh, true)) { - var pos = next + 1; - while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; } - if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } - var ident = this.input.slice(next, pos); + if (nextCh === 123) { return true } // '{' + if (isIdentifierStart(nextCh)) { + var start = next; + do { next += nextCh <= 0xffff ? 1 : 2; } + while (isIdentifierChar(nextCh = this.fullCharCodeAt(next))) + if (nextCh === 92) { return true } + var ident = this.input.slice(start, next); if (!keywordRelationalOperator.test(ident)) { return true } } return false @@ -884,7 +908,7 @@ return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || - !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00)) + !(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92 /* '\' */)) }; pp$8.isUsingKeyword = function(isAwaitUsing, isFor) { @@ -898,28 +922,28 @@ if (lineBreak.test(this.input.slice(this.pos, next))) { return false } if (isAwaitUsing) { - var awaitEndPos = next + 5 /* await */, after; - if (this.input.slice(next, awaitEndPos) !== "using" || - awaitEndPos === this.input.length || - isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) || - (after > 0xd7ff && after < 0xdc00) + var usingEndPos = next + 5 /* using */, after; + if (this.input.slice(next, usingEndPos) !== "using" || + usingEndPos === this.input.length || + isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) || + after === 92 /* '\' */ ) { return false } - skipWhiteSpace.lastIndex = awaitEndPos; + skipWhiteSpace.lastIndex = usingEndPos; var skipAfterUsing = skipWhiteSpace.exec(this.input); - if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) { return false } - } - - if (isFor) { - var ofEndPos = next + 2 /* of */, after$1; - if (this.input.slice(next, ofEndPos) === "of") { - if (ofEndPos === this.input.length || - (!isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 0xd7ff && after$1 < 0xdc00))) { return false } - } - } - - var ch = this.input.charCodeAt(next); - return isIdentifierStart(ch, true) || ch === 92 // '\' + next = usingEndPos + skipAfterUsing[0].length; + if (skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next))) { return false } + } + + var ch = this.fullCharCodeAt(next); + if (!isIdentifierStart(ch) && ch !== 92 /* '\' */) { return false } + var idStart = next; + do { next += ch <= 0xffff ? 1 : 2; } + while (isIdentifierChar(ch = this.fullCharCodeAt(next))) + if (ch === 92) { return true } + var id = this.input.slice(idStart, next); + if (keywordRelationalOperator.test(id) || isFor && id === "of") { return false } + return true }; pp$8.isAwaitUsing = function(isFor) { @@ -1008,8 +1032,8 @@ var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null; if (usingKind) { - if (topLevel && this.options.sourceType === "script") { - this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`"); + if (!this.allowUsing) { + this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"); } if (usingKind === "await using") { if (!this.canAwait) { @@ -1106,7 +1130,12 @@ if (usingKind) { var init$2 = this.startNode(); this.next(); - if (usingKind === "await using") { this.next(); } + if (usingKind === "await using") { + if (!this.canAwait) { + this.raise(this.start, "Await using cannot appear outside of async function"); + } + this.next(); + } this.parseVar(init$2, true, usingKind); this.finishNode(init$2, "VariableDeclaration"); return this.parseForAfterInit(node, init$2, awaitAt) @@ -1165,7 +1194,7 @@ }; pp$8.parseReturnStatement = function(node) { - if (!this.inFunction && !this.options.allowReturnOutsideFunction) + if (!this.allowReturn) { this.raise(this.start, "'return' outside of function"); } this.next(); @@ -1184,7 +1213,7 @@ node.cases = []; this.expect(types$1.braceL); this.labels.push(switchLabel); - this.enterScope(0); + this.enterScope(SCOPE_SWITCH); // Statements under must be grouped (by label) in SwitchCase // nodes. `cur` is used to keep the node that we are currently @@ -3892,7 +3921,7 @@ }; // This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually! - var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz"; + var scriptValuesAddedInUnicode = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz"; // This file contains Unicode properties extracted from the ECMAScript specification. // The lists are extracted like so: @@ -5453,13 +5482,17 @@ return this.getTokenFromCode(code) }; - pp.fullCharCodeAtPos = function() { - var code = this.input.charCodeAt(this.pos); + pp.fullCharCodeAt = function(pos) { + var code = this.input.charCodeAt(pos); if (code <= 0xd7ff || code >= 0xdc00) { return code } - var next = this.input.charCodeAt(this.pos + 1); + var next = this.input.charCodeAt(pos + 1); return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00 }; + pp.fullCharCodeAtPos = function() { + return this.fullCharCodeAt(this.pos) + }; + pp.skipBlockComment = function() { var startLoc = this.options.onComment && this.curPosition(); var start = this.pos, end = this.input.indexOf("*/", this.pos += 2); @@ -6187,7 +6220,7 @@ // [ghbt]: https://github.com/acornjs/acorn/issues - var version = "8.15.0"; + var version = "8.16.0"; Parser.acorn = { Parser: Parser, diff --git a/deps/acorn/acorn/dist/acorn.mjs b/deps/acorn/acorn/dist/acorn.mjs index 74d5fc431be2b5..9067e9bf97f84f 100644 --- a/deps/acorn/acorn/dist/acorn.mjs +++ b/deps/acorn/acorn/dist/acorn.mjs @@ -1,14 +1,14 @@ // This file was generated. Do not modify manually! -var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; +var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; // This file was generated. Do not modify manually! -var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191]; +var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489]; // This file was generated. Do not modify manually! -var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65"; +var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65"; // This file was generated. Do not modify manually! -var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; +var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; // These are a run-length and offset encoded representation of the // >0xffff code points that are a valid part of identifiers. The @@ -333,7 +333,7 @@ var defaultOptions = { // for new syntax features. ecmaVersion: null, // `sourceType` indicates the mode the code should be parsed in. - // Can be either `"script"` or `"module"`. This influences global + // Can be either `"script"`, `"module"` or `"commonjs"`. This influences global // strict mode and parsing of `import` and `export` declarations. sourceType: "script", // `onInsertedSemicolon` can be a callback that will be called when @@ -457,6 +457,9 @@ function getOptions(opts) { if (isArray(options.onComment)) { options.onComment = pushComment(options, options.onComment); } + if (options.sourceType === "commonjs" && options.allowAwaitOutsideFunction) + { throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs") } + return options } @@ -488,6 +491,7 @@ var SCOPE_DIRECT_SUPER = 128, SCOPE_CLASS_STATIC_BLOCK = 256, SCOPE_CLASS_FIELD_INIT = 512, + SCOPE_SWITCH = 1024, SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK; function functionFlags(async, generator) { @@ -577,7 +581,12 @@ var Parser = function Parser(options, input, startPos) { // Scope tracking for duplicate variable names (see scope.js) this.scopeStack = []; - this.enterScope(SCOPE_TOP); + this.enterScope( + this.options.sourceType === "commonjs" + // In commonjs, the top-level scope behaves like a function scope + ? SCOPE_FUNCTION + : SCOPE_TOP + ); // For RegExp validation this.regexpState = null; @@ -588,7 +597,7 @@ var Parser = function Parser(options, input, startPos) { this.privateNameStack = []; }; -var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } }; +var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowReturn: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },allowUsing: { configurable: true },inClassStaticBlock: { configurable: true } }; Parser.prototype.parse = function parse () { var node = this.options.program || this.startNode(); @@ -612,6 +621,12 @@ prototypeAccessors.canAwait.get = function () { return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction }; +prototypeAccessors.allowReturn.get = function () { + if (this.inFunction) { return true } + if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) { return true } + return false +}; + prototypeAccessors.allowSuper.get = function () { var ref = this.currentThisScope(); var flags = ref.flags; @@ -632,6 +647,14 @@ prototypeAccessors.allowNewDotTarget.get = function () { return false }; +prototypeAccessors.allowUsing.get = function () { + var ref = this.currentScope(); + var flags = ref.flags; + if (flags & SCOPE_SWITCH) { return false } + if (!this.inModule && flags & SCOPE_TOP) { return false } + return true +}; + prototypeAccessors.inClassStaticBlock.get = function () { return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0 }; @@ -836,7 +859,7 @@ pp$8.parseTopLevel = function(node) { } } this.adaptDirectivePrologue(node.body); this.next(); - node.sourceType = this.options.sourceType; + node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType; return this.finishNode(node, "Program") }; @@ -846,7 +869,7 @@ pp$8.isLet = function(context) { if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false } skipWhiteSpace.lastIndex = this.pos; var skip = skipWhiteSpace.exec(this.input); - var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); + var next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next); // For ambiguous cases, determine if a LexicalDeclaration (or only a // Statement) is allowed here. If context is not empty then only a Statement // is allowed. However, `let [` is an explicit negative lookahead for @@ -854,12 +877,13 @@ pp$8.isLet = function(context) { if (nextCh === 91 || nextCh === 92) { return true } // '[', '\' if (context) { return false } - if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral - if (isIdentifierStart(nextCh, true)) { - var pos = next + 1; - while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; } - if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } - var ident = this.input.slice(next, pos); + if (nextCh === 123) { return true } // '{' + if (isIdentifierStart(nextCh)) { + var start = next; + do { next += nextCh <= 0xffff ? 1 : 2; } + while (isIdentifierChar(nextCh = this.fullCharCodeAt(next))) + if (nextCh === 92) { return true } + var ident = this.input.slice(start, next); if (!keywordRelationalOperator.test(ident)) { return true } } return false @@ -878,7 +902,7 @@ pp$8.isAsyncFunction = function() { return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || - !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00)) + !(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92 /* '\' */)) }; pp$8.isUsingKeyword = function(isAwaitUsing, isFor) { @@ -892,28 +916,28 @@ pp$8.isUsingKeyword = function(isAwaitUsing, isFor) { if (lineBreak.test(this.input.slice(this.pos, next))) { return false } if (isAwaitUsing) { - var awaitEndPos = next + 5 /* await */, after; - if (this.input.slice(next, awaitEndPos) !== "using" || - awaitEndPos === this.input.length || - isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) || - (after > 0xd7ff && after < 0xdc00) + var usingEndPos = next + 5 /* using */, after; + if (this.input.slice(next, usingEndPos) !== "using" || + usingEndPos === this.input.length || + isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) || + after === 92 /* '\' */ ) { return false } - skipWhiteSpace.lastIndex = awaitEndPos; + skipWhiteSpace.lastIndex = usingEndPos; var skipAfterUsing = skipWhiteSpace.exec(this.input); - if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) { return false } - } - - if (isFor) { - var ofEndPos = next + 2 /* of */, after$1; - if (this.input.slice(next, ofEndPos) === "of") { - if (ofEndPos === this.input.length || - (!isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 0xd7ff && after$1 < 0xdc00))) { return false } - } - } - - var ch = this.input.charCodeAt(next); - return isIdentifierStart(ch, true) || ch === 92 // '\' + next = usingEndPos + skipAfterUsing[0].length; + if (skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next))) { return false } + } + + var ch = this.fullCharCodeAt(next); + if (!isIdentifierStart(ch) && ch !== 92 /* '\' */) { return false } + var idStart = next; + do { next += ch <= 0xffff ? 1 : 2; } + while (isIdentifierChar(ch = this.fullCharCodeAt(next))) + if (ch === 92) { return true } + var id = this.input.slice(idStart, next); + if (keywordRelationalOperator.test(id) || isFor && id === "of") { return false } + return true }; pp$8.isAwaitUsing = function(isFor) { @@ -1002,8 +1026,8 @@ pp$8.parseStatement = function(context, topLevel, exports) { var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null; if (usingKind) { - if (topLevel && this.options.sourceType === "script") { - this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`"); + if (!this.allowUsing) { + this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"); } if (usingKind === "await using") { if (!this.canAwait) { @@ -1100,7 +1124,12 @@ pp$8.parseForStatement = function(node) { if (usingKind) { var init$2 = this.startNode(); this.next(); - if (usingKind === "await using") { this.next(); } + if (usingKind === "await using") { + if (!this.canAwait) { + this.raise(this.start, "Await using cannot appear outside of async function"); + } + this.next(); + } this.parseVar(init$2, true, usingKind); this.finishNode(init$2, "VariableDeclaration"); return this.parseForAfterInit(node, init$2, awaitAt) @@ -1159,7 +1188,7 @@ pp$8.parseIfStatement = function(node) { }; pp$8.parseReturnStatement = function(node) { - if (!this.inFunction && !this.options.allowReturnOutsideFunction) + if (!this.allowReturn) { this.raise(this.start, "'return' outside of function"); } this.next(); @@ -1178,7 +1207,7 @@ pp$8.parseSwitchStatement = function(node) { node.cases = []; this.expect(types$1.braceL); this.labels.push(switchLabel); - this.enterScope(0); + this.enterScope(SCOPE_SWITCH); // Statements under must be grouped (by label) in SwitchCase // nodes. `cur` is used to keep the node that we are currently @@ -3886,7 +3915,7 @@ pp$2.copyNode = function(node) { }; // This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually! -var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz"; +var scriptValuesAddedInUnicode = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz"; // This file contains Unicode properties extracted from the ECMAScript specification. // The lists are extracted like so: @@ -5447,13 +5476,17 @@ pp.readToken = function(code) { return this.getTokenFromCode(code) }; -pp.fullCharCodeAtPos = function() { - var code = this.input.charCodeAt(this.pos); +pp.fullCharCodeAt = function(pos) { + var code = this.input.charCodeAt(pos); if (code <= 0xd7ff || code >= 0xdc00) { return code } - var next = this.input.charCodeAt(this.pos + 1); + var next = this.input.charCodeAt(pos + 1); return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00 }; +pp.fullCharCodeAtPos = function() { + return this.fullCharCodeAt(this.pos) +}; + pp.skipBlockComment = function() { var startLoc = this.options.onComment && this.curPosition(); var start = this.pos, end = this.input.indexOf("*/", this.pos += 2); @@ -6181,7 +6214,7 @@ pp.readWord = function() { // [ghbt]: https://github.com/acornjs/acorn/issues -var version = "8.15.0"; +var version = "8.16.0"; Parser.acorn = { Parser: Parser, diff --git a/deps/acorn/acorn/package.json b/deps/acorn/acorn/package.json index 6f63ddbf620a19..7f4d1708b3f026 100644 --- a/deps/acorn/acorn/package.json +++ b/deps/acorn/acorn/package.json @@ -16,7 +16,7 @@ ], "./package.json": "./package.json" }, - "version": "8.15.0", + "version": "8.16.0", "engines": { "node": ">=0.4.0" }, diff --git a/deps/cjs-module-lexer/dist/lexer.js b/deps/cjs-module-lexer/dist/lexer.js index d59aaf1bc47851..e1a05b5b260684 100644 --- a/deps/cjs-module-lexer/dist/lexer.js +++ b/deps/cjs-module-lexer/dist/lexer.js @@ -1 +1 @@ -"use strict";exports.init=init;exports.initSync=initSync;exports.parse=parse;let A;const B=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(I,C="@"){if(!A)throw new Error("Not initialized");const w=I.length+1,D=(A.__heap_base.value||A.__heap_base)+4*w-A.memory.buffer.byteLength;D>0&&A.memory.grow(Math.ceil(D/65536));const G=A.sa(w);(B?g:E)(I,new Uint16Array(A.memory.buffer,G,w));const S=A.parseCJS(G,I.length,0,0,0);if(S){const B=new Error(`Parse error ${C}${A.e()}:${I.slice(0,A.e()).split("\n").length}:${A.e()-I.lastIndexOf("\n",A.e()-1)}`);throw Object.assign(B,{idx:A.e()}),5!==S&&6!==S&&7!==S||Object.assign(B,{code:"ERR_LEXER_ESM_SYNTAX"}),B}let R=new Set,o=new Set,H=new Set;for(;A.rre();){const B=Q(I.slice(A.res(),A.ree()));B&&o.add(B)}for(;A.ru();)H.add(Q(I.slice(A.us(),A.ue())));for(;A.re();){let B=Q(I.slice(A.es(),A.ee()));void 0===B||H.has(B)||R.add(B)}return{exports:[...R],reexports:[...o]}}function Q(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const B=(0,eval)(A);for(let A=0;A>>8}}function g(A,B){const Q=A.length;let E=0;for(;EA.charCodeAt(0))}let C;function init(){return C||(C=(async()=>{const B=await WebAssembly.compile(I()),{exports:Q}=await WebAssembly.instantiate(B);A=Q})())}function initSync(){if(A)return;const B=new WebAssembly.Module(I()),{exports:Q}=new WebAssembly.Instance(B);A=Q} \ No newline at end of file +"use strict";exports.init=init;exports.initSync=initSync;exports.parse=parse;let A;const B=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(E,g="@"){if(!A)throw new Error("Not initialized");const w=E.length+1,D=(A.__heap_base.value||A.__heap_base)+4*w-A.memory.buffer.byteLength;D>0&&A.memory.grow(Math.ceil(D/65536));const G=A.sa(w);(B?C:I)(E,new Uint16Array(A.memory.buffer,G,w));const S=A.parseCJS(G,E.length,0,0,0);if(S){const B=new Error(`Parse error ${g}${A.e()}:${E.slice(0,A.e()).split("\n").length}:${A.e()-E.lastIndexOf("\n",A.e()-1)}`);throw Object.assign(B,{idx:A.e()}),5!==S&&6!==S&&7!==S||Object.assign(B,{code:"ERR_LEXER_ESM_SYNTAX"}),B}let o=new Set,R=new Set,y=new Set;for(;A.rre();){const B=Q(E.slice(A.res(),A.ree()));B&&R.add(B)}for(;A.ru();)y.add(Q(E.slice(A.us(),A.ue())));for(;A.re();){let B=Q(E.slice(A.es(),A.ee()));void 0===B||y.has(B)||o.add(B)}return{exports:[...o],reexports:[...R]}}function Q(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const B=function(A){const B=A[0];if('"'===B)try{return JSON.parse(A)}catch{}else if("'"===B&&A.length>1&&"'"===A[A.length-1]&&-1===A.indexOf('"'))try{return JSON.parse('"'+A.slice(1,-1)+'"')}catch{}let Q="",g={v:1};for(;g.v1114111)throw new SyntaxError;++B.v}while("}"!==A[B.v]);++B.v}else for(let E=0;E<4;++E)Q=16*Q+g(A[B.v]),++B.v;return String.fromCodePoint(Q)}(A,B);case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":return function(A,B,Q){let E=A<="3"?2:1,g=+A;do{if((A=B[Q.v])<"0"||A>"7")break;g=8*g+ +A,++Q.v,--E}while(E>0);return String.fromCodePoint(g)}(Q,A,B);default:return Q}}function g(A){if(A>="0"&&A<="9")return+A;if(A>="a"&&A<="f")return A.charCodeAt(0)-87;if(A>="A"&&A<="F")return A.charCodeAt(0)-55;throw new SyntaxError}function I(A,B){const Q=A.length;let E=0;for(;E>>8}}function C(A,B){const Q=A.length;let E=0;for(;EA.charCodeAt(0))}let D;function init(){return D||(D=(async()=>{const B=await WebAssembly.compile(w()),{exports:Q}=await WebAssembly.instantiate(B);A=Q})())}function initSync(){if(A)return;const B=new WebAssembly.Module(w()),{exports:Q}=new WebAssembly.Instance(B);A=Q} \ No newline at end of file diff --git a/deps/cjs-module-lexer/dist/lexer.mjs b/deps/cjs-module-lexer/dist/lexer.mjs index b6f5fb548bb73f..44a2f3eb0d1c35 100644 --- a/deps/cjs-module-lexer/dist/lexer.mjs +++ b/deps/cjs-module-lexer/dist/lexer.mjs @@ -1,2 +1,2 @@ -/* cjs-module-lexer 2.1.0 */ -let A;const B=1===new Uint8Array(new Uint16Array([1]).buffer)[0];export function parse(I,C="@"){if(!A)throw new Error("Not initialized");const w=I.length+1,D=(A.__heap_base.value||A.__heap_base)+4*w-A.memory.buffer.byteLength;D>0&&A.memory.grow(Math.ceil(D/65536));const G=A.sa(w);(B?g:E)(I,new Uint16Array(A.memory.buffer,G,w));const S=A.parseCJS(G,I.length,0,0,0);if(S){const B=new Error(`Parse error ${C}${A.e()}:${I.slice(0,A.e()).split("\n").length}:${A.e()-I.lastIndexOf("\n",A.e()-1)}`);throw Object.assign(B,{idx:A.e()}),5!==S&&6!==S&&7!==S||Object.assign(B,{code:"ERR_LEXER_ESM_SYNTAX"}),B}let R=new Set,o=new Set,H=new Set;for(;A.rre();){const B=Q(I.slice(A.res(),A.ree()));B&&o.add(B)}for(;A.ru();)H.add(Q(I.slice(A.us(),A.ue())));for(;A.re();){let B=Q(I.slice(A.es(),A.ee()));void 0===B||H.has(B)||R.add(B)}return{exports:[...R],reexports:[...o]}}function Q(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const B=(0,eval)(A);for(let A=0;A>>8}}function g(A,B){const Q=A.length;let E=0;for(;EA.charCodeAt(0))}let C;export function init(){return C||(C=(async()=>{const B=await WebAssembly.compile(I()),{exports:Q}=await WebAssembly.instantiate(B);A=Q})())}export function initSync(){if(A)return;const B=new WebAssembly.Module(I()),{exports:Q}=new WebAssembly.Instance(B);A=Q} \ No newline at end of file +/* cjs-module-lexer 2.2.0 */ +let A;const B=1===new Uint8Array(new Uint16Array([1]).buffer)[0];export function parse(E,g="@"){if(!A)throw new Error("Not initialized");const w=E.length+1,D=(A.__heap_base.value||A.__heap_base)+4*w-A.memory.buffer.byteLength;D>0&&A.memory.grow(Math.ceil(D/65536));const G=A.sa(w);(B?C:I)(E,new Uint16Array(A.memory.buffer,G,w));const S=A.parseCJS(G,E.length,0,0,0);if(S){const B=new Error(`Parse error ${g}${A.e()}:${E.slice(0,A.e()).split("\n").length}:${A.e()-E.lastIndexOf("\n",A.e()-1)}`);throw Object.assign(B,{idx:A.e()}),5!==S&&6!==S&&7!==S||Object.assign(B,{code:"ERR_LEXER_ESM_SYNTAX"}),B}let o=new Set,R=new Set,y=new Set;for(;A.rre();){const B=Q(E.slice(A.res(),A.ree()));B&&R.add(B)}for(;A.ru();)y.add(Q(E.slice(A.us(),A.ue())));for(;A.re();){let B=Q(E.slice(A.es(),A.ee()));void 0===B||y.has(B)||o.add(B)}return{exports:[...o],reexports:[...R]}}function Q(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const B=function(A){const B=A[0];if('"'===B)try{return JSON.parse(A)}catch{}else if("'"===B&&A.length>1&&"'"===A[A.length-1]&&-1===A.indexOf('"'))try{return JSON.parse('"'+A.slice(1,-1)+'"')}catch{}let Q="",g={v:1};for(;g.v1114111)throw new SyntaxError;++B.v}while("}"!==A[B.v]);++B.v}else for(let E=0;E<4;++E)Q=16*Q+g(A[B.v]),++B.v;return String.fromCodePoint(Q)}(A,B);case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":return function(A,B,Q){let E=A<="3"?2:1,g=+A;do{if((A=B[Q.v])<"0"||A>"7")break;g=8*g+ +A,++Q.v,--E}while(E>0);return String.fromCodePoint(g)}(Q,A,B);default:return Q}}function g(A){if(A>="0"&&A<="9")return+A;if(A>="a"&&A<="f")return A.charCodeAt(0)-87;if(A>="A"&&A<="F")return A.charCodeAt(0)-55;throw new SyntaxError}function I(A,B){const Q=A.length;let E=0;for(;E>>8}}function C(A,B){const Q=A.length;let E=0;for(;EA.charCodeAt(0))}let D;export function init(){return D||(D=(async()=>{const B=await WebAssembly.compile(w()),{exports:Q}=await WebAssembly.instantiate(B);A=Q})())}export function initSync(){if(A)return;const B=new WebAssembly.Module(w()),{exports:Q}=new WebAssembly.Instance(B);A=Q} \ No newline at end of file diff --git a/deps/cjs-module-lexer/lexer.js b/deps/cjs-module-lexer/lexer.js index aaf7dde807f98e..1614fd9e62d88f 100755 --- a/deps/cjs-module-lexer/lexer.js +++ b/deps/cjs-module-lexer/lexer.js @@ -55,7 +55,7 @@ function parseCJS (source, name = '@') { function decode (str) { if (str[0] === '"' || str[0] === '\'') { try { - const decoded = (0, eval)(str); + const decoded = scanStringLiteral(str); // Filter to exclude non-matching UTF-16 surrogate strings for (let i = 0; i < decoded.length; i++) { const surrogatePrefix = decoded.charCodeAt(i) & 0xFC00; @@ -137,8 +137,10 @@ function parseSource (cjsSource) { pos += 4; if (source.charCodeAt(pos) === 40/*(*/) { openTokenPosStack[openTokenDepth++] = lastTokenPos; - if (source.charCodeAt(++pos) === 114/*r*/) + if (source.charCodeAt(pos + 1) === 114/*r*/) { + pos++; tryParseRequire(ExportStar); + } } } lastTokenPos = pos; @@ -288,7 +290,7 @@ function tryBacktrackAddStarExportBinding (bPos) { // `Object.` `prototype.`? hasOwnProperty.call(` IDENTIFIER `, ` IDENTIFIER$2 `)` function tryParseObjectHasOwnProperty (it_id) { - ch = commentWhitespace(); + let ch = commentWhitespace(); if (ch !== 79/*O*/ || !source.startsWith('bject', pos + 1)) return false; pos += 6; ch = commentWhitespace(); @@ -1025,6 +1027,168 @@ function tryParseLiteralExports () { } } +// This function and it's callees are duplicated in src/lexer.js +function scanStringLiteral (source) { + const quote = source[0]; + + // try JSON.parse first for performance + if (quote === '"') { + try { + return JSON.parse(source); + } catch { + // ignored + } + } else if (quote === "'" && source.length > 1 && source[source.length - 1] === "'" && source.indexOf('"') === -1) { + try { + return JSON.parse('"' + source.slice(1, -1) + '"'); + } catch { + // ignored + } + } + + // fall back to doing it the hard way + let parsed = ''; + let index = { v: 1 }; + + while (index.v < source.length) { + const char = source[index.v]; + switch (char) { + case quote: { + return parsed; + } + case '\\': { + ++index.v; + parsed += scanEscapeSequence(source, index); + break; + } + case '\r': + case '\n': { + throw new SyntaxError(); + } + default: { + ++index.v; + parsed += char; + } + } + } + + throw new SyntaxError(); +} + +function scanEscapeSequence (source, index) { + if (index.v === source.length) { + throw new SyntaxError(); + } + const char = source[index.v]; + ++index.v; + switch (char) { + case '\r': { + if (source[index.v] === '\n') { + ++index.v; + } + // fall through + } + case '\n': + case '\u2028': + case '\u2029': { + return ''; + } + case 'r': { + return '\r'; + } + case 'n': { + return '\n'; + } + case 't': { + return '\t'; + } + case 'b': { + return '\b'; + } + case 'f': { + return '\f'; + } + case 'v': { + return '\v'; + } + case 'x': { + return scanHexEscapeSequence(source, index); + } + case 'u': { + return scanUnicodeEscapeSequence(source, index); + } + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': { + return scanOctalEscapeSequence(char, source, index); + } + default: { + return char; + } + } +} + +function scanHexEscapeSequence (source, index) { + const a = readHex(source[index.v]); + ++index.v; + const b = readHex(source[index.v]); + ++index.v; + return String.fromCodePoint(a * 16 + b); +} + +function scanUnicodeEscapeSequence (source, index) { + let result = 0; + if (source[index.v] === '{') { + ++index.v; + do { + result = result * 16 + readHex(source[index.v]); + if (result > 0x10FFFF) { + throw new SyntaxError(); + } + ++index.v; + } while (source[index.v] !== '}'); + ++index.v; + } else { + for (let i = 0; i < 4; ++i) { + result = result * 16 + readHex(source[index.v]); + ++index.v; + } + } + return String.fromCodePoint(result); +} + +function scanOctalEscapeSequence (char, source, index) { + let toRead = char <= '3' ? 2 : 1; + let result = +char; + do { + char = source[index.v]; + if (char < '0' || char > '7') { + break; + } + result = result * 8 + (+char); + ++index.v; + --toRead; + } while (toRead > 0); + return String.fromCodePoint(result); +} + +function readHex (char) { + if (char >= '0' && char <= '9') { + return +char; + } else if (char >= 'a' && char <= 'f') { + return char.charCodeAt(0) - 87; + } else if (char >= 'A' && char <= 'F') { + return char.charCodeAt(0) - 55; + } + throw new SyntaxError(); +} + + // --- Extracted from AcornJS --- //(https://github.com/acornjs/acorn/blob/master/acorn/src/identifier.js#L23 // diff --git a/deps/cjs-module-lexer/src/Makefile b/deps/cjs-module-lexer/src/Makefile index 9a75850f73ae65..bf45b6270a5b9c 100755 --- a/deps/cjs-module-lexer/src/Makefile +++ b/deps/cjs-module-lexer/src/Makefile @@ -1,5 +1,5 @@ -WASM2WAT := ../wabt/bin/wasm2wat -WASM_OPT := ../binaryen/bin/wasm-opt +WASM2WAT ?= ../wabt/bin/wasm2wat +WASM_OPT ?= ../binaryen/bin/wasm-opt .PHONY: optimize clean @@ -12,5 +12,8 @@ lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c | lib/ lib/: @mkdir -p $@ +optimize: lib/lexer.wasm + $(WASM_OPT) -Oz --enable-bulk-memory --strip-debug lib/lexer.wasm -o lib/lexer.wasm + clean: $(RM) lib/* diff --git a/deps/cjs-module-lexer/src/build/wasm.js b/deps/cjs-module-lexer/src/build/wasm.js index 58fb64041d7691..ad83d5992863b7 100644 --- a/deps/cjs-module-lexer/src/build/wasm.js +++ b/deps/cjs-module-lexer/src/build/wasm.js @@ -2,7 +2,7 @@ const WASM_BUILDER_CONTAINER = 'ghcr.io/nodejs/wasm-builder@sha256:975f391d907e42a75b8c72eb77c782181e941608687d4d8694c3e9df415a0970' // v0.0.9 -const WASM_OPT = './wasm-opt' +const WASM_OPT = process.env.WASM_OPT || './wasm-opt' const { execSync } = require('node:child_process') const { writeFileSync, readFileSync, existsSync, mkdirSync } = require('node:fs') diff --git a/deps/cjs-module-lexer/src/lexer.js b/deps/cjs-module-lexer/src/lexer.js index aaf7dde807f98e..1614fd9e62d88f 100755 --- a/deps/cjs-module-lexer/src/lexer.js +++ b/deps/cjs-module-lexer/src/lexer.js @@ -55,7 +55,7 @@ function parseCJS (source, name = '@') { function decode (str) { if (str[0] === '"' || str[0] === '\'') { try { - const decoded = (0, eval)(str); + const decoded = scanStringLiteral(str); // Filter to exclude non-matching UTF-16 surrogate strings for (let i = 0; i < decoded.length; i++) { const surrogatePrefix = decoded.charCodeAt(i) & 0xFC00; @@ -137,8 +137,10 @@ function parseSource (cjsSource) { pos += 4; if (source.charCodeAt(pos) === 40/*(*/) { openTokenPosStack[openTokenDepth++] = lastTokenPos; - if (source.charCodeAt(++pos) === 114/*r*/) + if (source.charCodeAt(pos + 1) === 114/*r*/) { + pos++; tryParseRequire(ExportStar); + } } } lastTokenPos = pos; @@ -288,7 +290,7 @@ function tryBacktrackAddStarExportBinding (bPos) { // `Object.` `prototype.`? hasOwnProperty.call(` IDENTIFIER `, ` IDENTIFIER$2 `)` function tryParseObjectHasOwnProperty (it_id) { - ch = commentWhitespace(); + let ch = commentWhitespace(); if (ch !== 79/*O*/ || !source.startsWith('bject', pos + 1)) return false; pos += 6; ch = commentWhitespace(); @@ -1025,6 +1027,168 @@ function tryParseLiteralExports () { } } +// This function and it's callees are duplicated in src/lexer.js +function scanStringLiteral (source) { + const quote = source[0]; + + // try JSON.parse first for performance + if (quote === '"') { + try { + return JSON.parse(source); + } catch { + // ignored + } + } else if (quote === "'" && source.length > 1 && source[source.length - 1] === "'" && source.indexOf('"') === -1) { + try { + return JSON.parse('"' + source.slice(1, -1) + '"'); + } catch { + // ignored + } + } + + // fall back to doing it the hard way + let parsed = ''; + let index = { v: 1 }; + + while (index.v < source.length) { + const char = source[index.v]; + switch (char) { + case quote: { + return parsed; + } + case '\\': { + ++index.v; + parsed += scanEscapeSequence(source, index); + break; + } + case '\r': + case '\n': { + throw new SyntaxError(); + } + default: { + ++index.v; + parsed += char; + } + } + } + + throw new SyntaxError(); +} + +function scanEscapeSequence (source, index) { + if (index.v === source.length) { + throw new SyntaxError(); + } + const char = source[index.v]; + ++index.v; + switch (char) { + case '\r': { + if (source[index.v] === '\n') { + ++index.v; + } + // fall through + } + case '\n': + case '\u2028': + case '\u2029': { + return ''; + } + case 'r': { + return '\r'; + } + case 'n': { + return '\n'; + } + case 't': { + return '\t'; + } + case 'b': { + return '\b'; + } + case 'f': { + return '\f'; + } + case 'v': { + return '\v'; + } + case 'x': { + return scanHexEscapeSequence(source, index); + } + case 'u': { + return scanUnicodeEscapeSequence(source, index); + } + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': { + return scanOctalEscapeSequence(char, source, index); + } + default: { + return char; + } + } +} + +function scanHexEscapeSequence (source, index) { + const a = readHex(source[index.v]); + ++index.v; + const b = readHex(source[index.v]); + ++index.v; + return String.fromCodePoint(a * 16 + b); +} + +function scanUnicodeEscapeSequence (source, index) { + let result = 0; + if (source[index.v] === '{') { + ++index.v; + do { + result = result * 16 + readHex(source[index.v]); + if (result > 0x10FFFF) { + throw new SyntaxError(); + } + ++index.v; + } while (source[index.v] !== '}'); + ++index.v; + } else { + for (let i = 0; i < 4; ++i) { + result = result * 16 + readHex(source[index.v]); + ++index.v; + } + } + return String.fromCodePoint(result); +} + +function scanOctalEscapeSequence (char, source, index) { + let toRead = char <= '3' ? 2 : 1; + let result = +char; + do { + char = source[index.v]; + if (char < '0' || char > '7') { + break; + } + result = result * 8 + (+char); + ++index.v; + --toRead; + } while (toRead > 0); + return String.fromCodePoint(result); +} + +function readHex (char) { + if (char >= '0' && char <= '9') { + return +char; + } else if (char >= 'a' && char <= 'f') { + return char.charCodeAt(0) - 87; + } else if (char >= 'A' && char <= 'F') { + return char.charCodeAt(0) - 55; + } + throw new SyntaxError(); +} + + // --- Extracted from AcornJS --- //(https://github.com/acornjs/acorn/blob/master/acorn/src/identifier.js#L23 // diff --git a/deps/cjs-module-lexer/src/lib/lexer.wasm b/deps/cjs-module-lexer/src/lib/lexer.wasm index ae6ac5a0f43621..d58cc87e730790 100755 Binary files a/deps/cjs-module-lexer/src/lib/lexer.wasm and b/deps/cjs-module-lexer/src/lib/lexer.wasm differ diff --git a/deps/cjs-module-lexer/src/package-lock.json b/deps/cjs-module-lexer/src/package-lock.json index e8de2e3e921611..61fd2b65fdfc51 100644 --- a/deps/cjs-module-lexer/src/package-lock.json +++ b/deps/cjs-module-lexer/src/package-lock.json @@ -1,12 +1,12 @@ { "name": "cjs-module-lexer", - "version": "2.1.0", + "version": "2.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cjs-module-lexer", - "version": "2.1.0", + "version": "2.2.0", "license": "MIT", "devDependencies": { "@babel/cli": "^7.5.5", diff --git a/deps/cjs-module-lexer/src/package.json b/deps/cjs-module-lexer/src/package.json index 9ef0db81e12b46..0e1bbf829f8acd 100755 --- a/deps/cjs-module-lexer/src/package.json +++ b/deps/cjs-module-lexer/src/package.json @@ -1,6 +1,6 @@ { "name": "cjs-module-lexer", - "version": "2.1.0", + "version": "2.2.0", "description": "Lexes CommonJS modules, returning their named exports metadata", "main": "lexer.js", "exports": { @@ -12,10 +12,10 @@ }, "types": "lexer.d.ts", "scripts": { - "test-js": "mocha -b -u tdd test/*.js", - "test-wasm": "cross-env WASM=1 mocha -b -u tdd test/*.js", - "test-wasm-sync": "cross-env WASM_SYNC=1 mocha -b -u tdd test/*.js", - "test": "npm run test-wasm ; npm run test-wasm-sync ; npm run test-js", + "test-js": "cross-env NODE_OPTIONS=--disallow-code-generation-from-strings mocha -b -u tdd test/*.js", + "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", "bench": "node --expose-gc bench/index.mjs", "build": "node build.js ; babel dist/lexer.mjs -o dist/lexer.js ; terser dist/lexer.js -o dist/lexer.js", "build-wasm": "make lib/lexer.wasm ; node build.js", diff --git a/deps/cjs-module-lexer/src/src/lexer.c b/deps/cjs-module-lexer/src/src/lexer.c index 78c6849f9c9f55..fd7ba8b4e7e7ea 100755 --- a/deps/cjs-module-lexer/src/src/lexer.c +++ b/deps/cjs-module-lexer/src/src/lexer.c @@ -120,8 +120,10 @@ uint32_t parseCJS (uint16_t* _source, uint32_t _sourceLen, void (*_addExport)(co pos += 4; if (*pos == '(') { openTokenPosStack[openTokenDepth++] = lastTokenPos; - if (*(++pos) == 'r') + if (*(pos + 1) == 'r') { + pos++; tryParseRequire(ExportStar); + } } } lastTokenPos = pos; diff --git a/deps/cjs-module-lexer/src/src/lexer.js b/deps/cjs-module-lexer/src/src/lexer.js index 1fc557dd1ef17a..30bca50218e07a 100755 --- a/deps/cjs-module-lexer/src/src/lexer.js +++ b/deps/cjs-module-lexer/src/src/lexer.js @@ -47,7 +47,7 @@ export function parse (source, name = '@') { function decode (str) { if (str[0] === '"' || str[0] === '\'') { try { - const decoded = (0, eval)(str); + const decoded = scanStringLiteral(str); // Filter to exclude non-matching UTF-16 surrogate strings for (let i = 0; i < decoded.length; i++) { const surrogatePrefix = decoded.charCodeAt(i) & 0xFC00; @@ -74,6 +74,169 @@ function decode (str) { } } + +function scanStringLiteral (source) { + const quote = source[0]; + + // try JSON.parse first for performance + if (quote === '"') { + try { + return JSON.parse(source); + } catch { + // ignored + } + } else if (quote === "'" && source.length > 1 && source[source.length - 1] === "'" && source.indexOf('"') === -1) { + try { + return JSON.parse('"' + source.slice(1, -1) + '"'); + } catch { + // ignored + } + } + + // fall back to doing it the hard way + let parsed = ''; + let index = { v: 1 }; + + while (index.v < source.length) { + const char = source[index.v]; + switch (char) { + case quote: { + return parsed; + } + case '\\': { + ++index.v; + parsed += scanEscapeSequence(source, index); + break; + } + case '\r': + case '\n': { + throw new SyntaxError(); + } + default: { + ++index.v; + parsed += char; + } + } + } + + throw new SyntaxError(); +} + +function scanEscapeSequence (source, index) { + if (index.v === source.length) { + throw new SyntaxError(); + } + const char = source[index.v]; + ++index.v; + switch (char) { + case '\r': { + if (source[index.v] === '\n') { + ++index.v; + } + // fall through + } + case '\n': + case '\u2028': + case '\u2029': { + return ''; + } + case 'r': { + return '\r'; + } + case 'n': { + return '\n'; + } + case 't': { + return '\t'; + } + case 'b': { + return '\b'; + } + case 'f': { + return '\f'; + } + case 'v': { + return '\v'; + } + case 'x': { + return scanHexEscapeSequence(source, index); + } + case 'u': { + return scanUnicodeEscapeSequence(source, index); + } + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': { + return scanOctalEscapeSequence(char, source, index); + } + default: { + return char; + } + } +} + +function scanHexEscapeSequence (source, index) { + const a = readHex(source[index.v]); + ++index.v; + const b = readHex(source[index.v]); + ++index.v; + return String.fromCodePoint(a * 16 + b); +} + +function scanUnicodeEscapeSequence (source, index) { + let result = 0; + if (source[index.v] === '{') { + ++index.v; + do { + result = result * 16 + readHex(source[index.v]); + if (result > 0x10FFFF) { + throw new SyntaxError(); + } + ++index.v; + } while (source[index.v] !== '}'); + ++index.v; + } else { + for (let i = 0; i < 4; ++i) { + result = result * 16 + readHex(source[index.v]); + ++index.v; + } + } + return String.fromCodePoint(result); +} + +function scanOctalEscapeSequence (char, source, index) { + let toRead = char <= '3' ? 2 : 1; + let result = +char; + do { + char = source[index.v]; + if (char < '0' || char > '7') { + break; + } + result = result * 8 + (+char); + ++index.v; + --toRead; + } while (toRead > 0); + return String.fromCodePoint(result); +} + +function readHex (char) { + if (char >= '0' && char <= '9') { + return +char; + } else if (char >= 'a' && char <= 'f') { + return char.charCodeAt(0) - 87; + } else if (char >= 'A' && char <= 'F') { + return char.charCodeAt(0) - 55; + } + throw new SyntaxError(); +} + + + function copyBE (src, outBuf16) { const len = src.length; let i = 0; diff --git a/deps/corepack/CHANGELOG.md b/deps/corepack/CHANGELOG.md index 61ad4b5379818c..dfc1dddd7b6a32 100644 --- a/deps/corepack/CHANGELOG.md +++ b/deps/corepack/CHANGELOG.md @@ -1,5 +1,46 @@ # Changelog +## [0.34.6](https://github.com/nodejs/corepack/compare/v0.34.5...v0.34.6) (2026-01-23) + + +### Bug Fixes + +* **docs:** fix PowerShell functions suggestions ([#784](https://github.com/nodejs/corepack/issues/784)) ([b1544c8](https://github.com/nodejs/corepack/commit/b1544c82a63781bd77d49f7b566fefd0104b7d6d)) +* update package manager versions ([#778](https://github.com/nodejs/corepack/issues/778)) ([efed597](https://github.com/nodejs/corepack/commit/efed59797d30caa362a1fa8475cd7d17dc3b7282)) + +## [0.34.5](https://github.com/nodejs/corepack/compare/v0.34.4...v0.34.5) (2025-11-24) + + +### Bug Fixes + +* **pnpm:** fix bin path for v11 ([#776](https://github.com/nodejs/corepack/issues/776)) ([0c8048a](https://github.com/nodejs/corepack/commit/0c8048adc61651f6eb798448675d3ecc4a7e26a9)) +* update package manager versions ([#773](https://github.com/nodejs/corepack/issues/773)) ([06c286b](https://github.com/nodejs/corepack/commit/06c286b5fc171e43090b5eed5cd501bc9580927f)) + +## [0.34.4](https://github.com/nodejs/corepack/compare/v0.34.3...v0.34.4) (2025-11-14) + + +### Bug Fixes + +* bump pnpm version in `config.json` ([#768](https://github.com/nodejs/corepack/issues/768)) ([99a9a6e](https://github.com/nodejs/corepack/commit/99a9a6eb1b6e918ceb896b3d558bb5ed583bdc70)) +* ignore devEngines version range when CLI provides a version ([#762](https://github.com/nodejs/corepack/issues/762)) ([ac518c4](https://github.com/nodejs/corepack/commit/ac518c4106f8d9ceb4e85e6c3614b1eba5d03fcb)) +* use `lstatSync` in `generatePosixLink` ([#767](https://github.com/nodejs/corepack/issues/767)) ([a02bea0](https://github.com/nodejs/corepack/commit/a02bea078eb584ed7492ec561626987e35386bae)) + +## [0.34.3](https://github.com/nodejs/corepack/compare/v0.34.2...v0.34.3) (2025-11-07) + + +### Bug Fixes + +* update package manager versions ([#765](https://github.com/nodejs/corepack/issues/765)) ([13a2e98](https://github.com/nodejs/corepack/commit/13a2e989ee37694a7ec1b1d60acdaa28f90642d1)) +* Yarn switch install support and tests ([#761](https://github.com/nodejs/corepack/issues/761)) ([d04d483](https://github.com/nodejs/corepack/commit/d04d4839aeecaf4fca989c577f6c000dc90be933)) + +## [0.34.2](https://github.com/nodejs/corepack/compare/v0.34.1...v0.34.2) (2025-10-31) + + +### Bug Fixes + +* bump package manager versions ([#754](https://github.com/nodejs/corepack/issues/754)) ([35e3869](https://github.com/nodejs/corepack/commit/35e3869f3f4d21bbfccdf78ea564ab0723d6f36f)) +* fix potential race condition in `node-tar` ([#757](https://github.com/nodejs/corepack/pull/757)) ([78808a7](78808a72691655fe5140c02ae41d4baef88cd9fa)) + ## [0.34.1](https://github.com/nodejs/corepack/compare/v0.34.0...v0.34.1) (2025-10-17) diff --git a/deps/corepack/README.md b/deps/corepack/README.md index 7ddf1de40022cb..1920174797a5dc 100644 --- a/deps/corepack/README.md +++ b/deps/corepack/README.md @@ -219,12 +219,12 @@ On Windows PowerShell, you can add functions using the `$PROFILE` automatic variable: ```powershell -echo "function yarn { corepack yarn `$args }" >> $PROFILE -echo "function yarnpkg { corepack yarnpkg `$args }" >> $PROFILE -echo "function pnpm { corepack pnpm `$args }" >> $PROFILE -echo "function pnpx { corepack pnpx `$args }" >> $PROFILE -echo "function npm { corepack npm `$args }" >> $PROFILE -echo "function npx { corepack npx `$args }" >> $PROFILE +echo 'function yarn { corepack yarn @args }' >> $PROFILE +echo 'function yarnpkg { corepack yarnpkg @args }' >> $PROFILE +echo 'function pnpm { corepack pnpm @args }' >> $PROFILE +echo 'function pnpx { corepack pnpx @args }' >> $PROFILE +echo 'function npm { corepack npm @args }' >> $PROFILE +echo 'function npx { corepack npx @args }' >> $PROFILE ``` ### `corepack disable [... name]` diff --git a/deps/corepack/dist/lib/corepack.cjs b/deps/corepack/dist/lib/corepack.cjs index 8a5add55f0083c..2d570f7b70233c 100644 --- a/deps/corepack/dist/lib/corepack.cjs +++ b/deps/corepack/dist/lib/corepack.cjs @@ -13800,10 +13800,10 @@ var init_esm2 = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/options.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/options.js var argmap, isSyncFile, isAsyncFile, isSyncNoFile, isAsyncNoFile, dealiasKey, dealias; var init_options = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/options.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/options.js"() { argmap = /* @__PURE__ */ new Map([ ["C", "cwd"], ["f", "file"], @@ -13853,10 +13853,10 @@ var init_options = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/make-command.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/make-command.js var makeCommand; var init_make_command = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/make-command.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/make-command.js"() { init_options(); makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => { return Object.assign((opt_ = [], entries, cb) => { @@ -14307,10 +14307,10 @@ var init_esm3 = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/large-numbers.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/large-numbers.js var encode, encodePositive, encodeNegative, parse, twos, pos, onesComp, twosComp; var init_large_numbers = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/large-numbers.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/large-numbers.js"() { encode = (num, buf) => { if (!Number.isSafeInteger(num)) { throw Error("cannot encode number outside of javascript safe integer range"); @@ -14393,10 +14393,10 @@ var init_large_numbers = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/types.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/types.js var isCode, name, code; var init_types = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/types.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/types.js"() { isCode = (c) => name.has(c); name = /* @__PURE__ */ new Map([ ["0", "File"], @@ -14441,10 +14441,10 @@ var init_types = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/header.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/header.js var import_node_path, Header, splitPrefix, decString, decDate, numToDate, decNumber, nanUndef, decSmallNumber, MAXNUM, encNumber, encSmallNumber, octalString, padOctal, encDate, NULLS, encString; var init_header = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/header.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/header.js"() { import_node_path = require("node:path"); init_large_numbers(); init_types(); @@ -14484,12 +14484,12 @@ var init_header = __esm({ if (!buf || !(buf.length >= off + 512)) { throw new Error("need 512 bytes for header"); } - this.path = decString(buf, off, 100); - this.mode = decNumber(buf, off + 100, 8); - this.uid = decNumber(buf, off + 108, 8); - this.gid = decNumber(buf, off + 116, 8); - this.size = decNumber(buf, off + 124, 12); - this.mtime = decDate(buf, off + 136, 12); + this.path = ex?.path ?? decString(buf, off, 100); + this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8); + this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8); + this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8); + this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12); + this.mtime = ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12); this.cksum = decNumber(buf, off + 148, 12); if (gex) this.#slurp(gex, true); @@ -14507,10 +14507,10 @@ var init_header = __esm({ } this.linkpath = decString(buf, off + 157, 100); if (buf.subarray(off + 257, off + 265).toString() === "ustar\x0000") { - this.uname = decString(buf, off + 265, 32); - this.gname = decString(buf, off + 297, 32); - this.devmaj = decNumber(buf, off + 329, 8) ?? 0; - this.devmin = decNumber(buf, off + 337, 8) ?? 0; + this.uname = ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32); + this.gname = ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32); + this.devmaj = ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0; + this.devmin = ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0; if (buf[off + 475] !== 0) { const prefix = decString(buf, off + 345, 155); this.path = prefix + "/" + this.path; @@ -14519,8 +14519,8 @@ var init_header = __esm({ if (prefix) { this.path = prefix + "/" + this.path; } - this.atime = decDate(buf, off + 476, 12); - this.ctime = decDate(buf, off + 488, 12); + this.atime = ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12); + this.ctime = ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12); } } let sum = 8 * 32; @@ -14652,10 +14652,10 @@ var init_header = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/pax.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/pax.js var import_node_path2, Pax, merge, parseKV, parseKVLine; var init_pax = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/pax.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/pax.js"() { import_node_path2 = require("node:path"); init_header(); Pax = class _Pax { @@ -14775,19 +14775,19 @@ var init_pax = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/normalize-windows-path.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/normalize-windows-path.js var platform, normalizeWindowsPath; var init_normalize_windows_path = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/normalize-windows-path.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/normalize-windows-path.js"() { platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; normalizeWindowsPath = platform !== "win32" ? (p) => p : (p) => p && p.replace(/\\/g, "/"); } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/read-entry.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/read-entry.js var ReadEntry; var init_read_entry = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/read-entry.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/read-entry.js"() { init_esm(); init_normalize_windows_path(); ReadEntry = class extends Minipass { @@ -14908,10 +14908,10 @@ var init_read_entry = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/warn-method.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/warn-method.js var warnMethod; var init_warn_method = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/warn-method.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/warn-method.js"() { warnMethod = (self2, code2, message, data = {}) => { if (self2.file) { data.file = self2.file; @@ -14936,10 +14936,10 @@ var init_warn_method = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/parse.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/parse.js var import_events3, maxMetaEntrySize, gzipHeader, zstdHeader, ZIP_HEADER_LEN, STATE, WRITEENTRY, READENTRY, NEXTENTRY, PROCESSENTRY, EX, GEX, META, EMITMETA, BUFFER2, QUEUE, ENDED, EMITTEDEND, EMIT, UNZIP, CONSUMECHUNK, CONSUMECHUNKSUB, CONSUMEBODY, CONSUMEMETA, CONSUMEHEADER, CONSUMING, BUFFERCONCAT, MAYBEEND, WRITING, ABORTED2, DONE, SAW_VALID_ENTRY, SAW_NULL_BLOCK, SAW_EOF, CLOSESTREAM, noop2, Parser; var init_parse = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/parse.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/parse.js"() { import_events3 = require("events"); init_esm3(); init_header(); @@ -15435,10 +15435,10 @@ var init_parse = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/strip-trailing-slashes.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/strip-trailing-slashes.js var stripTrailingSlashes; var init_strip_trailing_slashes = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/strip-trailing-slashes.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/strip-trailing-slashes.js"() { stripTrailingSlashes = (str) => { let i = str.length - 1; let slashesStart = -1; @@ -15451,7 +15451,7 @@ var init_strip_trailing_slashes = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/list.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/list.js var list_exports = {}; __export(list_exports, { filesFilter: () => filesFilter, @@ -15459,7 +15459,7 @@ __export(list_exports, { }); var import_node_fs, import_path2, onReadEntryFunction, filesFilter, listFileSync, listFile, list; var init_list = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/list.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/list.js"() { init_esm2(); import_node_fs = __toESM(require("node:fs"), 1); import_path2 = require("path"); @@ -15504,13 +15504,15 @@ var init_list = __esm({ const readSize = opt.maxReadSize || 16 * 1024 * 1024; if (stat.size < readSize) { const buf = Buffer.allocUnsafe(stat.size); - import_node_fs.default.readSync(fd, buf, 0, stat.size, 0); - p.end(buf); + const read = import_node_fs.default.readSync(fd, buf, 0, stat.size, 0); + p.end(read === buf.byteLength ? buf : buf.subarray(0, read)); } else { let pos2 = 0; const buf = Buffer.allocUnsafe(readSize); while (pos2 < stat.size) { const bytesRead = import_node_fs.default.readSync(fd, buf, 0, readSize, pos2); + if (bytesRead === 0) + break; pos2 += bytesRead; p.write(buf.subarray(0, bytesRead)); } @@ -15556,10 +15558,10 @@ var init_list = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/get-write-flag.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/get-write-flag.js var import_fs3, platform2, isWindows, O_CREAT, O_TRUNC, O_WRONLY, UV_FS_O_FILEMAP, fMapEnabled, fMapLimit, fMapFlag, getWriteFlag; var init_get_write_flag = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/get-write-flag.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/get-write-flag.js"() { import_fs3 = __toESM(require("fs"), 1); platform2 = process.env.__FAKE_PLATFORM__ || process.platform; isWindows = platform2 === "win32"; @@ -15655,10 +15657,10 @@ var init_esm4 = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/cwd-error.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/cwd-error.js var CwdError; var init_cwd_error = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/cwd-error.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/cwd-error.js"() { CwdError = class extends Error { path; code; @@ -15675,10 +15677,10 @@ var init_cwd_error = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/symlink-error.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/symlink-error.js var SymlinkError; var init_symlink_error = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/symlink-error.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/symlink-error.js"() { SymlinkError = class extends Error { path; symlink; @@ -15696,10 +15698,10 @@ var init_symlink_error = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/mkdir.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/mkdir.js var import_node_fs3, import_promises, import_node_path4, checkCwd, mkdir, mkdir_, onmkdir, checkCwdSync, mkdirSync2; var init_mkdir = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/mkdir.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/mkdir.js"() { init_esm4(); import_node_fs3 = __toESM(require("node:fs"), 1); import_promises = __toESM(require("node:fs/promises"), 1); @@ -15853,10 +15855,10 @@ var init_mkdir = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/strip-absolute-path.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/strip-absolute-path.js var import_node_path5, isAbsolute, parse3, stripAbsolutePath; var init_strip_absolute_path = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/strip-absolute-path.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/strip-absolute-path.js"() { import_node_path5 = require("node:path"); ({ isAbsolute, parse: parse3 } = import_node_path5.win32); stripAbsolutePath = (path16) => { @@ -15873,10 +15875,10 @@ var init_strip_absolute_path = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/winchars.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/winchars.js var raw, win, toWin, toRaw, encode2, decode; var init_winchars = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/winchars.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/winchars.js"() { raw = ["|", "<", ">", "?", ":"]; win = raw.map((char) => String.fromCharCode(61440 + char.charCodeAt(0))); toWin = new Map(raw.map((char, i) => [char, win[i]])); @@ -15886,16 +15888,16 @@ var init_winchars = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/normalize-unicode.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/normalize-unicode.js var normalizeCache, MAX, cache, normalizeUnicode; var init_normalize_unicode = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/normalize-unicode.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/normalize-unicode.js"() { normalizeCache = /* @__PURE__ */ Object.create(null); MAX = 1e4; cache = /* @__PURE__ */ new Set(); normalizeUnicode = (s) => { if (!cache.has(s)) { - normalizeCache[s] = s.normalize("NFD"); + normalizeCache[s] = s.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"); } else { cache.delete(s); } @@ -15915,10 +15917,10 @@ var init_normalize_unicode = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/path-reservations.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/path-reservations.js var import_node_path6, platform3, isWindows2, getDirs, PathReservations; var init_path_reservations = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/path-reservations.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/path-reservations.js"() { import_node_path6 = require("node:path"); init_normalize_unicode(); init_strip_trailing_slashes(); @@ -15946,7 +15948,7 @@ var init_path_reservations = __esm({ #running = /* @__PURE__ */ new Set(); reserve(paths, fn2) { paths = isWindows2 ? ["win32 parallelization disabled"] : paths.map((p) => { - return stripTrailingSlashes((0, import_node_path6.join)(normalizeUnicode(p))).toLowerCase(); + return stripTrailingSlashes((0, import_node_path6.join)(normalizeUnicode(p))); }); const dirs = new Set(paths.map((path16) => getDirs(path16)).reduce((a, b) => a.concat(b))); this.#reservations.set(fn2, { dirs, paths }); @@ -16055,10 +16057,10 @@ var init_path_reservations = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/unpack.js -var import_node_assert, import_node_crypto, import_node_fs4, import_node_path7, ONENTRY, CHECKFS, CHECKFS2, ISREUSABLE, MAKEFS, FILE, DIRECTORY, LINK, SYMLINK, HARDLINK, UNSUPPORTED, CHECKPATH, MKDIR, ONERROR, PENDING, PEND, UNPEND, ENDED2, MAYBECLOSE, SKIP, DOCHOWN, UID, GID, CHECKED_CWD, platform4, isWindows3, DEFAULT_MAX_DEPTH, unlinkFile, unlinkFileSync, uint32, Unpack, callSync, UnpackSync; +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/unpack.js +var import_node_assert, import_node_crypto, import_node_fs4, import_node_path7, ONENTRY, CHECKFS, CHECKFS2, ISREUSABLE, MAKEFS, FILE, DIRECTORY, LINK, SYMLINK, HARDLINK, UNSUPPORTED, CHECKPATH, STRIPABSOLUTEPATH, MKDIR, ONERROR, PENDING, PEND, UNPEND, ENDED2, MAYBECLOSE, SKIP, DOCHOWN, UID, GID, CHECKED_CWD, platform4, isWindows3, DEFAULT_MAX_DEPTH, unlinkFile, unlinkFileSync, uint32, Unpack, callSync, UnpackSync; var init_unpack = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/unpack.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/unpack.js"() { init_esm2(); import_node_assert = __toESM(require("node:assert"), 1); import_node_crypto = require("node:crypto"); @@ -16083,6 +16085,7 @@ var init_unpack = __esm({ HARDLINK = Symbol("hardlink"); UNSUPPORTED = Symbol("unsupported"); CHECKPATH = Symbol("checkPath"); + STRIPABSOLUTEPATH = Symbol("stripAbsolutePath"); MKDIR = Symbol("mkdir"); ONERROR = Symbol("onError"); PENDING = Symbol("pending"); @@ -16210,6 +16213,43 @@ var init_unpack = __esm({ this.emit("end"); } } + // return false if we need to skip this file + // return true if the field was successfully sanitized + [STRIPABSOLUTEPATH](entry, field) { + const p = entry[field]; + if (!p || this.preservePaths) + return true; + const parts = p.split("/"); + if (parts.includes("..") || /* c8 ignore next */ + isWindows3 && /^[a-z]:\.\.$/i.test(parts[0] ?? "")) { + if (field === "path") { + this.warn("TAR_ENTRY_ERROR", `${field} contains '..'`, { + entry, + [field]: p + }); + return false; + } else { + const entryDir = import_node_path7.default.posix.dirname(entry.path); + const resolved = import_node_path7.default.posix.normalize(import_node_path7.default.posix.join(entryDir, p)); + if (resolved.startsWith("../") || resolved === "..") { + this.warn("TAR_ENTRY_ERROR", `${field} escapes extraction directory`, { + entry, + [field]: p + }); + return false; + } + } + } + const [root, stripped] = stripAbsolutePath(p); + if (root) { + entry[field] = String(stripped); + this.warn("TAR_ENTRY_INFO", `stripping ${root} from absolute ${field}`, { + entry, + [field]: p + }); + } + return true; + } [CHECKPATH](entry) { const p = normalizeWindowsPath(entry.path); const parts = p.split("/"); @@ -16237,23 +16277,8 @@ var init_unpack = __esm({ }); return false; } - if (!this.preservePaths) { - if (parts.includes("..") || /* c8 ignore next */ - isWindows3 && /^[a-z]:\.\.$/i.test(parts[0] ?? "")) { - this.warn("TAR_ENTRY_ERROR", `path contains '..'`, { - entry, - path: p - }); - return false; - } - const [root, stripped] = stripAbsolutePath(p); - if (root) { - entry.path = String(stripped); - this.warn("TAR_ENTRY_INFO", `stripping ${root} from absolute path`, { - entry, - path: p - }); - } + if (!this[STRIPABSOLUTEPATH](entry, "path") || !this[STRIPABSOLUTEPATH](entry, "linkpath")) { + return false; } if (import_node_path7.default.isAbsolute(entry.path)) { entry.absolute = normalizeWindowsPath(import_node_path7.default.resolve(entry.path)); @@ -16739,14 +16764,14 @@ var init_unpack = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/extract.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/extract.js var extract_exports = {}; __export(extract_exports, { extract: () => extract }); var import_node_fs5, extractFileSync, extractFile, extract; var init_extract = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/extract.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/extract.js"() { init_esm2(); import_node_fs5 = __toESM(require("node:fs"), 1); init_list(); @@ -18492,10 +18517,10 @@ ${nodePath ? "$env:NODE_PATH=$env_node_path\n" : ""}${prependPath ? "$env:PATH=$ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/mode-fix.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/mode-fix.js var modeFix; var init_mode_fix = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/mode-fix.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/mode-fix.js"() { modeFix = (mode, isDir, portable) => { mode &= 4095; if (portable) { @@ -18517,10 +18542,10 @@ var init_mode_fix = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/write-entry.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/write-entry.js var import_fs11, import_path9, prefixPath, maxReadSize, PROCESS, FILE2, DIRECTORY2, SYMLINK2, HARDLINK2, HEADER, READ2, LSTAT, ONLSTAT, ONREAD, ONREADLINK, OPENFILE, ONOPENFILE, CLOSE, MODE, AWAITDRAIN, ONDRAIN, PREFIX, WriteEntry, WriteEntrySync, WriteEntryTar, getType; var init_write_entry = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/write-entry.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/write-entry.js"() { import_fs11 = __toESM(require("fs"), 1); init_esm(); import_path9 = __toESM(require("path"), 1); @@ -19486,10 +19511,10 @@ var init_esm5 = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/pack.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/pack.js var import_fs12, import_path10, PackJob, EOF2, ONSTAT, ENDED3, QUEUE2, CURRENT, PROCESS2, PROCESSING, PROCESSJOB, JOBS, JOBDONE, ADDFSENTRY, ADDTARENTRY, STAT, READDIR, ONREADDIR, PIPE, ENTRY, ENTRYOPT, WRITEENTRYCLASS, WRITE, ONDRAIN2, Pack, PackSync; var init_pack = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/pack.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/pack.js"() { import_fs12 = __toESM(require("fs"), 1); init_write_entry(); init_esm(); @@ -19535,6 +19560,7 @@ var init_pack = __esm({ WRITE = Symbol("write"); ONDRAIN2 = Symbol("ondrain"); Pack = class extends Minipass { + sync = false; opt; cwd; maxReadSize; @@ -19707,6 +19733,8 @@ var init_pack = __esm({ job.stat = stat; if (!this.filter(job.path, stat)) { job.ignore = true; + } else if (stat.isFile() && stat.nlink > 1 && job === this[CURRENT] && !this.linkCache.get(`${stat.dev}:${stat.ino}`) && !this.sync) { + this[PROCESSJOB](job); } this[PROCESS2](); } @@ -19917,14 +19945,14 @@ var init_pack = __esm({ } }); -// .yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/create.js +// .yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/create.js var create_exports = {}; __export(create_exports, { create: () => create }); var import_node_path8, createFileSync, createFile, addFilesSync, addFilesAsync, createSync, createAsync, create; var init_create = __esm({ - ".yarn/cache/tar-npm-7.5.1-7b414f7fec-0dad0596a6.zip/node_modules/tar/dist/esm/create.js"() { + ".yarn/cache/tar-npm-7.5.6-955ec951c2-08af380703.zip/node_modules/tar/dist/esm/create.js"() { init_esm2(); import_node_path8 = __toESM(require("node:path"), 1); init_list(); @@ -21675,7 +21703,7 @@ function String2(descriptor, ...args) { } // package.json -var version = "0.34.1"; +var version = "0.34.6"; // sources/Engine.ts var import_fs6 = __toESM(require("fs")); @@ -21689,7 +21717,7 @@ var import_valid4 = __toESM(require_valid2()); var config_default = { definitions: { npm: { - default: "11.6.2+sha1.2af8ff1f23b279df1e5289db7c70cfedd0fe18c5", + default: "11.8.0+sha1.d1bc924deb3b4d412055b1755098a70bf8a4713b", fetchLatestFrom: { type: "npm", package: "npm" @@ -21726,7 +21754,7 @@ var config_default = { } }, pnpm: { - default: "10.18.3+sha1.0202a20aaa3d7ba8bc29b50d95efe1a34dd95773", + default: "10.28.1+sha1.20817ab95fb7f61154ba5ff3bcb61f27defb6142", fetchLatestFrom: { type: "npm", package: "pnpm" @@ -21764,7 +21792,7 @@ var config_default = { ] } }, - ">=6.0.0": { + "6.x || 7.x || 8.x || 9.x || 10.x": { url: "https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz", bin: { pnpm: "./bin/pnpm.cjs", @@ -21780,6 +21808,23 @@ var config_default = { "install" ] } + }, + ">=11.0.0": { + url: "https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz", + bin: { + pnpm: "./bin/pnpm.mjs", + pnpx: "./bin/pnpx.mjs" + }, + registry: { + type: "npm", + package: "pnpm" + }, + commands: { + use: [ + "pnpm", + "install" + ] + } } } }, @@ -21790,7 +21835,7 @@ var config_default = { package: "yarn" }, transparent: { - default: "4.10.3+sha224.6020b3cdcdfbd7dbc24b7a7b75d58a249ce36068a8bf97d39aa8cc6d", + default: "4.12.0+sha224.877304a94a6946ab1d58a358df5ff8af2f7c9d86ea506f05f5c9df05", commands: [ [ "yarn", @@ -22097,6 +22142,50 @@ async function getProxyAgent(input) { return new ProxyAgent(proxy); } +// sources/nodeUtils.ts +var import_os2 = __toESM(require("os")); +function isNodeError(err) { + return !!err?.code; +} +function isExistError(err) { + return err.code === `EEXIST` || err.code === `ENOTEMPTY`; +} +function getEndOfLine(content) { + const matches = content.match(/\r?\n/g); + if (matches === null) + return import_os2.default.EOL; + const crlf = matches.filter((nl) => nl === `\r +`).length; + const lf = matches.length - crlf; + return crlf > lf ? `\r +` : ` +`; +} +function normalizeLineEndings(originalContent, newContent) { + return newContent.replace(/\r?\n/g, getEndOfLine(originalContent)); +} +function getIndent(content) { + const indentMatch = content.match(/^[ \t]+/m); + if (indentMatch) { + return indentMatch[0]; + } else { + return ` `; + } +} +function stripBOM(content) { + if (content.charCodeAt(0) === 65279) { + return content.slice(1); + } else { + return content; + } +} +function readPackageJson(content) { + return { + data: JSON.parse(stripBOM(content) || `{}`), + indent: getIndent(content) + }; +} + // sources/corepackUtils.ts var YARN_SWITCH_REGEX = /[/\\]switch[/\\]bin[/\\]/; function isYarnSwitchPath(p) { @@ -22154,7 +22243,7 @@ async function findInstalledVersion(installTarget, descriptor) { try { cacheDirectory = await import_fs4.default.promises.opendir(installFolder); } catch (error) { - if (error.code === `ENOENT`) { + if (isNodeError(error) && error.code === `ENOENT`) { return null; } else { throw error; @@ -22226,9 +22315,13 @@ async function download(installTarget, url, algo, binPath = null) { try { await renameSafe(downloadedBin, outputFile); } catch (err) { - if (err?.code === `ENOENT`) + if (isNodeError(err) && err.code === `ENOENT`) throw new Error(`Cannot locate '${binPath}' in downloaded tarball`, { cause: err }); - throw err; + if (isNodeError(err) && isExistError(err)) { + await import_fs4.default.promises.rm(downloadedBin); + } else { + throw err; + } } const fileStream = import_fs4.default.createReadStream(outputFile); hash = fileStream.pipe((0, import_crypto2.createHash)(algo)); @@ -22256,7 +22349,7 @@ async function installVersion(installTarget, locator, { spec }) { bin: corepackData.bin }; } catch (err) { - if (err?.code !== `ENOENT`) { + if (isNodeError(err) && err.code !== `ENOENT`) { throw err; } } @@ -22334,8 +22427,8 @@ async function installVersion(installTarget, locator, { spec }) { try { await renameSafe(tmpFolder, installFolder); } catch (err) { - if (err.code === `ENOTEMPTY` || // On Windows the error code is EPERM so we check if it is a directory - err.code === `EPERM` && (await import_fs4.default.promises.stat(installFolder)).isDirectory()) { + if (isNodeError(err) && (isExistError(err) || // On Windows the error code is EPERM so we check if it is a directory + err.code === `EPERM` && (await import_fs4.default.promises.stat(installFolder)).isDirectory())) { log(`Another instance of corepack installed ${locator.name}@${locator.reference}`); await import_fs4.default.promises.rm(tmpFolder, { recursive: true, force: true }); } else { @@ -22374,7 +22467,7 @@ async function renameUnderWindows(oldPath, newPath) { await import_fs4.default.promises.rename(oldPath, newPath); break; } catch (err) { - if ((err.code === `ENOENT` || err.code === `EPERM`) && i < retries - 1) { + if (isNodeError(err) && (err.code === `ENOENT` || err.code === `EPERM`) && i < retries - 1) { await (0, import_promises2.setTimeout)(100 * 2 ** i); continue; } else { @@ -22465,44 +22558,6 @@ var import_valid = __toESM(require_valid()); var import_valid2 = __toESM(require_valid2()); var import_util = require("util"); -// sources/nodeUtils.ts -var import_os2 = __toESM(require("os")); -function getEndOfLine(content) { - const matches = content.match(/\r?\n/g); - if (matches === null) - return import_os2.default.EOL; - const crlf = matches.filter((nl) => nl === `\r -`).length; - const lf = matches.length - crlf; - return crlf > lf ? `\r -` : ` -`; -} -function normalizeLineEndings(originalContent, newContent) { - return newContent.replace(/\r?\n/g, getEndOfLine(originalContent)); -} -function getIndent(content) { - const indentMatch = content.match(/^[ \t]+/m); - if (indentMatch) { - return indentMatch[0]; - } else { - return ` `; - } -} -function stripBOM(content) { - if (content.charCodeAt(0) === 65279) { - return content.slice(1); - } else { - return content; - } -} -function readPackageJson(content) { - return { - data: JSON.parse(stripBOM(content) || `{}`), - indent: getIndent(content) - }; -} - // sources/types.ts var SupportedPackageManagers = /* @__PURE__ */ ((SupportedPackageManagers3) => { SupportedPackageManagers3["Npm"] = `npm`; @@ -22689,7 +22744,7 @@ async function loadSpec(initialCwd) { onFail: selection.data.devEngines.packageManager.onFail }, // Lazy-loading it so we do not throw errors on commands that do not need valid spec. - getSpec: () => parseSpec(rawPmSpec, import_path4.default.relative(initialCwd, selection.manifestPath)) + getSpec: ({ enforceExactVersion = true } = {}) => parseSpec(rawPmSpec, import_path4.default.relative(initialCwd, selection.manifestPath), { enforceExactVersion }) }; } @@ -22872,7 +22927,7 @@ var Engine = class { * project using the default package managers, and configure it so that we * don't need to ask again in the future. */ - async findProjectSpec(initialCwd, locator, { transparent = false } = {}) { + async findProjectSpec(initialCwd, locator, { transparent = false, binaryVersion } = {}) { const fallbackDescriptor = { name: locator.name, range: `${locator.reference}` }; if (import_process3.default.env.COREPACK_ENABLE_PROJECT_SPEC === `0`) { if (typeof locator.reference === `function`) @@ -22907,7 +22962,7 @@ var Engine = class { return fallbackDescriptor; } case `Found`: { - const spec = result.getSpec(); + const spec = result.getSpec({ enforceExactVersion: !binaryVersion }); if (spec.name !== locator.name) { if (transparent) { if (typeof locator.reference === `function`) @@ -22946,7 +23001,7 @@ var Engine = class { reference: fallbackReference }; } - const descriptor = await this.findProjectSpec(cwd, fallbackLocator, { transparent: isTransparentCommand }); + const descriptor = await this.findProjectSpec(cwd, fallbackLocator, { transparent: isTransparentCommand, binaryVersion }); if (binaryVersion) descriptor.range = binaryVersion; const resolved = await this.resolveDescriptor(descriptor, { allowTags: true }); @@ -23146,17 +23201,19 @@ var EnableCommand = class extends Command { async generatePosixLink(installDirectory, distFolder, binName) { const file = import_path7.default.join(installDirectory, binName); const symlink = import_path7.default.relative(installDirectory, import_path7.default.join(distFolder, `${binName}.js`)); - if (import_fs9.default.existsSync(file)) { - const currentSymlink = await import_fs9.default.promises.readlink(file); - if (binName.includes(`yarn`) && isYarnSwitchPath(await import_fs9.default.promises.realpath(file))) { - console.warn(`${binName} is already installed in ${file} and points to a Yarn Switch install - skipping`); - return; - } - if (currentSymlink !== symlink) { - await import_fs9.default.promises.unlink(file); - } else { - return; + const stats = import_fs9.default.lstatSync(file, { throwIfNoEntry: false }); + if (stats) { + if (stats.isSymbolicLink()) { + const currentSymlink = await import_fs9.default.promises.readlink(file); + if (binName.includes(`yarn`) && isYarnSwitchPath(await import_fs9.default.promises.realpath(file))) { + console.warn(`${binName} is already installed in ${file} and points to a Yarn Switch install - skipping`); + return; + } + if (currentSymlink === symlink) { + return; + } } + await import_fs9.default.promises.unlink(file); } await import_fs9.default.promises.symlink(symlink, file); } diff --git a/deps/corepack/package.json b/deps/corepack/package.json index 245fc175913e42..ab39b1d2dd8e20 100644 --- a/deps/corepack/package.json +++ b/deps/corepack/package.json @@ -1,6 +1,6 @@ { "name": "corepack", - "version": "0.34.1", + "version": "0.34.6", "homepage": "https://github.com/nodejs/corepack#readme", "bugs": { "url": "https://github.com/nodejs/corepack/issues" @@ -16,7 +16,7 @@ "./package.json": "./package.json" }, "license": "MIT", - "packageManager": "yarn@4.10.3+sha224.6020b3cdcdfbd7dbc24b7a7b75d58a249ce36068a8bf97d39aa8cc6d", + "packageManager": "yarn@4.11.0+sha224.209a3e277c6bbc03df6e4206fbfcb0c1621c27ecf0688f79a0c619f0", "devDependencies": { "@types/debug": "^4.1.5", "@types/node": "^20.4.6", @@ -34,7 +34,7 @@ "proxy-from-env": "^1.1.0", "semver": "^7.6.3", "supports-color": "^10.0.0", - "tar": "^7.4.0", + "tar": "^7.5.4", "tsx": "^4.16.2", "typescript": "^5.7.3", "undici": "^6.21.2", diff --git a/deps/googletest/include/gtest/gtest-assertion-result.h b/deps/googletest/include/gtest/gtest-assertion-result.h index 74eb2b1f3c712c..52a6d62c77ec2f 100644 --- a/deps/googletest/include/gtest/gtest-assertion-result.h +++ b/deps/googletest/include/gtest/gtest-assertion-result.h @@ -129,8 +129,15 @@ namespace testing { // // Expected: Foo() is even // Actual: it's 5 +// + +// Returned AssertionResult objects may not be ignored. +// Note: Disabled for SWIG as it doesn't parse attributes correctly. +#if !defined(SWIG) +class [[nodiscard]] AssertionResult; +#endif // !SWIG -class GTEST_API_ AssertionResult { +class GTEST_API_ [[nodiscard]] AssertionResult { public: // Copy constructor. // Used in EXPECT_TRUE/FALSE(assertion_result). diff --git a/deps/googletest/include/gtest/gtest-death-test.h b/deps/googletest/include/gtest/gtest-death-test.h index 3c61909726f3c1..afd7b3a4685a01 100644 --- a/deps/googletest/include/gtest/gtest-death-test.h +++ b/deps/googletest/include/gtest/gtest-death-test.h @@ -192,7 +192,7 @@ GTEST_API_ bool InDeathTestChild(); // Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*: // Tests that an exit code describes a normal exit with a given exit code. -class GTEST_API_ ExitedWithCode { +class GTEST_API_ [[nodiscard]] ExitedWithCode { public: explicit ExitedWithCode(int exit_code); ExitedWithCode(const ExitedWithCode&) = default; @@ -206,7 +206,7 @@ class GTEST_API_ ExitedWithCode { #if !defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_FUCHSIA) // Tests that an exit code describes an exit due to termination by a // given signal. -class GTEST_API_ KilledBySignal { +class GTEST_API_ [[nodiscard]] KilledBySignal { public: explicit KilledBySignal(int signum); bool operator()(int exit_status) const; @@ -317,7 +317,7 @@ class GTEST_API_ KilledBySignal { GTEST_LOG_(WARNING) << "Death tests are not supported on this platform.\n" \ << "Statement '" #statement "' cannot be verified."; \ } else if (::testing::internal::AlwaysFalse()) { \ - ::testing::internal::MakeDeathTestMatcher(regex_or_matcher); \ + (void)::testing::internal::MakeDeathTestMatcher(regex_or_matcher); \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ terminator; \ } else \ diff --git a/deps/googletest/include/gtest/gtest-matchers.h b/deps/googletest/include/gtest/gtest-matchers.h index 78160f0e418da6..6d2ab14d2ad9bd 100644 --- a/deps/googletest/include/gtest/gtest-matchers.h +++ b/deps/googletest/include/gtest/gtest-matchers.h @@ -40,6 +40,7 @@ #define GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_ #include +#include #include #include #include @@ -75,7 +76,7 @@ namespace testing { // 2. a factory function that creates a Matcher object from a // FooMatcherMatcher. -class MatchResultListener { +class [[nodiscard]] MatchResultListener { public: // Creates a listener object with the given underlying ostream. The // listener does not own the ostream, and does not dereference it @@ -111,7 +112,7 @@ inline MatchResultListener::~MatchResultListener() = default; // An instance of a subclass of this knows how to describe itself as a // matcher. -class GTEST_API_ MatcherDescriberInterface { +class GTEST_API_ [[nodiscard]] MatcherDescriberInterface { public: virtual ~MatcherDescriberInterface() = default; @@ -137,7 +138,7 @@ class GTEST_API_ MatcherDescriberInterface { // The implementation of a matcher. template -class MatcherInterface : public MatcherDescriberInterface { +class [[nodiscard]] MatcherInterface : public MatcherDescriberInterface { public: // Returns true if and only if the matcher matches x; also explains the // match result to 'listener' if necessary (see the next paragraph), in @@ -180,7 +181,7 @@ class MatcherInterface : public MatcherDescriberInterface { namespace internal { // A match result listener that ignores the explanation. -class DummyMatchResultListener : public MatchResultListener { +class [[nodiscard]] DummyMatchResultListener : public MatchResultListener { public: DummyMatchResultListener() : MatchResultListener(nullptr) {} @@ -192,7 +193,7 @@ class DummyMatchResultListener : public MatchResultListener { // A match result listener that forwards the explanation to a given // ostream. The difference between this and MatchResultListener is // that the former is concrete. -class StreamMatchResultListener : public MatchResultListener { +class [[nodiscard]] StreamMatchResultListener : public MatchResultListener { public: explicit StreamMatchResultListener(::std::ostream* os) : MatchResultListener(os) {} @@ -225,7 +226,7 @@ struct SharedPayload : SharedPayloadBase { // from it. We put functionalities common to all Matcher // specializations here to avoid code duplication. template -class MatcherBase : private MatcherDescriberInterface { +class [[nodiscard]] MatcherBase : private MatcherDescriberInterface { public: // Returns true if and only if the matcher matches x; also explains the // match result to 'listener'. @@ -296,12 +297,12 @@ class MatcherBase : private MatcherDescriberInterface { return *this; } - MatcherBase(MatcherBase&& other) + MatcherBase(MatcherBase&& other) noexcept : vtable_(other.vtable_), buffer_(other.buffer_) { other.vtable_ = nullptr; } - MatcherBase& operator=(MatcherBase&& other) { + MatcherBase& operator=(MatcherBase&& other) noexcept { if (this == &other) return *this; Destroy(); vtable_ = other.vtable_; @@ -460,7 +461,7 @@ class MatcherBase : private MatcherDescriberInterface { // implementation of Matcher is just a std::shared_ptr to const // MatcherInterface. Don't inherit from Matcher! template -class Matcher : public internal::MatcherBase { +class [[nodiscard]] Matcher : public internal::MatcherBase { public: // Constructs a null matcher. Needed for storing Matcher objects in STL // containers. A default-constructed matcher is not yet initialized. You @@ -485,14 +486,23 @@ class Matcher : public internal::MatcherBase { // Implicit constructor here allows people to write // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes Matcher(T value); // NOLINT + + // Implicit constructor here allows people to write + // EXPECT_THAT(foo, nullptr) instead of EXPECT_THAT(foo, IsNull()) for smart + // pointer types. + // + // The second argument is needed to avoid capturing literal '0'. + template + Matcher(U, // NOLINT + std::enable_if_t>* = nullptr); }; // The following two specializations allow the user to write str // instead of Eq(str) and "foo" instead of Eq("foo") when a std::string // matcher is expected. template <> -class GTEST_API_ Matcher - : public internal::MatcherBase { +class GTEST_API_ [[nodiscard]] +Matcher : public internal::MatcherBase { public: Matcher() = default; @@ -513,8 +523,8 @@ class GTEST_API_ Matcher }; template <> -class GTEST_API_ Matcher - : public internal::MatcherBase { +class GTEST_API_ [[nodiscard]] +Matcher : public internal::MatcherBase { public: Matcher() = default; @@ -541,7 +551,7 @@ class GTEST_API_ Matcher // instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view // matcher is expected. template <> -class GTEST_API_ Matcher +class GTEST_API_ [[nodiscard]] Matcher : public internal::MatcherBase { public: Matcher() = default; @@ -567,7 +577,7 @@ class GTEST_API_ Matcher }; template <> -class GTEST_API_ Matcher +class GTEST_API_ [[nodiscard]] Matcher : public internal::MatcherBase { public: Matcher() = default; @@ -614,7 +624,7 @@ std::ostream& operator<<(std::ostream& os, const Matcher& matcher) { // // See the definition of NotNull() for a complete example. template -class PolymorphicMatcher { +class [[nodiscard]] PolymorphicMatcher { public: explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {} @@ -689,7 +699,7 @@ namespace internal { // The following template definition assumes that the Rhs parameter is // a "bare" type (i.e. neither 'const T' nor 'T&'). template -class ComparisonBase { +class [[nodiscard]] ComparisonBase { public: explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {} @@ -722,7 +732,8 @@ class ComparisonBase { }; template -class EqMatcher : public ComparisonBase, Rhs, std::equal_to<>> { +class [[nodiscard]] EqMatcher + : public ComparisonBase, Rhs, std::equal_to<>> { public: explicit EqMatcher(const Rhs& rhs) : ComparisonBase, Rhs, std::equal_to<>>(rhs) {} @@ -730,7 +741,7 @@ class EqMatcher : public ComparisonBase, Rhs, std::equal_to<>> { static const char* NegatedDesc() { return "isn't equal to"; } }; template -class NeMatcher +class [[nodiscard]] NeMatcher : public ComparisonBase, Rhs, std::not_equal_to<>> { public: explicit NeMatcher(const Rhs& rhs) @@ -739,7 +750,8 @@ class NeMatcher static const char* NegatedDesc() { return "is equal to"; } }; template -class LtMatcher : public ComparisonBase, Rhs, std::less<>> { +class [[nodiscard]] LtMatcher + : public ComparisonBase, Rhs, std::less<>> { public: explicit LtMatcher(const Rhs& rhs) : ComparisonBase, Rhs, std::less<>>(rhs) {} @@ -747,7 +759,8 @@ class LtMatcher : public ComparisonBase, Rhs, std::less<>> { static const char* NegatedDesc() { return "isn't <"; } }; template -class GtMatcher : public ComparisonBase, Rhs, std::greater<>> { +class [[nodiscard]] GtMatcher + : public ComparisonBase, Rhs, std::greater<>> { public: explicit GtMatcher(const Rhs& rhs) : ComparisonBase, Rhs, std::greater<>>(rhs) {} @@ -755,7 +768,7 @@ class GtMatcher : public ComparisonBase, Rhs, std::greater<>> { static const char* NegatedDesc() { return "isn't >"; } }; template -class LeMatcher +class [[nodiscard]] LeMatcher : public ComparisonBase, Rhs, std::less_equal<>> { public: explicit LeMatcher(const Rhs& rhs) @@ -764,7 +777,7 @@ class LeMatcher static const char* NegatedDesc() { return "isn't <="; } }; template -class GeMatcher +class [[nodiscard]] GeMatcher : public ComparisonBase, Rhs, std::greater_equal<>> { public: explicit GeMatcher(const Rhs& rhs) @@ -773,6 +786,35 @@ class GeMatcher static const char* NegatedDesc() { return "isn't >="; } }; +// Same as `EqMatcher`, except that the `rhs` is stored as `StoredRhs` and +// must be implicitly convertible to `Rhs`. +template +class [[nodiscard]] ImplicitCastEqMatcher { + public: + explicit ImplicitCastEqMatcher(const StoredRhs& rhs) : stored_rhs_(rhs) {} + + using is_gtest_matcher = void; + + template + bool MatchAndExplain(const Lhs& lhs, std::ostream*) const { + return lhs == rhs(); + } + + void DescribeTo(std::ostream* os) const { + *os << "is equal to "; + UniversalPrint(rhs(), os); + } + void DescribeNegationTo(std::ostream* os) const { + *os << "isn't equal to "; + UniversalPrint(rhs(), os); + } + + private: + Rhs rhs() const { return ImplicitCast_(stored_rhs_); } + + StoredRhs stored_rhs_; +}; + template ::value>::type> using StringLike = T; @@ -780,7 +822,7 @@ using StringLike = T; // Implements polymorphic matchers MatchesRegex(regex) and // ContainsRegex(regex), which can be used as a Matcher as long as // T can be converted to a string. -class MatchesRegexMatcher { +class [[nodiscard]] MatchesRegexMatcher { public: MatchesRegexMatcher(const RE* regex, bool full_match) : regex_(regex), full_match_(full_match) {} @@ -863,13 +905,21 @@ inline internal::EqMatcher Eq(T x) { return internal::EqMatcher(x); } -// Constructs a Matcher from a 'value' of type T. The constructed +// Constructs a Matcher from a 'value' of type T. The constructed // matcher matches any value that's equal to 'value'. template Matcher::Matcher(T value) { *this = Eq(value); } +// Constructs a Matcher from nullptr. The constructed matcher matches any +// value that is equal to nullptr. +template +template +Matcher::Matcher(U, std::enable_if_t>*) { + *this = Eq(nullptr); +} + // Creates a monomorphic matcher that matches anything with type Lhs // and equal to rhs. A user may need to use this instead of Eq(...) // in order to resolve an overloading ambiguity. diff --git a/deps/googletest/include/gtest/gtest-param-test.h b/deps/googletest/include/gtest/gtest-param-test.h index 55ee088b93fb8d..9e023f96dc60f7 100644 --- a/deps/googletest/include/gtest/gtest-param-test.h +++ b/deps/googletest/include/gtest/gtest-param-test.h @@ -174,6 +174,7 @@ TEST_P(DerivedTest, DoesBlah) { #endif // 0 +#include #include #include @@ -413,7 +414,8 @@ internal::CartesianProductHolder Combine(const Generator&... g) { // Synopsis: // ConvertGenerator(gen) // - returns a generator producing the same elements as generated by gen, but -// each element is static_cast to type T before being returned +// each T-typed element is static_cast to a type deduced from the interface +// that accepts this generator, and then returned // // It is useful when using the Combine() function to get the generated // parameters in a custom type instead of std::tuple @@ -441,10 +443,65 @@ internal::CartesianProductHolder Combine(const Generator&... g) { // Combine(Values("cat", "dog"), // Values(BLACK, WHITE)))); // -template -internal::ParamConverterGenerator ConvertGenerator( - internal::ParamGenerator gen) { - return internal::ParamConverterGenerator(gen); +template +internal::ParamConverterGenerator ConvertGenerator( + internal::ParamGenerator gen) { + return internal::ParamConverterGenerator(std::move(gen)); +} + +// As above, but takes a callable as a second argument. The callable converts +// the generated parameter to the test fixture's parameter type. This allows you +// to use a parameter type that does not have a converting constructor from the +// generated type. +// +// Example: +// +// This will instantiate tests in test suite AnimalTest each one with +// the parameter values tuple("cat", BLACK), tuple("cat", WHITE), +// tuple("dog", BLACK), and tuple("dog", WHITE): +// +// enum Color { BLACK, GRAY, WHITE }; +// struct ParamType { +// std::string animal; +// Color color; +// }; +// class AnimalTest +// : public testing::TestWithParam {...}; +// +// TEST_P(AnimalTest, AnimalLooksNice) {...} +// +// INSTANTIATE_TEST_SUITE_P( +// AnimalVariations, AnimalTest, +// ConvertGenerator(Combine(Values("cat", "dog"), Values(BLACK, WHITE)), +// [](std::tuple t) { +// return ParamType{.animal = std::get<0>(t), +// .color = std::get<1>(t)}; +// })); +// +template ()))> +internal::ParamConverterGenerator ConvertGenerator(Gen&& gen, + Func&& f) { + return internal::ParamConverterGenerator( + std::forward(gen), std::forward(f)); +} + +// As above, but infers the T from the supplied std::function instead of +// having the caller specify it. +template ()))> +auto ConvertGenerator(Gen&& gen, Func&& f) { + constexpr bool is_single_arg_std_function = + internal::IsSingleArgStdFunction::value; + if constexpr (is_single_arg_std_function) { + return ConvertGenerator< + typename internal::FuncSingleParamType::type>( + std::forward(gen), std::forward(f)); + } else { + static_assert(is_single_arg_std_function, + "The call signature must contain a single argument."); + } } #define TEST_P(test_suite_name, test_name) \ @@ -469,7 +526,7 @@ internal::ParamConverterGenerator ConvertGenerator( ::testing::internal::CodeLocation(__FILE__, __LINE__)); \ return 0; \ } \ - GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static int gtest_registering_dummy_; \ + [[maybe_unused]] static int gtest_registering_dummy_; \ }; \ int GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::gtest_registering_dummy_ = \ @@ -493,39 +550,38 @@ internal::ParamConverterGenerator ConvertGenerator( #define GTEST_GET_FIRST_(first, ...) first #define GTEST_GET_SECOND_(first, second, ...) second -#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \ - static ::testing::internal::ParamGenerator \ - gtest_##prefix##test_suite_name##_EvalGenerator_() { \ - return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \ - } \ - static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \ - const ::testing::TestParamInfo& info) { \ - if (::testing::internal::AlwaysFalse()) { \ - ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \ - __VA_ARGS__, \ - ::testing::internal::DefaultParamName, \ - DUMMY_PARAM_))); \ - auto t = std::make_tuple(__VA_ARGS__); \ - static_assert(std::tuple_size::value <= 2, \ - "Too Many Args!"); \ - } \ - return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \ - __VA_ARGS__, \ - ::testing::internal::DefaultParamName, \ - DUMMY_PARAM_))))(info); \ - } \ - GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static int \ - gtest_##prefix##test_suite_name##_dummy_ = \ - ::testing::UnitTest::GetInstance() \ - ->parameterized_test_registry() \ - .GetTestSuitePatternHolder( \ - GTEST_STRINGIFY_(test_suite_name), \ - ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ - ->AddTestSuiteInstantiation( \ - GTEST_STRINGIFY_(prefix), \ - >est_##prefix##test_suite_name##_EvalGenerator_, \ - >est_##prefix##test_suite_name##_EvalGenerateName_, \ - __FILE__, __LINE__) +#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \ + static ::testing::internal::ParamGenerator \ + gtest_##prefix##test_suite_name##_EvalGenerator_() { \ + return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \ + } \ + static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \ + const ::testing::TestParamInfo& info) { \ + if (::testing::internal::AlwaysFalse()) { \ + ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \ + __VA_ARGS__, \ + ::testing::internal::DefaultParamName, \ + DUMMY_PARAM_))); \ + auto t = std::make_tuple(__VA_ARGS__); \ + static_assert(std::tuple_size::value <= 2, \ + "Too Many Args!"); \ + } \ + return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \ + __VA_ARGS__, \ + ::testing::internal::DefaultParamName, \ + DUMMY_PARAM_))))(info); \ + } \ + [[maybe_unused]] static int gtest_##prefix##test_suite_name##_dummy_ = \ + ::testing::UnitTest::GetInstance() \ + ->parameterized_test_registry() \ + .GetTestSuitePatternHolder( \ + GTEST_STRINGIFY_(test_suite_name), \ + ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ + ->AddTestSuiteInstantiation( \ + GTEST_STRINGIFY_(prefix), \ + >est_##prefix##test_suite_name##_EvalGenerator_, \ + >est_##prefix##test_suite_name##_EvalGenerateName_, __FILE__, \ + __LINE__) // Allow Marking a Parameterized test class as not needing to be instantiated. #define GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(T) \ diff --git a/deps/googletest/include/gtest/gtest-printers.h b/deps/googletest/include/gtest/gtest-printers.h index 198a7693493a33..d1704bb7580a96 100644 --- a/deps/googletest/include/gtest/gtest-printers.h +++ b/deps/googletest/include/gtest/gtest-printers.h @@ -104,15 +104,19 @@ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ #define GOOGLETEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ +#include #include #include +#include #include // NOLINT #include #include +#include #include #include #include #include +#include #include #ifdef GTEST_HAS_ABSL @@ -245,8 +249,8 @@ struct StreamPrinter { // ADL (possibly involving implicit conversions). // (Use SFINAE via return type, because it seems GCC < 12 doesn't handle name // lookup properly when we do it in the template parameter list.) - static auto PrintValue(const T& value, - ::std::ostream* os) -> decltype((void)(*os << value)) { + static auto PrintValue(const T& value, ::std::ostream* os) + -> decltype((void)(*os << value)) { // Call streaming operator found by ADL, possibly with implicit conversions // of the arguments. *os << value; @@ -378,7 +382,7 @@ void PrintWithFallback(const T& value, ::std::ostream* os) { // The default case. template -class FormatForComparison { +class [[nodiscard]] FormatForComparison { public: static ::std::string Format(const ToPrint& value) { return ::testing::PrintToString(value); @@ -387,7 +391,7 @@ class FormatForComparison { // Array. template -class FormatForComparison { +class [[nodiscard]] FormatForComparison { public: static ::std::string Format(const ToPrint* value) { return FormatForComparison::Format(value); @@ -473,7 +477,7 @@ std::string FormatForComparisonFailureMessage(const T1& value, // function template), as we need to partially specialize it for // reference types, which cannot be done with function templates. template -class UniversalPrinter; +class [[nodiscard]] UniversalPrinter; // Prints the given value using the << operator if it has one; // otherwise prints the bytes in it. This is what @@ -521,11 +525,15 @@ GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os); GTEST_API_ void PrintTo(char32_t c, ::std::ostream* os); inline void PrintTo(char16_t c, ::std::ostream* os) { - PrintTo(ImplicitCast_(c), os); + // TODO(b/418738869): Incorrect for values not representing valid codepoints. + // Also see https://github.com/google/googletest/issues/4762. + PrintTo(static_cast(c), os); } #ifdef __cpp_lib_char8_t inline void PrintTo(char8_t c, ::std::ostream* os) { - PrintTo(ImplicitCast_(c), os); + // TODO(b/418738869): Incorrect for values not representing valid codepoints. + // Also see https://github.com/google/googletest/issues/4762. + PrintTo(static_cast(c), os); } #endif @@ -695,44 +703,63 @@ void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) { } } -// Overloads for ::std::string. -GTEST_API_ void PrintStringTo(const ::std::string& s, ::std::ostream* os); +// Overloads for ::std::string and ::std::string_view +GTEST_API_ void PrintStringTo(::std::string_view s, ::std::ostream* os); inline void PrintTo(const ::std::string& s, ::std::ostream* os) { PrintStringTo(s, os); } +inline void PrintTo(::std::string_view s, ::std::ostream* os) { + PrintStringTo(s, os); +} -// Overloads for ::std::u8string +// Overloads for ::std::u8string and ::std::u8string_view #ifdef __cpp_lib_char8_t -GTEST_API_ void PrintU8StringTo(const ::std::u8string& s, ::std::ostream* os); +GTEST_API_ void PrintU8StringTo(::std::u8string_view s, ::std::ostream* os); inline void PrintTo(const ::std::u8string& s, ::std::ostream* os) { PrintU8StringTo(s, os); } +inline void PrintTo(::std::u8string_view s, ::std::ostream* os) { + PrintU8StringTo(s, os); +} #endif -// Overloads for ::std::u16string -GTEST_API_ void PrintU16StringTo(const ::std::u16string& s, ::std::ostream* os); +// Overloads for ::std::u16string and ::std::u16string_view +GTEST_API_ void PrintU16StringTo(::std::u16string_view s, ::std::ostream* os); inline void PrintTo(const ::std::u16string& s, ::std::ostream* os) { PrintU16StringTo(s, os); } +inline void PrintTo(::std::u16string_view s, ::std::ostream* os) { + PrintU16StringTo(s, os); +} -// Overloads for ::std::u32string -GTEST_API_ void PrintU32StringTo(const ::std::u32string& s, ::std::ostream* os); +// Overloads for ::std::u32string and ::std::u32string_view +GTEST_API_ void PrintU32StringTo(::std::u32string_view s, ::std::ostream* os); inline void PrintTo(const ::std::u32string& s, ::std::ostream* os) { PrintU32StringTo(s, os); } +inline void PrintTo(::std::u32string_view s, ::std::ostream* os) { + PrintU32StringTo(s, os); +} -// Overloads for ::std::wstring. +// Overloads for ::std::wstring and ::std::wstring_view #if GTEST_HAS_STD_WSTRING -GTEST_API_ void PrintWideStringTo(const ::std::wstring& s, ::std::ostream* os); +GTEST_API_ void PrintWideStringTo(::std::wstring_view s, ::std::ostream* os); inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) { PrintWideStringTo(s, os); } +inline void PrintTo(::std::wstring_view s, ::std::ostream* os) { + PrintWideStringTo(s, os); +} #endif // GTEST_HAS_STD_WSTRING #if GTEST_INTERNAL_HAS_STRING_VIEW -// Overload for internal::StringView. +// Overload for internal::StringView. Needed for build configurations where +// internal::StringView is an alias for absl::string_view, but absl::string_view +// is a distinct type from std::string_view. +template , int> = 0> inline void PrintTo(internal::StringView sp, ::std::ostream* os) { - PrintTo(::std::string(sp), os); + PrintStringTo(sp, os); } #endif // GTEST_INTERNAL_HAS_STRING_VIEW @@ -862,7 +889,7 @@ void PrintTo(const ::std::pair& value, ::std::ostream* os) { // Implements printing a non-reference type T by letting the compiler // pick the right overload of PrintTo() for T. template -class UniversalPrinter { +class [[nodiscard]] UniversalPrinter { public: // MSVC warns about adding const to a function type, so we want to // disable the warning. @@ -888,16 +915,13 @@ class UniversalPrinter { // Remove any const-qualifiers before passing a type to UniversalPrinter. template -class UniversalPrinter : public UniversalPrinter {}; - -#if GTEST_INTERNAL_HAS_ANY - -// Printer for std::any / absl::any +class [[nodiscard]] UniversalPrinter : public UniversalPrinter {}; +// Printer for std::any template <> -class UniversalPrinter { +class [[nodiscard]] UniversalPrinter { public: - static void Print(const Any& value, ::std::ostream* os) { + static void Print(const std::any& value, ::std::ostream* os) { if (value.has_value()) { *os << "value of type " << GetTypeName(value); } else { @@ -906,7 +930,7 @@ class UniversalPrinter { } private: - static std::string GetTypeName(const Any& value) { + static std::string GetTypeName(const std::any& value) { #if GTEST_HAS_RTTI return internal::GetTypeName(value.type()); #else @@ -916,16 +940,11 @@ class UniversalPrinter { } }; -#endif // GTEST_INTERNAL_HAS_ANY - -#if GTEST_INTERNAL_HAS_OPTIONAL - -// Printer for std::optional / absl::optional - +// Printer for std::optional template -class UniversalPrinter> { +class [[nodiscard]] UniversalPrinter> { public: - static void Print(const Optional& value, ::std::ostream* os) { + static void Print(const std::optional& value, ::std::ostream* os) { *os << '('; if (!value) { *os << "nullopt"; @@ -937,29 +956,18 @@ class UniversalPrinter> { }; template <> -class UniversalPrinter { +class [[nodiscard]] UniversalPrinter { public: - static void Print(decltype(Nullopt()), ::std::ostream* os) { - *os << "(nullopt)"; - } + static void Print(std::nullopt_t, ::std::ostream* os) { *os << "(nullopt)"; } }; -#endif // GTEST_INTERNAL_HAS_OPTIONAL - -#if GTEST_INTERNAL_HAS_VARIANT - -// Printer for std::variant / absl::variant - +// Printer for std::variant template -class UniversalPrinter> { +class [[nodiscard]] UniversalPrinter> { public: - static void Print(const Variant& value, ::std::ostream* os) { + static void Print(const std::variant& value, ::std::ostream* os) { *os << '('; -#ifdef GTEST_HAS_ABSL - absl::visit(Visitor{os, value.index()}, value); -#else std::visit(Visitor{os, value.index()}, value); -#endif // GTEST_HAS_ABSL *os << ')'; } @@ -976,8 +984,6 @@ class UniversalPrinter> { }; }; -#endif // GTEST_INTERNAL_HAS_VARIANT - // UniversalPrintArray(begin, len, os) prints an array of 'len' // elements, starting at address 'begin'. template @@ -1025,7 +1031,7 @@ GTEST_API_ void UniversalPrintArray(const wchar_t* begin, size_t len, // Implements printing an array type T[N]. template -class UniversalPrinter { +class [[nodiscard]] UniversalPrinter { public: // Prints the given array, omitting some elements when there are too // many. @@ -1036,7 +1042,7 @@ class UniversalPrinter { // Implements printing a reference type T&. template -class UniversalPrinter { +class [[nodiscard]] UniversalPrinter { public: // MSVC warns about adding const to a function type, so we want to // disable the warning. @@ -1059,35 +1065,35 @@ class UniversalPrinter { // NUL-terminated string (but not the pointer) is printed. template -class UniversalTersePrinter { +class [[nodiscard]] UniversalTersePrinter { public: static void Print(const T& value, ::std::ostream* os) { UniversalPrint(value, os); } }; template -class UniversalTersePrinter { +class [[nodiscard]] UniversalTersePrinter { public: static void Print(const T& value, ::std::ostream* os) { UniversalPrint(value, os); } }; template -class UniversalTersePrinter> { +class [[nodiscard]] UniversalTersePrinter> { public: static void Print(std::reference_wrapper value, ::std::ostream* os) { UniversalTersePrinter::Print(value.get(), os); } }; template -class UniversalTersePrinter { +class [[nodiscard]] UniversalTersePrinter { public: static void Print(const T (&value)[N], ::std::ostream* os) { UniversalPrinter::Print(value, os); } }; template <> -class UniversalTersePrinter { +class [[nodiscard]] UniversalTersePrinter { public: static void Print(const char* str, ::std::ostream* os) { if (str == nullptr) { @@ -1098,12 +1104,12 @@ class UniversalTersePrinter { } }; template <> -class UniversalTersePrinter : public UniversalTersePrinter { -}; +class [[nodiscard]] +UniversalTersePrinter : public UniversalTersePrinter {}; #ifdef __cpp_lib_char8_t template <> -class UniversalTersePrinter { +class [[nodiscard]] UniversalTersePrinter { public: static void Print(const char8_t* str, ::std::ostream* os) { if (str == nullptr) { @@ -1114,12 +1120,12 @@ class UniversalTersePrinter { } }; template <> -class UniversalTersePrinter +class [[nodiscard]] UniversalTersePrinter : public UniversalTersePrinter {}; #endif template <> -class UniversalTersePrinter { +class [[nodiscard]] UniversalTersePrinter { public: static void Print(const char16_t* str, ::std::ostream* os) { if (str == nullptr) { @@ -1130,11 +1136,11 @@ class UniversalTersePrinter { } }; template <> -class UniversalTersePrinter +class [[nodiscard]] UniversalTersePrinter : public UniversalTersePrinter {}; template <> -class UniversalTersePrinter { +class [[nodiscard]] UniversalTersePrinter { public: static void Print(const char32_t* str, ::std::ostream* os) { if (str == nullptr) { @@ -1145,12 +1151,12 @@ class UniversalTersePrinter { } }; template <> -class UniversalTersePrinter +class [[nodiscard]] UniversalTersePrinter : public UniversalTersePrinter {}; #if GTEST_HAS_STD_WSTRING template <> -class UniversalTersePrinter { +class [[nodiscard]] UniversalTersePrinter { public: static void Print(const wchar_t* str, ::std::ostream* os) { if (str == nullptr) { @@ -1163,7 +1169,7 @@ class UniversalTersePrinter { #endif template <> -class UniversalTersePrinter { +class [[nodiscard]] UniversalTersePrinter { public: static void Print(wchar_t* str, ::std::ostream* os) { UniversalTersePrinter::Print(str, os); diff --git a/deps/googletest/include/gtest/gtest-spi.h b/deps/googletest/include/gtest/gtest-spi.h index c0613b6959560b..27c2d660e0d51d 100644 --- a/deps/googletest/include/gtest/gtest-spi.h +++ b/deps/googletest/include/gtest/gtest-spi.h @@ -51,7 +51,7 @@ namespace testing { // generated in the same thread that created this object or it can intercept // all generated failures. The scope of this mock object can be controlled with // the second argument to the two arguments constructor. -class GTEST_API_ ScopedFakeTestPartResultReporter +class GTEST_API_ [[nodiscard]] ScopedFakeTestPartResultReporter : public TestPartResultReporterInterface { public: // The two possible mocking modes of this object. @@ -100,7 +100,7 @@ namespace internal { // TestPartResultArray contains exactly one failure that has the given // type and contains the given substring. If that's not the case, a // non-fatal failure will be generated. -class GTEST_API_ SingleFailureChecker { +class GTEST_API_ [[nodiscard]] SingleFailureChecker { public: // The constructor remembers the arguments. SingleFailureChecker(const TestPartResultArray* results, diff --git a/deps/googletest/include/gtest/gtest-test-part.h b/deps/googletest/include/gtest/gtest-test-part.h index 41c8a9a0d0e31f..90380a973070b9 100644 --- a/deps/googletest/include/gtest/gtest-test-part.h +++ b/deps/googletest/include/gtest/gtest-test-part.h @@ -51,7 +51,7 @@ namespace testing { // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()). // // Don't inherit from TestPartResult as its destructor is not virtual. -class GTEST_API_ TestPartResult { +class GTEST_API_ [[nodiscard]] TestPartResult { public: // The possible outcomes of a test part (i.e. an assertion or an // explicit SUCCEED(), FAIL(), or ADD_FAILURE()). @@ -131,7 +131,7 @@ std::ostream& operator<<(std::ostream& os, const TestPartResult& result); // // Don't inherit from TestPartResultArray as its destructor is not // virtual. -class GTEST_API_ TestPartResultArray { +class GTEST_API_ [[nodiscard]] TestPartResultArray { public: TestPartResultArray() = default; @@ -152,7 +152,7 @@ class GTEST_API_ TestPartResultArray { }; // This interface knows how to report a test part result. -class GTEST_API_ TestPartResultReporterInterface { +class GTEST_API_ [[nodiscard]] TestPartResultReporterInterface { public: virtual ~TestPartResultReporterInterface() = default; @@ -167,7 +167,7 @@ namespace internal { // reported, it only delegates the reporting to the former result reporter. // The original result reporter is restored in the destructor. // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -class GTEST_API_ HasNewFatalFailureHelper +class GTEST_API_ [[nodiscard]] HasNewFatalFailureHelper : public TestPartResultReporterInterface { public: HasNewFatalFailureHelper(); diff --git a/deps/googletest/include/gtest/gtest-typed-test.h b/deps/googletest/include/gtest/gtest-typed-test.h index 7e23ec2dbce8cc..8575a41076ed0f 100644 --- a/deps/googletest/include/gtest/gtest-typed-test.h +++ b/deps/googletest/include/gtest/gtest-typed-test.h @@ -45,7 +45,7 @@ // First, define a fixture class template. It should be parameterized // by a type. Remember to derive it from testing::Test. template -class FooTest : public testing::Test { +class [[nodiscard]] FooTest : public testing::Test { public: ... using List = ::std::list; @@ -123,7 +123,7 @@ TYPED_TEST(FooTest, HasPropertyA) { ... } // First, define a fixture class template. It should be parameterized // by a type. Remember to derive it from testing::Test. template -class FooTest : public testing::Test { +class [[nodiscard]] FooTest : public testing::Test { ... }; @@ -194,34 +194,33 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \ GTEST_NAME_GENERATOR_(CaseName) -#define TYPED_TEST(CaseName, TestName) \ - static_assert(sizeof(GTEST_STRINGIFY_(TestName)) > 1, \ - "test-name must not be empty"); \ - template \ - class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \ - : public CaseName { \ - private: \ - typedef CaseName TestFixture; \ - typedef gtest_TypeParam_ TypeParam; \ - void TestBody() override; \ - }; \ - GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static bool \ - gtest_##CaseName##_##TestName##_registered_ = \ - ::testing::internal::TypeParameterizedTest< \ - CaseName, \ - ::testing::internal::TemplateSel, \ - GTEST_TYPE_PARAMS_( \ - CaseName)>::Register("", \ - ::testing::internal::CodeLocation( \ - __FILE__, __LINE__), \ - GTEST_STRINGIFY_(CaseName), \ - GTEST_STRINGIFY_(TestName), 0, \ - ::testing::internal::GenerateNames< \ - GTEST_NAME_GENERATOR_(CaseName), \ - GTEST_TYPE_PARAMS_(CaseName)>()); \ - template \ - void GTEST_TEST_CLASS_NAME_(CaseName, \ +#define TYPED_TEST(CaseName, TestName) \ + static_assert(sizeof(GTEST_STRINGIFY_(TestName)) > 1, \ + "test-name must not be empty"); \ + template \ + class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \ + : public CaseName { \ + private: \ + typedef CaseName TestFixture; \ + typedef gtest_TypeParam_ TypeParam; \ + void TestBody() override; \ + }; \ + [[maybe_unused]] static bool gtest_##CaseName##_##TestName##_registered_ = \ + ::testing::internal::TypeParameterizedTest< \ + CaseName, \ + ::testing::internal::TemplateSel, \ + GTEST_TYPE_PARAMS_( \ + CaseName)>::Register("", \ + ::testing::internal::CodeLocation( \ + __FILE__, __LINE__), \ + GTEST_STRINGIFY_(CaseName), \ + GTEST_STRINGIFY_(TestName), 0, \ + ::testing::internal::GenerateNames< \ + GTEST_NAME_GENERATOR_(CaseName), \ + GTEST_TYPE_PARAMS_(CaseName)>()); \ + template \ + void GTEST_TEST_CLASS_NAME_(CaseName, \ TestName)::TestBody() // Legacy API is deprecated but still available @@ -268,23 +267,22 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); TYPED_TEST_SUITE_P #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -#define TYPED_TEST_P(SuiteName, TestName) \ - namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \ - template \ - class TestName : public SuiteName { \ - private: \ - typedef SuiteName TestFixture; \ - typedef gtest_TypeParam_ TypeParam; \ - void TestBody() override; \ - }; \ - GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static bool \ - gtest_##TestName##_defined_ = \ - GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \ - __FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \ - GTEST_STRINGIFY_(TestName)); \ - } \ - template \ - void GTEST_SUITE_NAMESPACE_( \ +#define TYPED_TEST_P(SuiteName, TestName) \ + namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \ + template \ + class TestName : public SuiteName { \ + private: \ + typedef SuiteName TestFixture; \ + typedef gtest_TypeParam_ TypeParam; \ + void TestBody() override; \ + }; \ + [[maybe_unused]] static bool gtest_##TestName##_defined_ = \ + GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \ + __FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \ + GTEST_STRINGIFY_(TestName)); \ + } \ + template \ + void GTEST_SUITE_NAMESPACE_( \ SuiteName)::TestName::TestBody() // Note: this won't work correctly if the trailing arguments are macros. @@ -292,8 +290,8 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \ typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \ } \ - GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static const char* const \ - GTEST_REGISTERED_TEST_NAMES_(SuiteName) = \ + [[maybe_unused]] static const char* const GTEST_REGISTERED_TEST_NAMES_( \ + SuiteName) = \ GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).VerifyRegisteredTestNames( \ GTEST_STRINGIFY_(SuiteName), __FILE__, __LINE__, #__VA_ARGS__) @@ -305,24 +303,22 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); REGISTER_TYPED_TEST_SUITE_P #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \ - static_assert(sizeof(GTEST_STRINGIFY_(Prefix)) > 1, \ - "test-suit-prefix must not be empty"); \ - GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static bool \ - gtest_##Prefix##_##SuiteName = \ - ::testing::internal::TypeParameterizedTestSuite< \ - SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \ - ::testing::internal::GenerateTypeList::type>:: \ - Register( \ - GTEST_STRINGIFY_(Prefix), \ - ::testing::internal::CodeLocation(__FILE__, __LINE__), \ - >EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \ - GTEST_STRINGIFY_(SuiteName), \ - GTEST_REGISTERED_TEST_NAMES_(SuiteName), \ - ::testing::internal::GenerateNames< \ - ::testing::internal::NameGeneratorSelector< \ - __VA_ARGS__>::type, \ - ::testing::internal::GenerateTypeList::type>()) +#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \ + static_assert(sizeof(GTEST_STRINGIFY_(Prefix)) > 1, \ + "test-suit-prefix must not be empty"); \ + [[maybe_unused]] static bool gtest_##Prefix##_##SuiteName = \ + ::testing::internal::TypeParameterizedTestSuite< \ + SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \ + ::testing::internal::GenerateTypeList::type>:: \ + Register(GTEST_STRINGIFY_(Prefix), \ + ::testing::internal::CodeLocation(__FILE__, __LINE__), \ + >EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \ + GTEST_STRINGIFY_(SuiteName), \ + GTEST_REGISTERED_TEST_NAMES_(SuiteName), \ + ::testing::internal::GenerateNames< \ + ::testing::internal::NameGeneratorSelector< \ + __VA_ARGS__>::type, \ + ::testing::internal::GenerateTypeList::type>()) // Legacy API is deprecated but still available #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ diff --git a/deps/googletest/include/gtest/gtest.h b/deps/googletest/include/gtest/gtest.h index 9aa746039d30d2..b63685380c8a14 100644 --- a/deps/googletest/include/gtest/gtest.h +++ b/deps/googletest/include/gtest/gtest.h @@ -193,7 +193,7 @@ std::set* GetIgnoredParameterizedTestSuites(); // A base class that prevents subclasses from being copyable. // We do this instead of using '= delete' so as to avoid triggering warnings // inside user code regarding any of our declarations. -class GTestNonCopyable { +class [[nodiscard]] GTestNonCopyable { public: GTestNonCopyable() = default; GTestNonCopyable(const GTestNonCopyable&) = delete; @@ -206,15 +206,15 @@ class GTestNonCopyable { // The friend relationship of some of these classes is cyclic. // If we don't forward declare them the compiler might confuse the classes // in friendship clauses with same named classes on the scope. -class Test; -class TestSuite; +class [[nodiscard]] Test; +class [[nodiscard]] TestSuite; // Old API is still available but deprecated #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ using TestCase = TestSuite; #endif -class TestInfo; -class UnitTest; +class [[nodiscard]] TestInfo; +class [[nodiscard]] UnitTest; // The abstract class that all tests inherit from. // @@ -239,7 +239,7 @@ class UnitTest; // TEST_F(FooTest, Baz) { ... } // // Test is not copyable. -class GTEST_API_ Test { +class GTEST_API_ [[nodiscard]] Test { public: friend class TestInfo; @@ -366,7 +366,7 @@ typedef internal::TimeInMillis TimeInMillis; // output as a key/value string pair. // // Don't inherit from TestProperty as its destructor is not virtual. -class TestProperty { +class [[nodiscard]] TestProperty { public: // C'tor. TestProperty does NOT have a default constructor. // Always use this constructor (with parameters) to create a @@ -396,7 +396,7 @@ class TestProperty { // the Test. // // TestResult is not copyable. -class GTEST_API_ TestResult { +class GTEST_API_ [[nodiscard]] TestResult { public: // Creates an empty TestResult. TestResult(); @@ -530,7 +530,7 @@ class GTEST_API_ TestResult { // The constructor of TestInfo registers itself with the UnitTest // singleton such that the RUN_ALL_TESTS() macro knows which tests to // run. -class GTEST_API_ TestInfo { +class GTEST_API_ [[nodiscard]] TestInfo { public: // Destructs a TestInfo object. This function is not virtual, so // don't inherit from TestInfo. @@ -669,7 +669,7 @@ class GTEST_API_ TestInfo { // A test suite, which consists of a vector of TestInfos. // // TestSuite is not copyable. -class GTEST_API_ TestSuite { +class GTEST_API_ [[nodiscard]] TestSuite { public: // Creates a TestSuite with the given name. // @@ -890,7 +890,7 @@ class GTEST_API_ TestSuite { // available. // 2. You cannot use ASSERT_* directly in a constructor or // destructor. -class Environment { +class [[nodiscard]] Environment { public: // The d'tor is virtual as we need to subclass Environment. virtual ~Environment() = default; @@ -911,7 +911,7 @@ class Environment { #if GTEST_HAS_EXCEPTIONS // Exception which can be thrown from TestEventListener::OnTestPartResult. -class GTEST_API_ AssertionException +class GTEST_API_ [[nodiscard]] AssertionException : public internal::GoogleTestFailureException { public: explicit AssertionException(const TestPartResult& result) @@ -922,7 +922,7 @@ class GTEST_API_ AssertionException // The interface for tracing execution of tests. The methods are organized in // the order the corresponding events are fired. -class TestEventListener { +class [[nodiscard]] TestEventListener { public: virtual ~TestEventListener() = default; @@ -989,7 +989,7 @@ class TestEventListener { // the methods they override will not be caught during the build. For // comments about each method please see the definition of TestEventListener // above. -class EmptyTestEventListener : public TestEventListener { +class [[nodiscard]] EmptyTestEventListener : public TestEventListener { public: void OnTestProgramStart(const UnitTest& /*unit_test*/) override {} void OnTestIterationStart(const UnitTest& /*unit_test*/, @@ -1019,7 +1019,7 @@ class EmptyTestEventListener : public TestEventListener { }; // TestEventListeners lets users add listeners to track events in Google Test. -class GTEST_API_ TestEventListeners { +class GTEST_API_ [[nodiscard]] TestEventListeners { public: TestEventListeners(); ~TestEventListeners(); @@ -1110,7 +1110,7 @@ class GTEST_API_ TestEventListeners { // // This class is thread-safe as long as the methods are called // according to their specification. -class GTEST_API_ UnitTest { +class GTEST_API_ [[nodiscard]] UnitTest { public: // Gets the singleton UnitTest object. The first time this method // is called, a UnitTest object is constructed and returned. @@ -1123,7 +1123,7 @@ class GTEST_API_ UnitTest { // This method can only be called from the main thread. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. - int Run() GTEST_MUST_USE_RESULT_; + [[nodiscard]] int Run(); // Returns the working directory when the first TEST() or TEST_F() // was executed. The UnitTest object owns the string. @@ -1398,7 +1398,7 @@ AssertionResult CmpHelperEQ(const char* lhs_expression, return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs); } -class EqHelper { +class [[nodiscard]] EqHelper { public: // This templatized version is for the general case. template < @@ -1614,7 +1614,7 @@ using GoogleTest_NotSupported_OnFunctionReturningNonVoid = void; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // A class that enables one to stream messages to assertion macros -class GTEST_API_ AssertHelper { +class GTEST_API_ [[nodiscard]] AssertHelper { public: // Constructor. AssertHelper(TestPartResult::Type type, const char* file, int line, @@ -1689,14 +1689,14 @@ class GTEST_API_ AssertHelper { // INSTANTIATE_TEST_SUITE_P(OneToTenRange, FooTest, ::testing::Range(1, 10)); template -class WithParamInterface { +class [[nodiscard]] WithParamInterface { public: typedef T ParamType; virtual ~WithParamInterface() = default; // The current parameter value. Is also available in the test fixture's // constructor. - static const ParamType& GetParam() { + [[nodiscard]] static const ParamType& GetParam() { GTEST_CHECK_(parameter_ != nullptr) << "GetParam() can only be called inside a value-parameterized test " << "-- did you intend to write TEST_P instead of TEST_F?"; @@ -1723,7 +1723,8 @@ const T* WithParamInterface::parameter_ = nullptr; // WithParamInterface, and can just inherit from ::testing::TestWithParam. template -class TestWithParam : public Test, public WithParamInterface {}; +class [[nodiscard]] TestWithParam : public Test, + public WithParamInterface {}; // Macros for indicating success/failure in test code. @@ -2071,7 +2072,7 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2, // Example: // testing::ScopedTrace trace("file.cc", 123, "message"); // -class GTEST_API_ ScopedTrace { +class GTEST_API_ [[nodiscard]] ScopedTrace { public: // The c'tor pushes the given source file location and message onto // a trace stack maintained by Google Test. @@ -2332,7 +2333,7 @@ TestInfo* RegisterTest(const char* test_suite_name, const char* test_name, // // This function was formerly a macro; thus, it is in the global // namespace and has an all-caps name. -int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_; +[[nodiscard]] int RUN_ALL_TESTS(); inline int RUN_ALL_TESTS() { return ::testing::UnitTest::GetInstance()->Run(); } diff --git a/deps/googletest/include/gtest/internal/gtest-death-test-internal.h b/deps/googletest/include/gtest/internal/gtest-death-test-internal.h index b363259ec60203..6013a57bfe9f69 100644 --- a/deps/googletest/include/gtest/internal/gtest-death-test-internal.h +++ b/deps/googletest/include/gtest/internal/gtest-death-test-internal.h @@ -96,7 +96,7 @@ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ // by wait(2) // exit code: The integer code passed to exit(3), _Exit(2), or // returned from main() -class GTEST_API_ DeathTest { +class GTEST_API_ [[nodiscard]] DeathTest { public: // Create returns false if there was an error determining the // appropriate action to take for the current death test; for example, @@ -172,7 +172,7 @@ class GTEST_API_ DeathTest { GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 // Factory interface for death tests. May be mocked out for testing. -class DeathTestFactory { +class [[nodiscard]] DeathTestFactory { public: virtual ~DeathTestFactory() = default; virtual bool Create(const char* statement, @@ -181,7 +181,7 @@ class DeathTestFactory { }; // A concrete DeathTestFactory implementation for normal use. -class DefaultDeathTestFactory : public DeathTestFactory { +class [[nodiscard]] DefaultDeathTestFactory : public DeathTestFactory { public: bool Create(const char* statement, Matcher matcher, const char* file, int line, DeathTest** test) override; @@ -256,19 +256,19 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status); // must accept a streamed message even though the message is never printed. // The regex object is not evaluated, but it is used to prevent "unused" // warnings and to avoid an expression that doesn't compile in debug mode. -#define GTEST_EXECUTE_STATEMENT_(statement, regex_or_matcher) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } else if (!::testing::internal::AlwaysTrue()) { \ - ::testing::internal::MakeDeathTestMatcher(regex_or_matcher); \ - } else \ +#define GTEST_EXECUTE_STATEMENT_(statement, regex_or_matcher) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (::testing::internal::AlwaysTrue()) { \ + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + } else if (!::testing::internal::AlwaysTrue()) { \ + (void)::testing::internal::MakeDeathTestMatcher(regex_or_matcher); \ + } else \ ::testing::Message() // A class representing the parsed contents of the // --gtest_internal_run_death_test flag, as it existed when // RUN_ALL_TESTS was called. -class InternalRunDeathTestFlag { +class [[nodiscard]] InternalRunDeathTestFlag { public: InternalRunDeathTestFlag(const std::string& a_file, int a_line, int an_index, int a_write_fd) diff --git a/deps/googletest/include/gtest/internal/gtest-filepath.h b/deps/googletest/include/gtest/internal/gtest-filepath.h index 6dc47be54ad3e7..4dc00ee7b31503 100644 --- a/deps/googletest/include/gtest/internal/gtest-filepath.h +++ b/deps/googletest/include/gtest/internal/gtest-filepath.h @@ -67,7 +67,7 @@ namespace internal { // Names are NOT checked for syntax correctness -- no checking for illegal // characters, malformed paths, etc. -class GTEST_API_ FilePath { +class GTEST_API_ [[nodiscard]] FilePath { public: FilePath() : pathname_("") {} FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) {} diff --git a/deps/googletest/include/gtest/internal/gtest-internal.h b/deps/googletest/include/gtest/internal/gtest-internal.h index 7e55dc605cb996..4379137d77eba3 100644 --- a/deps/googletest/include/gtest/internal/gtest-internal.h +++ b/deps/googletest/include/gtest/internal/gtest-internal.h @@ -95,7 +95,7 @@ #define GTEST_STRINGIFY_(...) GTEST_STRINGIFY_HELPER_(__VA_ARGS__, ) namespace proto2 { -class MessageLite; +class [[nodiscard]] MessageLite; } namespace testing { @@ -115,15 +115,15 @@ ::std::string PrintToString(const T& value); namespace internal { struct TraceInfo; // Information about a trace point. -class TestInfoImpl; // Opaque implementation of TestInfo -class UnitTestImpl; // Opaque implementation of UnitTest +class [[nodiscard]] TestInfoImpl; // Opaque implementation of TestInfo +class [[nodiscard]] UnitTestImpl; // Opaque implementation of UnitTest // The text used in failure messages to indicate the start of the // stack trace. GTEST_API_ extern const char kStackTraceMarker[]; // An IgnoredValue object can be implicitly constructed from ANY value. -class IgnoredValue { +class [[nodiscard]] IgnoredValue { struct Sink {}; public: @@ -155,7 +155,8 @@ GTEST_DISABLE_MSC_WARNINGS_PUSH_( // errors presumably detectable only at run time. Since // std::runtime_error inherits from std::exception, many testing // frameworks know how to extract and print the message inside it. -class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error { +class GTEST_API_ [[nodiscard]] GoogleTestFailureException + : public ::std::runtime_error { public: explicit GoogleTestFailureException(const TestPartResult& failure); }; @@ -242,7 +243,7 @@ GTEST_API_ std::string GetBoolAssertionFailureMessage( // // RawType: the raw floating-point type (either float or double) template -class FloatingPoint { +class [[nodiscard]] FloatingPoint { public: // Defines the unsigned integer type that has the same size as the // floating point number. @@ -290,17 +291,17 @@ class FloatingPoint { // around may change its bits, although the new value is guaranteed // to be also a NAN. Therefore, don't expect this constructor to // preserve the bits in x when x is a NAN. - explicit FloatingPoint(const RawType& x) { u_.value_ = x; } + explicit FloatingPoint(RawType x) { memcpy(&bits_, &x, sizeof(x)); } // Static methods // Reinterprets a bit pattern as a floating-point number. // // This function is needed to test the AlmostEquals() method. - static RawType ReinterpretBits(const Bits bits) { - FloatingPoint fp(0); - fp.u_.bits_ = bits; - return fp.u_.value_; + static RawType ReinterpretBits(Bits bits) { + RawType fp; + memcpy(&fp, &bits, sizeof(fp)); + return fp; } // Returns the floating-point number that represent positive infinity. @@ -309,16 +310,16 @@ class FloatingPoint { // Non-static methods // Returns the bits that represents this number. - const Bits& bits() const { return u_.bits_; } + const Bits& bits() const { return bits_; } // Returns the exponent bits of this number. - Bits exponent_bits() const { return kExponentBitMask & u_.bits_; } + Bits exponent_bits() const { return kExponentBitMask & bits_; } // Returns the fraction bits of this number. - Bits fraction_bits() const { return kFractionBitMask & u_.bits_; } + Bits fraction_bits() const { return kFractionBitMask & bits_; } // Returns the sign bit of this number. - Bits sign_bit() const { return kSignBitMask & u_.bits_; } + Bits sign_bit() const { return kSignBitMask & bits_; } // Returns true if and only if this is NAN (not a number). bool is_nan() const { @@ -332,23 +333,16 @@ class FloatingPoint { // // - returns false if either number is (or both are) NAN. // - treats really large numbers as almost equal to infinity. - // - thinks +0.0 and -0.0 are 0 DLP's apart. + // - thinks +0.0 and -0.0 are 0 ULP's apart. bool AlmostEquals(const FloatingPoint& rhs) const { // The IEEE standard says that any comparison operation involving // a NAN must return false. if (is_nan() || rhs.is_nan()) return false; - return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_) <= - kMaxUlps; + return DistanceBetweenSignAndMagnitudeNumbers(bits_, rhs.bits_) <= kMaxUlps; } private: - // The data type used to store the actual floating-point number. - union FloatingPointUnion { - RawType value_; // The raw floating-point number. - Bits bits_; // The bits that represent the number. - }; - // Converts an integer from the sign-and-magnitude representation to // the biased representation. More precisely, let N be 2 to the // power of (kBitCount - 1), an integer x is represented by the @@ -364,7 +358,7 @@ class FloatingPoint { // // Read https://en.wikipedia.org/wiki/Signed_number_representations // for more details on signed number representations. - static Bits SignAndMagnitudeToBiased(const Bits& sam) { + static Bits SignAndMagnitudeToBiased(Bits sam) { if (kSignBitMask & sam) { // sam represents a negative number. return ~sam + 1; @@ -376,14 +370,13 @@ class FloatingPoint { // Given two numbers in the sign-and-magnitude representation, // returns the distance between them as an unsigned number. - static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits& sam1, - const Bits& sam2) { + static Bits DistanceBetweenSignAndMagnitudeNumbers(Bits sam1, Bits sam2) { const Bits biased1 = SignAndMagnitudeToBiased(sam1); const Bits biased2 = SignAndMagnitudeToBiased(sam2); return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1); } - FloatingPointUnion u_; + Bits bits_; // The bits that represent the number. }; // Typedefs the instances of the FloatingPoint template class that we @@ -400,7 +393,7 @@ typedef FloatingPoint Double; typedef const void* TypeId; template -class TypeIdHelper { +class [[nodiscard]] TypeIdHelper { public: // dummy_ must not have a const type. Otherwise an overly eager // compiler (e.g. MSVC 7.1 & 8.0) may try to merge @@ -432,7 +425,7 @@ GTEST_API_ TypeId GetTestTypeId(); // Defines the abstract factory interface that creates instances // of a Test object. -class TestFactoryBase { +class [[nodiscard]] TestFactoryBase { public: virtual ~TestFactoryBase() = default; @@ -451,7 +444,7 @@ class TestFactoryBase { // This class provides implementation of TestFactoryBase interface. // It is used in TEST and TEST_F macros. template -class TestFactoryImpl : public TestFactoryBase { +class [[nodiscard]] TestFactoryImpl : public TestFactoryBase { public: Test* CreateTest() override { return new TestClass; } }; @@ -578,7 +571,7 @@ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) // State of the definition of a type-parameterized test suite. -class GTEST_API_ TypedTestSuitePState { +class GTEST_API_ [[nodiscard]] TypedTestSuitePState { public: TypedTestSuitePState() : registered_(false) {} @@ -693,7 +686,7 @@ std::vector GenerateNames() { // Implementation note: The GTEST_TEMPLATE_ macro declares a template // template parameter. It's defined in gtest-type-util.h. template -class TypeParameterizedTest { +class [[nodiscard]] TypeParameterizedTest { public: // 'index' is the index of the test in the type list 'Types' // specified in INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, TestSuite, @@ -731,7 +724,7 @@ class TypeParameterizedTest { // The base case for the compile time recursion. template -class TypeParameterizedTest { +class [[nodiscard]] TypeParameterizedTest { public: static bool Register(const char* /*prefix*/, CodeLocation, const char* /*case_name*/, const char* /*test_names*/, @@ -752,7 +745,7 @@ GTEST_API_ void RegisterTypeParameterizedTestSuiteInstantiation( // Test. The return value is insignificant - we just need to return // something such that we can call this function in a namespace scope. template -class TypeParameterizedTestSuite { +class [[nodiscard]] TypeParameterizedTestSuite { public: static bool Register(const char* prefix, CodeLocation code_location, const TypedTestSuitePState* state, const char* case_name, @@ -790,7 +783,7 @@ class TypeParameterizedTestSuite { // The base case for the compile time recursion. template -class TypeParameterizedTestSuite { +class [[nodiscard]] TypeParameterizedTestSuite { public: static bool Register(const char* /*prefix*/, const CodeLocation&, const TypedTestSuitePState* /*state*/, @@ -846,7 +839,7 @@ struct TrueWithString { // doesn't use global state (and therefore can't interfere with user // code). Unlike rand_r(), it's portable. An LCG isn't very random, // but it's good enough for our purposes. -class GTEST_API_ Random { +class GTEST_API_ [[nodiscard]] Random { public: static const uint32_t kMaxRange = 1u << 31; @@ -872,7 +865,7 @@ class GTEST_API_ Random { // that's true if and only if T has methods DebugString() and ShortDebugString() // that return std::string. template -class HasDebugStringAndShortDebugString { +class [[nodiscard]] HasDebugStringAndShortDebugString { private: template static auto CheckDebugString(C*) -> typename std::is_same< @@ -894,11 +887,6 @@ class HasDebugStringAndShortDebugString { HasDebugStringType::value && HasShortDebugStringType::value; }; -#ifdef GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL -template -constexpr bool HasDebugStringAndShortDebugString::value; -#endif - // When the compiler sees expression IsContainerTest(0), if C is an // STL-style container class, the first overload of IsContainerTest // will be viable (since both C::iterator* and C::const_iterator* are @@ -1077,7 +1065,7 @@ struct RelationToSourceCopy {}; // this requirement. Element can be an array type itself (hence // multi-dimensional arrays are supported). template -class NativeArray { +class [[nodiscard]] NativeArray { public: // STL-style container typedefs. typedef Element value_type; @@ -1163,7 +1151,7 @@ struct ElemFromList { struct FlatTupleConstructTag {}; template -class FlatTuple; +class [[nodiscard]] FlatTuple; template struct FlatTupleElemBase; @@ -1222,7 +1210,7 @@ struct FlatTupleBase, std::index_sequence> // std::make_index_sequence, on the other hand, it is recursive but with an // instantiation depth of O(ln(N)). template -class FlatTuple +class [[nodiscard]] FlatTuple : private FlatTupleBase, std::make_index_sequence> { using Indices = @@ -1241,30 +1229,40 @@ class FlatTuple // Utility functions to be called with static_assert to induce deprecation // warnings. -GTEST_INTERNAL_DEPRECATED( +[[deprecated( "INSTANTIATE_TEST_CASE_P is deprecated, please use " - "INSTANTIATE_TEST_SUITE_P") -constexpr bool InstantiateTestCase_P_IsDeprecated() { return true; } + "INSTANTIATE_TEST_SUITE_P")]] +constexpr bool InstantiateTestCase_P_IsDeprecated() { + return true; +} -GTEST_INTERNAL_DEPRECATED( +[[deprecated( "TYPED_TEST_CASE_P is deprecated, please use " - "TYPED_TEST_SUITE_P") -constexpr bool TypedTestCase_P_IsDeprecated() { return true; } + "TYPED_TEST_SUITE_P")]] +constexpr bool TypedTestCase_P_IsDeprecated() { + return true; +} -GTEST_INTERNAL_DEPRECATED( +[[deprecated( "TYPED_TEST_CASE is deprecated, please use " - "TYPED_TEST_SUITE") -constexpr bool TypedTestCaseIsDeprecated() { return true; } + "TYPED_TEST_SUITE")]] +constexpr bool TypedTestCaseIsDeprecated() { + return true; +} -GTEST_INTERNAL_DEPRECATED( +[[deprecated( "REGISTER_TYPED_TEST_CASE_P is deprecated, please use " - "REGISTER_TYPED_TEST_SUITE_P") -constexpr bool RegisterTypedTestCase_P_IsDeprecated() { return true; } + "REGISTER_TYPED_TEST_SUITE_P")]] +constexpr bool RegisterTypedTestCase_P_IsDeprecated() { + return true; +} -GTEST_INTERNAL_DEPRECATED( +[[deprecated( "INSTANTIATE_TYPED_TEST_CASE_P is deprecated, please use " - "INSTANTIATE_TYPED_TEST_SUITE_P") -constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; } + "INSTANTIATE_TYPED_TEST_SUITE_P")]] +constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { + return true; +} } // namespace internal } // namespace testing @@ -1320,7 +1318,7 @@ struct tuple_size> namespace testing { namespace internal { -class NeverThrown { +class [[nodiscard]] NeverThrown { public: const char* what() const noexcept { return "this exception should never be thrown"; @@ -1501,8 +1499,7 @@ class NeverThrown { \ private: \ void TestBody() override; \ - GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static ::testing::TestInfo* const \ - test_info_; \ + [[maybe_unused]] static ::testing::TestInfo* const test_info_; \ }; \ \ ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \ diff --git a/deps/googletest/include/gtest/internal/gtest-param-util.h b/deps/googletest/include/gtest/internal/gtest-param-util.h index cc7ea531738c9d..716779346a012d 100644 --- a/deps/googletest/include/gtest/internal/gtest-param-util.h +++ b/deps/googletest/include/gtest/internal/gtest-param-util.h @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -89,14 +90,14 @@ GTEST_API_ void ReportInvalidTestSuiteType(const char* test_suite_name, const CodeLocation& code_location); template -class ParamGeneratorInterface; +class [[nodiscard]] ParamGeneratorInterface; template -class ParamGenerator; +class [[nodiscard]] ParamGenerator; // Interface for iterating over elements provided by an implementation // of ParamGeneratorInterface. template -class ParamIteratorInterface { +class [[nodiscard]] ParamIteratorInterface { public: virtual ~ParamIteratorInterface() = default; // A pointer to the base generator instance. @@ -126,7 +127,7 @@ class ParamIteratorInterface { // ParamGeneratorInterface. It wraps ParamIteratorInterface // and implements the const forward iterator concept. template -class ParamIterator { +class [[nodiscard]] ParamIterator { public: typedef T value_type; typedef const T& reference; @@ -168,7 +169,7 @@ class ParamIterator { // ParamGeneratorInterface is the binary interface to access generators // defined in other translation units. template -class ParamGeneratorInterface { +class [[nodiscard]] ParamGeneratorInterface { public: typedef T ParamType; @@ -185,7 +186,7 @@ class ParamGeneratorInterface { // ParamGeneratorInterface instance is shared among all copies // of the original object. This is possible because that instance is immutable. template -class ParamGenerator { +class [[nodiscard]] ParamGenerator { public: typedef ParamIterator iterator; @@ -209,7 +210,7 @@ class ParamGenerator { // operator<(). // This class is used in the Range() function. template -class RangeGenerator : public ParamGeneratorInterface { +class [[nodiscard]] RangeGenerator : public ParamGeneratorInterface { public: RangeGenerator(T begin, T end, IncrementT step) : begin_(begin), @@ -295,7 +296,8 @@ class RangeGenerator : public ParamGeneratorInterface { // since the source can be located on the stack, and the generator // is likely to persist beyond that stack frame. template -class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface { +class [[nodiscard]] ValuesInIteratorRangeGenerator + : public ParamGeneratorInterface { public: template ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end) @@ -395,7 +397,7 @@ void TestNotEmpty(const T&) {} // Stores a parameter value and later creates tests parameterized with that // value. template -class ParameterizedTestFactory : public TestFactoryBase { +class [[nodiscard]] ParameterizedTestFactory : public TestFactoryBase { public: typedef typename TestClass::ParamType ParamType; explicit ParameterizedTestFactory(ParamType parameter) @@ -417,7 +419,7 @@ class ParameterizedTestFactory : public TestFactoryBase { // TestMetaFactoryBase is a base class for meta-factories that create // test factories for passing into MakeAndRegisterTestInfo function. template -class TestMetaFactoryBase { +class [[nodiscard]] TestMetaFactoryBase { public: virtual ~TestMetaFactoryBase() = default; @@ -433,7 +435,7 @@ class TestMetaFactoryBase { // it for each Test/Parameter value combination. Thus it needs meta factory // creator class. template -class TestMetaFactory +class [[nodiscard]] TestMetaFactory : public TestMetaFactoryBase { public: using ParamType = typename TestSuite::ParamType; @@ -459,7 +461,7 @@ class TestMetaFactory // in RegisterTests method. The ParameterizeTestSuiteRegistry class holds // a collection of pointers to the ParameterizedTestSuiteInfo objects // and calls RegisterTests() on each of them when asked. -class ParameterizedTestSuiteInfoBase { +class [[nodiscard]] ParameterizedTestSuiteInfoBase { public: virtual ~ParameterizedTestSuiteInfoBase() = default; @@ -502,7 +504,8 @@ GTEST_API_ void InsertSyntheticTestCase(const std::string& name, // test suite. It registers tests with all values generated by all // generators when asked. template -class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { +class [[nodiscard]] ParameterizedTestSuiteInfo + : public ParameterizedTestSuiteInfoBase { public: // ParamType and GeneratorCreationFunc are private types but are required // for declarations of public methods AddTestPattern() and @@ -529,8 +532,7 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { // prefix). test_base_name is the name of an individual test without // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is // test suite base name and DoBar is test base name. - void AddTestPattern(const char*, - const char* test_base_name, + void AddTestPattern(const char*, const char* test_base_name, TestMetaFactoryBase* meta_factory, CodeLocation code_location) { tests_.emplace_back( @@ -688,7 +690,7 @@ using ParameterizedTestCaseInfo = ParameterizedTestSuiteInfo; // ParameterizedTestSuiteInfoBase classes accessed by test suite names. TEST_P // and INSTANTIATE_TEST_SUITE_P macros use it to locate their corresponding // ParameterizedTestSuiteInfo descriptors. -class ParameterizedTestSuiteRegistry { +class [[nodiscard]] ParameterizedTestSuiteRegistry { public: ParameterizedTestSuiteRegistry() = default; ~ParameterizedTestSuiteRegistry() { @@ -762,7 +764,7 @@ class ParameterizedTestSuiteRegistry { // Keep track of what type-parameterized test suite are defined and // where as well as which are intatiated. This allows susequently // identifying suits that are defined but never used. -class TypeParameterizedTestSuiteRegistry { +class [[nodiscard]] TypeParameterizedTestSuiteRegistry { public: // Add a suite definition void RegisterTestSuite(const char* test_suite_name, @@ -801,7 +803,7 @@ namespace internal { GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100) template -class ValueArray { +class [[nodiscard]] ValueArray { public: explicit ValueArray(Ts... v) : v_(FlatTupleConstructTag{}, std::move(v)...) {} @@ -822,7 +824,7 @@ class ValueArray { GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 template -class CartesianProductGenerator +class [[nodiscard]] CartesianProductGenerator : public ParamGeneratorInterface<::std::tuple> { public: typedef ::std::tuple ParamType; @@ -939,7 +941,7 @@ class CartesianProductGenerator }; template -class CartesianProductHolder { +class [[nodiscard]] CartesianProductHolder { public: CartesianProductHolder(const Gen&... g) : generators_(g...) {} template @@ -952,11 +954,12 @@ class CartesianProductHolder { std::tuple generators_; }; -template -class ParamGeneratorConverter : public ParamGeneratorInterface { +template +class [[nodiscard]] ParamGeneratorConverter + : public ParamGeneratorInterface { public: - ParamGeneratorConverter(ParamGenerator gen) // NOLINT - : generator_(std::move(gen)) {} + ParamGeneratorConverter(ParamGenerator gen, Func converter) // NOLINT + : generator_(std::move(gen)), converter_(std::move(converter)) {} ParamIteratorInterface* Begin() const override { return new Iterator(this, generator_.begin(), generator_.end()); @@ -965,13 +968,21 @@ class ParamGeneratorConverter : public ParamGeneratorInterface { return new Iterator(this, generator_.end(), generator_.end()); } + // Returns the std::function wrapping the user-supplied converter callable. It + // is used by the iterator (see class Iterator below) to convert the object + // (of type FROM) returned by the ParamGenerator to an object of a type that + // can be static_cast to type TO. + const Func& TypeConverter() const { return converter_; } + private: class Iterator : public ParamIteratorInterface { public: - Iterator(const ParamGeneratorInterface* base, ParamIterator it, + Iterator(const ParamGeneratorConverter* base, ParamIterator it, ParamIterator end) : base_(base), it_(it), end_(end) { - if (it_ != end_) value_ = std::make_shared(static_cast(*it_)); + if (it_ != end_) + value_ = + std::make_shared(static_cast(base->TypeConverter()(*it_))); } ~Iterator() override = default; @@ -980,7 +991,9 @@ class ParamGeneratorConverter : public ParamGeneratorInterface { } void Advance() override { ++it_; - if (it_ != end_) value_ = std::make_shared(static_cast(*it_)); + if (it_ != end_) + value_ = + std::make_shared(static_cast(base_->TypeConverter()(*it_))); } ParamIteratorInterface* Clone() const override { return new Iterator(*this); @@ -1000,30 +1013,54 @@ class ParamGeneratorConverter : public ParamGeneratorInterface { private: Iterator(const Iterator& other) = default; - const ParamGeneratorInterface* const base_; + const ParamGeneratorConverter* const base_; ParamIterator it_; ParamIterator end_; std::shared_ptr value_; }; // class ParamGeneratorConverter::Iterator ParamGenerator generator_; + Func converter_; }; // class ParamGeneratorConverter -template -class ParamConverterGenerator { +template > +class [[nodiscard]] ParamConverterGenerator { public: - ParamConverterGenerator(ParamGenerator g) // NOLINT - : generator_(std::move(g)) {} + ParamConverterGenerator(ParamGenerator g) // NOLINT + : generator_(std::move(g)), converter_(Identity) {} + + ParamConverterGenerator(ParamGenerator g, StdFunction converter) + : generator_(std::move(g)), converter_(std::move(converter)) {} template operator ParamGenerator() const { // NOLINT - return ParamGenerator(new ParamGeneratorConverter(generator_)); + return ParamGenerator( + new ParamGeneratorConverter(generator_, + converter_)); } private: - ParamGenerator generator_; + static const GeneratedT& Identity(const GeneratedT& v) { return v; } + + ParamGenerator generator_; + StdFunction converter_; +}; + +// Template to determine the param type of a single-param std::function. +template +struct FuncSingleParamType; +template +struct FuncSingleParamType> { + using type = std::remove_cv_t>; }; +template +struct IsSingleArgStdFunction : public std::false_type {}; +template +struct IsSingleArgStdFunction> : public std::true_type {}; + } // namespace internal } // namespace testing diff --git a/deps/googletest/include/gtest/internal/gtest-port-arch.h b/deps/googletest/include/gtest/internal/gtest-port-arch.h index 7ec968f312e4f4..fbffc95b1a13f9 100644 --- a/deps/googletest/include/gtest/internal/gtest-port-arch.h +++ b/deps/googletest/include/gtest/internal/gtest-port-arch.h @@ -119,6 +119,8 @@ #define GTEST_OS_NXP_QN9090 1 #elif defined(NRF52) #define GTEST_OS_NRF52 1 +#elif defined(__EMSCRIPTEN__) +#define GTEST_OS_EMSCRIPTEN 1 #endif // __CYGWIN__ #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ diff --git a/deps/googletest/include/gtest/internal/gtest-port.h b/deps/googletest/include/gtest/internal/gtest-port.h index ca18513e77f7a0..3ea95ba5560714 100644 --- a/deps/googletest/include/gtest/internal/gtest-port.h +++ b/deps/googletest/include/gtest/internal/gtest-port.h @@ -194,26 +194,12 @@ // // Macros for basic C++ coding: // GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning. -// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used. // GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is // suppressed (constant conditional). // GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127 // is suppressed. -// GTEST_INTERNAL_HAS_ANY - for enabling UniversalPrinter or -// UniversalPrinter specializations. -// Always defined to 0 or 1. -// GTEST_INTERNAL_HAS_OPTIONAL - for enabling UniversalPrinter -// or -// UniversalPrinter -// specializations. Always defined to 0 or 1. // GTEST_INTERNAL_HAS_STD_SPAN - for enabling UniversalPrinter // specializations. Always defined to 0 or 1 -// GTEST_INTERNAL_HAS_STRING_VIEW - for enabling Matcher or -// Matcher -// specializations. Always defined to 0 or 1. -// GTEST_INTERNAL_HAS_VARIANT - for enabling UniversalPrinter or -// UniversalPrinter -// specializations. Always defined to 0 or 1. // GTEST_USE_OWN_FLAGFILE_FLAG_ - Always defined to 0 or 1. // GTEST_HAS_CXXABI_H_ - Always defined to 0 or 1. // GTEST_CAN_STREAM_RESULTS_ - Always defined to 0 or 1. @@ -260,11 +246,6 @@ // BoolFromGTestEnv() - parses a bool environment variable. // Int32FromGTestEnv() - parses an int32_t environment variable. // StringFromGTestEnv() - parses a string environment variable. -// -// Deprecation warnings: -// GTEST_INTERNAL_DEPRECATED(message) - attribute marking a function as -// deprecated; calling a marked function -// should generate a compiler warning // The definition of GTEST_INTERNAL_CPLUSPLUS_LANG comes first because it can // potentially be used as an #include guard. @@ -275,8 +256,8 @@ #endif #if !defined(GTEST_INTERNAL_CPLUSPLUS_LANG) || \ - GTEST_INTERNAL_CPLUSPLUS_LANG < 201402L -#error C++ versions less than C++14 are not supported. + GTEST_INTERNAL_CPLUSPLUS_LANG < 201703L +#error C++ versions less than C++17 are not supported. #endif // MSVC >= 19.11 (VS 2017 Update 3) supports __has_include. @@ -288,10 +269,14 @@ // Detect C++ feature test macros as gracefully as possible. // MSVC >= 19.15, Clang >= 3.4.1, and GCC >= 4.1.2 support feature test macros. -#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L && \ - (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE()) -#include // C++20 and later -#elif (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE()) +// +// GCC15 warns that is deprecated in C++17 and suggests using +// instead, even though is not available in C++17 mode prior +// to GCC9. +#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L || \ + GTEST_INTERNAL_HAS_INCLUDE() +#include // C++20 or support. +#else #include // Pre-C++20 #endif @@ -679,12 +664,22 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; defined(GTEST_OS_NETBSD) || defined(GTEST_OS_FUCHSIA) || \ defined(GTEST_OS_DRAGONFLY) || defined(GTEST_OS_GNU_KFREEBSD) || \ defined(GTEST_OS_HAIKU) || defined(GTEST_OS_GNU_HURD)) + // Death tests require a file system to work properly. #if GTEST_HAS_FILE_SYSTEM #define GTEST_HAS_DEATH_TEST 1 #endif // GTEST_HAS_FILE_SYSTEM #endif +// Determines whether the Premature Exit file can be created. +// Created by default when Death tests are supported, but other platforms can +// use the Premature exit file without Death test support (e.g. for detecting +// crashes). +#if GTEST_HAS_DEATH_TEST || \ + (defined(GTEST_OS_EMSCRIPTEN) && GTEST_HAS_FILE_SYSTEM) +#define GTEST_INTERNAL_HAS_PREMATURE_EXIT_FILE 1 +#endif + // Determines whether to support type-driven tests. // Typed tests need and variadic macros, which GCC, VC++ 8.0, @@ -772,25 +767,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #define GTEST_HAVE_FEATURE_(x) 0 #endif -// Use this annotation after a variable or parameter declaration to tell the -// compiler the variable/parameter may be used. -// Example: -// -// GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED int foo = bar(); -// -// This can be removed once we only support only C++17 or newer and -// [[maybe_unused]] is available on all supported platforms. -#if GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE(maybe_unused) -#define GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED [[maybe_unused]] -#elif GTEST_HAVE_ATTRIBUTE_(unused) -// This is inferior to [[maybe_unused]] as it can produce a -// -Wused-but-marked-unused warning on optionally used symbols, but it is all we -// have. -#define GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED __attribute__((__unused__)) -#else -#define GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED -#endif - // Use this annotation before a function that takes a printf format string. #if GTEST_HAVE_ATTRIBUTE_(format) && defined(__MINGW_PRINTF_FORMAT) // MinGW has two different printf implementations. Ensure the format macro @@ -805,17 +781,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) #endif -// Tell the compiler to warn about unused return values for functions declared -// with this macro. The macro should be used on function declarations -// following the argument list: -// -// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_; -#if GTEST_HAVE_ATTRIBUTE_(warn_unused_result) -#define GTEST_MUST_USE_RESULT_ __attribute__((warn_unused_result)) -#else -#define GTEST_MUST_USE_RESULT_ -#endif - // MS C++ compiler emits warning when a conditional expression is compile time // constant. In some contexts this warning is false positive and needs to be // suppressed. Use the following two macros in such cases: @@ -867,11 +832,13 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #ifndef GTEST_API_ #ifdef _MSC_VER -#if defined(GTEST_LINKED_AS_SHARED_LIBRARY) && GTEST_LINKED_AS_SHARED_LIBRARY -#define GTEST_API_ __declspec(dllimport) -#elif defined(GTEST_CREATE_SHARED_LIBRARY) && GTEST_CREATE_SHARED_LIBRARY +#if defined(GTEST_CREATE_SHARED_LIBRARY) && GTEST_CREATE_SHARED_LIBRARY #define GTEST_API_ __declspec(dllexport) +#elif defined(GTEST_LINKED_AS_SHARED_LIBRARY) && GTEST_LINKED_AS_SHARED_LIBRARY +#define GTEST_API_ __declspec(dllimport) #endif +#elif GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE(gnu::visibility) +#define GTEST_API_ [[gnu::visibility("default")]] #elif GTEST_HAVE_ATTRIBUTE_(visibility) #define GTEST_API_ __attribute__((visibility("default"))) #endif // _MSC_VER @@ -962,7 +929,7 @@ namespace internal { // A secret type that Google Test users don't know about. It has no // accessible constructors on purpose. Therefore it's impossible to create a // Secret object, which is what we want. -class Secret { +class [[nodiscard]] Secret { Secret(const Secret&) = delete; }; @@ -977,7 +944,7 @@ GTEST_API_ bool IsTrue(bool condition); // This is almost `using RE = ::RE2`, except it is copy-constructible, and it // needs to disambiguate the `std::string`, `absl::string_view`, and `const // char*` constructors. -class GTEST_API_ RE { +class GTEST_API_ [[nodiscard]] RE { public: RE(absl::string_view regex) : regex_(regex) {} // NOLINT RE(const char* regex) : RE(absl::string_view(regex)) {} // NOLINT @@ -1003,7 +970,7 @@ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ // A simple C++ wrapper for . It uses the POSIX Extended // Regular Expression syntax. -class GTEST_API_ RE { +class GTEST_API_ [[nodiscard]] RE { public: // A copy constructor is required by the Standard to initialize object // references from r-values. @@ -1072,7 +1039,7 @@ enum GTestLogSeverity { GTEST_INFO, GTEST_WARNING, GTEST_ERROR, GTEST_FATAL }; // Formats log entry severity, provides a stream object for streaming the // log message, and terminates the message with a newline when going out of // scope. -class GTEST_API_ GTestLog { +class GTEST_API_ [[nodiscard]] GTestLog { public: GTestLog(GTestLogSeverity severity, const char* file, int line); @@ -1235,7 +1202,7 @@ void ClearInjectableArgvs(); #ifdef GTEST_OS_WINDOWS // Provides leak-safe Windows kernel handle ownership. // Used in death tests and in threading support. -class GTEST_API_ AutoHandle { +class GTEST_API_ [[nodiscard]] AutoHandle { public: // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to // avoid including in this header file. Including is @@ -1279,7 +1246,7 @@ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ // This class is only for testing Google Test's own constructs. Do not // use it in user tests, either directly or indirectly. // TODO(b/203539622): Replace unconditionally with absl::Notification. -class GTEST_API_ Notification { +class GTEST_API_ [[nodiscard]] Notification { public: Notification() : notified_(false) {} Notification(const Notification&) = delete; @@ -1318,7 +1285,7 @@ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 // in order to call its Run(). Introducing ThreadWithParamBase as a // non-templated base class for ThreadWithParam allows us to bypass this // problem. -class ThreadWithParamBase { +class [[nodiscard]] ThreadWithParamBase { public: virtual ~ThreadWithParamBase() = default; virtual void Run() = 0; @@ -1348,7 +1315,7 @@ extern "C" inline void* ThreadFuncWithCLinkage(void* thread) { // These classes are only for testing Google Test's own constructs. Do // not use them in user tests, either directly or indirectly. template -class ThreadWithParam : public ThreadWithParamBase { +class [[nodiscard]] ThreadWithParam : public ThreadWithParamBase { public: typedef void UserThreadFunc(T); @@ -1414,7 +1381,7 @@ class ThreadWithParam : public ThreadWithParamBase { // GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex); // // (A non-static Mutex is defined/declared in the usual way). -class GTEST_API_ Mutex { +class GTEST_API_ [[nodiscard]] Mutex { public: enum MutexType { kStatic = 0, kDynamic = 1 }; // We rely on kStaticMutex being 0 as it is to what the linker initializes @@ -1430,9 +1397,9 @@ class GTEST_API_ Mutex { Mutex(); ~Mutex(); - void Lock(); + void lock(); - void Unlock(); + void unlock(); // Does nothing if the current thread holds the mutex. Otherwise, crashes // with high probability. @@ -1467,14 +1434,13 @@ class GTEST_API_ Mutex { // platforms. That macro is used as a defensive measure to prevent against // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than // "MutexLock l(&mu)". Hence the typedef trick below. -class GTestMutexLock { +class [[nodiscard]] GTestMutexLock { public: - explicit GTestMutexLock(Mutex* mutex) : mutex_(mutex) { mutex_->Lock(); } - - ~GTestMutexLock() { mutex_->Unlock(); } + explicit GTestMutexLock(Mutex& mutex) : mutex_(mutex) { mutex_.lock(); } + ~GTestMutexLock() { mutex_.unlock(); } private: - Mutex* const mutex_; + Mutex& mutex_; GTestMutexLock(const GTestMutexLock&) = delete; GTestMutexLock& operator=(const GTestMutexLock&) = delete; @@ -1484,14 +1450,14 @@ typedef GTestMutexLock MutexLock; // Base class for ValueHolder. Allows a caller to hold and delete a value // without knowing its type. -class ThreadLocalValueHolderBase { +class [[nodiscard]] ThreadLocalValueHolderBase { public: - virtual ~ThreadLocalValueHolderBase() {} + virtual ~ThreadLocalValueHolderBase() = default; }; // Provides a way for a thread to send notifications to a ThreadLocal // regardless of its parameter type. -class ThreadLocalBase { +class [[nodiscard]] ThreadLocalBase { public: // Creates a new ValueHolder object holding a default value passed to // this ThreadLocal's constructor and returns it. It is the caller's @@ -1500,8 +1466,8 @@ class ThreadLocalBase { virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0; protected: - ThreadLocalBase() {} - virtual ~ThreadLocalBase() {} + ThreadLocalBase() = default; + virtual ~ThreadLocalBase() = default; private: ThreadLocalBase(const ThreadLocalBase&) = delete; @@ -1511,7 +1477,7 @@ class ThreadLocalBase { // Maps a thread to a set of ThreadLocals that have values instantiated on that // thread and notifies them when the thread exits. A ThreadLocal instance is // expected to persist until all threads it has values on have terminated. -class GTEST_API_ ThreadLocalRegistry { +class GTEST_API_ [[nodiscard]] ThreadLocalRegistry { public: // Registers thread_local_instance as having value on the current thread. // Returns a value that can be used to identify the thread from other threads. @@ -1523,14 +1489,14 @@ class GTEST_API_ ThreadLocalRegistry { const ThreadLocalBase* thread_local_instance); }; -class GTEST_API_ ThreadWithParamBase { +class GTEST_API_ [[nodiscard]] ThreadWithParamBase { public: void Join(); protected: class Runnable { public: - virtual ~Runnable() {} + virtual ~Runnable() = default; virtual void Run() = 0; }; @@ -1543,20 +1509,20 @@ class GTEST_API_ ThreadWithParamBase { // Helper class for testing Google Test's multi-threading constructs. template -class ThreadWithParam : public ThreadWithParamBase { +class [[nodiscard]] ThreadWithParam : public ThreadWithParamBase { public: typedef void UserThreadFunc(T); ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start) : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {} - virtual ~ThreadWithParam() {} + ~ThreadWithParam() override = default; private: class RunnableImpl : public Runnable { public: RunnableImpl(UserThreadFunc* func, T param) : func_(func), param_(param) {} - virtual ~RunnableImpl() {} - virtual void Run() { func_(param_); } + ~RunnableImpl() override = default; + void Run() override { func_(param_); } private: UserThreadFunc* const func_; @@ -1598,7 +1564,7 @@ class ThreadWithParam : public ThreadWithParamBase { // object managed by Google Test will be leaked as long as all threads // using Google Test have exited when main() returns. template -class ThreadLocal : public ThreadLocalBase { +class [[nodiscard]] ThreadLocal : public ThreadLocalBase { public: ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {} explicit ThreadLocal(const T& value) @@ -1639,8 +1605,8 @@ class ThreadLocal : public ThreadLocalBase { class ValueHolderFactory { public: - ValueHolderFactory() {} - virtual ~ValueHolderFactory() {} + ValueHolderFactory() = default; + virtual ~ValueHolderFactory() = default; virtual ValueHolder* MakeNewHolder() const = 0; private: @@ -1650,7 +1616,7 @@ class ThreadLocal : public ThreadLocalBase { class DefaultValueHolderFactory : public ValueHolderFactory { public: - DefaultValueHolderFactory() {} + DefaultValueHolderFactory() = default; ValueHolder* MakeNewHolder() const override { return new ValueHolder(); } private: @@ -1683,17 +1649,17 @@ class ThreadLocal : public ThreadLocalBase { #elif GTEST_HAS_PTHREAD // MutexBase and Mutex implement mutex on pthreads-based platforms. -class MutexBase { +class [[nodiscard]] MutexBase { public: // Acquires this mutex. - void Lock() { + void lock() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_)); owner_ = pthread_self(); has_owner_ = true; } // Releases this mutex. - void Unlock() { + void unlock() { // Since the lock is being released the owner_ field should no longer be // considered valid. We don't protect writing to has_owner_ here, as it's // the caller's responsibility to ensure that the current thread holds the @@ -1741,7 +1707,7 @@ class MutexBase { // The Mutex class can only be used for mutexes created at runtime. It // shares its API with MutexBase otherwise. -class Mutex : public MutexBase { +class [[nodiscard]] Mutex : public MutexBase { public: Mutex() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr)); @@ -1759,14 +1725,13 @@ class Mutex : public MutexBase { // platforms. That macro is used as a defensive measure to prevent against // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than // "MutexLock l(&mu)". Hence the typedef trick below. -class GTestMutexLock { +class [[nodiscard]] GTestMutexLock { public: - explicit GTestMutexLock(MutexBase* mutex) : mutex_(mutex) { mutex_->Lock(); } - - ~GTestMutexLock() { mutex_->Unlock(); } + explicit GTestMutexLock(MutexBase& mutex) : mutex_(mutex) { mutex_.lock(); } + ~GTestMutexLock() { mutex_.unlock(); } private: - MutexBase* const mutex_; + MutexBase& mutex_; GTestMutexLock(const GTestMutexLock&) = delete; GTestMutexLock& operator=(const GTestMutexLock&) = delete; @@ -1780,7 +1745,7 @@ typedef GTestMutexLock MutexLock; // C-linkage. Therefore it cannot be templatized to access // ThreadLocal. Hence the need for class // ThreadLocalValueHolderBase. -class GTEST_API_ ThreadLocalValueHolderBase { +class GTEST_API_ [[nodiscard]] ThreadLocalValueHolderBase { public: virtual ~ThreadLocalValueHolderBase() = default; }; @@ -1793,7 +1758,7 @@ extern "C" inline void DeleteThreadLocalValue(void* value_holder) { // Implements thread-local storage on pthreads-based systems. template -class GTEST_API_ ThreadLocal { +class GTEST_API_ [[nodiscard]] ThreadLocal { public: ThreadLocal() : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {} @@ -1906,11 +1871,11 @@ class GTEST_API_ ThreadLocal { // mutex is not supported - using Google Test in multiple threads is not // supported on such platforms. -class Mutex { +class [[nodiscard]] Mutex { public: Mutex() {} - void Lock() {} - void Unlock() {} + void lock() {} + void unlock() {} void AssertHeld() const {} }; @@ -1924,15 +1889,15 @@ class Mutex { // platforms. That macro is used as a defensive measure to prevent against // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than // "MutexLock l(&mu)". Hence the typedef trick below. -class GTestMutexLock { +class [[nodiscard]] GTestMutexLock { public: - explicit GTestMutexLock(Mutex*) {} // NOLINT + explicit GTestMutexLock(Mutex&) {} // NOLINT }; typedef GTestMutexLock MutexLock; template -class GTEST_API_ ThreadLocal { +class GTEST_API_ [[nodiscard]] ThreadLocal { public: ThreadLocal() : value_() {} explicit ThreadLocal(const T& value) : value_(value) {} @@ -2240,7 +2205,7 @@ constexpr BiggestInt kMaxBiggestInt = (std::numeric_limits::max)(); // needs. Other types can be easily added in the future if need // arises. template -class TypeWithSize { +class [[nodiscard]] TypeWithSize { public: // This prevents the user from using TypeWithSize with incorrect // values of N. @@ -2249,7 +2214,7 @@ class TypeWithSize { // The specialization for size 4. template <> -class TypeWithSize<4> { +class [[nodiscard]] TypeWithSize<4> { public: using Int = std::int32_t; using UInt = std::uint32_t; @@ -2257,7 +2222,7 @@ class TypeWithSize<4> { // The specialization for size 8. template <> -class TypeWithSize<8> { +class [[nodiscard]] TypeWithSize<8> { public: using Int = std::int64_t; using UInt = std::uint64_t; @@ -2287,11 +2252,11 @@ using TimeInMillis = int64_t; // Represents time in milliseconds. // Macros for declaring flags. #define GTEST_DECLARE_bool_(name) \ - ABSL_DECLARE_FLAG(bool, GTEST_FLAG_NAME_(name)) + GTEST_API_ ABSL_DECLARE_FLAG(bool, GTEST_FLAG_NAME_(name)) #define GTEST_DECLARE_int32_(name) \ - ABSL_DECLARE_FLAG(int32_t, GTEST_FLAG_NAME_(name)) + GTEST_API_ ABSL_DECLARE_FLAG(int32_t, GTEST_FLAG_NAME_(name)) #define GTEST_DECLARE_string_(name) \ - ABSL_DECLARE_FLAG(std::string, GTEST_FLAG_NAME_(name)) + GTEST_API_ ABSL_DECLARE_FLAG(std::string, GTEST_FLAG_NAME_(name)) #define GTEST_FLAG_SAVER_ ::absl::FlagSaver @@ -2367,91 +2332,11 @@ const char* StringFromGTestEnv(const char* flag, const char* default_val); } // namespace internal } // namespace testing -#if !defined(GTEST_INTERNAL_DEPRECATED) - -// Internal Macro to mark an API deprecated, for googletest usage only -// Usage: class GTEST_INTERNAL_DEPRECATED(message) MyClass or -// GTEST_INTERNAL_DEPRECATED(message) myFunction(); Every usage of -// a deprecated entity will trigger a warning when compiled with -// `-Wdeprecated-declarations` option (clang, gcc, any __GNUC__ compiler). -// For msvc /W3 option will need to be used -// Note that for 'other' compilers this macro evaluates to nothing to prevent -// compilations errors. -#if defined(_MSC_VER) -#define GTEST_INTERNAL_DEPRECATED(message) __declspec(deprecated(message)) -#elif defined(__GNUC__) -#define GTEST_INTERNAL_DEPRECATED(message) __attribute__((deprecated(message))) -#else -#define GTEST_INTERNAL_DEPRECATED(message) -#endif - -#endif // !defined(GTEST_INTERNAL_DEPRECATED) - -#ifdef GTEST_HAS_ABSL -// Always use absl::any for UniversalPrinter<> specializations if googletest -// is built with absl support. -#define GTEST_INTERNAL_HAS_ANY 1 -#include "absl/types/any.h" -namespace testing { -namespace internal { -using Any = ::absl::any; -} // namespace internal -} // namespace testing -#else -#if defined(__cpp_lib_any) || (GTEST_INTERNAL_HAS_INCLUDE() && \ - GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L && \ - (!defined(_MSC_VER) || GTEST_HAS_RTTI)) -// Otherwise for C++17 and higher use std::any for UniversalPrinter<> -// specializations. -#define GTEST_INTERNAL_HAS_ANY 1 -#include -namespace testing { -namespace internal { -using Any = ::std::any; -} // namespace internal -} // namespace testing -// The case where absl is configured NOT to alias std::any is not -// supported. -#endif // __cpp_lib_any -#endif // GTEST_HAS_ABSL - -#ifndef GTEST_INTERNAL_HAS_ANY -#define GTEST_INTERNAL_HAS_ANY 0 -#endif - -#ifdef GTEST_HAS_ABSL -// Always use absl::optional for UniversalPrinter<> specializations if -// googletest is built with absl support. -#define GTEST_INTERNAL_HAS_OPTIONAL 1 -#include "absl/types/optional.h" -namespace testing { -namespace internal { -template -using Optional = ::absl::optional; -inline ::absl::nullopt_t Nullopt() { return ::absl::nullopt; } -} // namespace internal -} // namespace testing +#if GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE(clang::annotate) +#define GTEST_INTERNAL_DEPRECATE_AND_INLINE(msg) \ + [[deprecated(msg), clang::annotate("inline-me")]] #else -#if defined(__cpp_lib_optional) || (GTEST_INTERNAL_HAS_INCLUDE() && \ - GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L) -// Otherwise for C++17 and higher use std::optional for UniversalPrinter<> -// specializations. -#define GTEST_INTERNAL_HAS_OPTIONAL 1 -#include -namespace testing { -namespace internal { -template -using Optional = ::std::optional; -inline ::std::nullopt_t Nullopt() { return ::std::nullopt; } -} // namespace internal -} // namespace testing -// The case where absl is configured NOT to alias std::optional is not -// supported. -#endif // __cpp_lib_optional -#endif // GTEST_HAS_ABSL - -#ifndef GTEST_INTERNAL_HAS_OPTIONAL -#define GTEST_INTERNAL_HAS_OPTIONAL 0 +#define GTEST_INTERNAL_DEPRECATE_AND_INLINE(msg) [[deprecated(msg)]] #endif #if defined(__cpp_lib_span) || (GTEST_INTERNAL_HAS_INCLUDE() && \ @@ -2495,44 +2380,6 @@ using StringView = ::std::string_view; #define GTEST_INTERNAL_HAS_STRING_VIEW 0 #endif -#ifdef GTEST_HAS_ABSL -// Always use absl::variant for UniversalPrinter<> specializations if googletest -// is built with absl support. -#define GTEST_INTERNAL_HAS_VARIANT 1 -#include "absl/types/variant.h" -namespace testing { -namespace internal { -template -using Variant = ::absl::variant; -} // namespace internal -} // namespace testing -#else -#if defined(__cpp_lib_variant) || (GTEST_INTERNAL_HAS_INCLUDE() && \ - GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L) -// Otherwise for C++17 and higher use std::variant for UniversalPrinter<> -// specializations. -#define GTEST_INTERNAL_HAS_VARIANT 1 -#include -namespace testing { -namespace internal { -template -using Variant = ::std::variant; -} // namespace internal -} // namespace testing -// The case where absl is configured NOT to alias std::variant is not supported. -#endif // __cpp_lib_variant -#endif // GTEST_HAS_ABSL - -#ifndef GTEST_INTERNAL_HAS_VARIANT -#define GTEST_INTERNAL_HAS_VARIANT 0 -#endif - -#if (defined(__cpp_constexpr) && !defined(__cpp_inline_variables)) || \ - (defined(GTEST_INTERNAL_CPLUSPLUS_LANG) && \ - GTEST_INTERNAL_CPLUSPLUS_LANG < 201703L) -#define GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1 -#endif - #if (defined(__cpp_lib_three_way_comparison) || \ (GTEST_INTERNAL_HAS_INCLUDE() && \ GTEST_INTERNAL_CPLUSPLUS_LANG >= 201907L)) diff --git a/deps/googletest/include/gtest/internal/gtest-string.h b/deps/googletest/include/gtest/internal/gtest-string.h index 7c05b58339f681..2363034fc0dbcb 100644 --- a/deps/googletest/include/gtest/internal/gtest-string.h +++ b/deps/googletest/include/gtest/internal/gtest-string.h @@ -60,7 +60,7 @@ namespace testing { namespace internal { // String - an abstract class holding static string utilities. -class GTEST_API_ String { +class GTEST_API_ [[nodiscard]] String { public: // Static utility methods @@ -166,7 +166,7 @@ class GTEST_API_ String { private: String(); // Not meant to be instantiated. -}; // class String +}; // class String // Gets the content of the stringstream's buffer as an std::string. Each '\0' // character in the buffer is replaced with "\\0". diff --git a/deps/googletest/src/gtest-internal-inl.h b/deps/googletest/src/gtest-internal-inl.h index cc6f00488f9608..6a39b93be132e2 100644 --- a/deps/googletest/src/gtest-internal-inl.h +++ b/deps/googletest/src/gtest-internal-inl.h @@ -826,6 +826,10 @@ class GTEST_API_ UnitTestImpl { bool catch_exceptions() const { return catch_exceptions_; } private: + // Returns true if a warning should be issued if no tests match the test + // filter flag. + bool ShouldWarnIfNoTestsMatchFilter() const; + struct CompareTestSuitesByPointer { bool operator()(const TestSuite* lhs, const TestSuite* rhs) const { return lhs->name_ < rhs->name_; diff --git a/deps/googletest/src/gtest-port.cc b/deps/googletest/src/gtest-port.cc index 1038ad7bf60209..f8ecb37c48d943 100644 --- a/deps/googletest/src/gtest-port.cc +++ b/deps/googletest/src/gtest-port.cc @@ -89,6 +89,7 @@ #include "gtest/gtest-message.h" #include "gtest/gtest-spi.h" +#include "gtest/gtest.h" #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-string.h" #include "src/gtest-internal-inl.h" @@ -320,13 +321,13 @@ Mutex::~Mutex() { } } -void Mutex::Lock() { +void Mutex::lock() { ThreadSafeLazyInit(); ::EnterCriticalSection(critical_section_); owner_thread_id_ = ::GetCurrentThreadId(); } -void Mutex::Unlock() { +void Mutex::unlock() { ThreadSafeLazyInit(); // We don't protect writing to owner_thread_id_ here, as it's the // caller's responsibility to ensure that the current thread holds the @@ -499,7 +500,7 @@ class ThreadLocalRegistryImpl { MemoryIsNotDeallocated memory_is_not_deallocated; #endif // _MSC_VER DWORD current_thread = ::GetCurrentThreadId(); - MutexLock lock(&mutex_); + MutexLock lock(mutex_); ThreadIdToThreadLocals* const thread_to_thread_locals = GetThreadLocalsMapLocked(); ThreadIdToThreadLocals::iterator thread_local_pos = @@ -532,7 +533,7 @@ class ThreadLocalRegistryImpl { // Clean up the ThreadLocalValues data structure while holding the lock, but // defer the destruction of the ThreadLocalValueHolderBases. { - MutexLock lock(&mutex_); + MutexLock lock(mutex_); ThreadIdToThreadLocals* const thread_to_thread_locals = GetThreadLocalsMapLocked(); for (ThreadIdToThreadLocals::iterator it = @@ -559,7 +560,7 @@ class ThreadLocalRegistryImpl { // Clean up the ThreadIdToThreadLocals data structure while holding the // lock, but defer the destruction of the ThreadLocalValueHolderBases. { - MutexLock lock(&mutex_); + MutexLock lock(mutex_); ThreadIdToThreadLocals* const thread_to_thread_locals = GetThreadLocalsMapLocked(); ThreadIdToThreadLocals::iterator thread_local_pos = @@ -729,7 +730,7 @@ void RE::Init(const char* regex) { char* const full_pattern = new char[full_regex_len]; snprintf(full_pattern, full_regex_len, "^(%s)$", regex); - is_valid_ = regcomp(&full_regex_, full_pattern, reg_flags) == 0; + int error = regcomp(&full_regex_, full_pattern, reg_flags); // We want to call regcomp(&partial_regex_, ...) even if the // previous expression returns false. Otherwise partial_regex_ may // not be properly initialized can may cause trouble when it's @@ -738,13 +739,13 @@ void RE::Init(const char* regex) { // Some implementation of POSIX regex (e.g. on at least some // versions of Cygwin) doesn't accept the empty string as a valid // regex. We change it to an equivalent form "()" to be safe. - if (is_valid_) { + if (!error) { const char* const partial_regex = (*regex == '\0') ? "()" : regex; - is_valid_ = regcomp(&partial_regex_, partial_regex, reg_flags) == 0; + error = regcomp(&partial_regex_, partial_regex, reg_flags); } - EXPECT_TRUE(is_valid_) - << "Regular expression \"" << regex - << "\" is not a valid POSIX Extended regular expression."; + is_valid_ = error == 0; + EXPECT_EQ(error, 0) << "Regular expression \"" << regex + << "\" is not a valid POSIX Extended regular expression."; delete[] full_pattern; } diff --git a/deps/googletest/src/gtest-printers.cc b/deps/googletest/src/gtest-printers.cc index e3acecba8e4dec..f65573077861b4 100644 --- a/deps/googletest/src/gtest-printers.cc +++ b/deps/googletest/src/gtest-printers.cc @@ -50,7 +50,7 @@ #include #include #include // NOLINT -#include +#include #include #include "gtest/internal/gtest-port.h" @@ -333,14 +333,14 @@ void PrintTo(__int128_t v, ::std::ostream* os) { // Prints the given array of characters to the ostream. CharType must be either // char, char8_t, char16_t, char32_t, or wchar_t. -// The array starts at begin, the length is len, it may include '\0' characters -// and may not be NUL-terminated. +// The array starts at begin (which may be nullptr) and contains len characters. +// The array may include '\0' characters and may not be NUL-terminated. template GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ static CharFormat PrintCharsAsStringTo(const CharType* begin, size_t len, ostream* os) { - const char* const quote_prefix = GetCharWidthPrefix(*begin); + const char* const quote_prefix = GetCharWidthPrefix(CharType()); *os << quote_prefix << "\""; bool is_previous_hex = false; CharFormat print_format = kAsIs; @@ -516,13 +516,13 @@ bool IsValidUTF8(const char* str, size_t length) { void ConditionalPrintAsText(const char* str, size_t length, ostream* os) { if (!ContainsUnprintableControlCodes(str, length) && IsValidUTF8(str, length)) { - *os << "\n As Text: \"" << str << "\""; + *os << "\n As Text: \"" << ::std::string_view(str, length) << "\""; } } } // anonymous namespace -void PrintStringTo(const ::std::string& s, ostream* os) { +void PrintStringTo(::std::string_view s, ostream* os) { if (PrintCharsAsStringTo(s.data(), s.size(), os) == kHexEscape) { if (GTEST_FLAG_GET(print_utf8)) { ConditionalPrintAsText(s.data(), s.size(), os); @@ -531,21 +531,21 @@ void PrintStringTo(const ::std::string& s, ostream* os) { } #ifdef __cpp_lib_char8_t -void PrintU8StringTo(const ::std::u8string& s, ostream* os) { +void PrintU8StringTo(::std::u8string_view s, ostream* os) { PrintCharsAsStringTo(s.data(), s.size(), os); } #endif -void PrintU16StringTo(const ::std::u16string& s, ostream* os) { +void PrintU16StringTo(::std::u16string_view s, ostream* os) { PrintCharsAsStringTo(s.data(), s.size(), os); } -void PrintU32StringTo(const ::std::u32string& s, ostream* os) { +void PrintU32StringTo(::std::u32string_view s, ostream* os) { PrintCharsAsStringTo(s.data(), s.size(), os); } #if GTEST_HAS_STD_WSTRING -void PrintWideStringTo(const ::std::wstring& s, ostream* os) { +void PrintWideStringTo(::std::wstring_view s, ostream* os) { PrintCharsAsStringTo(s.data(), s.size(), os); } #endif // GTEST_HAS_STD_WSTRING diff --git a/deps/googletest/src/gtest.cc b/deps/googletest/src/gtest.cc index 3c1cac6ebe69fd..193f880be27fff 100644 --- a/deps/googletest/src/gtest.cc +++ b/deps/googletest/src/gtest.cc @@ -192,12 +192,17 @@ static const char kDefaultOutputFormat[] = "xml"; // The default output file. static const char kDefaultOutputFile[] = "test_detail"; +// These environment variables are set by Bazel. +// https://bazel.build/reference/test-encyclopedia#initial-conditions +// // The environment variable name for the test shard index. static const char kTestShardIndex[] = "GTEST_SHARD_INDEX"; // The environment variable name for the total number of test shards. static const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS"; // The environment variable name for the test shard status file. static const char kTestShardStatusFile[] = "GTEST_SHARD_STATUS_FILE"; +// The environment variable name for the test output warnings file. +static const char kTestWarningsOutputFile[] = "TEST_WARNINGS_OUTPUT_FILE"; namespace internal { @@ -258,6 +263,19 @@ GTEST_DEFINE_bool_( testing::GetDefaultFailFast()), "True if and only if a test failure should stop further test execution."); +GTEST_DEFINE_bool_( + fail_if_no_test_linked, + testing::internal::BoolFromGTestEnv("fail_if_no_test_linked", false), + "True if and only if the test should fail if no test case (including " + "disabled test cases) is linked."); + +GTEST_DEFINE_bool_( + fail_if_no_test_selected, + testing::internal::BoolFromGTestEnv("fail_if_no_test_selected", false), + "True if and only if the test should fail if no test case is selected to " + "run. A test case is selected to run if it is not disabled and is matched " + "by the filter flag so that it starts executing."); + GTEST_DEFINE_bool_( also_run_disabled_tests, testing::internal::BoolFromGTestEnv("also_run_disabled_tests", false), @@ -695,7 +713,7 @@ std::string UnitTestOptions::GetAbsolutePathToOutputFile() { const char* const gtest_output_flag = s.c_str(); std::string format = GetOutputFormat(); - if (format.empty()) format = std::string(kDefaultOutputFormat); + if (format.empty()) format = kDefaultOutputFormat; const char* const colon = strchr(gtest_output_flag, ':'); if (colon == nullptr) @@ -1068,14 +1086,14 @@ void DefaultPerThreadTestPartResultReporter::ReportTestPartResult( // Returns the global test part result reporter. TestPartResultReporterInterface* UnitTestImpl::GetGlobalTestPartResultReporter() { - internal::MutexLock lock(&global_test_part_result_reporter_mutex_); + internal::MutexLock lock(global_test_part_result_reporter_mutex_); return global_test_part_result_reporter_; } // Sets the global test part result reporter. void UnitTestImpl::SetGlobalTestPartResultReporter( TestPartResultReporterInterface* reporter) { - internal::MutexLock lock(&global_test_part_result_reporter_mutex_); + internal::MutexLock lock(global_test_part_result_reporter_mutex_); global_test_part_result_reporter_ = reporter; } @@ -1477,17 +1495,17 @@ class Hunk { // Print a unified diff header for one hunk. // The format is // "@@ -, +, @@" - // where the left/right parts are omitted if unnecessary. + // where the left/right lengths are omitted if unnecessary. void PrintHeader(std::ostream* ss) const { - *ss << "@@ "; - if (removes_) { - *ss << "-" << left_start_ << "," << (removes_ + common_); - } - if (removes_ && adds_) { - *ss << " "; + size_t left_length = removes_ + common_; + size_t right_length = adds_ + common_; + *ss << "@@ " << "-" << left_start_; + if (left_length != 1) { + *ss << "," << left_length; } - if (adds_) { - *ss << "+" << right_start_ << "," << (adds_ + common_); + *ss << " " << "+" << right_start_; + if (right_length != 1) { + *ss << "," << right_length; } *ss << " @@\n"; } @@ -2329,7 +2347,7 @@ void TestResult::RecordProperty(const std::string& xml_element, if (!ValidateTestProperty(xml_element, test_property)) { return; } - internal::MutexLock lock(&test_properties_mutex_); + internal::MutexLock lock(test_properties_mutex_); const std::vector::iterator property_with_matching_key = std::find_if(test_properties_.begin(), test_properties_.end(), internal::TestPropertyKeyIs(test_property.key())); @@ -3287,6 +3305,7 @@ bool ShouldUseColor(bool stdout_is_tty) { const bool term_supports_color = term != nullptr && (String::CStringEquals(term, "xterm") || String::CStringEquals(term, "xterm-color") || + String::CStringEquals(term, "xterm-ghostty") || String::CStringEquals(term, "xterm-kitty") || String::CStringEquals(term, "alacritty") || String::CStringEquals(term, "screen") || @@ -4012,16 +4031,11 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener { static void PrintXmlUnitTest(::std::ostream* stream, const UnitTest& unit_test); - // Produces a string representing the test properties in a result as space - // delimited XML attributes based on the property key="value" pairs. - // When the std::string is not empty, it includes a space at the beginning, - // to delimit this attribute from prior attributes. - static std::string TestPropertiesAsXmlAttributes(const TestResult& result); - // Streams an XML representation of the test properties of a TestResult // object. static void OutputXmlTestProperties(std::ostream* stream, - const TestResult& result); + const TestResult& result, + const std::string& indent); // The output file. const std::string output_file_; @@ -4341,8 +4355,8 @@ void XmlUnitTestResultPrinter::OutputXmlTestResult(::std::ostream* stream, internal::FormatCompilerIndependentFileLocation(part.file_name(), part.line_number()); const std::string summary = location + "\n" + part.summary(); - *stream << " "; + *stream << " "; const std::string detail = location + "\n" + part.message(); OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str()); *stream << "\n"; @@ -4355,7 +4369,7 @@ void XmlUnitTestResultPrinter::OutputXmlTestResult(::std::ostream* stream, if (failures == 0 && skips == 0) { *stream << ">\n"; } - OutputXmlTestProperties(stream, result); + OutputXmlTestProperties(stream, result, /*indent=*/" "); *stream << " \n"; } } @@ -4384,9 +4398,10 @@ void XmlUnitTestResultPrinter::PrintXmlTestSuite(std::ostream* stream, OutputXmlAttribute( stream, kTestsuite, "timestamp", FormatEpochTimeInMillisAsIso8601(test_suite.start_timestamp())); - *stream << TestPropertiesAsXmlAttributes(test_suite.ad_hoc_test_result()); } *stream << ">\n"; + OutputXmlTestProperties(stream, test_suite.ad_hoc_test_result(), + /*indent=*/" "); for (int i = 0; i < test_suite.total_test_count(); ++i) { if (test_suite.GetTestInfo(i)->is_reportable()) OutputXmlTestInfo(stream, test_suite.name(), *test_suite.GetTestInfo(i)); @@ -4424,11 +4439,12 @@ void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream, OutputXmlAttribute(stream, kTestsuites, "random_seed", StreamableToString(unit_test.random_seed())); } - *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result()); OutputXmlAttribute(stream, kTestsuites, "name", "AllTests"); *stream << ">\n"; + OutputXmlTestProperties(stream, unit_test.ad_hoc_test_result(), + /*indent=*/" "); for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { if (unit_test.GetTestSuite(i)->reportable_test_count() > 0) PrintXmlTestSuite(stream, *unit_test.GetTestSuite(i)); @@ -4465,21 +4481,8 @@ void XmlUnitTestResultPrinter::PrintXmlTestsList( *stream << "\n"; } -// Produces a string representing the test properties in a result as space -// delimited XML attributes based on the property key="value" pairs. -std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes( - const TestResult& result) { - Message attributes; - for (int i = 0; i < result.test_property_count(); ++i) { - const TestProperty& property = result.GetTestProperty(i); - attributes << " " << property.key() << "=" << "\"" - << EscapeXmlAttribute(property.value()) << "\""; - } - return attributes.GetString(); -} - void XmlUnitTestResultPrinter::OutputXmlTestProperties( - std::ostream* stream, const TestResult& result) { + std::ostream* stream, const TestResult& result, const std::string& indent) { const std::string kProperties = "properties"; const std::string kProperty = "property"; @@ -4487,15 +4490,15 @@ void XmlUnitTestResultPrinter::OutputXmlTestProperties( return; } - *stream << " <" << kProperties << ">\n"; + *stream << indent << "<" << kProperties << ">\n"; for (int i = 0; i < result.test_property_count(); ++i) { const TestProperty& property = result.GetTestProperty(i); - *stream << " <" << kProperty; + *stream << indent << " <" << kProperty; *stream << " name=\"" << EscapeXmlAttribute(property.key()) << "\""; *stream << " value=\"" << EscapeXmlAttribute(property.value()) << "\""; *stream << "/>\n"; } - *stream << " \n"; + *stream << indent << "\n"; } // End XmlUnitTestResultPrinter @@ -5085,7 +5088,7 @@ std::string OsStackTraceGetter::CurrentStackTrace(int max_depth, int skip_count) void* caller_frame = nullptr; { - MutexLock lock(&mutex_); + MutexLock lock(mutex_); caller_frame = caller_frame_; } @@ -5124,12 +5127,12 @@ void OsStackTraceGetter::UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_) { caller_frame = nullptr; } - MutexLock lock(&mutex_); + MutexLock lock(mutex_); caller_frame_ = caller_frame; #endif // GTEST_HAS_ABSL } -#ifdef GTEST_HAS_DEATH_TEST +#ifdef GTEST_INTERNAL_HAS_PREMATURE_EXIT_FILE // A helper class that creates the premature-exit file in its // constructor and deletes the file in its destructor. class ScopedPrematureExitFile { @@ -5167,7 +5170,7 @@ class ScopedPrematureExitFile { ScopedPrematureExitFile(const ScopedPrematureExitFile&) = delete; ScopedPrematureExitFile& operator=(const ScopedPrematureExitFile&) = delete; }; -#endif // GTEST_HAS_DEATH_TEST +#endif // GTEST_INTERNAL_HAS_PREMATURE_EXIT_FILE } // namespace internal @@ -5387,13 +5390,13 @@ void UnitTest::UponLeavingGTest() { // Sets the TestSuite object for the test that's currently running. void UnitTest::set_current_test_suite(TestSuite* a_current_test_suite) { - internal::MutexLock lock(&mutex_); + internal::MutexLock lock(mutex_); impl_->set_current_test_suite(a_current_test_suite); } // Sets the TestInfo object for the test that's currently running. void UnitTest::set_current_test_info(TestInfo* a_current_test_info) { - internal::MutexLock lock(&mutex_); + internal::MutexLock lock(mutex_); impl_->set_current_test_info(a_current_test_info); } @@ -5432,7 +5435,7 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type, Message msg; msg << message; - internal::MutexLock lock(&mutex_); + internal::MutexLock lock(mutex_); if (!impl_->gtest_trace_stack().empty()) { msg << "\n" << GTEST_NAME_ << " trace:"; @@ -5512,7 +5515,7 @@ void UnitTest::RecordProperty(const std::string& key, // We don't protect this under mutex_, as we only support calling it // from the main thread. int UnitTest::Run() { -#ifdef GTEST_HAS_DEATH_TEST +#ifdef GTEST_INTERNAL_HAS_PREMATURE_EXIT_FILE const bool in_death_test_child_process = !GTEST_FLAG_GET(internal_run_death_test).empty(); @@ -5543,7 +5546,7 @@ int UnitTest::Run() { : internal::posix::GetEnv("TEST_PREMATURE_EXIT_FILE")); #else const bool in_death_test_child_process = false; -#endif // GTEST_HAS_DEATH_TEST +#endif // GTEST_INTERNAL_HAS_PREMATURE_EXIT_FILE // Captures the value of GTEST_FLAG(catch_exceptions). This value will be // used for the duration of the program. @@ -5615,7 +5618,7 @@ const char* UnitTest::original_working_dir() const { // or NULL if no test is running. const TestSuite* UnitTest::current_test_suite() const GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); + internal::MutexLock lock(mutex_); return impl_->current_test_suite(); } @@ -5623,7 +5626,7 @@ const TestSuite* UnitTest::current_test_suite() const #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ const TestCase* UnitTest::current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); + internal::MutexLock lock(mutex_); return impl_->current_test_suite(); } #endif @@ -5632,7 +5635,7 @@ const TestCase* UnitTest::current_test_case() const // or NULL if no test is running. const TestInfo* UnitTest::current_test_info() const GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); + internal::MutexLock lock(mutex_); return impl_->current_test_info(); } @@ -5656,13 +5659,13 @@ UnitTest::~UnitTest() { delete impl_; } // Google Test trace stack. void UnitTest::PushGTestTrace(const internal::TraceInfo& trace) GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); + internal::MutexLock lock(mutex_); impl_->gtest_trace_stack().push_back(trace); } // Pops a trace from the per-thread Google Test trace stack. void UnitTest::PopGTestTrace() GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); + internal::MutexLock lock(mutex_); impl_->gtest_trace_stack().pop_back(); } @@ -5885,6 +5888,23 @@ TestSuite* UnitTestImpl::GetTestSuite( static void SetUpEnvironment(Environment* env) { env->SetUp(); } static void TearDownEnvironment(Environment* env) { env->TearDown(); } +// If the environment variable TEST_WARNINGS_OUTPUT_FILE was provided, appends +// `str` to the file, creating the file if necessary. +#if GTEST_HAS_FILE_SYSTEM +static void AppendToTestWarningsOutputFile(const std::string& str) { + const char* const filename = posix::GetEnv(kTestWarningsOutputFile); + if (filename == nullptr) { + return; + } + auto* const file = posix::FOpen(filename, "a"); + if (file == nullptr) { + return; + } + GTEST_CHECK_(fwrite(str.data(), 1, str.size(), file) == str.size()); + GTEST_CHECK_(posix::FClose(file) == 0); +} +#endif // GTEST_HAS_FILE_SYSTEM + // Runs all tests in this UnitTest object, prints the result, and // returns true if all tests are successful. If any exception is // thrown during a test, the test is considered to be failed, but the @@ -5906,6 +5926,28 @@ bool UnitTestImpl::RunAllTests() { // user didn't call InitGoogleTest. PostFlagParsingInit(); + // Handle the case where the program has no tests linked. + // Sometimes this is a programmer mistake, but sometimes it is intended. + if (total_test_count() == 0) { + constexpr char kNoTestLinkedMessage[] = + "This test program does NOT link in any test case."; + constexpr char kNoTestLinkedFatal[] = + "This is INVALID. Please make sure to link in at least one test case."; + constexpr char kNoTestLinkedWarning[] = + "Please make sure this is intended."; + const bool fail_if_no_test_linked = GTEST_FLAG_GET(fail_if_no_test_linked); + ColoredPrintf( + GTestColor::kRed, "%s %s\n", kNoTestLinkedMessage, + fail_if_no_test_linked ? kNoTestLinkedFatal : kNoTestLinkedWarning); + if (fail_if_no_test_linked) { + return false; + } +#if GTEST_HAS_FILE_SYSTEM + AppendToTestWarningsOutputFile(std::string(kNoTestLinkedMessage) + ' ' + + kNoTestLinkedWarning + '\n'); +#endif // GTEST_HAS_FILE_SYSTEM + } + #if GTEST_HAS_FILE_SYSTEM // Even if sharding is not on, test runners may want to use the // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding @@ -6045,6 +6087,20 @@ bool UnitTestImpl::RunAllTests() { TearDownEnvironment); repeater->OnEnvironmentsTearDownEnd(*parent_); } + } else if (GTEST_FLAG_GET(fail_if_no_test_selected)) { + // If there were no tests to run, bail if we were requested to be + // strict. + constexpr char kNoTestsSelectedMessage[] = + "No tests ran. Check that tests exist and are not disabled or " + "filtered out.\n\n" + "For sharded runs, this error indicates an empty shard. This can " + "happen if you have more shards than tests, or if --gtest_filter " + "leaves a shard with no tests.\n\n" + "To permit empty shards (e.g., when debugging with a filter), " + "specify \n" + "--gtest_fail_if_no_test_selected=false."; + ColoredPrintf(GTestColor::kRed, "%s\n", kNoTestsSelectedMessage); + return false; } elapsed_time_ = timer.Elapsed(); @@ -6079,6 +6135,17 @@ bool UnitTestImpl::RunAllTests() { environments_.clear(); } + // Try to warn the user if no tests matched the test filter. + if (ShouldWarnIfNoTestsMatchFilter()) { + const std::string filter_warning = + std::string("filter \"") + GTEST_FLAG_GET(filter) + + "\" did not match any test; no tests were run\n"; + ColoredPrintf(GTestColor::kRed, "WARNING: %s", filter_warning.c_str()); +#if GTEST_HAS_FILE_SYSTEM + AppendToTestWarningsOutputFile(filter_warning); +#endif // GTEST_HAS_FILE_SYSTEM + } + if (!gtest_is_initialized_before_run_all_tests) { ColoredPrintf( GTestColor::kRed, @@ -6247,6 +6314,30 @@ int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) { return num_selected_tests; } +// Returns true if a warning should be issued if no tests match the test filter +// flag. We can't simply count the number of tests that ran because, for +// instance, test sharding and death tests might mean no tests are expected to +// run in this process, but will run in another process. +bool UnitTestImpl::ShouldWarnIfNoTestsMatchFilter() const { + if (total_test_count() == 0) { + // No tests were linked in to program. + // This case is handled by a different warning. + return false; + } + const PositiveAndNegativeUnitTestFilter gtest_flag_filter( + GTEST_FLAG_GET(filter)); + for (auto* test_suite : test_suites_) { + const std::string& test_suite_name = test_suite->name_; + for (TestInfo* test_info : test_suite->test_info_list()) { + const std::string& test_name = test_info->name_; + if (gtest_flag_filter.MatchesTest(test_suite_name, test_name)) { + return false; + } + } + } + return true; +} + // Prints the given C-string on a single line by replacing all '\n' // characters with string "\\n". If the output takes more than // max_length characters, only prints the first max_length characters @@ -6693,6 +6784,8 @@ static bool ParseGoogleTestFlag(const char* const arg) { GTEST_INTERNAL_PARSE_FLAG(death_test_style); GTEST_INTERNAL_PARSE_FLAG(death_test_use_fork); GTEST_INTERNAL_PARSE_FLAG(fail_fast); + GTEST_INTERNAL_PARSE_FLAG(fail_if_no_test_linked); + GTEST_INTERNAL_PARSE_FLAG(fail_if_no_test_selected); GTEST_INTERNAL_PARSE_FLAG(filter); GTEST_INTERNAL_PARSE_FLAG(internal_run_death_test); GTEST_INTERNAL_PARSE_FLAG(list_tests); diff --git a/deps/icu-small/LICENSE b/deps/icu-small/LICENSE index 0b9efcd9092f97..5a2eda629500c3 100644 --- a/deps/icu-small/LICENSE +++ b/deps/icu-small/LICENSE @@ -540,3 +540,29 @@ publicity pertaining to distribution of the software without specific, written prior permission. M.I.T. makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. + +---------------------------------------------------------------------- + +File: sorttable.js (only for ICU4J) + +The MIT Licence, for code from kryogenix.org + +Code downloaded from the Browser Experiments section of kryogenix.org is +licenced under the so-called MIT licence. The licence is below. + +Copyright (c) 1997-date Stuart Langridge + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/deps/icu-small/README-FULL-ICU.txt b/deps/icu-small/README-FULL-ICU.txt index ee3fdf50b5e59e..882e0f28b6240e 100644 --- a/deps/icu-small/README-FULL-ICU.txt +++ b/deps/icu-small/README-FULL-ICU.txt @@ -1,8 +1,8 @@ ICU sources - auto generated by shrink-icu-src.py This directory contains the ICU subset used by --with-intl=full-icu -It is a strict subset of ICU 77 source files with the following exception(s): -* deps/icu-small/source/data/in/icudt77l.dat.bz2 : compressed data file +It is a strict subset of ICU 78 source files with the following exception(s): +* deps/icu-small/source/data/in/icudt78l.dat.bz2 : compressed data file To rebuild this directory, see ../../tools/icu/README.md diff --git a/deps/icu-small/source/common/BUILD.bazel b/deps/icu-small/source/common/BUILD.bazel index 3ecae30c437f08..e894ed907e6e61 100644 --- a/deps/icu-small/source/common/BUILD.bazel +++ b/deps/icu-small/source/common/BUILD.bazel @@ -64,6 +64,7 @@ cc_library( "umutex.cpp", "sharedobject.cpp", "utrace.cpp", + "fixedstring.cpp", ], deps = [ ":headers", diff --git a/deps/icu-small/source/common/brkiter.cpp b/deps/icu-small/source/common/brkiter.cpp index 44a13ee6a2acd1..09d168bbf46fe3 100644 --- a/deps/icu-small/source/common/brkiter.cpp +++ b/deps/icu-small/source/common/brkiter.cpp @@ -121,11 +121,9 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st // If there is a result, set the valid locale and actual locale, and the kind if (U_SUCCESS(status) && result != nullptr) { - U_LOCALE_BASED(locBased, *(BreakIterator*)result); - - locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status), - actual.data(), status); - LocaleBased::setLocaleID(loc.getName(), result->requestLocale, status); + result->actualLocale = Locale(actual.data()); + result->validLocale = Locale(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status)); + result->requestLocale = loc; } ures_close(b); @@ -204,33 +202,28 @@ BreakIterator::getAvailableLocales(int32_t& count) //------------------------------------------- BreakIterator::BreakIterator() + : actualLocale(Locale::getRoot()), validLocale(Locale::getRoot()), requestLocale(Locale::getRoot()) { } -BreakIterator::BreakIterator(const BreakIterator &other) : UObject(other) { - UErrorCode status = U_ZERO_ERROR; - U_LOCALE_BASED(locBased, *this); - locBased.setLocaleIDs(other.validLocale, other.actualLocale, status); - LocaleBased::setLocaleID(other.requestLocale, requestLocale, status); - U_ASSERT(U_SUCCESS(status)); +BreakIterator::BreakIterator(const BreakIterator &other) + : UObject(other), + actualLocale(other.actualLocale), + validLocale(other.validLocale), + requestLocale(other.requestLocale) { } BreakIterator &BreakIterator::operator =(const BreakIterator &other) { if (this != &other) { - UErrorCode status = U_ZERO_ERROR; - U_LOCALE_BASED(locBased, *this); - locBased.setLocaleIDs(other.validLocale, other.actualLocale, status); - LocaleBased::setLocaleID(other.requestLocale, requestLocale, status); - U_ASSERT(U_SUCCESS(status)); + actualLocale = other.actualLocale; + validLocale = other.validLocale; + requestLocale = other.requestLocale; } return *this; } BreakIterator::~BreakIterator() { - delete validLocale; - delete actualLocale; - delete requestLocale; } // ------------------------------------------ @@ -398,8 +391,8 @@ BreakIterator::createInstance(const Locale& loc, int32_t kind, UErrorCode& statu // THIS LONG is a sign of bad code -- so the action item is to // revisit this in ICU 3.0 and clean it up/fix it/remove it. if (U_SUCCESS(status) && (result != nullptr) && *actualLoc.getName() != 0) { - U_LOCALE_BASED(locBased, *result); - locBased.setLocaleIDs(actualLoc.getName(), actualLoc.getName(), status); + result->actualLocale = actualLoc; + result->validLocale = actualLoc; } return result; } @@ -506,8 +499,7 @@ BreakIterator::getLocale(ULocDataLocaleType type, UErrorCode& status) const { return Locale::getRoot(); } if (type == ULOC_REQUESTED_LOCALE) { - return requestLocale == nullptr ? - Locale::getRoot() : Locale(requestLocale->data()); + return requestLocale; } return LocaleBased::getLocale(validLocale, actualLocale, type, status); } @@ -518,7 +510,7 @@ BreakIterator::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const { return nullptr; } if (type == ULOC_REQUESTED_LOCALE) { - return requestLocale == nullptr ? "" : requestLocale->data(); + return requestLocale.getName(); } return LocaleBased::getLocaleID(validLocale, actualLocale, type, status); } @@ -546,11 +538,8 @@ int32_t BreakIterator::getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UE return 1; } -BreakIterator::BreakIterator (const Locale& valid, const Locale& actual) { - UErrorCode status = U_ZERO_ERROR; - U_LOCALE_BASED(locBased, (*this)); - locBased.setLocaleIDs(valid.getName(), actual.getName(), status); - U_ASSERT(U_SUCCESS(status)); +BreakIterator::BreakIterator(const Locale& valid, const Locale& actual) + : actualLocale(actual), validLocale(valid), requestLocale(Locale::getRoot()) { } U_NAMESPACE_END diff --git a/deps/icu-small/source/common/charstr.h b/deps/icu-small/source/common/charstr.h index ea54ede735cd3d..a4a70f0773b2f9 100644 --- a/deps/icu-small/source/common/charstr.h +++ b/deps/icu-small/source/common/charstr.h @@ -21,12 +21,6 @@ U_NAMESPACE_BEGIN -// Windows needs us to DLL-export the MaybeStackArray template specialization, -// but MacOS X cannot handle it. Same as in digitlst.h. -#if !U_PLATFORM_IS_DARWIN_BASED -template class U_COMMON_API MaybeStackArray; -#endif - /** * ICU-internal char * string class. * This class does not assume or enforce any particular character encoding. @@ -38,34 +32,34 @@ template class U_COMMON_API MaybeStackArray; * For example: * cs.data()[5]='a'; // no need for setCharAt(5, 'a') */ -class U_COMMON_API CharString : public UMemory { +class U_COMMON_API_CLASS CharString : public UMemory { public: - CharString() : len(0) { buffer[0]=0; } - CharString(StringPiece s, UErrorCode &errorCode) : len(0) { + U_COMMON_API CharString() : len(0) { buffer[0]=0; } + U_COMMON_API CharString(StringPiece s, UErrorCode &errorCode) : len(0) { buffer[0]=0; append(s, errorCode); } - CharString(const CharString &s, UErrorCode &errorCode) : len(0) { + U_COMMON_API CharString(const CharString &s, UErrorCode &errorCode) : len(0) { buffer[0]=0; append(s, errorCode); } - CharString(const char *s, int32_t sLength, UErrorCode &errorCode) : len(0) { + U_COMMON_API CharString(const char *s, int32_t sLength, UErrorCode &errorCode) : len(0) { buffer[0]=0; append(s, sLength, errorCode); } - ~CharString() {} + U_COMMON_API ~CharString() {} /** * Move constructor; might leave src in an undefined state. * This string will have the same contents and state that the source string had. */ - CharString(CharString &&src) noexcept; + U_COMMON_API CharString(CharString &&src) noexcept; /** * Move assignment operator; might leave src in an undefined state. * This string will have the same contents and state that the source string had. * The behavior is undefined if *this and src are the same object. */ - CharString &operator=(CharString &&src) noexcept; + U_COMMON_API CharString &operator=(CharString &&src) noexcept; /** * Replaces this string's contents with the other string's contents. @@ -73,21 +67,21 @@ class U_COMMON_API CharString : public UMemory { * the assignment operator, to make copies explicit and to * use a UErrorCode where memory allocations might be needed. */ - CharString ©From(const CharString &other, UErrorCode &errorCode); - CharString ©From(StringPiece s, UErrorCode &errorCode); + U_COMMON_API CharString ©From(const CharString &other, UErrorCode &errorCode); + U_COMMON_API CharString ©From(StringPiece s, UErrorCode &errorCode); - UBool isEmpty() const { return len==0; } - int32_t length() const { return len; } - char operator[](int32_t index) const { return buffer[index]; } - StringPiece toStringPiece() const { return StringPiece(buffer.getAlias(), len); } + U_COMMON_API UBool isEmpty() const { return len==0; } + U_COMMON_API int32_t length() const { return len; } + U_COMMON_API char operator[](int32_t index) const { return buffer[index]; } + U_COMMON_API StringPiece toStringPiece() const { return StringPiece(buffer.getAlias(), len); } - const char *data() const { return buffer.getAlias(); } - char *data() { return buffer.getAlias(); } + U_COMMON_API const char *data() const { return buffer.getAlias(); } + U_COMMON_API char *data() { return buffer.getAlias(); } /** * Allocates length()+1 chars and copies the NUL-terminated data(). * The caller must uprv_free() the result. */ - char *cloneData(UErrorCode &errorCode) const; + U_COMMON_API char *cloneData(UErrorCode &errorCode) const; /** * Copies the contents of the string into dest. * Checks if there is enough space in dest, extracts the entire string if possible, @@ -103,40 +97,40 @@ class U_COMMON_API CharString : public UMemory { * @param errorCode ICU error code. * @return length() */ - int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const; + U_COMMON_API int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const; - bool operator==(const CharString& other) const { + U_COMMON_API bool operator==(const CharString& other) const { return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0); } - bool operator!=(const CharString& other) const { + U_COMMON_API bool operator!=(const CharString& other) const { return !operator==(other); } - bool operator==(StringPiece other) const { + U_COMMON_API bool operator==(StringPiece other) const { return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0); } - bool operator!=(StringPiece other) const { + U_COMMON_API bool operator!=(StringPiece other) const { return !operator==(other); } /** @return last index of c, or -1 if c is not in this string */ - int32_t lastIndexOf(char c) const; + U_COMMON_API int32_t lastIndexOf(char c) const; - bool contains(StringPiece s) const; + U_COMMON_API bool contains(StringPiece s) const; - CharString &clear() { len=0; buffer[0]=0; return *this; } - CharString &truncate(int32_t newLength); + U_COMMON_API CharString &clear() { len=0; buffer[0]=0; return *this; } + U_COMMON_API CharString &truncate(int32_t newLength); - CharString &append(char c, UErrorCode &errorCode); - CharString &append(StringPiece s, UErrorCode &errorCode) { + U_COMMON_API CharString &append(char c, UErrorCode &errorCode); + U_COMMON_API CharString &append(StringPiece s, UErrorCode &errorCode) { return append(s.data(), s.length(), errorCode); } - CharString &append(const CharString &s, UErrorCode &errorCode) { + U_COMMON_API CharString &append(const CharString &s, UErrorCode &errorCode) { return append(s.data(), s.length(), errorCode); } - CharString &append(const char *s, int32_t sLength, UErrorCode &status); + U_COMMON_API CharString &append(const char *s, int32_t sLength, UErrorCode &status); - CharString &appendNumber(int64_t number, UErrorCode &status); + U_COMMON_API CharString &appendNumber(int64_t number, UErrorCode &status); /** * Returns a writable buffer for appending and writes the buffer's capacity to @@ -158,26 +152,28 @@ class U_COMMON_API CharString : public UMemory { * @param errorCode in/out error code * @return a buffer with resultCapacity>=min_capacity */ - char *getAppendBuffer(int32_t minCapacity, - int32_t desiredCapacityHint, - int32_t &resultCapacity, - UErrorCode &errorCode); + U_COMMON_API char *getAppendBuffer(int32_t minCapacity, + int32_t desiredCapacityHint, + int32_t &resultCapacity, + UErrorCode &errorCode); - CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode); - CharString &appendInvariantChars(const char16_t* uchars, int32_t ucharsLen, UErrorCode& errorCode); + U_COMMON_API CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode); + U_COMMON_API CharString &appendInvariantChars(const char16_t* uchars, + int32_t ucharsLen, + UErrorCode& errorCode); /** * Appends a filename/path part, e.g., a directory name. * First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary. * Does nothing if s is empty. */ - CharString &appendPathPart(StringPiece s, UErrorCode &errorCode); + U_COMMON_API CharString &appendPathPart(StringPiece s, UErrorCode &errorCode); /** * Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty * and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR. */ - CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode); + U_COMMON_API CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode); private: MaybeStackArray buffer; diff --git a/deps/icu-small/source/common/cmemory.h b/deps/icu-small/source/common/cmemory.h index 3705c2dfd0e069..e31c54aac7099c 100644 --- a/deps/icu-small/source/common/cmemory.h +++ b/deps/icu-small/source/common/cmemory.h @@ -334,9 +334,7 @@ class MaybeStackArray { // No heap allocation. Use only on the stack. static void* U_EXPORT2 operator new(size_t) noexcept = delete; static void* U_EXPORT2 operator new[](size_t) noexcept = delete; -#if U_HAVE_PLACEMENT_NEW static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete; -#endif /** * Default constructor initializes with internal T[stackCapacity] buffer. @@ -570,9 +568,7 @@ class MaybeStackHeaderAndArray { // No heap allocation. Use only on the stack. static void* U_EXPORT2 operator new(size_t) noexcept = delete; static void* U_EXPORT2 operator new[](size_t) noexcept = delete; -#if U_HAVE_PLACEMENT_NEW static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete; -#endif /** * Default constructor initializes with internal H+T[stackCapacity] buffer. diff --git a/deps/icu-small/source/common/cstr.h b/deps/icu-small/source/common/cstr.h index be21d910bb475e..84a07543eabac5 100644 --- a/deps/icu-small/source/common/cstr.h +++ b/deps/icu-small/source/common/cstr.h @@ -43,11 +43,11 @@ U_NAMESPACE_BEGIN -class U_COMMON_API CStr : public UMemory { +class U_COMMON_API_CLASS CStr : public UMemory { public: - CStr(const UnicodeString &in); - ~CStr(); - const char * operator ()() const; + U_COMMON_API CStr(const UnicodeString &in); + U_COMMON_API ~CStr(); + U_COMMON_API const char * operator ()() const; private: CharString s; diff --git a/deps/icu-small/source/common/fixedstring.cpp b/deps/icu-small/source/common/fixedstring.cpp new file mode 100644 index 00000000000000..1c603083e2f2b2 --- /dev/null +++ b/deps/icu-small/source/common/fixedstring.cpp @@ -0,0 +1,29 @@ +// © 2025 and later: Unicode, Inc. and others. +// License & terms of use: https://www.unicode.org/copyright.html + +#include "fixedstring.h" + +#include "unicode/unistr.h" +#include "unicode/utypes.h" + +U_NAMESPACE_BEGIN + +U_EXPORT void copyInvariantChars(const UnicodeString& src, FixedString& dst, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + + if (src.isEmpty()) { + dst.clear(); + return; + } + + int32_t length = src.length(); + if (!dst.reserve(length + 1)) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + src.extract(0, length, dst.getAlias(), length + 1, US_INV); +} + +U_NAMESPACE_END diff --git a/deps/icu-small/source/common/fixedstring.h b/deps/icu-small/source/common/fixedstring.h new file mode 100644 index 00000000000000..b576d17ad9af83 --- /dev/null +++ b/deps/icu-small/source/common/fixedstring.h @@ -0,0 +1,104 @@ +// © 2025 and later: Unicode, Inc. and others. +// License & terms of use: https://www.unicode.org/copyright.html + +#ifndef FIXEDSTRING_H +#define FIXEDSTRING_H + +#include +#include + +#include "unicode/uobject.h" +#include "unicode/utypes.h" +#include "cmemory.h" + +U_NAMESPACE_BEGIN + +class UnicodeString; + +/** + * ICU-internal fixed-length char* string class. + * This is a complement to CharString to store fixed-length strings efficiently + * (not allocating any unnecessary storage for future additions to the string). + * + * A terminating NUL is always stored, but the length of the string isn't. + * An empty string is stored as nullptr, allocating no storage at all. + * + * This class wants to be convenient but is also deliberately minimalist. + * Please do not add methods if they only add minor convenience. + */ +class FixedString : public UMemory { +public: + FixedString() = default; + ~FixedString() { operator delete[](ptr); } + + FixedString(const FixedString& other) : FixedString(other.data()) {} + + FixedString(std::string_view init) { + size_t size = init.size(); + if (size > 0 && reserve(size + 1)) { + uprv_memcpy(ptr, init.data(), size); + ptr[size] = '\0'; + } + } + + FixedString& operator=(const FixedString& other) { + *this = other.data(); + return *this; + } + + FixedString& operator=(std::string_view init) { + if (init.empty()) { + operator delete[](ptr); + ptr = nullptr; + } else { + size_t size = init.size(); + if (reserve(size + 1)) { + uprv_memcpy(ptr, init.data(), size); + ptr[size] = '\0'; + } + } + return *this; + } + + FixedString(FixedString&& other) noexcept : ptr(std::exchange(other.ptr, nullptr)) {} + + FixedString& operator=(FixedString&& other) noexcept { + operator delete[](ptr); + ptr = other.ptr; + other.ptr = nullptr; + return *this; + } + + void clear() { + operator delete[](ptr); + ptr = nullptr; + } + + const char* data() const { + return isEmpty() ? "" : ptr; + } + + char* getAlias() { + return ptr; + } + + bool isEmpty() const { + return ptr == nullptr; + } + + /** Allocate storage for a new string, without initializing it. */ + bool reserve(size_t size) { + operator delete[](ptr); + ptr = static_cast(operator new[](size)); + return ptr != nullptr; + } + +private: + char* ptr = nullptr; +}; + +U_COMMON_API void copyInvariantChars(const UnicodeString& src, FixedString& dst, UErrorCode& status); + +U_NAMESPACE_END + +#endif diff --git a/deps/icu-small/source/common/localebuilder.cpp b/deps/icu-small/source/common/localebuilder.cpp index 71969c847b19c1..3ba7355306894c 100644 --- a/deps/icu-small/source/common/localebuilder.cpp +++ b/deps/icu-small/source/common/localebuilder.cpp @@ -8,6 +8,7 @@ #include "bytesinkutil.h" // StringByteSink #include "charstr.h" #include "cstring.h" +#include "fixedstring.h" #include "ulocimp.h" #include "unicode/localebuilder.h" #include "unicode/locid.h" @@ -131,14 +132,13 @@ LocaleBuilder& LocaleBuilder::setVariant(StringPiece variant) variant_ = nullptr; return *this; } - CharString* new_variant = new CharString(variant, status_); - if (U_FAILURE(status_)) { return *this; } - if (new_variant == nullptr) { + FixedString* new_variant = new FixedString(variant); + if (new_variant == nullptr || new_variant->isEmpty()) { status_ = U_MEMORY_ALLOCATION_ERROR; return *this; } - transform(new_variant->data(), new_variant->length()); - if (!ultag_isVariantSubtags(new_variant->data(), new_variant->length())) { + transform(new_variant->getAlias(), variant.length()); + if (!ultag_isVariantSubtags(new_variant->data(), variant.length())) { delete new_variant; status_ = U_ILLEGAL_ARGUMENT_ERROR; return *this; diff --git a/deps/icu-small/source/common/localefallback_data.h b/deps/icu-small/source/common/localefallback_data.h index 3b8ad8a3f398b8..338bfa3595ba42 100644 --- a/deps/icu-small/source/common/localefallback_data.h +++ b/deps/icu-small/source/common/localefallback_data.h @@ -11,1149 +11,1171 @@ //====================================================================== // Default script table const char scriptCodeChars[] = - "Aghb\0Ahom\0Arab\0Armi\0Armn\0Avst\0Bali\0Bamu\0Bass\0Batk\0Beng\0" - "Bopo\0Brah\0Cakm\0Cans\0Cari\0Cham\0Cher\0Chrs\0Copt\0Cprt\0Cyrl\0" - "Deva\0Egyp\0Elym\0Ethi\0Geor\0Gong\0Gonm\0Goth\0Gran\0Grek\0Gujr\0" - "Guru\0Hang\0Hani\0Hans\0Hant\0Hebr\0Hluw\0Hmnp\0Ital\0Java\0Jpan\0" - "Kali\0Kana\0Khar\0Khmr\0Kits\0Knda\0Kore\0Lana\0Laoo\0Latf\0Latg\0" - "Lepc\0Lina\0Linb\0Lisu\0Lyci\0Lydi\0Mand\0Mani\0Marc\0Medf\0Merc\0" - "Mlym\0Modi\0Mong\0Mroo\0Mtei\0Mymr\0Narb\0Newa\0Nkoo\0Nshu\0Ogam\0" - "Olck\0Orkh\0Orya\0Osge\0Ougr\0Pauc\0Phli\0Phnx\0Plrd\0Prti\0Rjng\0" - "Rohg\0Runr\0Samr\0Sarb\0Saur\0Sgnw\0Sinh\0Sogd\0Sora\0Soyo\0Sunu\0" - "Syrc\0Tagb\0Takr\0Tale\0Talu\0Taml\0Tang\0Tavt\0Telu\0Tfng\0Thaa\0" - "Thai\0Tibt\0Tnsa\0Toto\0Ugar\0Vaii\0Wcho\0Xpeo\0Xsux\0Yiii\0"; + "Aghb\0Ahom\0Arab\0Armi\0Armn\0Avst\0Bali\0Bamu\0Batk\0Beng\0Bopo\0" + "Brah\0Cakm\0Cans\0Cari\0Cham\0Cher\0Chrs\0Copt\0Cprt\0Cyrl\0Deva\0" + "Egyp\0Elym\0Ethi\0Geor\0Gong\0Gonm\0Goth\0Gran\0Grek\0Gujr\0Guru\0" + "Hang\0Hani\0Hans\0Hant\0Hebr\0Hluw\0Hmnp\0Ital\0Java\0Jpan\0Kali\0" + "Kana\0Khar\0Khmr\0Kits\0Knda\0Kore\0Lana\0Laoo\0Latf\0Latg\0Lepc\0" + "Lina\0Linb\0Lisu\0Lyci\0Lydi\0Mand\0Mani\0Marc\0Medf\0Merc\0Mlym\0" + "Modi\0Mong\0Mroo\0Mtei\0Mymr\0Narb\0Newa\0Nkoo\0Ogam\0Olck\0Orkh\0" + "Orya\0Osge\0Ougr\0Pauc\0Phli\0Phnx\0Plrd\0Prti\0Rjng\0Rohg\0Runr\0" + "Samr\0Sarb\0Saur\0Sgnw\0Sidt\0Sinh\0Sogd\0Sora\0Soyo\0Syrc\0Tagb\0" + "Takr\0Tale\0Talu\0Taml\0Tang\0Tavt\0Telu\0Tfng\0Thaa\0Thai\0Tibt\0" + "Tnsa\0Toto\0Ugar\0Vaii\0Wcho\0Xpeo\0Xsux\0Yiii\0"; const char dsLocaleIDChars[] = - "aaf\0aao\0aat\0ab\0abh\0abl\0abv\0acm\0acq\0acw\0acx\0adf\0adx\0" - "ady\0ae\0aeb\0aec\0aee\0aeq\0afb\0agi\0agj\0agx\0ahg\0aho\0ahr\0" - "aib\0aii\0aij\0ain\0aio\0aiq\0akk\0akv\0alk\0all\0alr\0alt\0alw\0" - "am\0ams\0amw\0ani\0anp\0anq\0anr\0anu\0aot\0apc\0apd\0aph\0aqc\0" - "ar\0arc\0arq\0ars\0ary\0arz\0as\0ase\0ask\0asr\0atn\0atv\0auj\0" - "auz\0av\0avd\0avl\0awa\0awn\0axm\0ayh\0ayl\0ayn\0ayp\0az_IQ\0" + "aaf\0aao\0aat\0ab\0abh\0abl\0abq\0abv\0acm\0acq\0acw\0acx\0adf\0" + "adx\0ady\0ae\0aeb\0aec\0aee\0aeq\0afb\0agi\0agj\0agx\0ahg\0aho\0" + "ahr\0aib\0aii\0aij\0ain\0aio\0aiq\0akk\0akv\0alk\0all\0alr\0alt\0" + "alw\0am\0ams\0amw\0ani\0anp\0anq\0anr\0anu\0aot\0apc\0apd\0aph\0" + "aqc\0ar\0arc\0arq\0ars\0ary\0arz\0as\0ase\0ask\0asr\0atn\0atv\0" + "auj\0auz\0av\0avd\0avl\0awa\0awn\0axm\0ayh\0ayl\0ayn\0ayp\0az_IQ\0" "az_IR\0az_RU\0azb\0ba\0bal\0bap\0bax\0bbl\0bcq\0bdv\0bdz\0be\0" "bee\0bej\0bfb\0bfq\0bft\0bfu\0bfw\0bfy\0bfz\0bg\0bgc\0bgd\0bgn\0" "bgp\0bgq\0bgw\0bgx\0bha\0bhb\0bhd\0bhe\0bhh\0bhi\0bhj\0bhm\0bhn\0" - "bho\0bht\0bhu\0biy\0bjf\0bjj\0bjm\0bkk\0blk\0blt\0bmj\0bn\0bns\0" - "bo\0bph\0bpx\0bpy\0bqi\0bra\0brb\0brd\0brh\0brk\0bro\0brv\0brw\0" - "brx\0bsh\0bsk\0bsq\0bst\0btd\0btm\0btv\0bua\0bwe\0bxm\0bxu\0byh\0" - "byn\0byw\0bzi\0cbn\0ccp\0cde\0cdh\0cdi\0cdj\0cdm\0cdo\0cdz\0ce\0" - "cgk\0chg\0chm\0chr\0chx\0cih\0cja\0cji\0cjm\0cjy\0ckb\0ckt\0clh\0" - "clw\0cmg\0cna\0cnp\0cog\0cop\0cpg\0cr\0crh\0crj\0crk\0crl\0crm\0" - "csh\0csp\0csw\0ctd\0ctg\0ctn\0ctt\0cty\0cu\0cuu\0cv\0czh\0czk\0" - "daq\0dar\0dcc\0ddo\0def\0deh\0der\0dgl\0dhi\0dhn\0dho\0dhw\0dka\0" - "dlg\0dmf\0dmk\0dml\0dng\0dnu\0dnv\0doi\0dox\0dre\0drq\0drs\0dry\0" - "dso\0dty\0dub\0duh\0dus\0dv\0dwk\0dwz\0dz\0dzl\0ecr\0ecy\0egy\0" - "eky\0el\0emg\0emu\0enf\0enh\0era\0esg\0esh\0ett\0eve\0evn\0fa\0" - "fay\0faz\0fia\0fmu\0fub\0gan\0gaq\0gas\0gau\0gbj\0gbk\0gbl\0gbm\0" - "gbz\0gdb\0gdo\0gdx\0gez\0ggg\0gha\0ghe\0gho\0ghr\0ght\0gig\0gin\0" - "gjk\0gju\0gld\0glh\0glk\0gml\0gmv\0gmy\0goe\0gof\0goj\0gok\0gon\0" - "got\0gra\0grc\0grt\0gru\0gu\0gvr\0gwc\0gwf\0gwt\0gyo\0gzi\0ha_CM\0" - "ha_SD\0hac\0hak\0hak_TW\0har\0haz\0hbo\0hdy\0he\0hi\0hif\0hii\0" - "hit\0hkh\0hlb\0hlu\0hmd\0hmj\0hmq\0hnd\0hne\0hnj\0hno\0hoc\0hoh\0" - "hoj\0how\0hoy\0hpo\0hrt\0hrz\0hsn\0hss\0htx\0hut\0huy\0huz\0hy\0" - "hyw\0ii\0imy\0inh\0int\0ior\0iru\0isk\0itk\0itl\0iu\0iw\0ja\0" - "jad\0jat\0jbe\0jbn\0jct\0jda\0jdg\0jdt\0jee\0jge\0ji\0jje\0jkm\0" - "jml\0jna\0jnd\0jnl\0jns\0jog\0jpa\0jpr\0jrb\0jul\0jun\0juy\0jya\0" - "jye\0ka\0kaa\0kap\0kaw\0kbd\0kbg\0kbu\0kby\0kca\0kcy\0kdq\0kdt\0" - "ket\0kev\0kex\0key\0kfa\0kfb\0kfc\0kfd\0kfe\0kfg\0kfh\0kfi\0kfk\0" - "kfm\0kfp\0kfq\0kfr\0kfs\0kfu\0kfx\0kfy\0kgj\0kgy\0khb\0khf\0khg\0" - "khn\0kho\0kht\0khv\0khw\0kif\0kim\0kip\0kjg\0kjh\0kjl\0kjo\0kjp\0" - "kjt\0kjz\0kk\0kk_AF\0kk_CN\0kk_IR\0kk_MN\0kkf\0kkh\0kkt\0kle\0" - "klj\0klr\0km\0kmj\0kmz\0kn\0knn\0ko\0koi\0kok\0kpt\0kpy\0kqd\0" - "kqy\0kra\0krc\0krk\0krr\0kru\0krv\0ks\0ksu\0ksw\0ksz\0ktb\0kte\0" - "ktl\0ktp\0ku_LB\0kuf\0kum\0kv\0kva\0kvq\0kvt\0kvx\0kvy\0kxf\0" + "bho\0bht\0bhu\0bix\0biy\0bjf\0bjj\0bjm\0bkk\0blk\0blt\0bmj\0bn\0" + "bns\0bo\0bph\0bpx\0bpy\0bqi\0bra\0brb\0brd\0brh\0brk\0bro\0brv\0" + "brw\0brx\0bsh\0bsk\0bst\0btd\0btm\0btv\0bua\0bwe\0bxm\0bxu\0byh\0" + "byn\0byw\0bzi\0cbn\0ccp\0cde\0cdh\0cdi\0cdj\0cdm\0cdn\0cdo\0cdz\0" + "ce\0cgk\0chg\0chm\0chr\0chx\0cih\0cja\0cji\0cjm\0cjy\0ckb\0ckt\0" + "clh\0clw\0cmg\0cna\0cnp\0cog\0cop\0cpg\0cr\0crh\0crj\0crk\0crl\0" + "crm\0csh\0csp\0csw\0ctd\0ctg\0ctn\0ctt\0cty\0cu\0cuu\0cv\0czh\0" + "czk\0daq\0dar\0dcc\0ddo\0def\0deh\0der\0dgl\0dhi\0dhn\0dho\0dhw\0" + "dka\0dlg\0dmf\0dmk\0dml\0dng\0dnu\0dnv\0doi\0dox\0dre\0drq\0drs\0" + "dry\0dso\0dty\0dub\0duh\0dus\0dv\0dwk\0dwz\0dz\0dzl\0ecr\0ecy\0" + "egy\0eky\0el\0emg\0emu\0enf\0enh\0era\0esg\0esh\0ett\0eve\0evn\0" + "fa\0fay\0faz\0fia\0fmu\0fub\0gan\0gaq\0gas\0gau\0gbj\0gbk\0gbl\0" + "gbm\0gbz\0gdb\0gdo\0gdx\0gez\0ggg\0gha\0ghe\0gho\0ghr\0ght\0gig\0" + "gin\0gjk\0gju\0gld\0glh\0glk\0gml\0gmv\0gmy\0goe\0gof\0goj\0gok\0" + "gon\0got\0gra\0grc\0grr\0grt\0gru\0gu\0gvr\0gwc\0gwf\0gwt\0gyo\0" + "gzi\0ha_CM\0ha_SD\0hac\0hak\0hak_TW\0har\0haz\0hbo\0hdy\0he\0" + "hi\0hif\0hii\0hit\0hkh\0hlb\0hlu\0hmd\0hmj\0hmq\0hnd\0hne\0hnj\0" + "hnm\0hno\0hoc\0hoh\0hoj\0how\0hoy\0hpo\0hrt\0hrz\0hsn\0hss\0htx\0" + "hut\0huy\0huz\0hy\0hyw\0ii\0imy\0inh\0int\0ior\0iru\0isk\0itk\0" + "itl\0iu\0iw\0ja\0jad\0jat\0jbe\0jbn\0jct\0jda\0jdg\0jdt\0jee\0" + "jge\0ji\0jje\0jkm\0jml\0jna\0jnd\0jnl\0jns\0jog\0jpa\0jpr\0jrb\0" + "jul\0jun\0juy\0jya\0jye\0ka\0kaa\0kap\0kaw\0kbd\0kbg\0kbu\0kby\0" + "kca\0kcy\0kdq\0kdt\0ket\0kev\0kex\0key\0kfa\0kfb\0kfc\0kfd\0kfe\0" + "kfg\0kfh\0kfi\0kfk\0kfm\0kfp\0kfq\0kfr\0kfs\0kfu\0kfx\0kfy\0kgj\0" + "kgy\0khb\0khf\0khg\0khn\0kho\0kht\0khv\0khw\0kif\0kim\0kip\0kjg\0" + "kjh\0kjl\0kjo\0kjp\0kjt\0kjz\0kk\0kk_AF\0kk_CN\0kk_IR\0kk_MN\0" + "kkf\0kkh\0kkt\0kle\0klj\0klr\0km\0kmj\0kmz\0kn\0knn\0ko\0koi\0" + "kok\0kpt\0kpy\0kqd\0kqy\0kra\0krc\0krk\0krr\0kru\0krv\0ks\0ksu\0" + "ksw\0ksz\0ktb\0kte\0ktl\0ktp\0ku_AM\0ku_AZ\0ku_GE\0ku_IQ\0ku_IR\0" + "ku_LB\0ku_TM\0kuf\0kum\0kv\0kva\0kvq\0kvt\0kvx\0kvy\0kwx\0kxf\0" "kxk\0kxm\0kxp\0ky\0ky_CN\0kyu\0kyv\0kyw\0lab\0lad\0lae\0lah\0" "lbe\0lbf\0lbj\0lbm\0lbo\0lbr\0lcp\0lep\0lez\0lhm\0lhs\0lif\0lis\0" "lkh\0lki\0lmh\0lmn\0lo\0loy\0lpo\0lrc\0lrk\0lrl\0lsa\0lsd\0lss\0" - "ltc\0luk\0luu\0luv\0luz\0lwl\0lwm\0lya\0lzh\0lzz_GE\0mag\0mai\0" - "mby\0mde\0mdf\0mdx\0mdy\0mfa\0mfi\0mga\0mgp\0mhj\0mid\0mjl\0mjq\0" - "mjr\0mjt\0mju\0mjv\0mjz\0mk\0mkb\0mke\0mki\0mkm\0ml\0mlf\0mn\0" - "mn_CN\0mnc\0mni\0mnj\0mns\0mnw\0mpz\0mr\0mra\0mrd\0mrj\0mro\0" - "mrr\0ms_CC\0mtm\0mtr\0mud\0muk\0mut\0muv\0muz\0mve\0mvf\0mvy\0" - "mvz\0mwr\0mwt\0mww\0my\0mym\0myv\0myz\0mzn\0nan\0nan_TW\0nao\0" - "ncd\0ncq\0ndf\0ne\0neg\0neh\0nei\0new\0ngt\0nio\0nit\0niv\0nli\0" - "nlm\0nlx\0nmm\0nnp\0nod\0noe\0nog\0noi\0non\0nos\0npb\0nqo\0nrn\0" - "nsd\0nsf\0nsk\0nst\0nsv\0nty\0ntz\0nwc\0nwx\0nyl\0nyq\0nyw\0oaa\0" - "oac\0oar\0oav\0obm\0obr\0odk\0oht\0oj\0ojs\0okm\0oko\0okz\0ola\0" - "ole\0omk\0omp\0omr\0omx\0oon\0or\0ort\0oru\0orv\0os\0osa\0osc\0" - "osi\0ota\0otb\0otk\0oty\0oui\0pa\0pa_PK\0pal\0paq\0pbt\0pcb\0" - "pce\0pcf\0pcg\0pch\0pci\0pcj\0peg\0peo\0pgd\0pgg\0pgl\0pgn\0phd\0" - "phk\0phl\0phn\0pho\0phr\0pht\0phu\0phv\0phw\0pi\0pka\0pkr\0plk\0" - "pll\0pmh\0pnt\0pnt_RU\0pra\0prc\0prd\0prt\0prx\0ps\0psh\0psi\0" - "pst\0psu\0pum\0pwo\0pwr\0pww\0pyx\0qxq\0raa\0rab\0raf\0rah\0raj\0" - "rav\0rbb\0rdb\0rei\0rhg\0rji\0rjs\0rka\0rki\0rkt\0rmi\0rmt\0rmz\0" - "rsk\0rtw\0ru\0rue\0rut\0rwr\0ryu\0sa\0sah\0sam\0sat\0saz\0sbn\0" - "sbu\0sck\0scl\0scp\0sct\0scu\0scx\0sd\0sd_IN\0sdb\0sdf\0sdg\0" - "sdh\0sdr\0sds\0sel\0sfm\0sgh\0sgj\0sgr\0sgt\0sgw\0sgy\0shd\0shi\0" - "shm\0shn\0shu\0shv\0si\0sia\0sip\0siy\0siz\0sjd\0sjp\0sjt\0skb\0" - "skj\0skr\0smh\0smp\0smu\0smy\0soa\0sog\0soi\0sou\0spt\0spv\0sqo\0" - "sqq\0sqt\0sr\0srb\0srh\0srx\0srz\0ssh\0sss\0sts\0stv\0sty\0suz\0" - "sva\0swb\0swi\0swv\0sxu\0syc\0syl\0syn\0syr\0syw\0ta\0tab\0taj\0" - "tbk\0tcn\0tco\0tcx\0tcy\0tda\0tdb\0tdd\0tdg\0tdh\0te\0tes\0tg\0" - "tg_PK\0tge\0tgf\0th\0the\0thf\0thi\0thl\0thm\0thq\0thr\0ths\0" - "ti\0tig\0tij\0tin\0tjl\0tjo\0tkb\0tks\0tkt\0tmr\0tnv\0tov\0tpu\0" - "tra\0trg\0trm\0trw\0tsd\0tsj\0tt\0tth\0tto\0tts\0ttz\0tvn\0twm\0" - "txg\0txo\0tyr\0tyv\0ude\0udg\0udi\0udm\0ug\0ug_KZ\0ug_MN\0uga\0" - "ugh\0ugo\0uk\0uki\0ulc\0unr\0unr_NP\0unx\0ur\0urk\0ush\0uum\0" - "uz_AF\0uz_CN\0uzs\0vaa\0vaf\0vah\0vai\0vas\0vav\0vay\0vgr\0vjk\0" - "vmd\0vmh\0wal\0wbk\0wbq\0wbr\0wle\0wlo\0wme\0wne\0wni\0wsg\0wsv\0" - "wtm\0wuu\0xag\0xal\0xan\0xas\0xco\0xcr\0xdq\0xhe\0xhm\0xis\0xka\0" - "xkc\0xkf\0xkj\0xkp\0xlc\0xld\0xly\0xmf\0xmn\0xmr\0xna\0xnr\0xpg\0" - "xpi\0xpm\0xpr\0xrm\0xrn\0xsa\0xsr\0xtq\0xub\0xuj\0xve\0xvi\0xwo\0" - "xzh\0yai\0ybh\0ybi\0ydg\0yea\0yej\0yeu\0ygp\0yhd\0yi\0yig\0yih\0" - "yiv\0ykg\0ykh\0yna\0ynk\0yoi\0yoy\0yrk\0ysd\0ysn\0ysp\0ysr\0ysy\0" - "yud\0yue\0yue_CN\0yug\0yux\0ywq\0ywu\0zau\0zba\0zch\0zdj\0zeh\0" - "zen\0zgb\0zgh\0zgm\0zgn\0zh\0zh_AU\0zh_BN\0zh_GB\0zh_GF\0zh_HK\0" - "zh_ID\0zh_MO\0zh_PA\0zh_PF\0zh_PH\0zh_SR\0zh_TH\0zh_TW\0zh_US\0" - "zh_VN\0zhd\0zhx\0zko\0zkt\0zkz\0zlj\0zln\0zlq\0zqe\0zrg\0zrp\0" - "zum\0zwa\0zyg\0zyn\0zzj\0"; + "ltc\0luh\0luk\0luu\0luv\0luz\0lwl\0lwm\0lya\0lzh\0lzz_GE\0mag\0" + "mai\0mby\0mde\0mdf\0mdx\0mdy\0mey\0mfa\0mfi\0mga\0mgp\0mhj\0mid\0" + "mjl\0mjq\0mjr\0mjt\0mju\0mjv\0mjz\0mk\0mkb\0mke\0mki\0mkm\0ml\0" + "mlf\0mn\0mn_CN\0mnc\0mni\0mnj\0mns\0mnw\0mpz\0mr\0mra\0mrd\0mrj\0" + "mro\0mrr\0ms_CC\0mtm\0mtr\0mud\0muk\0mut\0muv\0muz\0mve\0mvf\0" + "mvy\0mvz\0mwr\0mwt\0mww\0my\0mym\0myv\0myz\0mzb\0mzn\0nan\0nan_MO\0" + "nan_TW\0nao\0ncd\0ncq\0ndf\0ne\0neg\0neh\0nei\0new\0ngt\0nio\0" + "nit\0niv\0nli\0nlm\0nlx\0nmm\0nnp\0nod\0noe\0nog\0noi\0non\0nos\0" + "npb\0nqo\0nrn\0nsd\0nsf\0nsk\0nst\0nsv\0nty\0ntz\0nwc\0nwx\0nyl\0" + "nyq\0nyw\0oaa\0oac\0oar\0oav\0obm\0obr\0odk\0oht\0oj\0ojs\0okm\0" + "oko\0okz\0ola\0ole\0omk\0omp\0omr\0omx\0oon\0or\0ort\0oru\0orv\0" + "os\0osa\0osc\0osi\0ota\0otb\0otk\0oty\0oui\0oyb\0pa\0pa_PK\0pal\0" + "paq\0pbt\0pcb\0pce\0pcf\0pcg\0pch\0pci\0pcj\0peg\0peo\0pgd\0pgg\0" + "pgl\0pgn\0phd\0phk\0phl\0phn\0pho\0phr\0pht\0phu\0phv\0phw\0pi_IN\0" + "pi_LK\0pi_MM\0pi_TH\0pka\0pkr\0plk\0pll\0pmh\0pnt\0pnt_RU\0prc\0" + "prd\0prt\0prx\0ps\0psh\0psi\0pst\0psu\0pum\0pwo\0pwr\0pww\0pyx\0" + "qxq\0raa\0rab\0raf\0rah\0raj\0rav\0rbb\0rdb\0rei\0rhg\0rji\0rjs\0" + "rka\0rki\0rkt\0rmi\0rmt\0rmz\0rsk\0rtw\0ru\0rue\0rut\0rwr\0ryu\0" + "sa\0sah\0sam\0sat\0saz\0sbn\0sbu\0sck\0scl\0scp\0sct\0scu\0scx\0" + "sd\0sd_IN\0sdb\0sdf\0sdg\0sdh\0sdr\0sds\0sel\0sfm\0sgh\0sgj\0" + "sgr\0sgt\0sgw\0sgy\0shd\0shi\0shm\0shn\0shu\0shv\0si\0sia\0sip\0" + "siy\0siz\0sjc\0sjd\0sjp\0sjt\0skb\0skj\0skr\0smh\0smp\0smu\0smy\0" + "soa\0sog\0soi\0sou\0spt\0spv\0sqo\0sqq\0sqt\0sr\0srb\0srh\0srx\0" + "srz\0ssh\0sss\0sts\0stu\0stu_CN\0stv\0sty\0suz\0sva\0swb\0swi\0" + "swv\0sxu\0syc\0syl\0syn\0syr\0syw\0ta\0tab\0taj\0tbk\0tcn\0tco\0" + "tcx\0tcy\0tda\0tdb\0tdd\0tdg\0tdh\0te\0tes\0tg\0tg_PK\0tge\0tgf\0" + "th\0the\0thf\0thi\0thl\0thm\0thq\0thr\0ths\0ti\0tig\0tij\0tin\0" + "tjl\0tjo\0tkb\0tks\0tkt\0tmr\0tnv\0tov\0tpu\0tra\0trg\0trm\0trw\0" + "tsd\0tsj\0tt\0tth\0tto\0tts\0ttz\0tvn\0twm\0txg\0txo\0tyr\0tyv\0" + "ude\0udg\0udi\0udm\0ug\0ug_KZ\0ug_MN\0uga\0ugh\0ugo\0uk\0uki\0" + "ulc\0unr\0unr_NP\0unx\0ur\0urk\0ush\0uum\0uz_AF\0uz_CN\0uzs\0" + "vaa\0vaf\0vah\0vai\0vas\0vav\0vay\0vgr\0vjk\0vmd\0vmh\0wal\0wbk\0" + "wbq\0wbr\0wle\0wlo\0wme\0wne\0wni\0wsg\0wsv\0wtm\0wuu\0xag\0xal\0" + "xan\0xas\0xco\0xcr\0xdq\0xhe\0xhm\0xis\0xka\0xkc\0xkf\0xkj\0xkp\0" + "xlc\0xld\0xly\0xmf\0xmn\0xmr\0xna\0xnr\0xpg\0xpi\0xpm\0xpr\0xrm\0" + "xrn\0xsa\0xsd\0xsr\0xtq\0xub\0xuj\0xve\0xvi\0xwo\0xzh\0yai\0ybh\0" + "ybi\0ydg\0yea\0yej\0yeu\0ygp\0yhd\0yi\0yig\0yih\0yiv\0ykg\0ykh\0" + "yna\0ynk\0yoi\0yoy\0yrk\0ysd\0ysn\0ysp\0ysr\0ysy\0yud\0yue\0yue_CN\0" + "yug\0yux\0ywq\0ywu\0zau\0zba\0zch\0zdj\0zeh\0zen\0zgb\0zgh\0zgm\0" + "zgn\0zh\0zh_AU\0zh_BN\0zh_GB\0zh_GF\0zh_HK\0zh_ID\0zh_MO\0zh_PA\0" + "zh_PF\0zh_PH\0zh_SR\0zh_TH\0zh_TW\0zh_US\0zh_VN\0zhd\0zko\0zkt\0" + "zkz\0zlj\0zln\0zlq\0zqe\0zrg\0zrp\0zum\0zwa\0zyg\0zyn\0zzj\0"; const int32_t defaultScriptTable[] = { - 0, 330, // aaf -> Mlym + 0, 325, // aaf -> Mlym 4, 10, // aao -> Arab - 8, 155, // aat -> Grek - 12, 105, // ab -> Cyrl + 8, 150, // aat -> Grek + 12, 100, // ab -> Cyrl 15, 10, // abh -> Arab - 19, 435, // abl -> Rjng - 23, 10, // abv -> Arab - 27, 10, // acm -> Arab - 31, 10, // acq -> Arab - 35, 10, // acw -> Arab - 39, 10, // acx -> Arab - 43, 10, // adf -> Arab - 47, 555, // adx -> Tibt - 51, 105, // ady -> Cyrl - 55, 25, // ae -> Avst - 58, 10, // aeb -> Arab - 62, 10, // aec -> Arab - 66, 10, // aee -> Arab - 70, 10, // aeq -> Arab - 74, 10, // afb -> Arab - 78, 110, // agi -> Deva - 82, 125, // agj -> Ethi - 86, 105, // agx -> Cyrl - 90, 125, // ahg -> Ethi - 94, 5, // aho -> Ahom - 98, 110, // ahr -> Deva - 102, 10, // aib -> Arab - 106, 495, // aii -> Syrc - 110, 190, // aij -> Hebr - 114, 225, // ain -> Kana - 118, 355, // aio -> Mymr - 122, 10, // aiq -> Arab - 126, 590, // akk -> Xsux - 130, 105, // akv -> Cyrl - 134, 260, // alk -> Laoo - 138, 330, // all -> Mlym - 142, 105, // alr -> Cyrl - 146, 105, // alt -> Cyrl - 150, 125, // alw -> Ethi - 154, 125, // am -> Ethi - 157, 215, // ams -> Jpan - 161, 495, // amw -> Syrc - 165, 105, // ani -> Cyrl - 169, 110, // anp -> Deva - 173, 110, // anq -> Deva - 177, 110, // anr -> Deva - 181, 125, // anu -> Ethi - 185, 50, // aot -> Beng - 189, 10, // apc -> Arab - 193, 10, // apd -> Arab - 197, 110, // aph -> Deva - 201, 105, // aqc -> Cyrl - 205, 10, // ar -> Arab - 208, 15, // arc -> Armi - 212, 10, // arq -> Arab - 216, 10, // ars -> Arab - 220, 10, // ary -> Arab - 224, 10, // arz -> Arab - 228, 50, // as -> Beng - 231, 465, // ase -> Sgnw - 235, 10, // ask -> Arab - 239, 110, // asr -> Deva - 243, 10, // atn -> Arab - 247, 105, // atv -> Cyrl - 251, 10, // auj -> Arab - 255, 10, // auz -> Arab - 259, 105, // av -> Cyrl - 262, 10, // avd -> Arab - 266, 10, // avl -> Arab - 270, 110, // awa -> Deva - 274, 125, // awn -> Ethi - 278, 20, // axm -> Armn - 282, 10, // ayh -> Arab - 286, 10, // ayl -> Arab - 290, 10, // ayn -> Arab - 294, 10, // ayp -> Arab - 298, 10, // az_IQ -> Arab - 304, 10, // az_IR -> Arab - 310, 105, // az_RU -> Cyrl - 316, 10, // azb -> Arab - 320, 105, // ba -> Cyrl - 323, 10, // bal -> Arab - 327, 110, // bap -> Deva - 331, 35, // bax -> Bamu - 335, 130, // bbl -> Geor - 339, 125, // bcq -> Ethi - 343, 395, // bdv -> Orya - 347, 10, // bdz -> Arab - 351, 105, // be -> Cyrl - 354, 110, // bee -> Deva - 358, 10, // bej -> Arab - 362, 110, // bfb -> Deva - 366, 520, // bfq -> Taml - 370, 10, // bft -> Arab - 374, 555, // bfu -> Tibt - 378, 395, // bfw -> Orya - 382, 110, // bfy -> Deva - 386, 110, // bfz -> Deva - 390, 105, // bg -> Cyrl - 393, 110, // bgc -> Deva - 397, 110, // bgd -> Deva - 401, 10, // bgn -> Arab - 405, 10, // bgp -> Arab - 409, 110, // bgq -> Deva - 413, 110, // bgw -> Deva - 417, 155, // bgx -> Grek - 421, 110, // bha -> Deva - 425, 110, // bhb -> Deva - 429, 110, // bhd -> Deva - 433, 10, // bhe -> Arab - 437, 105, // bhh -> Cyrl - 441, 110, // bhi -> Deva - 445, 110, // bhj -> Deva - 449, 10, // bhm -> Arab - 453, 495, // bhn -> Syrc - 457, 110, // bho -> Deva - 461, 110, // bht -> Deva - 465, 110, // bhu -> Deva - 469, 110, // biy -> Deva - 473, 495, // bjf -> Syrc - 477, 110, // bjj -> Deva - 481, 10, // bjm -> Arab - 485, 555, // bkk -> Tibt - 489, 355, // blk -> Mymr - 493, 530, // blt -> Tavt - 497, 110, // bmj -> Deva - 501, 50, // bn -> Beng - 504, 110, // bns -> Deva - 508, 555, // bo -> Tibt - 511, 105, // bph -> Cyrl - 515, 110, // bpx -> Deva - 519, 50, // bpy -> Beng - 523, 10, // bqi -> Arab - 527, 110, // bra -> Deva - 531, 235, // brb -> Khmr - 535, 110, // brd -> Deva - 539, 10, // brh -> Arab - 543, 10, // brk -> Arab - 547, 555, // bro -> Tibt - 551, 260, // brv -> Laoo - 555, 245, // brw -> Knda - 559, 110, // brx -> Deva - 563, 10, // bsh -> Arab - 567, 10, // bsk -> Arab - 571, 40, // bsq -> Bass - 575, 125, // bst -> Ethi - 579, 45, // btd -> Batk - 583, 45, // btm -> Batk - 587, 110, // btv -> Deva - 591, 105, // bua -> Cyrl - 595, 355, // bwe -> Mymr - 599, 105, // bxm -> Cyrl - 603, 340, // bxu -> Mong - 607, 110, // byh -> Deva - 611, 125, // byn -> Ethi - 615, 110, // byw -> Deva - 619, 550, // bzi -> Thai - 623, 550, // cbn -> Thai - 627, 65, // ccp -> Cakm - 631, 535, // cde -> Telu - 635, 110, // cdh -> Deva - 639, 160, // cdi -> Gujr - 643, 110, // cdj -> Deva - 647, 110, // cdm -> Deva - 651, 180, // cdo -> Hans - 655, 50, // cdz -> Beng - 659, 105, // ce -> Cyrl - 662, 555, // cgk -> Tibt - 666, 10, // chg -> Arab - 670, 105, // chm -> Cyrl - 674, 85, // chr -> Cher - 678, 110, // chx -> Deva - 682, 110, // cih -> Deva - 686, 10, // cja -> Arab - 690, 105, // cji -> Cyrl - 694, 80, // cjm -> Cham - 698, 180, // cjy -> Hans - 702, 10, // ckb -> Arab - 706, 105, // ckt -> Cyrl - 710, 10, // clh -> Arab - 714, 105, // clw -> Cyrl - 718, 485, // cmg -> Soyo - 722, 555, // cna -> Tibt - 726, 180, // cnp -> Hans - 730, 550, // cog -> Thai - 734, 95, // cop -> Copt - 738, 155, // cpg -> Grek - 742, 70, // cr -> Cans - 745, 105, // crh -> Cyrl - 749, 70, // crj -> Cans - 753, 70, // crk -> Cans - 757, 70, // crl -> Cans - 761, 70, // crm -> Cans - 765, 355, // csh -> Mymr - 769, 180, // csp -> Hans - 773, 70, // csw -> Cans - 777, 410, // ctd -> Pauc - 781, 50, // ctg -> Beng - 785, 110, // ctn -> Deva - 789, 520, // ctt -> Taml - 793, 520, // cty -> Taml - 797, 105, // cu -> Cyrl - 800, 255, // cuu -> Lana - 804, 105, // cv -> Cyrl - 807, 180, // czh -> Hans - 811, 190, // czk -> Hebr - 815, 110, // daq -> Deva - 819, 105, // dar -> Cyrl - 823, 10, // dcc -> Arab - 827, 105, // ddo -> Cyrl - 831, 10, // def -> Arab - 835, 10, // deh -> Arab - 839, 50, // der -> Beng - 843, 10, // dgl -> Arab - 847, 110, // dhi -> Deva - 851, 160, // dhn -> Gujr - 855, 110, // dho -> Deva - 859, 110, // dhw -> Deva - 863, 555, // dka -> Tibt - 867, 105, // dlg -> Cyrl - 871, 320, // dmf -> Medf - 875, 10, // dmk -> Arab - 879, 10, // dml -> Arab - 883, 105, // dng -> Cyrl - 887, 355, // dnu -> Mymr - 891, 355, // dnv -> Mymr - 895, 110, // doi -> Deva - 899, 125, // dox -> Ethi - 903, 555, // dre -> Tibt - 907, 110, // drq -> Deva - 911, 125, // drs -> Ethi - 915, 110, // dry -> Deva - 919, 395, // dso -> Orya - 923, 110, // dty -> Deva - 927, 160, // dub -> Gujr - 931, 110, // duh -> Deva - 935, 110, // dus -> Deva - 939, 545, // dv -> Thaa - 942, 395, // dwk -> Orya - 946, 110, // dwz -> Deva - 950, 555, // dz -> Tibt - 953, 555, // dzl -> Tibt - 957, 155, // ecr -> Grek - 961, 100, // ecy -> Cprt - 965, 115, // egy -> Egyp - 969, 220, // eky -> Kali - 973, 155, // el -> Grek - 976, 110, // emg -> Deva - 980, 110, // emu -> Deva - 984, 105, // enf -> Cyrl - 988, 105, // enh -> Cyrl - 992, 520, // era -> Taml - 996, 140, // esg -> Gonm - 1000, 10, // esh -> Arab - 1004, 205, // ett -> Ital - 1008, 105, // eve -> Cyrl - 1012, 105, // evn -> Cyrl - 1016, 10, // fa -> Arab - 1019, 10, // fay -> Arab - 1023, 10, // faz -> Arab - 1027, 10, // fia -> Arab - 1031, 110, // fmu -> Deva - 1035, 10, // fub -> Arab - 1039, 180, // gan -> Hans - 1043, 395, // gaq -> Orya - 1047, 160, // gas -> Gujr - 1051, 535, // gau -> Telu - 1055, 395, // gbj -> Orya - 1059, 110, // gbk -> Deva - 1063, 160, // gbl -> Gujr - 1067, 110, // gbm -> Deva - 1071, 10, // gbz -> Arab - 1075, 395, // gdb -> Orya - 1079, 105, // gdo -> Cyrl - 1083, 110, // gdx -> Deva - 1087, 125, // gez -> Ethi - 1091, 10, // ggg -> Arab - 1095, 10, // gha -> Arab - 1099, 110, // ghe -> Deva - 1103, 540, // gho -> Tfng - 1107, 10, // ghr -> Arab - 1111, 555, // ght -> Tibt - 1115, 10, // gig -> Arab - 1119, 105, // gin -> Cyrl - 1123, 10, // gjk -> Arab - 1127, 10, // gju -> Arab - 1131, 105, // gld -> Cyrl - 1135, 10, // glh -> Arab - 1139, 10, // glk -> Arab - 1143, 265, // gml -> Latf - 1147, 125, // gmv -> Ethi - 1151, 285, // gmy -> Linb - 1155, 555, // goe -> Tibt - 1159, 125, // gof -> Ethi - 1163, 110, // goj -> Deva - 1167, 110, // gok -> Deva - 1171, 110, // gon -> Deva - 1175, 145, // got -> Goth - 1179, 110, // gra -> Deva - 1183, 155, // grc -> Grek - 1187, 50, // grt -> Beng - 1191, 125, // gru -> Ethi - 1195, 160, // gu -> Gujr - 1198, 110, // gvr -> Deva - 1202, 10, // gwc -> Arab - 1206, 10, // gwf -> Arab - 1210, 10, // gwt -> Arab - 1214, 110, // gyo -> Deva - 1218, 10, // gzi -> Arab - 1222, 10, // ha_CM -> Arab - 1228, 10, // ha_SD -> Arab - 1234, 10, // hac -> Arab - 1238, 180, // hak -> Hans - 1242, 185, // hak_TW -> Hant - 1249, 125, // har -> Ethi - 1253, 10, // haz -> Arab - 1257, 190, // hbo -> Hebr - 1261, 125, // hdy -> Ethi - 1265, 190, // he -> Hebr - 1268, 110, // hi -> Deva - 1271, 110, // hif -> Deva - 1275, 505, // hii -> Takr - 1279, 590, // hit -> Xsux - 1283, 10, // hkh -> Arab - 1287, 110, // hlb -> Deva - 1291, 195, // hlu -> Hluw - 1295, 425, // hmd -> Plrd - 1299, 55, // hmj -> Bopo - 1303, 55, // hmq -> Bopo - 1307, 10, // hnd -> Arab - 1311, 110, // hne -> Deva - 1315, 200, // hnj -> Hmnp - 1319, 10, // hno -> Arab - 1323, 110, // hoc -> Deva - 1327, 10, // hoh -> Arab - 1331, 110, // hoj -> Deva - 1335, 175, // how -> Hani - 1339, 110, // hoy -> Deva - 1343, 355, // hpo -> Mymr - 1347, 495, // hrt -> Syrc - 1351, 10, // hrz -> Arab - 1355, 180, // hsn -> Hans - 1359, 10, // hss -> Arab - 1363, 590, // htx -> Xsux - 1367, 110, // hut -> Deva - 1371, 190, // huy -> Hebr - 1375, 105, // huz -> Cyrl - 1379, 20, // hy -> Armn - 1382, 20, // hyw -> Armn - 1386, 595, // ii -> Yiii - 1389, 295, // imy -> Lyci - 1393, 105, // inh -> Cyrl - 1397, 355, // int -> Mymr - 1401, 125, // ior -> Ethi - 1405, 520, // iru -> Taml - 1409, 10, // isk -> Arab - 1413, 190, // itk -> Hebr - 1417, 105, // itl -> Cyrl - 1421, 70, // iu -> Cans - 1424, 190, // iw -> Hebr - 1427, 215, // ja -> Jpan - 1430, 10, // jad -> Arab - 1434, 10, // jat -> Arab - 1438, 190, // jbe -> Hebr - 1442, 10, // jbn -> Arab - 1446, 105, // jct -> Cyrl - 1450, 555, // jda -> Tibt - 1454, 10, // jdg -> Arab - 1458, 105, // jdt -> Cyrl - 1462, 110, // jee -> Deva - 1466, 130, // jge -> Geor - 1470, 190, // ji -> Hebr - 1473, 170, // jje -> Hang - 1477, 355, // jkm -> Mymr - 1481, 110, // jml -> Deva - 1485, 505, // jna -> Takr - 1489, 10, // jnd -> Arab - 1493, 110, // jnl -> Deva - 1497, 110, // jns -> Deva - 1501, 10, // jog -> Arab - 1505, 190, // jpa -> Hebr - 1509, 190, // jpr -> Hebr - 1513, 190, // jrb -> Hebr - 1517, 110, // jul -> Deva - 1521, 395, // jun -> Orya - 1525, 395, // juy -> Orya - 1529, 555, // jya -> Tibt - 1533, 190, // jye -> Hebr - 1537, 130, // ka -> Geor - 1540, 105, // kaa -> Cyrl - 1544, 105, // kap -> Cyrl - 1548, 30, // kaw -> Bali - 1552, 105, // kbd -> Cyrl - 1556, 555, // kbg -> Tibt - 1560, 10, // kbu -> Arab - 1564, 10, // kby -> Arab - 1568, 105, // kca -> Cyrl - 1572, 10, // kcy -> Arab - 1576, 50, // kdq -> Beng - 1580, 550, // kdt -> Thai - 1584, 105, // ket -> Cyrl - 1588, 330, // kev -> Mlym - 1592, 110, // kex -> Deva - 1596, 535, // key -> Telu - 1600, 245, // kfa -> Knda - 1604, 110, // kfb -> Deva - 1608, 535, // kfc -> Telu - 1612, 245, // kfd -> Knda - 1616, 520, // kfe -> Taml - 1620, 245, // kfg -> Knda - 1624, 330, // kfh -> Mlym - 1628, 520, // kfi -> Taml - 1632, 110, // kfk -> Deva - 1636, 10, // kfm -> Arab - 1640, 110, // kfp -> Deva - 1644, 110, // kfq -> Deva - 1648, 110, // kfr -> Deva - 1652, 110, // kfs -> Deva - 1656, 110, // kfu -> Deva - 1660, 110, // kfx -> Deva - 1664, 110, // kfy -> Deva - 1668, 110, // kgj -> Deva - 1672, 110, // kgy -> Deva - 1676, 515, // khb -> Talu - 1680, 550, // khf -> Thai - 1684, 555, // khg -> Tibt - 1688, 110, // khn -> Deva - 1692, 60, // kho -> Brah - 1696, 355, // kht -> Mymr - 1700, 105, // khv -> Cyrl - 1704, 10, // khw -> Arab - 1708, 110, // kif -> Deva - 1712, 105, // kim -> Cyrl - 1716, 110, // kip -> Deva - 1720, 260, // kjg -> Laoo - 1724, 105, // kjh -> Cyrl - 1728, 110, // kjl -> Deva - 1732, 110, // kjo -> Deva - 1736, 355, // kjp -> Mymr - 1740, 550, // kjt -> Thai - 1744, 555, // kjz -> Tibt - 1748, 105, // kk -> Cyrl - 1751, 10, // kk_AF -> Arab - 1757, 10, // kk_CN -> Arab - 1763, 10, // kk_IR -> Arab - 1769, 10, // kk_MN -> Arab - 1775, 555, // kkf -> Tibt - 1779, 255, // kkh -> Lana - 1783, 110, // kkt -> Deva - 1787, 110, // kle -> Deva - 1791, 10, // klj -> Arab - 1795, 110, // klr -> Deva - 1799, 235, // km -> Khmr - 1802, 110, // kmj -> Deva - 1806, 10, // kmz -> Arab - 1810, 245, // kn -> Knda - 1813, 110, // knn -> Deva - 1817, 250, // ko -> Kore - 1820, 105, // koi -> Cyrl - 1824, 110, // kok -> Deva - 1828, 105, // kpt -> Cyrl - 1832, 105, // kpy -> Cyrl - 1836, 495, // kqd -> Syrc - 1840, 125, // kqy -> Ethi - 1844, 110, // kra -> Deva - 1848, 105, // krc -> Cyrl - 1852, 105, // krk -> Cyrl - 1856, 235, // krr -> Khmr - 1860, 110, // kru -> Deva - 1864, 235, // krv -> Khmr - 1868, 10, // ks -> Arab - 1871, 355, // ksu -> Mymr - 1875, 355, // ksw -> Mymr - 1879, 110, // ksz -> Deva - 1883, 125, // ktb -> Ethi - 1887, 110, // kte -> Deva - 1891, 10, // ktl -> Arab - 1895, 425, // ktp -> Plrd - 1899, 10, // ku_LB -> Arab - 1905, 260, // kuf -> Laoo - 1909, 105, // kum -> Cyrl - 1913, 105, // kv -> Cyrl - 1916, 105, // kva -> Cyrl - 1920, 355, // kvq -> Mymr - 1924, 355, // kvt -> Mymr - 1928, 10, // kvx -> Arab - 1932, 220, // kvy -> Kali - 1936, 355, // kxf -> Mymr - 1940, 355, // kxk -> Mymr - 1944, 550, // kxm -> Thai - 1948, 10, // kxp -> Arab - 1952, 105, // ky -> Cyrl - 1955, 10, // ky_CN -> Arab - 1961, 220, // kyu -> Kali - 1965, 110, // kyv -> Deva - 1969, 110, // kyw -> Deva - 1973, 280, // lab -> Lina - 1977, 190, // lad -> Hebr - 1981, 110, // lae -> Deva - 1985, 10, // lah -> Arab - 1989, 105, // lbe -> Cyrl - 1993, 110, // lbf -> Deva - 1997, 555, // lbj -> Tibt - 2001, 110, // lbm -> Deva - 2005, 260, // lbo -> Laoo - 2009, 110, // lbr -> Deva - 2013, 550, // lcp -> Thai - 2017, 275, // lep -> Lepc - 2021, 105, // lez -> Cyrl - 2025, 110, // lhm -> Deva - 2029, 495, // lhs -> Syrc - 2033, 110, // lif -> Deva - 2037, 290, // lis -> Lisu - 2041, 555, // lkh -> Tibt - 2045, 10, // lki -> Arab - 2049, 110, // lmh -> Deva - 2053, 535, // lmn -> Telu - 2057, 260, // lo -> Laoo - 2060, 110, // loy -> Deva - 2064, 425, // lpo -> Plrd - 2068, 10, // lrc -> Arab - 2072, 10, // lrk -> Arab - 2076, 10, // lrl -> Arab - 2080, 10, // lsa -> Arab - 2084, 190, // lsd -> Hebr - 2088, 10, // lss -> Arab - 2092, 185, // ltc -> Hant - 2096, 555, // luk -> Tibt - 2100, 110, // luu -> Deva - 2104, 10, // luv -> Arab - 2108, 10, // luz -> Arab - 2112, 550, // lwl -> Thai - 2116, 550, // lwm -> Thai - 2120, 555, // lya -> Tibt - 2124, 180, // lzh -> Hans - 2128, 130, // lzz_GE -> Geor - 2135, 110, // mag -> Deva - 2139, 110, // mai -> Deva - 2143, 10, // mby -> Arab - 2147, 10, // mde -> Arab - 2151, 105, // mdf -> Cyrl - 2155, 125, // mdx -> Ethi - 2159, 125, // mdy -> Ethi - 2163, 10, // mfa -> Arab - 2167, 10, // mfi -> Arab - 2171, 270, // mga -> Latg - 2175, 110, // mgp -> Deva - 2179, 10, // mhj -> Arab - 2183, 305, // mid -> Mand - 2187, 110, // mjl -> Deva - 2191, 330, // mjq -> Mlym - 2195, 330, // mjr -> Mlym - 2199, 110, // mjt -> Deva - 2203, 535, // mju -> Telu - 2207, 330, // mjv -> Mlym - 2211, 110, // mjz -> Deva - 2215, 105, // mk -> Cyrl - 2218, 110, // mkb -> Deva - 2222, 110, // mke -> Deva - 2226, 10, // mki -> Arab - 2230, 550, // mkm -> Thai - 2234, 330, // ml -> Mlym - 2237, 550, // mlf -> Thai - 2241, 105, // mn -> Cyrl - 2244, 340, // mn_CN -> Mong - 2250, 340, // mnc -> Mong - 2254, 50, // mni -> Beng - 2258, 10, // mnj -> Arab - 2262, 105, // mns -> Cyrl - 2266, 355, // mnw -> Mymr - 2270, 550, // mpz -> Thai - 2274, 110, // mr -> Deva - 2277, 550, // mra -> Thai - 2281, 110, // mrd -> Deva - 2285, 105, // mrj -> Cyrl - 2289, 345, // mro -> Mroo - 2293, 110, // mrr -> Deva - 2297, 10, // ms_CC -> Arab - 2303, 105, // mtm -> Cyrl - 2307, 110, // mtr -> Deva - 2311, 105, // mud -> Cyrl - 2315, 555, // muk -> Tibt - 2319, 110, // mut -> Deva - 2323, 520, // muv -> Taml - 2327, 125, // muz -> Ethi - 2331, 10, // mve -> Arab - 2335, 340, // mvf -> Mong - 2339, 10, // mvy -> Arab - 2343, 125, // mvz -> Ethi - 2347, 110, // mwr -> Deva - 2351, 355, // mwt -> Mymr - 2355, 200, // mww -> Hmnp - 2359, 355, // my -> Mymr - 2362, 125, // mym -> Ethi - 2366, 105, // myv -> Cyrl - 2370, 305, // myz -> Mand - 2374, 10, // mzn -> Arab - 2378, 180, // nan -> Hans - 2382, 185, // nan_TW -> Hant - 2389, 110, // nao -> Deva - 2393, 110, // ncd -> Deva - 2397, 260, // ncq -> Laoo - 2401, 105, // ndf -> Cyrl - 2405, 110, // ne -> Deva - 2408, 105, // neg -> Cyrl - 2412, 555, // neh -> Tibt - 2416, 590, // nei -> Xsux - 2420, 110, // new -> Deva - 2424, 260, // ngt -> Laoo - 2428, 105, // nio -> Cyrl - 2432, 535, // nit -> Telu - 2436, 105, // niv -> Cyrl - 2440, 10, // nli -> Arab - 2444, 10, // nlm -> Arab - 2448, 110, // nlx -> Deva - 2452, 110, // nmm -> Deva - 2456, 580, // nnp -> Wcho - 2460, 255, // nod -> Lana - 2464, 110, // noe -> Deva - 2468, 105, // nog -> Cyrl - 2472, 110, // noi -> Deva - 2476, 445, // non -> Runr - 2480, 595, // nos -> Yiii - 2484, 555, // npb -> Tibt - 2488, 370, // nqo -> Nkoo - 2492, 445, // nrn -> Runr - 2496, 595, // nsd -> Yiii - 2500, 595, // nsf -> Yiii - 2504, 70, // nsk -> Cans - 2508, 560, // nst -> Tnsa - 2512, 595, // nsv -> Yiii - 2516, 595, // nty -> Yiii - 2520, 10, // ntz -> Arab - 2524, 365, // nwc -> Newa - 2528, 110, // nwx -> Deva - 2532, 550, // nyl -> Thai - 2536, 10, // nyq -> Arab - 2540, 550, // nyw -> Thai - 2544, 105, // oaa -> Cyrl - 2548, 105, // oac -> Cyrl - 2552, 495, // oar -> Syrc - 2556, 130, // oav -> Geor - 2560, 420, // obm -> Phnx - 2564, 355, // obr -> Mymr - 2568, 10, // odk -> Arab - 2572, 590, // oht -> Xsux - 2576, 70, // oj -> Cans - 2579, 70, // ojs -> Cans - 2583, 170, // okm -> Hang - 2587, 175, // oko -> Hani - 2591, 235, // okz -> Khmr - 2595, 110, // ola -> Deva - 2599, 555, // ole -> Tibt - 2603, 105, // omk -> Cyrl - 2607, 350, // omp -> Mtei - 2611, 335, // omr -> Modi - 2615, 355, // omx -> Mymr - 2619, 110, // oon -> Deva - 2623, 395, // or -> Orya - 2626, 535, // ort -> Telu - 2630, 10, // oru -> Arab - 2634, 105, // orv -> Cyrl - 2638, 105, // os -> Cyrl - 2641, 400, // osa -> Osge - 2645, 205, // osc -> Ital - 2649, 210, // osi -> Java - 2653, 10, // ota -> Arab - 2657, 555, // otb -> Tibt - 2661, 390, // otk -> Orkh - 2665, 150, // oty -> Gran - 2669, 405, // oui -> Ougr - 2673, 165, // pa -> Guru - 2676, 10, // pa_PK -> Arab - 2682, 415, // pal -> Phli - 2686, 105, // paq -> Cyrl - 2690, 10, // pbt -> Arab - 2694, 235, // pcb -> Khmr - 2698, 355, // pce -> Mymr - 2702, 330, // pcf -> Mlym - 2706, 330, // pcg -> Mlym - 2710, 110, // pch -> Deva - 2714, 110, // pci -> Deva - 2718, 535, // pcj -> Telu - 2722, 395, // peg -> Orya - 2726, 585, // peo -> Xpeo - 2730, 230, // pgd -> Khar - 2734, 110, // pgg -> Deva - 2738, 380, // pgl -> Ogam - 2742, 205, // pgn -> Ital - 2746, 110, // phd -> Deva - 2750, 355, // phk -> Mymr - 2754, 10, // phl -> Arab - 2758, 420, // phn -> Phnx - 2762, 260, // pho -> Laoo - 2766, 10, // phr -> Arab - 2770, 550, // pht -> Thai - 2774, 550, // phu -> Thai - 2778, 10, // phv -> Arab - 2782, 110, // phw -> Deva - 2786, 470, // pi -> Sinh - 2789, 60, // pka -> Brah - 2793, 330, // pkr -> Mlym - 2797, 10, // plk -> Arab - 2801, 355, // pll -> Mymr - 2805, 60, // pmh -> Brah - 2809, 155, // pnt -> Grek - 2813, 105, // pnt_RU -> Cyrl - 2820, 230, // pra -> Khar - 2824, 10, // prc -> Arab - 2828, 10, // prd -> Arab - 2832, 550, // prt -> Thai - 2836, 10, // prx -> Arab - 2840, 10, // ps -> Arab - 2843, 10, // psh -> Arab - 2847, 10, // psi -> Arab - 2851, 10, // pst -> Arab - 2855, 60, // psu -> Brah - 2859, 110, // pum -> Deva - 2863, 355, // pwo -> Mymr - 2867, 110, // pwr -> Deva - 2871, 550, // pww -> Thai - 2875, 355, // pyx -> Mymr - 2879, 10, // qxq -> Arab - 2883, 110, // raa -> Deva - 2887, 110, // rab -> Deva - 2891, 110, // raf -> Deva - 2895, 50, // rah -> Beng - 2899, 110, // raj -> Deva - 2903, 110, // rav -> Deva - 2907, 355, // rbb -> Mymr - 2911, 10, // rdb -> Arab - 2915, 395, // rei -> Orya - 2919, 440, // rhg -> Rohg - 2923, 110, // rji -> Deva - 2927, 110, // rjs -> Deva - 2931, 235, // rka -> Khmr - 2935, 355, // rki -> Mymr - 2939, 50, // rkt -> Beng - 2943, 20, // rmi -> Armn - 2947, 10, // rmt -> Arab - 2951, 355, // rmz -> Mymr - 2955, 105, // rsk -> Cyrl - 2959, 110, // rtw -> Deva - 2963, 105, // ru -> Cyrl - 2966, 105, // rue -> Cyrl - 2970, 105, // rut -> Cyrl - 2974, 110, // rwr -> Deva - 2978, 225, // ryu -> Kana - 2982, 110, // sa -> Deva - 2985, 105, // sah -> Cyrl - 2989, 450, // sam -> Samr - 2993, 385, // sat -> Olck - 2997, 460, // saz -> Saur - 3001, 10, // sbn -> Arab - 3005, 555, // sbu -> Tibt - 3009, 110, // sck -> Deva - 3013, 10, // scl -> Arab - 3017, 110, // scp -> Deva - 3021, 260, // sct -> Laoo - 3025, 505, // scu -> Takr - 3029, 155, // scx -> Grek - 3033, 10, // sd -> Arab - 3036, 110, // sd_IN -> Deva - 3042, 10, // sdb -> Arab - 3046, 10, // sdf -> Arab - 3050, 10, // sdg -> Arab - 3054, 10, // sdh -> Arab - 3058, 50, // sdr -> Beng - 3062, 10, // sds -> Arab - 3066, 105, // sel -> Cyrl - 3070, 425, // sfm -> Plrd - 3074, 105, // sgh -> Cyrl - 3078, 110, // sgj -> Deva - 3082, 10, // sgr -> Arab - 3086, 555, // sgt -> Tibt - 3090, 125, // sgw -> Ethi - 3094, 10, // sgy -> Arab - 3098, 10, // shd -> Arab - 3102, 540, // shi -> Tfng - 3106, 10, // shm -> Arab - 3110, 355, // shn -> Mymr - 3114, 10, // shu -> Arab - 3118, 10, // shv -> Arab - 3122, 470, // si -> Sinh - 3125, 105, // sia -> Cyrl - 3129, 555, // sip -> Tibt - 3133, 10, // siy -> Arab - 3137, 10, // siz -> Arab - 3141, 105, // sjd -> Cyrl - 3145, 110, // sjp -> Deva - 3149, 105, // sjt -> Cyrl - 3153, 550, // skb -> Thai - 3157, 110, // skj -> Deva - 3161, 10, // skr -> Arab - 3165, 595, // smh -> Yiii - 3169, 450, // smp -> Samr - 3173, 235, // smu -> Khmr - 3177, 10, // smy -> Arab - 3181, 530, // soa -> Tavt - 3185, 475, // sog -> Sogd - 3189, 110, // soi -> Deva - 3193, 550, // sou -> Thai - 3197, 555, // spt -> Tibt - 3201, 395, // spv -> Orya - 3205, 10, // sqo -> Arab - 3209, 260, // sqq -> Laoo - 3213, 10, // sqt -> Arab - 3217, 105, // sr -> Cyrl - 3220, 480, // srb -> Sora - 3224, 10, // srh -> Arab - 3228, 110, // srx -> Deva - 3232, 10, // srz -> Arab - 3236, 10, // ssh -> Arab - 3240, 260, // sss -> Laoo - 3244, 10, // sts -> Arab - 3248, 125, // stv -> Ethi - 3252, 105, // sty -> Cyrl - 3256, 490, // suz -> Sunu - 3260, 130, // sva -> Geor - 3264, 10, // swb -> Arab - 3268, 175, // swi -> Hani - 3272, 110, // swv -> Deva - 3276, 445, // sxu -> Runr - 3280, 495, // syc -> Syrc - 3284, 50, // syl -> Beng - 3288, 495, // syn -> Syrc - 3292, 495, // syr -> Syrc - 3296, 110, // syw -> Deva - 3300, 520, // ta -> Taml - 3303, 105, // tab -> Cyrl - 3307, 110, // taj -> Deva - 3311, 500, // tbk -> Tagb - 3315, 555, // tcn -> Tibt - 3319, 355, // tco -> Mymr - 3323, 520, // tcx -> Taml - 3327, 245, // tcy -> Knda - 3331, 540, // tda -> Tfng - 3335, 110, // tdb -> Deva - 3339, 510, // tdd -> Tale - 3343, 110, // tdg -> Deva - 3347, 110, // tdh -> Deva - 3351, 535, // te -> Telu - 3354, 210, // tes -> Java - 3358, 105, // tg -> Cyrl - 3361, 10, // tg_PK -> Arab - 3367, 110, // tge -> Deva - 3371, 555, // tgf -> Tibt - 3375, 550, // th -> Thai - 3378, 110, // the -> Deva - 3382, 110, // thf -> Deva - 3386, 510, // thi -> Tale - 3390, 110, // thl -> Deva - 3394, 550, // thm -> Thai - 3398, 110, // thq -> Deva - 3402, 110, // thr -> Deva - 3406, 110, // ths -> Deva - 3410, 125, // ti -> Ethi - 3413, 125, // tig -> Ethi - 3417, 110, // tij -> Deva - 3421, 105, // tin -> Cyrl - 3425, 355, // tjl -> Mymr - 3429, 10, // tjo -> Arab - 3433, 110, // tkb -> Deva - 3437, 10, // tks -> Arab - 3441, 110, // tkt -> Deva - 3445, 495, // tmr -> Syrc - 3449, 65, // tnv -> Cakm - 3453, 10, // tov -> Arab - 3457, 235, // tpu -> Khmr - 3461, 10, // tra -> Arab - 3465, 190, // trg -> Hebr - 3469, 10, // trm -> Arab - 3473, 10, // trw -> Arab - 3477, 155, // tsd -> Grek - 3481, 555, // tsj -> Tibt - 3485, 105, // tt -> Cyrl - 3488, 260, // tth -> Laoo - 3492, 260, // tto -> Laoo - 3496, 550, // tts -> Thai - 3500, 110, // ttz -> Deva - 3504, 355, // tvn -> Mymr - 3508, 110, // twm -> Deva - 3512, 525, // txg -> Tang - 3516, 565, // txo -> Toto - 3520, 530, // tyr -> Tavt - 3524, 105, // tyv -> Cyrl - 3528, 105, // ude -> Cyrl - 3532, 330, // udg -> Mlym - 3536, 105, // udi -> Cyrl - 3540, 105, // udm -> Cyrl - 3544, 10, // ug -> Arab - 3547, 105, // ug_KZ -> Cyrl - 3553, 105, // ug_MN -> Cyrl - 3559, 570, // uga -> Ugar - 3563, 105, // ugh -> Cyrl - 3567, 550, // ugo -> Thai - 3571, 105, // uk -> Cyrl - 3574, 395, // uki -> Orya - 3578, 105, // ulc -> Cyrl - 3582, 50, // unr -> Beng - 3586, 110, // unr_NP -> Deva - 3593, 50, // unx -> Beng - 3597, 10, // ur -> Arab - 3600, 550, // urk -> Thai - 3604, 10, // ush -> Arab - 3608, 155, // uum -> Grek - 3612, 10, // uz_AF -> Arab - 3618, 105, // uz_CN -> Cyrl - 3624, 10, // uzs -> Arab - 3628, 520, // vaa -> Taml - 3632, 10, // vaf -> Arab - 3636, 110, // vah -> Deva - 3640, 575, // vai -> Vaii - 3644, 110, // vas -> Deva - 3648, 110, // vav -> Deva - 3652, 110, // vay -> Deva - 3656, 10, // vgr -> Arab - 3660, 110, // vjk -> Deva - 3664, 245, // vmd -> Knda - 3668, 10, // vmh -> Arab - 3672, 125, // wal -> Ethi - 3676, 10, // wbk -> Arab - 3680, 535, // wbq -> Telu - 3684, 110, // wbr -> Deva - 3688, 125, // wle -> Ethi - 3692, 10, // wlo -> Arab - 3696, 110, // wme -> Deva - 3700, 10, // wne -> Arab - 3704, 10, // wni -> Arab - 3708, 135, // wsg -> Gong - 3712, 10, // wsv -> Arab - 3716, 110, // wtm -> Deva - 3720, 180, // wuu -> Hans - 3724, 0, // xag -> Aghb - 3728, 105, // xal -> Cyrl - 3732, 125, // xan -> Ethi - 3736, 105, // xas -> Cyrl - 3740, 90, // xco -> Chrs - 3744, 75, // xcr -> Cari - 3748, 105, // xdq -> Cyrl - 3752, 10, // xhe -> Arab - 3756, 235, // xhm -> Khmr - 3760, 395, // xis -> Orya - 3764, 10, // xka -> Arab - 3768, 10, // xkc -> Arab - 3772, 555, // xkf -> Tibt - 3776, 10, // xkj -> Arab - 3780, 10, // xkp -> Arab - 3784, 295, // xlc -> Lyci - 3788, 300, // xld -> Lydi - 3792, 120, // xly -> Elym - 3796, 130, // xmf -> Geor - 3800, 310, // xmn -> Mani - 3804, 325, // xmr -> Merc - 3808, 360, // xna -> Narb - 3812, 110, // xnr -> Deva - 3816, 155, // xpg -> Grek - 3820, 380, // xpi -> Ogam - 3824, 105, // xpm -> Cyrl - 3828, 430, // xpr -> Prti - 3832, 105, // xrm -> Cyrl - 3836, 105, // xrn -> Cyrl - 3840, 455, // xsa -> Sarb - 3844, 110, // xsr -> Deva - 3848, 60, // xtq -> Brah - 3852, 520, // xub -> Taml - 3856, 520, // xuj -> Taml - 3860, 205, // xve -> Ital - 3864, 10, // xvi -> Arab - 3868, 105, // xwo -> Cyrl - 3872, 315, // xzh -> Marc - 3876, 105, // yai -> Cyrl - 3880, 110, // ybh -> Deva - 3884, 110, // ybi -> Deva - 3888, 10, // ydg -> Arab - 3892, 330, // yea -> Mlym - 3896, 155, // yej -> Grek - 3900, 535, // yeu -> Telu - 3904, 425, // ygp -> Plrd - 3908, 190, // yhd -> Hebr - 3912, 190, // yi -> Hebr - 3915, 595, // yig -> Yiii - 3919, 190, // yih -> Hebr - 3923, 595, // yiv -> Yiii - 3927, 105, // ykg -> Cyrl - 3931, 105, // ykh -> Cyrl - 3935, 425, // yna -> Plrd - 3939, 105, // ynk -> Cyrl - 3943, 215, // yoi -> Jpan - 3947, 550, // yoy -> Thai - 3951, 105, // yrk -> Cyrl - 3955, 595, // ysd -> Yiii - 3959, 595, // ysn -> Yiii - 3963, 595, // ysp -> Yiii - 3967, 105, // ysr -> Cyrl - 3971, 425, // ysy -> Plrd - 3975, 190, // yud -> Hebr - 3979, 185, // yue -> Hant - 3983, 180, // yue_CN -> Hans - 3990, 105, // yug -> Cyrl - 3994, 105, // yux -> Cyrl - 3998, 425, // ywq -> Plrd - 4002, 425, // ywu -> Plrd - 4006, 555, // zau -> Tibt - 4010, 10, // zba -> Arab - 4014, 175, // zch -> Hani - 4018, 10, // zdj -> Arab - 4022, 175, // zeh -> Hani - 4026, 540, // zen -> Tfng - 4030, 175, // zgb -> Hani - 4034, 540, // zgh -> Tfng - 4038, 175, // zgm -> Hani - 4042, 175, // zgn -> Hani - 4046, 180, // zh -> Hans - 4049, 185, // zh_AU -> Hant - 4055, 185, // zh_BN -> Hant - 4061, 185, // zh_GB -> Hant - 4067, 185, // zh_GF -> Hant - 4073, 185, // zh_HK -> Hant - 4079, 185, // zh_ID -> Hant - 4085, 185, // zh_MO -> Hant - 4091, 185, // zh_PA -> Hant - 4097, 185, // zh_PF -> Hant - 4103, 185, // zh_PH -> Hant - 4109, 185, // zh_SR -> Hant - 4115, 185, // zh_TH -> Hant - 4121, 185, // zh_TW -> Hant - 4127, 185, // zh_US -> Hant - 4133, 185, // zh_VN -> Hant - 4139, 175, // zhd -> Hani - 4143, 375, // zhx -> Nshu - 4147, 105, // zko -> Cyrl - 4151, 240, // zkt -> Kits - 4155, 105, // zkz -> Cyrl - 4159, 175, // zlj -> Hani - 4163, 175, // zln -> Hani - 4167, 175, // zlq -> Hani - 4171, 175, // zqe -> Hani - 4175, 395, // zrg -> Orya - 4179, 190, // zrp -> Hebr - 4183, 10, // zum -> Arab - 4187, 125, // zwa -> Ethi - 4191, 175, // zyg -> Hani - 4195, 175, // zyn -> Hani - 4199, 175, // zzj -> Hani + 19, 425, // abl -> Rjng + 23, 100, // abq -> Cyrl + 27, 10, // abv -> Arab + 31, 10, // acm -> Arab + 35, 10, // acq -> Arab + 39, 10, // acw -> Arab + 43, 10, // acx -> Arab + 47, 10, // adf -> Arab + 51, 545, // adx -> Tibt + 55, 100, // ady -> Cyrl + 59, 25, // ae -> Avst + 62, 10, // aeb -> Arab + 66, 10, // aec -> Arab + 70, 10, // aee -> Arab + 74, 10, // aeq -> Arab + 78, 10, // afb -> Arab + 82, 105, // agi -> Deva + 86, 120, // agj -> Ethi + 90, 100, // agx -> Cyrl + 94, 120, // ahg -> Ethi + 98, 5, // aho -> Ahom + 102, 105, // ahr -> Deva + 106, 10, // aib -> Arab + 110, 485, // aii -> Syrc + 114, 185, // aij -> Hebr + 118, 220, // ain -> Kana + 122, 350, // aio -> Mymr + 126, 10, // aiq -> Arab + 130, 580, // akk -> Xsux + 134, 100, // akv -> Cyrl + 138, 255, // alk -> Laoo + 142, 325, // all -> Mlym + 146, 100, // alr -> Cyrl + 150, 100, // alt -> Cyrl + 154, 120, // alw -> Ethi + 158, 120, // am -> Ethi + 161, 210, // ams -> Jpan + 165, 485, // amw -> Syrc + 169, 100, // ani -> Cyrl + 173, 105, // anp -> Deva + 177, 105, // anq -> Deva + 181, 105, // anr -> Deva + 185, 120, // anu -> Ethi + 189, 45, // aot -> Beng + 193, 10, // apc -> Arab + 197, 10, // apd -> Arab + 201, 105, // aph -> Deva + 205, 100, // aqc -> Cyrl + 209, 10, // ar -> Arab + 212, 15, // arc -> Armi + 216, 10, // arq -> Arab + 220, 10, // ars -> Arab + 224, 10, // ary -> Arab + 228, 10, // arz -> Arab + 232, 45, // as -> Beng + 235, 455, // ase -> Sgnw + 239, 10, // ask -> Arab + 243, 105, // asr -> Deva + 247, 10, // atn -> Arab + 251, 100, // atv -> Cyrl + 255, 10, // auj -> Arab + 259, 10, // auz -> Arab + 263, 100, // av -> Cyrl + 266, 10, // avd -> Arab + 270, 10, // avl -> Arab + 274, 105, // awa -> Deva + 278, 120, // awn -> Ethi + 282, 20, // axm -> Armn + 286, 10, // ayh -> Arab + 290, 10, // ayl -> Arab + 294, 10, // ayn -> Arab + 298, 10, // ayp -> Arab + 302, 10, // az_IQ -> Arab + 308, 10, // az_IR -> Arab + 314, 100, // az_RU -> Cyrl + 320, 10, // azb -> Arab + 324, 100, // ba -> Cyrl + 327, 10, // bal -> Arab + 331, 105, // bap -> Deva + 335, 35, // bax -> Bamu + 339, 125, // bbl -> Geor + 343, 120, // bcq -> Ethi + 347, 385, // bdv -> Orya + 351, 10, // bdz -> Arab + 355, 100, // be -> Cyrl + 358, 105, // bee -> Deva + 362, 10, // bej -> Arab + 366, 105, // bfb -> Deva + 370, 510, // bfq -> Taml + 374, 10, // bft -> Arab + 378, 545, // bfu -> Tibt + 382, 385, // bfw -> Orya + 386, 105, // bfy -> Deva + 390, 105, // bfz -> Deva + 394, 100, // bg -> Cyrl + 397, 105, // bgc -> Deva + 401, 105, // bgd -> Deva + 405, 10, // bgn -> Arab + 409, 10, // bgp -> Arab + 413, 105, // bgq -> Deva + 417, 105, // bgw -> Deva + 421, 150, // bgx -> Grek + 425, 105, // bha -> Deva + 429, 105, // bhb -> Deva + 433, 105, // bhd -> Deva + 437, 10, // bhe -> Arab + 441, 100, // bhh -> Cyrl + 445, 105, // bhi -> Deva + 449, 105, // bhj -> Deva + 453, 10, // bhm -> Arab + 457, 485, // bhn -> Syrc + 461, 105, // bho -> Deva + 465, 105, // bht -> Deva + 469, 105, // bhu -> Deva + 473, 105, // bix -> Deva + 477, 105, // biy -> Deva + 481, 485, // bjf -> Syrc + 485, 105, // bjj -> Deva + 489, 10, // bjm -> Arab + 493, 545, // bkk -> Tibt + 497, 350, // blk -> Mymr + 501, 520, // blt -> Tavt + 505, 105, // bmj -> Deva + 509, 45, // bn -> Beng + 512, 105, // bns -> Deva + 516, 545, // bo -> Tibt + 519, 100, // bph -> Cyrl + 523, 105, // bpx -> Deva + 527, 45, // bpy -> Beng + 531, 10, // bqi -> Arab + 535, 105, // bra -> Deva + 539, 230, // brb -> Khmr + 543, 105, // brd -> Deva + 547, 10, // brh -> Arab + 551, 10, // brk -> Arab + 555, 545, // bro -> Tibt + 559, 255, // brv -> Laoo + 563, 240, // brw -> Knda + 567, 105, // brx -> Deva + 571, 10, // bsh -> Arab + 575, 10, // bsk -> Arab + 579, 120, // bst -> Ethi + 583, 40, // btd -> Batk + 587, 40, // btm -> Batk + 591, 105, // btv -> Deva + 595, 100, // bua -> Cyrl + 599, 350, // bwe -> Mymr + 603, 100, // bxm -> Cyrl + 607, 335, // bxu -> Mong + 611, 105, // byh -> Deva + 615, 120, // byn -> Ethi + 619, 105, // byw -> Deva + 623, 540, // bzi -> Thai + 627, 540, // cbn -> Thai + 631, 60, // ccp -> Cakm + 635, 525, // cde -> Telu + 639, 105, // cdh -> Deva + 643, 155, // cdi -> Gujr + 647, 105, // cdj -> Deva + 651, 105, // cdm -> Deva + 655, 105, // cdn -> Deva + 659, 175, // cdo -> Hans + 663, 45, // cdz -> Beng + 667, 100, // ce -> Cyrl + 670, 545, // cgk -> Tibt + 674, 10, // chg -> Arab + 678, 100, // chm -> Cyrl + 682, 80, // chr -> Cher + 686, 105, // chx -> Deva + 690, 105, // cih -> Deva + 694, 10, // cja -> Arab + 698, 100, // cji -> Cyrl + 702, 75, // cjm -> Cham + 706, 175, // cjy -> Hans + 710, 10, // ckb -> Arab + 714, 100, // ckt -> Cyrl + 718, 10, // clh -> Arab + 722, 100, // clw -> Cyrl + 726, 480, // cmg -> Soyo + 730, 545, // cna -> Tibt + 734, 175, // cnp -> Hans + 738, 540, // cog -> Thai + 742, 90, // cop -> Copt + 746, 150, // cpg -> Grek + 750, 65, // cr -> Cans + 753, 100, // crh -> Cyrl + 757, 65, // crj -> Cans + 761, 65, // crk -> Cans + 765, 65, // crl -> Cans + 769, 65, // crm -> Cans + 773, 350, // csh -> Mymr + 777, 175, // csp -> Hans + 781, 65, // csw -> Cans + 785, 400, // ctd -> Pauc + 789, 45, // ctg -> Beng + 793, 105, // ctn -> Deva + 797, 510, // ctt -> Taml + 801, 510, // cty -> Taml + 805, 100, // cu -> Cyrl + 808, 250, // cuu -> Lana + 812, 100, // cv -> Cyrl + 815, 175, // czh -> Hans + 819, 185, // czk -> Hebr + 823, 105, // daq -> Deva + 827, 100, // dar -> Cyrl + 831, 10, // dcc -> Arab + 835, 100, // ddo -> Cyrl + 839, 10, // def -> Arab + 843, 10, // deh -> Arab + 847, 45, // der -> Beng + 851, 10, // dgl -> Arab + 855, 105, // dhi -> Deva + 859, 155, // dhn -> Gujr + 863, 155, // dho -> Gujr + 867, 105, // dhw -> Deva + 871, 545, // dka -> Tibt + 875, 100, // dlg -> Cyrl + 879, 315, // dmf -> Medf + 883, 10, // dmk -> Arab + 887, 10, // dml -> Arab + 891, 100, // dng -> Cyrl + 895, 350, // dnu -> Mymr + 899, 350, // dnv -> Mymr + 903, 105, // doi -> Deva + 907, 120, // dox -> Ethi + 911, 545, // dre -> Tibt + 915, 105, // drq -> Deva + 919, 120, // drs -> Ethi + 923, 105, // dry -> Deva + 927, 385, // dso -> Orya + 931, 105, // dty -> Deva + 935, 155, // dub -> Gujr + 939, 105, // duh -> Deva + 943, 105, // dus -> Deva + 947, 535, // dv -> Thaa + 950, 385, // dwk -> Orya + 954, 105, // dwz -> Deva + 958, 545, // dz -> Tibt + 961, 545, // dzl -> Tibt + 965, 150, // ecr -> Grek + 969, 95, // ecy -> Cprt + 973, 110, // egy -> Egyp + 977, 215, // eky -> Kali + 981, 150, // el -> Grek + 984, 105, // emg -> Deva + 988, 105, // emu -> Deva + 992, 100, // enf -> Cyrl + 996, 100, // enh -> Cyrl + 1000, 510, // era -> Taml + 1004, 135, // esg -> Gonm + 1008, 10, // esh -> Arab + 1012, 200, // ett -> Ital + 1016, 100, // eve -> Cyrl + 1020, 100, // evn -> Cyrl + 1024, 10, // fa -> Arab + 1027, 10, // fay -> Arab + 1031, 10, // faz -> Arab + 1035, 10, // fia -> Arab + 1039, 105, // fmu -> Deva + 1043, 10, // fub -> Arab + 1047, 175, // gan -> Hans + 1051, 385, // gaq -> Orya + 1055, 155, // gas -> Gujr + 1059, 525, // gau -> Telu + 1063, 385, // gbj -> Orya + 1067, 105, // gbk -> Deva + 1071, 155, // gbl -> Gujr + 1075, 105, // gbm -> Deva + 1079, 10, // gbz -> Arab + 1083, 385, // gdb -> Orya + 1087, 100, // gdo -> Cyrl + 1091, 105, // gdx -> Deva + 1095, 120, // gez -> Ethi + 1099, 10, // ggg -> Arab + 1103, 10, // gha -> Arab + 1107, 105, // ghe -> Deva + 1111, 530, // gho -> Tfng + 1115, 10, // ghr -> Arab + 1119, 545, // ght -> Tibt + 1123, 10, // gig -> Arab + 1127, 100, // gin -> Cyrl + 1131, 10, // gjk -> Arab + 1135, 10, // gju -> Arab + 1139, 100, // gld -> Cyrl + 1143, 10, // glh -> Arab + 1147, 10, // glk -> Arab + 1151, 260, // gml -> Latf + 1155, 120, // gmv -> Ethi + 1159, 280, // gmy -> Linb + 1163, 545, // goe -> Tibt + 1167, 120, // gof -> Ethi + 1171, 105, // goj -> Deva + 1175, 105, // gok -> Deva + 1179, 105, // gon -> Deva + 1183, 140, // got -> Goth + 1187, 105, // gra -> Deva + 1191, 150, // grc -> Grek + 1195, 10, // grr -> Arab + 1199, 45, // grt -> Beng + 1203, 120, // gru -> Ethi + 1207, 155, // gu -> Gujr + 1210, 105, // gvr -> Deva + 1214, 10, // gwc -> Arab + 1218, 10, // gwf -> Arab + 1222, 10, // gwt -> Arab + 1226, 105, // gyo -> Deva + 1230, 10, // gzi -> Arab + 1234, 10, // ha_CM -> Arab + 1240, 10, // ha_SD -> Arab + 1246, 10, // hac -> Arab + 1250, 175, // hak -> Hans + 1254, 180, // hak_TW -> Hant + 1261, 120, // har -> Ethi + 1265, 10, // haz -> Arab + 1269, 185, // hbo -> Hebr + 1273, 120, // hdy -> Ethi + 1277, 185, // he -> Hebr + 1280, 105, // hi -> Deva + 1283, 105, // hif -> Deva + 1287, 495, // hii -> Takr + 1291, 580, // hit -> Xsux + 1295, 10, // hkh -> Arab + 1299, 105, // hlb -> Deva + 1303, 190, // hlu -> Hluw + 1307, 415, // hmd -> Plrd + 1311, 50, // hmj -> Bopo + 1315, 50, // hmq -> Bopo + 1319, 10, // hnd -> Arab + 1323, 105, // hne -> Deva + 1327, 195, // hnj -> Hmnp + 1331, 175, // hnm -> Hans + 1335, 10, // hno -> Arab + 1339, 105, // hoc -> Deva + 1343, 10, // hoh -> Arab + 1347, 105, // hoj -> Deva + 1351, 170, // how -> Hani + 1355, 105, // hoy -> Deva + 1359, 350, // hpo -> Mymr + 1363, 485, // hrt -> Syrc + 1367, 10, // hrz -> Arab + 1371, 175, // hsn -> Hans + 1375, 10, // hss -> Arab + 1379, 580, // htx -> Xsux + 1383, 105, // hut -> Deva + 1387, 185, // huy -> Hebr + 1391, 100, // huz -> Cyrl + 1395, 20, // hy -> Armn + 1398, 20, // hyw -> Armn + 1402, 585, // ii -> Yiii + 1405, 290, // imy -> Lyci + 1409, 100, // inh -> Cyrl + 1413, 350, // int -> Mymr + 1417, 120, // ior -> Ethi + 1421, 510, // iru -> Taml + 1425, 10, // isk -> Arab + 1429, 185, // itk -> Hebr + 1433, 100, // itl -> Cyrl + 1437, 65, // iu -> Cans + 1440, 185, // iw -> Hebr + 1443, 210, // ja -> Jpan + 1446, 10, // jad -> Arab + 1450, 10, // jat -> Arab + 1454, 185, // jbe -> Hebr + 1458, 10, // jbn -> Arab + 1462, 100, // jct -> Cyrl + 1466, 545, // jda -> Tibt + 1470, 10, // jdg -> Arab + 1474, 100, // jdt -> Cyrl + 1478, 105, // jee -> Deva + 1482, 125, // jge -> Geor + 1486, 185, // ji -> Hebr + 1489, 165, // jje -> Hang + 1493, 350, // jkm -> Mymr + 1497, 105, // jml -> Deva + 1501, 495, // jna -> Takr + 1505, 10, // jnd -> Arab + 1509, 105, // jnl -> Deva + 1513, 105, // jns -> Deva + 1517, 10, // jog -> Arab + 1521, 185, // jpa -> Hebr + 1525, 185, // jpr -> Hebr + 1529, 185, // jrb -> Hebr + 1533, 105, // jul -> Deva + 1537, 385, // jun -> Orya + 1541, 385, // juy -> Orya + 1545, 545, // jya -> Tibt + 1549, 185, // jye -> Hebr + 1553, 125, // ka -> Geor + 1556, 100, // kaa -> Cyrl + 1560, 100, // kap -> Cyrl + 1564, 30, // kaw -> Bali + 1568, 100, // kbd -> Cyrl + 1572, 545, // kbg -> Tibt + 1576, 10, // kbu -> Arab + 1580, 10, // kby -> Arab + 1584, 100, // kca -> Cyrl + 1588, 10, // kcy -> Arab + 1592, 45, // kdq -> Beng + 1596, 540, // kdt -> Thai + 1600, 100, // ket -> Cyrl + 1604, 325, // kev -> Mlym + 1608, 105, // kex -> Deva + 1612, 525, // key -> Telu + 1616, 240, // kfa -> Knda + 1620, 105, // kfb -> Deva + 1624, 525, // kfc -> Telu + 1628, 240, // kfd -> Knda + 1632, 510, // kfe -> Taml + 1636, 240, // kfg -> Knda + 1640, 325, // kfh -> Mlym + 1644, 510, // kfi -> Taml + 1648, 105, // kfk -> Deva + 1652, 10, // kfm -> Arab + 1656, 105, // kfp -> Deva + 1660, 105, // kfq -> Deva + 1664, 105, // kfr -> Deva + 1668, 105, // kfs -> Deva + 1672, 105, // kfu -> Deva + 1676, 105, // kfx -> Deva + 1680, 105, // kfy -> Deva + 1684, 105, // kgj -> Deva + 1688, 545, // kgy -> Tibt + 1692, 505, // khb -> Talu + 1696, 540, // khf -> Thai + 1700, 545, // khg -> Tibt + 1704, 105, // khn -> Deva + 1708, 55, // kho -> Brah + 1712, 350, // kht -> Mymr + 1716, 100, // khv -> Cyrl + 1720, 10, // khw -> Arab + 1724, 105, // kif -> Deva + 1728, 100, // kim -> Cyrl + 1732, 105, // kip -> Deva + 1736, 255, // kjg -> Laoo + 1740, 100, // kjh -> Cyrl + 1744, 105, // kjl -> Deva + 1748, 105, // kjo -> Deva + 1752, 350, // kjp -> Mymr + 1756, 540, // kjt -> Thai + 1760, 545, // kjz -> Tibt + 1764, 100, // kk -> Cyrl + 1767, 10, // kk_AF -> Arab + 1773, 10, // kk_CN -> Arab + 1779, 10, // kk_IR -> Arab + 1785, 10, // kk_MN -> Arab + 1791, 545, // kkf -> Tibt + 1795, 250, // kkh -> Lana + 1799, 105, // kkt -> Deva + 1803, 105, // kle -> Deva + 1807, 10, // klj -> Arab + 1811, 105, // klr -> Deva + 1815, 230, // km -> Khmr + 1818, 105, // kmj -> Deva + 1822, 10, // kmz -> Arab + 1826, 240, // kn -> Knda + 1829, 105, // knn -> Deva + 1833, 245, // ko -> Kore + 1836, 100, // koi -> Cyrl + 1840, 105, // kok -> Deva + 1844, 100, // kpt -> Cyrl + 1848, 100, // kpy -> Cyrl + 1852, 485, // kqd -> Syrc + 1856, 120, // kqy -> Ethi + 1860, 105, // kra -> Deva + 1864, 100, // krc -> Cyrl + 1868, 100, // krk -> Cyrl + 1872, 230, // krr -> Khmr + 1876, 105, // kru -> Deva + 1880, 230, // krv -> Khmr + 1884, 10, // ks -> Arab + 1887, 350, // ksu -> Mymr + 1891, 350, // ksw -> Mymr + 1895, 105, // ksz -> Deva + 1899, 120, // ktb -> Ethi + 1903, 105, // kte -> Deva + 1907, 10, // ktl -> Arab + 1911, 415, // ktp -> Plrd + 1915, 100, // ku_AM -> Cyrl + 1921, 100, // ku_AZ -> Cyrl + 1927, 100, // ku_GE -> Cyrl + 1933, 10, // ku_IQ -> Arab + 1939, 10, // ku_IR -> Arab + 1945, 10, // ku_LB -> Arab + 1951, 100, // ku_TM -> Cyrl + 1957, 255, // kuf -> Laoo + 1961, 100, // kum -> Cyrl + 1965, 100, // kv -> Cyrl + 1968, 100, // kva -> Cyrl + 1972, 350, // kvq -> Mymr + 1976, 350, // kvt -> Mymr + 1980, 10, // kvx -> Arab + 1984, 215, // kvy -> Kali + 1988, 105, // kwx -> Deva + 1992, 350, // kxf -> Mymr + 1996, 350, // kxk -> Mymr + 2000, 540, // kxm -> Thai + 2004, 10, // kxp -> Arab + 2008, 100, // ky -> Cyrl + 2011, 10, // ky_CN -> Arab + 2017, 215, // kyu -> Kali + 2021, 105, // kyv -> Deva + 2025, 105, // kyw -> Deva + 2029, 275, // lab -> Lina + 2033, 185, // lad -> Hebr + 2037, 105, // lae -> Deva + 2041, 10, // lah -> Arab + 2045, 100, // lbe -> Cyrl + 2049, 105, // lbf -> Deva + 2053, 545, // lbj -> Tibt + 2057, 105, // lbm -> Deva + 2061, 255, // lbo -> Laoo + 2065, 105, // lbr -> Deva + 2069, 540, // lcp -> Thai + 2073, 270, // lep -> Lepc + 2077, 100, // lez -> Cyrl + 2081, 105, // lhm -> Deva + 2085, 485, // lhs -> Syrc + 2089, 105, // lif -> Deva + 2093, 285, // lis -> Lisu + 2097, 545, // lkh -> Tibt + 2101, 10, // lki -> Arab + 2105, 105, // lmh -> Deva + 2109, 525, // lmn -> Telu + 2113, 255, // lo -> Laoo + 2116, 105, // loy -> Deva + 2120, 415, // lpo -> Plrd + 2124, 10, // lrc -> Arab + 2128, 10, // lrk -> Arab + 2132, 10, // lrl -> Arab + 2136, 10, // lsa -> Arab + 2140, 185, // lsd -> Hebr + 2144, 10, // lss -> Arab + 2148, 180, // ltc -> Hant + 2152, 175, // luh -> Hans + 2156, 545, // luk -> Tibt + 2160, 105, // luu -> Deva + 2164, 10, // luv -> Arab + 2168, 10, // luz -> Arab + 2172, 540, // lwl -> Thai + 2176, 540, // lwm -> Thai + 2180, 545, // lya -> Tibt + 2184, 180, // lzh -> Hant + 2188, 125, // lzz_GE -> Geor + 2195, 105, // mag -> Deva + 2199, 105, // mai -> Deva + 2203, 10, // mby -> Arab + 2207, 10, // mde -> Arab + 2211, 100, // mdf -> Cyrl + 2215, 120, // mdx -> Ethi + 2219, 120, // mdy -> Ethi + 2223, 10, // mey -> Arab + 2227, 10, // mfa -> Arab + 2231, 10, // mfi -> Arab + 2235, 265, // mga -> Latg + 2239, 105, // mgp -> Deva + 2243, 10, // mhj -> Arab + 2247, 300, // mid -> Mand + 2251, 105, // mjl -> Deva + 2255, 325, // mjq -> Mlym + 2259, 325, // mjr -> Mlym + 2263, 105, // mjt -> Deva + 2267, 525, // mju -> Telu + 2271, 325, // mjv -> Mlym + 2275, 105, // mjz -> Deva + 2279, 100, // mk -> Cyrl + 2282, 105, // mkb -> Deva + 2286, 105, // mke -> Deva + 2290, 10, // mki -> Arab + 2294, 540, // mkm -> Thai + 2298, 325, // ml -> Mlym + 2301, 540, // mlf -> Thai + 2305, 100, // mn -> Cyrl + 2308, 335, // mn_CN -> Mong + 2314, 335, // mnc -> Mong + 2318, 45, // mni -> Beng + 2322, 10, // mnj -> Arab + 2326, 100, // mns -> Cyrl + 2330, 350, // mnw -> Mymr + 2334, 540, // mpz -> Thai + 2338, 105, // mr -> Deva + 2341, 540, // mra -> Thai + 2345, 105, // mrd -> Deva + 2349, 100, // mrj -> Cyrl + 2353, 340, // mro -> Mroo + 2357, 105, // mrr -> Deva + 2361, 10, // ms_CC -> Arab + 2367, 100, // mtm -> Cyrl + 2371, 105, // mtr -> Deva + 2375, 100, // mud -> Cyrl + 2379, 545, // muk -> Tibt + 2383, 105, // mut -> Deva + 2387, 510, // muv -> Taml + 2391, 120, // muz -> Ethi + 2395, 10, // mve -> Arab + 2399, 335, // mvf -> Mong + 2403, 10, // mvy -> Arab + 2407, 120, // mvz -> Ethi + 2411, 105, // mwr -> Deva + 2415, 350, // mwt -> Mymr + 2419, 195, // mww -> Hmnp + 2423, 350, // my -> Mymr + 2426, 120, // mym -> Ethi + 2430, 100, // myv -> Cyrl + 2434, 300, // myz -> Mand + 2438, 10, // mzb -> Arab + 2442, 10, // mzn -> Arab + 2446, 175, // nan -> Hans + 2450, 180, // nan_MO -> Hant + 2457, 180, // nan_TW -> Hant + 2464, 105, // nao -> Deva + 2468, 105, // ncd -> Deva + 2472, 255, // ncq -> Laoo + 2476, 100, // ndf -> Cyrl + 2480, 105, // ne -> Deva + 2483, 100, // neg -> Cyrl + 2487, 545, // neh -> Tibt + 2491, 580, // nei -> Xsux + 2495, 105, // new -> Deva + 2499, 255, // ngt -> Laoo + 2503, 100, // nio -> Cyrl + 2507, 525, // nit -> Telu + 2511, 100, // niv -> Cyrl + 2515, 10, // nli -> Arab + 2519, 10, // nlm -> Arab + 2523, 105, // nlx -> Deva + 2527, 105, // nmm -> Deva + 2531, 570, // nnp -> Wcho + 2535, 250, // nod -> Lana + 2539, 105, // noe -> Deva + 2543, 100, // nog -> Cyrl + 2547, 105, // noi -> Deva + 2551, 435, // non -> Runr + 2555, 585, // nos -> Yiii + 2559, 545, // npb -> Tibt + 2563, 365, // nqo -> Nkoo + 2567, 435, // nrn -> Runr + 2571, 585, // nsd -> Yiii + 2575, 585, // nsf -> Yiii + 2579, 65, // nsk -> Cans + 2583, 550, // nst -> Tnsa + 2587, 585, // nsv -> Yiii + 2591, 585, // nty -> Yiii + 2595, 10, // ntz -> Arab + 2599, 360, // nwc -> Newa + 2603, 105, // nwx -> Deva + 2607, 540, // nyl -> Thai + 2611, 10, // nyq -> Arab + 2615, 540, // nyw -> Thai + 2619, 100, // oaa -> Cyrl + 2623, 100, // oac -> Cyrl + 2627, 485, // oar -> Syrc + 2631, 125, // oav -> Geor + 2635, 410, // obm -> Phnx + 2639, 350, // obr -> Mymr + 2643, 10, // odk -> Arab + 2647, 580, // oht -> Xsux + 2651, 65, // oj -> Cans + 2654, 65, // ojs -> Cans + 2658, 165, // okm -> Hang + 2662, 170, // oko -> Hani + 2666, 230, // okz -> Khmr + 2670, 105, // ola -> Deva + 2674, 545, // ole -> Tibt + 2678, 100, // omk -> Cyrl + 2682, 345, // omp -> Mtei + 2686, 330, // omr -> Modi + 2690, 350, // omx -> Mymr + 2694, 105, // oon -> Deva + 2698, 385, // or -> Orya + 2701, 525, // ort -> Telu + 2705, 10, // oru -> Arab + 2709, 100, // orv -> Cyrl + 2713, 100, // os -> Cyrl + 2716, 390, // osa -> Osge + 2720, 200, // osc -> Ital + 2724, 205, // osi -> Java + 2728, 10, // ota -> Arab + 2732, 545, // otb -> Tibt + 2736, 380, // otk -> Orkh + 2740, 145, // oty -> Gran + 2744, 395, // oui -> Ougr + 2748, 255, // oyb -> Laoo + 2752, 160, // pa -> Guru + 2755, 10, // pa_PK -> Arab + 2761, 405, // pal -> Phli + 2765, 100, // paq -> Cyrl + 2769, 10, // pbt -> Arab + 2773, 230, // pcb -> Khmr + 2777, 350, // pce -> Mymr + 2781, 325, // pcf -> Mlym + 2785, 325, // pcg -> Mlym + 2789, 105, // pch -> Deva + 2793, 105, // pci -> Deva + 2797, 525, // pcj -> Telu + 2801, 385, // peg -> Orya + 2805, 575, // peo -> Xpeo + 2809, 225, // pgd -> Khar + 2813, 105, // pgg -> Deva + 2817, 370, // pgl -> Ogam + 2821, 200, // pgn -> Ital + 2825, 105, // phd -> Deva + 2829, 350, // phk -> Mymr + 2833, 10, // phl -> Arab + 2837, 410, // phn -> Phnx + 2841, 255, // pho -> Laoo + 2845, 10, // phr -> Arab + 2849, 540, // pht -> Thai + 2853, 540, // phu -> Thai + 2857, 10, // phv -> Arab + 2861, 105, // phw -> Deva + 2865, 105, // pi_IN -> Deva + 2871, 465, // pi_LK -> Sinh + 2877, 350, // pi_MM -> Mymr + 2883, 540, // pi_TH -> Thai + 2889, 55, // pka -> Brah + 2893, 325, // pkr -> Mlym + 2897, 10, // plk -> Arab + 2901, 350, // pll -> Mymr + 2905, 55, // pmh -> Brah + 2909, 150, // pnt -> Grek + 2913, 100, // pnt_RU -> Cyrl + 2920, 10, // prc -> Arab + 2924, 10, // prd -> Arab + 2928, 540, // prt -> Thai + 2932, 10, // prx -> Arab + 2936, 10, // ps -> Arab + 2939, 10, // psh -> Arab + 2943, 10, // psi -> Arab + 2947, 10, // pst -> Arab + 2951, 55, // psu -> Brah + 2955, 105, // pum -> Deva + 2959, 350, // pwo -> Mymr + 2963, 105, // pwr -> Deva + 2967, 540, // pww -> Thai + 2971, 350, // pyx -> Mymr + 2975, 10, // qxq -> Arab + 2979, 105, // raa -> Deva + 2983, 105, // rab -> Deva + 2987, 105, // raf -> Deva + 2991, 45, // rah -> Beng + 2995, 105, // raj -> Deva + 2999, 105, // rav -> Deva + 3003, 350, // rbb -> Mymr + 3007, 10, // rdb -> Arab + 3011, 385, // rei -> Orya + 3015, 430, // rhg -> Rohg + 3019, 105, // rji -> Deva + 3023, 105, // rjs -> Deva + 3027, 230, // rka -> Khmr + 3031, 350, // rki -> Mymr + 3035, 45, // rkt -> Beng + 3039, 20, // rmi -> Armn + 3043, 10, // rmt -> Arab + 3047, 350, // rmz -> Mymr + 3051, 100, // rsk -> Cyrl + 3055, 105, // rtw -> Deva + 3059, 100, // ru -> Cyrl + 3062, 100, // rue -> Cyrl + 3066, 100, // rut -> Cyrl + 3070, 105, // rwr -> Deva + 3074, 220, // ryu -> Kana + 3078, 105, // sa -> Deva + 3081, 100, // sah -> Cyrl + 3085, 440, // sam -> Samr + 3089, 375, // sat -> Olck + 3093, 450, // saz -> Saur + 3097, 10, // sbn -> Arab + 3101, 545, // sbu -> Tibt + 3105, 105, // sck -> Deva + 3109, 10, // scl -> Arab + 3113, 105, // scp -> Deva + 3117, 255, // sct -> Laoo + 3121, 495, // scu -> Takr + 3125, 150, // scx -> Grek + 3129, 10, // sd -> Arab + 3132, 105, // sd_IN -> Deva + 3138, 10, // sdb -> Arab + 3142, 10, // sdf -> Arab + 3146, 10, // sdg -> Arab + 3150, 10, // sdh -> Arab + 3154, 45, // sdr -> Beng + 3158, 10, // sds -> Arab + 3162, 100, // sel -> Cyrl + 3166, 415, // sfm -> Plrd + 3170, 100, // sgh -> Cyrl + 3174, 105, // sgj -> Deva + 3178, 10, // sgr -> Arab + 3182, 545, // sgt -> Tibt + 3186, 120, // sgw -> Ethi + 3190, 10, // sgy -> Arab + 3194, 10, // shd -> Arab + 3198, 530, // shi -> Tfng + 3202, 10, // shm -> Arab + 3206, 350, // shn -> Mymr + 3210, 10, // shu -> Arab + 3214, 10, // shv -> Arab + 3218, 465, // si -> Sinh + 3221, 100, // sia -> Cyrl + 3225, 545, // sip -> Tibt + 3229, 10, // siy -> Arab + 3233, 10, // siz -> Arab + 3237, 175, // sjc -> Hans + 3241, 100, // sjd -> Cyrl + 3245, 105, // sjp -> Deva + 3249, 100, // sjt -> Cyrl + 3253, 540, // skb -> Thai + 3257, 105, // skj -> Deva + 3261, 10, // skr -> Arab + 3265, 585, // smh -> Yiii + 3269, 440, // smp -> Samr + 3273, 230, // smu -> Khmr + 3277, 10, // smy -> Arab + 3281, 520, // soa -> Tavt + 3285, 470, // sog -> Sogd + 3289, 105, // soi -> Deva + 3293, 540, // sou -> Thai + 3297, 545, // spt -> Tibt + 3301, 385, // spv -> Orya + 3305, 10, // sqo -> Arab + 3309, 255, // sqq -> Laoo + 3313, 10, // sqt -> Arab + 3317, 100, // sr -> Cyrl + 3320, 475, // srb -> Sora + 3324, 10, // srh -> Arab + 3328, 105, // srx -> Deva + 3332, 10, // srz -> Arab + 3336, 10, // ssh -> Arab + 3340, 255, // sss -> Laoo + 3344, 10, // sts -> Arab + 3348, 250, // stu -> Lana + 3352, 500, // stu_CN -> Tale + 3359, 120, // stv -> Ethi + 3363, 100, // sty -> Cyrl + 3367, 105, // suz -> Deva + 3371, 125, // sva -> Geor + 3375, 10, // swb -> Arab + 3379, 170, // swi -> Hani + 3383, 105, // swv -> Deva + 3387, 435, // sxu -> Runr + 3391, 485, // syc -> Syrc + 3395, 45, // syl -> Beng + 3399, 485, // syn -> Syrc + 3403, 485, // syr -> Syrc + 3407, 105, // syw -> Deva + 3411, 510, // ta -> Taml + 3414, 100, // tab -> Cyrl + 3418, 105, // taj -> Deva + 3422, 490, // tbk -> Tagb + 3426, 105, // tcn -> Deva + 3430, 350, // tco -> Mymr + 3434, 510, // tcx -> Taml + 3438, 240, // tcy -> Knda + 3442, 530, // tda -> Tfng + 3446, 105, // tdb -> Deva + 3450, 500, // tdd -> Tale + 3454, 105, // tdg -> Deva + 3458, 105, // tdh -> Deva + 3462, 525, // te -> Telu + 3465, 205, // tes -> Java + 3469, 100, // tg -> Cyrl + 3472, 10, // tg_PK -> Arab + 3478, 105, // tge -> Deva + 3482, 545, // tgf -> Tibt + 3486, 540, // th -> Thai + 3489, 105, // the -> Deva + 3493, 105, // thf -> Deva + 3497, 500, // thi -> Tale + 3501, 105, // thl -> Deva + 3505, 540, // thm -> Thai + 3509, 105, // thq -> Deva + 3513, 105, // thr -> Deva + 3517, 105, // ths -> Deva + 3521, 120, // ti -> Ethi + 3524, 120, // tig -> Ethi + 3528, 105, // tij -> Deva + 3532, 100, // tin -> Cyrl + 3536, 350, // tjl -> Mymr + 3540, 10, // tjo -> Arab + 3544, 105, // tkb -> Deva + 3548, 10, // tks -> Arab + 3552, 105, // tkt -> Deva + 3556, 485, // tmr -> Syrc + 3560, 60, // tnv -> Cakm + 3564, 10, // tov -> Arab + 3568, 230, // tpu -> Khmr + 3572, 10, // tra -> Arab + 3576, 185, // trg -> Hebr + 3580, 10, // trm -> Arab + 3584, 10, // trw -> Arab + 3588, 150, // tsd -> Grek + 3592, 545, // tsj -> Tibt + 3596, 100, // tt -> Cyrl + 3599, 255, // tth -> Laoo + 3603, 255, // tto -> Laoo + 3607, 540, // tts -> Thai + 3611, 105, // ttz -> Deva + 3615, 350, // tvn -> Mymr + 3619, 545, // twm -> Tibt + 3623, 515, // txg -> Tang + 3627, 555, // txo -> Toto + 3631, 520, // tyr -> Tavt + 3635, 100, // tyv -> Cyrl + 3639, 100, // ude -> Cyrl + 3643, 325, // udg -> Mlym + 3647, 100, // udi -> Cyrl + 3651, 100, // udm -> Cyrl + 3655, 10, // ug -> Arab + 3658, 100, // ug_KZ -> Cyrl + 3664, 100, // ug_MN -> Cyrl + 3670, 560, // uga -> Ugar + 3674, 100, // ugh -> Cyrl + 3678, 540, // ugo -> Thai + 3682, 100, // uk -> Cyrl + 3685, 385, // uki -> Orya + 3689, 100, // ulc -> Cyrl + 3693, 45, // unr -> Beng + 3697, 105, // unr_NP -> Deva + 3704, 45, // unx -> Beng + 3708, 10, // ur -> Arab + 3711, 540, // urk -> Thai + 3715, 10, // ush -> Arab + 3719, 150, // uum -> Grek + 3723, 10, // uz_AF -> Arab + 3729, 100, // uz_CN -> Cyrl + 3735, 10, // uzs -> Arab + 3739, 510, // vaa -> Taml + 3743, 10, // vaf -> Arab + 3747, 105, // vah -> Deva + 3751, 565, // vai -> Vaii + 3755, 105, // vas -> Deva + 3759, 105, // vav -> Deva + 3763, 105, // vay -> Deva + 3767, 10, // vgr -> Arab + 3771, 105, // vjk -> Deva + 3775, 240, // vmd -> Knda + 3779, 10, // vmh -> Arab + 3783, 120, // wal -> Ethi + 3787, 10, // wbk -> Arab + 3791, 525, // wbq -> Telu + 3795, 105, // wbr -> Deva + 3799, 120, // wle -> Ethi + 3803, 10, // wlo -> Arab + 3807, 105, // wme -> Deva + 3811, 10, // wne -> Arab + 3815, 10, // wni -> Arab + 3819, 130, // wsg -> Gong + 3823, 10, // wsv -> Arab + 3827, 105, // wtm -> Deva + 3831, 175, // wuu -> Hans + 3835, 0, // xag -> Aghb + 3839, 100, // xal -> Cyrl + 3843, 120, // xan -> Ethi + 3847, 100, // xas -> Cyrl + 3851, 85, // xco -> Chrs + 3855, 70, // xcr -> Cari + 3859, 100, // xdq -> Cyrl + 3863, 10, // xhe -> Arab + 3867, 230, // xhm -> Khmr + 3871, 385, // xis -> Orya + 3875, 10, // xka -> Arab + 3879, 10, // xkc -> Arab + 3883, 545, // xkf -> Tibt + 3887, 10, // xkj -> Arab + 3891, 10, // xkp -> Arab + 3895, 290, // xlc -> Lyci + 3899, 295, // xld -> Lydi + 3903, 115, // xly -> Elym + 3907, 125, // xmf -> Geor + 3911, 305, // xmn -> Mani + 3915, 320, // xmr -> Merc + 3919, 355, // xna -> Narb + 3923, 105, // xnr -> Deva + 3927, 150, // xpg -> Grek + 3931, 370, // xpi -> Ogam + 3935, 100, // xpm -> Cyrl + 3939, 420, // xpr -> Prti + 3943, 100, // xrm -> Cyrl + 3947, 100, // xrn -> Cyrl + 3951, 445, // xsa -> Sarb + 3955, 460, // xsd -> Sidt + 3959, 105, // xsr -> Deva + 3963, 55, // xtq -> Brah + 3967, 510, // xub -> Taml + 3971, 510, // xuj -> Taml + 3975, 200, // xve -> Ital + 3979, 10, // xvi -> Arab + 3983, 100, // xwo -> Cyrl + 3987, 310, // xzh -> Marc + 3991, 100, // yai -> Cyrl + 3995, 105, // ybh -> Deva + 3999, 105, // ybi -> Deva + 4003, 10, // ydg -> Arab + 4007, 325, // yea -> Mlym + 4011, 150, // yej -> Grek + 4015, 525, // yeu -> Telu + 4019, 415, // ygp -> Plrd + 4023, 185, // yhd -> Hebr + 4027, 185, // yi -> Hebr + 4030, 585, // yig -> Yiii + 4034, 185, // yih -> Hebr + 4038, 585, // yiv -> Yiii + 4042, 100, // ykg -> Cyrl + 4046, 100, // ykh -> Cyrl + 4050, 415, // yna -> Plrd + 4054, 100, // ynk -> Cyrl + 4058, 210, // yoi -> Jpan + 4062, 540, // yoy -> Thai + 4066, 100, // yrk -> Cyrl + 4070, 585, // ysd -> Yiii + 4074, 585, // ysn -> Yiii + 4078, 585, // ysp -> Yiii + 4082, 100, // ysr -> Cyrl + 4086, 415, // ysy -> Plrd + 4090, 185, // yud -> Hebr + 4094, 180, // yue -> Hant + 4098, 175, // yue_CN -> Hans + 4105, 100, // yug -> Cyrl + 4109, 100, // yux -> Cyrl + 4113, 415, // ywq -> Plrd + 4117, 415, // ywu -> Plrd + 4121, 545, // zau -> Tibt + 4125, 10, // zba -> Arab + 4129, 170, // zch -> Hani + 4133, 10, // zdj -> Arab + 4137, 170, // zeh -> Hani + 4141, 530, // zen -> Tfng + 4145, 170, // zgb -> Hani + 4149, 530, // zgh -> Tfng + 4153, 170, // zgm -> Hani + 4157, 170, // zgn -> Hani + 4161, 175, // zh -> Hans + 4164, 180, // zh_AU -> Hant + 4170, 180, // zh_BN -> Hant + 4176, 180, // zh_GB -> Hant + 4182, 180, // zh_GF -> Hant + 4188, 180, // zh_HK -> Hant + 4194, 180, // zh_ID -> Hant + 4200, 180, // zh_MO -> Hant + 4206, 180, // zh_PA -> Hant + 4212, 180, // zh_PF -> Hant + 4218, 180, // zh_PH -> Hant + 4224, 180, // zh_SR -> Hant + 4230, 180, // zh_TH -> Hant + 4236, 180, // zh_TW -> Hant + 4242, 180, // zh_US -> Hant + 4248, 180, // zh_VN -> Hant + 4254, 170, // zhd -> Hani + 4258, 100, // zko -> Cyrl + 4262, 235, // zkt -> Kits + 4266, 100, // zkz -> Cyrl + 4270, 170, // zlj -> Hani + 4274, 170, // zln -> Hani + 4278, 170, // zlq -> Hani + 4282, 170, // zqe -> Hani + 4286, 385, // zrg -> Orya + 4290, 185, // zrp -> Hebr + 4294, 10, // zum -> Arab + 4298, 120, // zwa -> Ethi + 4302, 170, // zyg -> Hani + 4306, 170, // zyn -> Hani + 4310, 170, // zzj -> Hani }; //====================================================================== @@ -1163,38 +1185,39 @@ const char parentLocaleChars[] = "cu_Glag\0dje_Arab\0dyo_Arab\0en_001\0en_150\0en_AG\0en_AI\0en_AT\0" "en_AU\0en_BB\0en_BE\0en_BM\0en_BS\0en_BW\0en_BZ\0en_CC\0en_CH\0" "en_CK\0en_CM\0en_CX\0en_CY\0en_CZ\0en_DE\0en_DG\0en_DK\0en_DM\0" - "en_Dsrt\0en_ER\0en_ES\0en_FI\0en_FJ\0en_FK\0en_FM\0en_FR\0en_GB\0" - "en_GD\0en_GG\0en_GH\0en_GI\0en_GM\0en_GS\0en_GY\0en_HK\0en_HU\0" - "en_ID\0en_IE\0en_IL\0en_IM\0en_IN\0en_IO\0en_IT\0en_JE\0en_JM\0" - "en_KE\0en_KI\0en_KN\0en_KY\0en_LC\0en_LR\0en_LS\0en_MG\0en_MO\0" - "en_MS\0en_MT\0en_MU\0en_MV\0en_MW\0en_MY\0en_NA\0en_NF\0en_NG\0" - "en_NL\0en_NO\0en_NR\0en_NU\0en_NZ\0en_PG\0en_PK\0en_PL\0en_PN\0" - "en_PT\0en_PW\0en_RO\0en_RW\0en_SB\0en_SC\0en_SD\0en_SE\0en_SG\0" - "en_SH\0en_SI\0en_SK\0en_SL\0en_SS\0en_SX\0en_SZ\0en_Shaw\0en_TC\0" - "en_TK\0en_TO\0en_TT\0en_TV\0en_TZ\0en_UG\0en_VC\0en_VG\0en_VU\0" - "en_WS\0en_ZA\0en_ZM\0en_ZW\0es_419\0es_AR\0es_BO\0es_BR\0es_BZ\0" - "es_CL\0es_CO\0es_CR\0es_CU\0es_DO\0es_EC\0es_GT\0es_HN\0es_JP\0" - "es_MX\0es_NI\0es_PA\0es_PE\0es_PR\0es_PY\0es_SV\0es_US\0es_UY\0" - "es_VE\0ff_Adlm\0ff_Arab\0fr_HT\0ha_Arab\0hi_Latn\0ht\0iu_Latn\0" - "kaa_Latn\0kk_Arab\0kok_Latn\0ks_Deva\0ku_Arab\0kxv_Deva\0kxv_Orya\0" - "kxv_Telu\0ky_Arab\0ky_Latn\0ml_Arab\0mn_Mong\0mni_Mtei\0ms_Arab\0" - "nb\0nn\0no\0no_NO\0pa_Arab\0pt_AO\0pt_CH\0pt_CV\0pt_FR\0pt_GQ\0" - "pt_GW\0pt_LU\0pt_MO\0pt_MZ\0pt_PT\0pt_ST\0pt_TL\0root\0sat_Deva\0" - "sd_Deva\0sd_Khoj\0sd_Sind\0shi_Latn\0so_Arab\0sr_Latn\0sw_Arab\0" - "tg_Arab\0ug_Cyrl\0uz_Arab\0uz_Cyrl\0vai_Latn\0wo_Arab\0yo_Arab\0" - "yue_Hans\0zh_Hant\0zh_Hant_HK\0zh_Hant_MO\0"; + "en_Dsrt\0en_EE\0en_ER\0en_ES\0en_FI\0en_FJ\0en_FK\0en_FM\0en_FR\0" + "en_GB\0en_GD\0en_GE\0en_GG\0en_GH\0en_GI\0en_GM\0en_GS\0en_GY\0" + "en_HK\0en_HU\0en_ID\0en_IE\0en_IL\0en_IM\0en_IN\0en_IO\0en_IT\0" + "en_JE\0en_JM\0en_KE\0en_KI\0en_KN\0en_KY\0en_LC\0en_LR\0en_LS\0" + "en_LT\0en_LV\0en_MG\0en_MO\0en_MS\0en_MT\0en_MU\0en_MV\0en_MW\0" + "en_MY\0en_NA\0en_NF\0en_NG\0en_NL\0en_NO\0en_NR\0en_NU\0en_NZ\0" + "en_PG\0en_PK\0en_PL\0en_PN\0en_PT\0en_PW\0en_RO\0en_RW\0en_SB\0" + "en_SC\0en_SD\0en_SE\0en_SG\0en_SH\0en_SI\0en_SK\0en_SL\0en_SS\0" + "en_SX\0en_SZ\0en_Shaw\0en_TC\0en_TK\0en_TO\0en_TT\0en_TV\0en_TZ\0" + "en_UA\0en_UG\0en_VC\0en_VG\0en_VU\0en_WS\0en_ZA\0en_ZM\0en_ZW\0" + "es_419\0es_AR\0es_BO\0es_BR\0es_BZ\0es_CL\0es_CO\0es_CR\0es_CU\0" + "es_DO\0es_EC\0es_GT\0es_HN\0es_JP\0es_MX\0es_NI\0es_PA\0es_PE\0" + "es_PR\0es_PY\0es_SV\0es_US\0es_UY\0es_VE\0ff_Adlm\0ff_Arab\0fr_HT\0" + "ha_Arab\0hi_Latn\0ht\0iu_Latn\0kaa_Latn\0kk_Arab\0kok_Latn\0ks_Deva\0" + "ku_Arab\0kxv_Deva\0kxv_Orya\0kxv_Telu\0ky_Arab\0ky_Latn\0ml_Arab\0" + "mn_Mong\0mni_Mtei\0ms_Arab\0nb\0nn\0no\0no_NO\0pa_Arab\0pt_AO\0" + "pt_CH\0pt_CV\0pt_FR\0pt_GQ\0pt_GW\0pt_LU\0pt_MO\0pt_MZ\0pt_PT\0" + "pt_ST\0pt_TL\0root\0sat_Deva\0sd_Deva\0sd_Khoj\0sd_Sind\0shi_Latn\0" + "so_Arab\0sr_Latn\0suz_Sunu\0sw_Arab\0tg_Arab\0ug_Cyrl\0uz_Arab\0" + "uz_Cyrl\0vai_Latn\0wo_Arab\0yo_Arab\0yue_Hans\0zh_Hant\0zh_Hant_HK\0" + "zh_Hant_MO\0"; const int32_t parentLocaleTable[] = { - 0, 1146, // az_Arab -> root - 8, 1146, // az_Cyrl -> root - 16, 1146, // bal_Latn -> root - 25, 1146, // blt_Latn -> root - 34, 1146, // bm_Nkoo -> root - 42, 1146, // bs_Cyrl -> root - 50, 1146, // byn_Latn -> root - 59, 1146, // cu_Glag -> root - 67, 1146, // dje_Arab -> root - 76, 1146, // dyo_Arab -> root + 0, 1176, // az_Arab -> root + 8, 1176, // az_Cyrl -> root + 16, 1176, // bal_Latn -> root + 25, 1176, // blt_Latn -> root + 34, 1176, // bm_Nkoo -> root + 42, 1176, // bs_Cyrl -> root + 50, 1176, // byn_Latn -> root + 59, 1176, // cu_Glag -> root + 67, 1176, // dje_Arab -> root + 76, 1176, // dyo_Arab -> root 92, 85, // en_150 -> en_001 99, 85, // en_AG -> en_001 105, 85, // en_AI -> en_001 @@ -1217,167 +1240,173 @@ const int32_t parentLocaleTable[] = { 207, 85, // en_DG -> en_001 213, 92, // en_DK -> en_150 219, 85, // en_DM -> en_001 - 225, 1146, // en_Dsrt -> root - 233, 85, // en_ER -> en_001 - 239, 92, // en_ES -> en_150 - 245, 92, // en_FI -> en_150 - 251, 85, // en_FJ -> en_001 - 257, 85, // en_FK -> en_001 - 263, 85, // en_FM -> en_001 - 269, 92, // en_FR -> en_150 - 275, 85, // en_GB -> en_001 - 281, 85, // en_GD -> en_001 - 287, 85, // en_GG -> en_001 - 293, 85, // en_GH -> en_001 - 299, 85, // en_GI -> en_001 - 305, 85, // en_GM -> en_001 - 311, 85, // en_GS -> en_001 - 317, 85, // en_GY -> en_001 - 323, 85, // en_HK -> en_001 - 329, 92, // en_HU -> en_150 - 335, 85, // en_ID -> en_001 - 341, 85, // en_IE -> en_001 - 347, 85, // en_IL -> en_001 - 353, 85, // en_IM -> en_001 - 359, 85, // en_IN -> en_001 - 365, 85, // en_IO -> en_001 - 371, 92, // en_IT -> en_150 - 377, 85, // en_JE -> en_001 - 383, 85, // en_JM -> en_001 - 389, 85, // en_KE -> en_001 - 395, 85, // en_KI -> en_001 - 401, 85, // en_KN -> en_001 - 407, 85, // en_KY -> en_001 - 413, 85, // en_LC -> en_001 - 419, 85, // en_LR -> en_001 - 425, 85, // en_LS -> en_001 - 431, 85, // en_MG -> en_001 - 437, 85, // en_MO -> en_001 - 443, 85, // en_MS -> en_001 - 449, 85, // en_MT -> en_001 - 455, 85, // en_MU -> en_001 - 461, 85, // en_MV -> en_001 - 467, 85, // en_MW -> en_001 - 473, 85, // en_MY -> en_001 - 479, 85, // en_NA -> en_001 - 485, 85, // en_NF -> en_001 - 491, 85, // en_NG -> en_001 - 497, 92, // en_NL -> en_150 - 503, 92, // en_NO -> en_150 - 509, 85, // en_NR -> en_001 - 515, 85, // en_NU -> en_001 - 521, 85, // en_NZ -> en_001 - 527, 85, // en_PG -> en_001 - 533, 85, // en_PK -> en_001 - 539, 92, // en_PL -> en_150 - 545, 85, // en_PN -> en_001 - 551, 92, // en_PT -> en_150 - 557, 85, // en_PW -> en_001 - 563, 92, // en_RO -> en_150 - 569, 85, // en_RW -> en_001 - 575, 85, // en_SB -> en_001 - 581, 85, // en_SC -> en_001 - 587, 85, // en_SD -> en_001 - 593, 92, // en_SE -> en_150 - 599, 85, // en_SG -> en_001 - 605, 85, // en_SH -> en_001 - 611, 92, // en_SI -> en_150 - 617, 92, // en_SK -> en_150 - 623, 85, // en_SL -> en_001 - 629, 85, // en_SS -> en_001 - 635, 85, // en_SX -> en_001 - 641, 85, // en_SZ -> en_001 - 647, 1146, // en_Shaw -> root - 655, 85, // en_TC -> en_001 - 661, 85, // en_TK -> en_001 - 667, 85, // en_TO -> en_001 - 673, 85, // en_TT -> en_001 - 679, 85, // en_TV -> en_001 - 685, 85, // en_TZ -> en_001 - 691, 85, // en_UG -> en_001 - 697, 85, // en_VC -> en_001 - 703, 85, // en_VG -> en_001 - 709, 85, // en_VU -> en_001 - 715, 85, // en_WS -> en_001 - 721, 85, // en_ZA -> en_001 - 727, 85, // en_ZM -> en_001 - 733, 85, // en_ZW -> en_001 - 746, 739, // es_AR -> es_419 - 752, 739, // es_BO -> es_419 - 758, 739, // es_BR -> es_419 - 764, 739, // es_BZ -> es_419 - 770, 739, // es_CL -> es_419 - 776, 739, // es_CO -> es_419 - 782, 739, // es_CR -> es_419 - 788, 739, // es_CU -> es_419 - 794, 739, // es_DO -> es_419 - 800, 739, // es_EC -> es_419 - 806, 739, // es_GT -> es_419 - 812, 739, // es_HN -> es_419 - 818, 739, // es_JP -> es_419 - 824, 739, // es_MX -> es_419 - 830, 739, // es_NI -> es_419 - 836, 739, // es_PA -> es_419 - 842, 739, // es_PE -> es_419 - 848, 739, // es_PR -> es_419 - 854, 739, // es_PY -> es_419 - 860, 739, // es_SV -> es_419 - 866, 739, // es_US -> es_419 - 872, 739, // es_UY -> es_419 - 878, 739, // es_VE -> es_419 - 884, 1146, // ff_Adlm -> root - 892, 1146, // ff_Arab -> root - 906, 1146, // ha_Arab -> root - 914, 359, // hi_Latn -> en_IN - 922, 900, // ht -> fr_HT - 925, 1146, // iu_Latn -> root - 933, 1146, // kaa_Latn -> root - 942, 1146, // kk_Arab -> root - 950, 1146, // kok_Latn -> root - 959, 1146, // ks_Deva -> root - 967, 1146, // ku_Arab -> root - 975, 1146, // kxv_Deva -> root - 984, 1146, // kxv_Orya -> root - 993, 1146, // kxv_Telu -> root - 1002, 1146, // ky_Arab -> root - 1010, 1146, // ky_Latn -> root - 1018, 1146, // ml_Arab -> root - 1026, 1146, // mn_Mong -> root - 1034, 1146, // mni_Mtei -> root - 1043, 1146, // ms_Arab -> root - 1051, 1057, // nb -> no - 1054, 1057, // nn -> no - 1060, 1057, // no_NO -> no - 1066, 1146, // pa_Arab -> root - 1074, 1128, // pt_AO -> pt_PT - 1080, 1128, // pt_CH -> pt_PT - 1086, 1128, // pt_CV -> pt_PT - 1092, 1128, // pt_FR -> pt_PT - 1098, 1128, // pt_GQ -> pt_PT - 1104, 1128, // pt_GW -> pt_PT - 1110, 1128, // pt_LU -> pt_PT - 1116, 1128, // pt_MO -> pt_PT - 1122, 1128, // pt_MZ -> pt_PT - 1134, 1128, // pt_ST -> pt_PT - 1140, 1128, // pt_TL -> pt_PT - 1151, 1146, // sat_Deva -> root - 1160, 1146, // sd_Deva -> root - 1168, 1146, // sd_Khoj -> root - 1176, 1146, // sd_Sind -> root - 1184, 1146, // shi_Latn -> root - 1193, 1146, // so_Arab -> root - 1201, 1146, // sr_Latn -> root - 1209, 1146, // sw_Arab -> root - 1217, 1146, // tg_Arab -> root - 1225, 1146, // ug_Cyrl -> root - 1233, 1146, // uz_Arab -> root - 1241, 1146, // uz_Cyrl -> root - 1249, 1146, // vai_Latn -> root - 1258, 1146, // wo_Arab -> root - 1266, 1146, // yo_Arab -> root - 1274, 1146, // yue_Hans -> root - 1283, 1146, // zh_Hant -> root - 1302, 1291, // zh_Hant_MO -> zh_Hant_HK + 225, 1176, // en_Dsrt -> root + 233, 92, // en_EE -> en_150 + 239, 85, // en_ER -> en_001 + 245, 92, // en_ES -> en_150 + 251, 92, // en_FI -> en_150 + 257, 85, // en_FJ -> en_001 + 263, 85, // en_FK -> en_001 + 269, 85, // en_FM -> en_001 + 275, 92, // en_FR -> en_150 + 281, 85, // en_GB -> en_001 + 287, 85, // en_GD -> en_001 + 293, 92, // en_GE -> en_150 + 299, 85, // en_GG -> en_001 + 305, 85, // en_GH -> en_001 + 311, 85, // en_GI -> en_001 + 317, 85, // en_GM -> en_001 + 323, 85, // en_GS -> en_001 + 329, 85, // en_GY -> en_001 + 335, 85, // en_HK -> en_001 + 341, 92, // en_HU -> en_150 + 347, 85, // en_ID -> en_001 + 353, 85, // en_IE -> en_001 + 359, 85, // en_IL -> en_001 + 365, 85, // en_IM -> en_001 + 371, 85, // en_IN -> en_001 + 377, 85, // en_IO -> en_001 + 383, 92, // en_IT -> en_150 + 389, 85, // en_JE -> en_001 + 395, 85, // en_JM -> en_001 + 401, 85, // en_KE -> en_001 + 407, 85, // en_KI -> en_001 + 413, 85, // en_KN -> en_001 + 419, 85, // en_KY -> en_001 + 425, 85, // en_LC -> en_001 + 431, 85, // en_LR -> en_001 + 437, 85, // en_LS -> en_001 + 443, 92, // en_LT -> en_150 + 449, 92, // en_LV -> en_150 + 455, 85, // en_MG -> en_001 + 461, 85, // en_MO -> en_001 + 467, 85, // en_MS -> en_001 + 473, 85, // en_MT -> en_001 + 479, 85, // en_MU -> en_001 + 485, 85, // en_MV -> en_001 + 491, 85, // en_MW -> en_001 + 497, 85, // en_MY -> en_001 + 503, 85, // en_NA -> en_001 + 509, 85, // en_NF -> en_001 + 515, 85, // en_NG -> en_001 + 521, 92, // en_NL -> en_150 + 527, 92, // en_NO -> en_150 + 533, 85, // en_NR -> en_001 + 539, 85, // en_NU -> en_001 + 545, 85, // en_NZ -> en_001 + 551, 85, // en_PG -> en_001 + 557, 85, // en_PK -> en_001 + 563, 92, // en_PL -> en_150 + 569, 85, // en_PN -> en_001 + 575, 92, // en_PT -> en_150 + 581, 85, // en_PW -> en_001 + 587, 92, // en_RO -> en_150 + 593, 85, // en_RW -> en_001 + 599, 85, // en_SB -> en_001 + 605, 85, // en_SC -> en_001 + 611, 85, // en_SD -> en_001 + 617, 92, // en_SE -> en_150 + 623, 85, // en_SG -> en_001 + 629, 85, // en_SH -> en_001 + 635, 92, // en_SI -> en_150 + 641, 92, // en_SK -> en_150 + 647, 85, // en_SL -> en_001 + 653, 85, // en_SS -> en_001 + 659, 85, // en_SX -> en_001 + 665, 85, // en_SZ -> en_001 + 671, 1176, // en_Shaw -> root + 679, 85, // en_TC -> en_001 + 685, 85, // en_TK -> en_001 + 691, 85, // en_TO -> en_001 + 697, 85, // en_TT -> en_001 + 703, 85, // en_TV -> en_001 + 709, 85, // en_TZ -> en_001 + 715, 92, // en_UA -> en_150 + 721, 85, // en_UG -> en_001 + 727, 85, // en_VC -> en_001 + 733, 85, // en_VG -> en_001 + 739, 85, // en_VU -> en_001 + 745, 85, // en_WS -> en_001 + 751, 85, // en_ZA -> en_001 + 757, 85, // en_ZM -> en_001 + 763, 85, // en_ZW -> en_001 + 776, 769, // es_AR -> es_419 + 782, 769, // es_BO -> es_419 + 788, 769, // es_BR -> es_419 + 794, 769, // es_BZ -> es_419 + 800, 769, // es_CL -> es_419 + 806, 769, // es_CO -> es_419 + 812, 769, // es_CR -> es_419 + 818, 769, // es_CU -> es_419 + 824, 769, // es_DO -> es_419 + 830, 769, // es_EC -> es_419 + 836, 769, // es_GT -> es_419 + 842, 769, // es_HN -> es_419 + 848, 769, // es_JP -> es_419 + 854, 769, // es_MX -> es_419 + 860, 769, // es_NI -> es_419 + 866, 769, // es_PA -> es_419 + 872, 769, // es_PE -> es_419 + 878, 769, // es_PR -> es_419 + 884, 769, // es_PY -> es_419 + 890, 769, // es_SV -> es_419 + 896, 769, // es_US -> es_419 + 902, 769, // es_UY -> es_419 + 908, 769, // es_VE -> es_419 + 914, 1176, // ff_Adlm -> root + 922, 1176, // ff_Arab -> root + 936, 1176, // ha_Arab -> root + 944, 371, // hi_Latn -> en_IN + 952, 930, // ht -> fr_HT + 955, 1176, // iu_Latn -> root + 963, 1176, // kaa_Latn -> root + 972, 1176, // kk_Arab -> root + 980, 1176, // kok_Latn -> root + 989, 1176, // ks_Deva -> root + 997, 1176, // ku_Arab -> root + 1005, 1176, // kxv_Deva -> root + 1014, 1176, // kxv_Orya -> root + 1023, 1176, // kxv_Telu -> root + 1032, 1176, // ky_Arab -> root + 1040, 1176, // ky_Latn -> root + 1048, 1176, // ml_Arab -> root + 1056, 1176, // mn_Mong -> root + 1064, 1176, // mni_Mtei -> root + 1073, 1176, // ms_Arab -> root + 1081, 1087, // nb -> no + 1084, 1087, // nn -> no + 1090, 1087, // no_NO -> no + 1096, 1176, // pa_Arab -> root + 1104, 1158, // pt_AO -> pt_PT + 1110, 1158, // pt_CH -> pt_PT + 1116, 1158, // pt_CV -> pt_PT + 1122, 1158, // pt_FR -> pt_PT + 1128, 1158, // pt_GQ -> pt_PT + 1134, 1158, // pt_GW -> pt_PT + 1140, 1158, // pt_LU -> pt_PT + 1146, 1158, // pt_MO -> pt_PT + 1152, 1158, // pt_MZ -> pt_PT + 1164, 1158, // pt_ST -> pt_PT + 1170, 1158, // pt_TL -> pt_PT + 1181, 1176, // sat_Deva -> root + 1190, 1176, // sd_Deva -> root + 1198, 1176, // sd_Khoj -> root + 1206, 1176, // sd_Sind -> root + 1214, 1176, // shi_Latn -> root + 1223, 1176, // so_Arab -> root + 1231, 1176, // sr_Latn -> root + 1239, 1176, // suz_Sunu -> root + 1248, 1176, // sw_Arab -> root + 1256, 1176, // tg_Arab -> root + 1264, 1176, // ug_Cyrl -> root + 1272, 1176, // uz_Arab -> root + 1280, 1176, // uz_Cyrl -> root + 1288, 1176, // vai_Latn -> root + 1297, 1176, // wo_Arab -> root + 1305, 1176, // yo_Arab -> root + 1313, 1176, // yue_Hans -> root + 1322, 1176, // zh_Hant -> root + 1341, 1330, // zh_Hant_MO -> zh_Hant_HK }; diff --git a/deps/icu-small/source/common/locbased.cpp b/deps/icu-small/source/common/locbased.cpp index 6f35e72210fef6..b661cc46278591 100644 --- a/deps/icu-small/source/common/locbased.cpp +++ b/deps/icu-small/source/common/locbased.cpp @@ -11,85 +11,36 @@ ********************************************************************** */ #include "locbased.h" -#include "cstring.h" -#include "charstr.h" +#include "uresimp.h" U_NAMESPACE_BEGIN -Locale LocaleBased::getLocale(const CharString* valid, const CharString* actual, - ULocDataLocaleType type, UErrorCode& status) { - const char* id = getLocaleID(valid, actual, type, status); - return Locale(id != nullptr ? id : ""); -} - -const char* LocaleBased::getLocaleID(const CharString* valid, const CharString* actual, +const Locale& LocaleBased::getLocale(const Locale& valid, const Locale& actual, ULocDataLocaleType type, UErrorCode& status) { if (U_FAILURE(status)) { - return nullptr; + return Locale::getRoot(); } switch(type) { case ULOC_VALID_LOCALE: - return valid == nullptr ? "" : valid->data(); + return valid; case ULOC_ACTUAL_LOCALE: - return actual == nullptr ? "" : actual->data(); + return actual; default: status = U_ILLEGAL_ARGUMENT_ERROR; - return nullptr; + return Locale::getRoot(); } } -void LocaleBased::setLocaleIDs(const CharString* validID, const CharString* actualID, UErrorCode& status) { - setValidLocaleID(validID, status); - setActualLocaleID(actualID,status); -} -void LocaleBased::setLocaleIDs(const char* validID, const char* actualID, UErrorCode& status) { - setValidLocaleID(validID, status); - setActualLocaleID(actualID,status); -} - -void LocaleBased::setLocaleID(const char* id, CharString*& dest, UErrorCode& status) { - if (U_FAILURE(status)) { return; } - if (id == nullptr || *id == 0) { - delete dest; - dest = nullptr; - } else { - if (dest == nullptr) { - dest = new CharString(id, status); - if (dest == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - } else { - dest->copyFrom(id, status); - } - } -} +const char* LocaleBased::getLocaleID(const Locale& valid, const Locale& actual, + ULocDataLocaleType type, UErrorCode& status) { + const Locale& locale = getLocale(valid, actual, type, status); -void LocaleBased::setLocaleID(const CharString* id, CharString*& dest, UErrorCode& status) { - if (U_FAILURE(status)) { return; } - if (id == nullptr || id->isEmpty()) { - delete dest; - dest = nullptr; - } else { - if (dest == nullptr) { - dest = new CharString(*id, status); - if (dest == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - } else { - dest->copyFrom(*id, status); - } + if (U_FAILURE(status)) { + return nullptr; } -} -bool LocaleBased::equalIDs(const CharString* left, const CharString* right) { - // true if both are nullptr - if (left == nullptr && right == nullptr) return true; - // false if only one is nullptr - if (left == nullptr || right == nullptr) return false; - return *left == *right; + return locale == Locale::getRoot() ? kRootLocaleName : locale.getName(); } U_NAMESPACE_END diff --git a/deps/icu-small/source/common/locbased.h b/deps/icu-small/source/common/locbased.h index 9441eb823107e3..dbff148bcd08cb 100644 --- a/deps/icu-small/source/common/locbased.h +++ b/deps/icu-small/source/common/locbased.h @@ -16,17 +16,8 @@ #include "unicode/locid.h" #include "unicode/uobject.h" -/** - * Macro to declare a locale LocaleBased wrapper object for the given - * object, which must have two members named `validLocale' and - * `actualLocale' of which are pointers to the internal icu::CharString. - */ -#define U_LOCALE_BASED(varname, objname) \ - LocaleBased varname((objname).validLocale, (objname).actualLocale) - U_NAMESPACE_BEGIN -class CharString; /** * A utility class that unifies the implementation of getLocale() by * various ICU services. This class is likely to be removed in the @@ -38,12 +29,6 @@ class U_COMMON_API LocaleBased : public UMemory { public: - /** - * Construct a LocaleBased wrapper around the two pointers. These - * will be aliased for the lifetime of this object. - */ - inline LocaleBased(CharString*& validAlias, CharString*& actualAlias); - /** * Return locale meta-data for the service object wrapped by this * object. Either the valid or the actual locale may be @@ -54,8 +39,8 @@ class U_COMMON_API LocaleBased : public UMemory { * @param status input-output error code * @return the indicated locale */ - static Locale getLocale( - const CharString* valid, const CharString* actual, + static const Locale& getLocale( + const Locale& valid, const Locale& actual, ULocDataLocaleType type, UErrorCode& status); /** @@ -69,51 +54,11 @@ class U_COMMON_API LocaleBased : public UMemory { * @return the indicated locale ID */ static const char* getLocaleID( - const CharString* valid, const CharString* actual, + const Locale& valid, const Locale& actual, ULocDataLocaleType type, UErrorCode& status); - /** - * Set the locale meta-data for the service object wrapped by this - * object. If either parameter is zero, it is ignored. - * @param valid the ID of the valid locale - * @param actual the ID of the actual locale - */ - void setLocaleIDs(const char* valid, const char* actual, UErrorCode& status); - void setLocaleIDs(const CharString* valid, const CharString* actual, UErrorCode& status); - - static void setLocaleID(const char* id, CharString*& dest, UErrorCode& status); - static void setLocaleID(const CharString* id, CharString*& dest, UErrorCode& status); - - static bool equalIDs(const CharString* left, const CharString* right); - - private: - - void setValidLocaleID(const CharString* id, UErrorCode& status); - void setActualLocaleID(const CharString* id, UErrorCode& status); - void setValidLocaleID(const char* id, UErrorCode& status); - void setActualLocaleID(const char* id, UErrorCode& status); - - CharString*& valid; - CharString*& actual; }; -inline LocaleBased::LocaleBased(CharString*& validAlias, CharString*& actualAlias) : - valid(validAlias), actual(actualAlias) { -} - -inline void LocaleBased::setValidLocaleID(const CharString* id, UErrorCode& status) { - setLocaleID(id, valid, status); -} -inline void LocaleBased::setActualLocaleID(const CharString* id, UErrorCode& status) { - setLocaleID(id, actual, status); -} -inline void LocaleBased::setValidLocaleID(const char* id, UErrorCode& status) { - setLocaleID(id, valid, status); -} -inline void LocaleBased::setActualLocaleID(const char* id, UErrorCode& status) { - setLocaleID(id, actual, status); -} - U_NAMESPACE_END #endif diff --git a/deps/icu-small/source/common/locdispnames.cpp b/deps/icu-small/source/common/locdispnames.cpp index d3521e879b60c8..3051798b78bc09 100644 --- a/deps/icu-small/source/common/locdispnames.cpp +++ b/deps/icu-small/source/common/locdispnames.cpp @@ -66,7 +66,7 @@ Locale::getDisplayLanguage(const Locale &displayLocale, return result; } - length=uloc_getDisplayLanguage(fullName, displayLocale.fullName, + length=uloc_getDisplayLanguage(getName(), displayLocale.getName(), buffer, result.getCapacity(), &errorCode); result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0); @@ -78,7 +78,7 @@ Locale::getDisplayLanguage(const Locale &displayLocale, return result; } errorCode=U_ZERO_ERROR; - length=uloc_getDisplayLanguage(fullName, displayLocale.fullName, + length=uloc_getDisplayLanguage(getName(), displayLocale.getName(), buffer, result.getCapacity(), &errorCode); result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0); @@ -106,7 +106,7 @@ Locale::getDisplayScript(const Locale &displayLocale, return result; } - length=uloc_getDisplayScript(fullName, displayLocale.fullName, + length=uloc_getDisplayScript(getName(), displayLocale.getName(), buffer, result.getCapacity(), &errorCode); result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0); @@ -118,7 +118,7 @@ Locale::getDisplayScript(const Locale &displayLocale, return result; } errorCode=U_ZERO_ERROR; - length=uloc_getDisplayScript(fullName, displayLocale.fullName, + length=uloc_getDisplayScript(getName(), displayLocale.getName(), buffer, result.getCapacity(), &errorCode); result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0); @@ -146,7 +146,7 @@ Locale::getDisplayCountry(const Locale &displayLocale, return result; } - length=uloc_getDisplayCountry(fullName, displayLocale.fullName, + length=uloc_getDisplayCountry(getName(), displayLocale.getName(), buffer, result.getCapacity(), &errorCode); result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0); @@ -158,7 +158,7 @@ Locale::getDisplayCountry(const Locale &displayLocale, return result; } errorCode=U_ZERO_ERROR; - length=uloc_getDisplayCountry(fullName, displayLocale.fullName, + length=uloc_getDisplayCountry(getName(), displayLocale.getName(), buffer, result.getCapacity(), &errorCode); result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0); @@ -186,7 +186,7 @@ Locale::getDisplayVariant(const Locale &displayLocale, return result; } - length=uloc_getDisplayVariant(fullName, displayLocale.fullName, + length=uloc_getDisplayVariant(getName(), displayLocale.getName(), buffer, result.getCapacity(), &errorCode); result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0); @@ -198,7 +198,7 @@ Locale::getDisplayVariant(const Locale &displayLocale, return result; } errorCode=U_ZERO_ERROR; - length=uloc_getDisplayVariant(fullName, displayLocale.fullName, + length=uloc_getDisplayVariant(getName(), displayLocale.getName(), buffer, result.getCapacity(), &errorCode); result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0); @@ -226,7 +226,7 @@ Locale::getDisplayName(const Locale &displayLocale, return result; } - length=uloc_getDisplayName(fullName, displayLocale.fullName, + length=uloc_getDisplayName(getName(), displayLocale.getName(), buffer, result.getCapacity(), &errorCode); result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0); @@ -238,7 +238,7 @@ Locale::getDisplayName(const Locale &displayLocale, return result; } errorCode=U_ZERO_ERROR; - length=uloc_getDisplayName(fullName, displayLocale.fullName, + length=uloc_getDisplayName(getName(), displayLocale.getName(), buffer, result.getCapacity(), &errorCode); result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0); diff --git a/deps/icu-small/source/common/locid.cpp b/deps/icu-small/source/common/locid.cpp index e7e86079ae9169..34f1266f60694c 100644 --- a/deps/icu-small/source/common/locid.cpp +++ b/deps/icu-small/source/common/locid.cpp @@ -31,13 +31,16 @@ ****************************************************************************** */ +#include #include #include +#include #include #include "unicode/bytestream.h" #include "unicode/locid.h" #include "unicode/localebuilder.h" +#include "unicode/localpointer.h" #include "unicode/strenum.h" #include "unicode/stringpiece.h" #include "unicode/uloc.h" @@ -48,6 +51,7 @@ #include "charstrmap.h" #include "cmemory.h" #include "cstring.h" +#include "fixedstring.h" #include "mutex.h" #include "putilimp.h" #include "uassert.h" @@ -232,9 +236,214 @@ locale_get_default() return Locale::getDefault().getName(); } +namespace { + +template +void copyToArray(std::string_view sv, T* that) { + auto& field = that->*FIELD; + constexpr size_t capacity = std::extent_v>; + static_assert(capacity > 0); + if (!sv.empty()) { + U_ASSERT(sv.size() < capacity); + uprv_memcpy(field, sv.data(), sv.size()); + } + field[sv.size()] = '\0'; +} + +} // namespace U_NAMESPACE_BEGIN +void Locale::Nest::init(std::string_view language, + std::string_view script, + std::string_view region, + uint8_t variantBegin) { + copyToArray<&Nest::language>(language, this); + copyToArray<&Nest::script>(script, this); + copyToArray<&Nest::region>(region, this); + this->variantBegin = variantBegin; +} + +Locale::Nest::Nest(Heap&& heap, uint8_t variantBegin) { + // When moving from Heap to Nest the language field can be left untouched + // (as it has the same offset in both) and only the script and region fields + // need to be copied to their new locations, which is safe to do because the + // new locations come before the old locations in memory and don't overlap. + static_assert(offsetof(Nest, region) <= offsetof(Heap, script)); + static_assert(offsetof(Nest, variantBegin) <= offsetof(Heap, region)); + U_ASSERT(this == reinterpret_cast(&heap)); + copyToArray<&Nest::script>(heap.script, this); + copyToArray<&Nest::region>(heap.region, this); + this->variantBegin = variantBegin; + *this->baseName = '\0'; +} + +struct Locale::Heap::Alloc : public UMemory { + FixedString fullName; + FixedString baseName; + int32_t variantBegin; + + const char* getVariant() const { return variantBegin == 0 ? "" : getBaseName() + variantBegin; } + const char* getFullName() const { return fullName.data(); } + const char* getBaseName() const { + if (baseName.isEmpty()) { + if (const char* name = fullName.data(); *name != '@') { + return name; + } + } + return baseName.data(); + } + + Alloc(int32_t variantBegin) : fullName(), baseName(), variantBegin(variantBegin) {} + + Alloc(const Alloc& other, UErrorCode& status) + : fullName(), baseName(), variantBegin(other.variantBegin) { + if (U_SUCCESS(status)) { + if (!other.fullName.isEmpty()) { + fullName = other.fullName; + if (fullName.isEmpty()) { + status = U_MEMORY_ALLOCATION_ERROR; + } else { + if (!other.baseName.isEmpty()) { + baseName = other.baseName; + if (baseName.isEmpty()) { + status = U_MEMORY_ALLOCATION_ERROR; + } + } + } + } + } + } + + // Move should be done on the owner of the pointer to this object. + Alloc(Alloc&&) noexcept = delete; + + ~Alloc() = default; +}; + +const char* Locale::Heap::getVariant() const { return ptr->getVariant(); } +const char* Locale::Heap::getFullName() const { return ptr->getFullName(); } +const char* Locale::Heap::getBaseName() const { return ptr->getBaseName(); } + +Locale::Heap::Heap(std::string_view language, + std::string_view script, + std::string_view region, + int32_t variantBegin) { + ptr = new Alloc(variantBegin); + if (ptr == nullptr) { + type = eBOGUS; + } else { + type = eHEAP; + copyToArray<&Heap::language>(language, this); + copyToArray<&Heap::script>(script, this); + copyToArray<&Heap::region>(region, this); + } +} + +Locale::Heap::~Heap() { + U_ASSERT(type == eHEAP); + delete ptr; +} + +Locale::Heap& Locale::Heap::operator=(const Heap& other) { + U_ASSERT(type == eBOGUS); + UErrorCode status = U_ZERO_ERROR; + ptr = new Alloc(*other.ptr, status); + if (ptr == nullptr || U_FAILURE(status)) { + delete ptr; + } else { + type = eHEAP; + uprv_memcpy(language, other.language, sizeof language); + uprv_memcpy(script, other.script, sizeof script); + uprv_memcpy(region, other.region, sizeof region); + } + return *this; +} + +Locale::Heap& Locale::Heap::operator=(Heap&& other) noexcept { + U_ASSERT(type == eBOGUS); + ptr = other.ptr; + type = eHEAP; + other.type = eBOGUS; + uprv_memcpy(language, other.language, sizeof language); + uprv_memcpy(script, other.script, sizeof script); + uprv_memcpy(region, other.region, sizeof region); + return *this; +} + +template +auto Locale::Payload::visit(BogusFn bogusFn, NestFn nestFn, HeapFn heapFn, Args... args) const { + switch (type) { + case eBOGUS: + return bogusFn(args...); + case eNEST: + return nestFn(nest, args...); + case eHEAP: + return heapFn(heap, args...); + default: + UPRV_UNREACHABLE_EXIT; + }; +} + +void Locale::Payload::copy(const Payload& other) { + other.visit([](Payload*) {}, + [](const Nest& nest, Payload* dst) { dst->nest = nest; }, + [](const Heap& heap, Payload* dst) { dst->heap = heap; }, + this); +} + +void Locale::Payload::move(Payload&& other) noexcept { + other.visit( + [](Payload*) {}, + [](const Nest& nest, Payload* dst) { dst->nest = nest; }, + [](const Heap& heap, Payload* dst) { dst->heap = std::move(const_cast(heap)); }, + this); +} + +Locale::Payload::~Payload() { + if (type == eHEAP) { heap.~Heap(); } +} + +Locale::Payload::Payload(const Payload& other) : type{eBOGUS} { copy(other); } +Locale::Payload::Payload(Payload&& other) noexcept : type{eBOGUS} { move(std::move(other)); } + +Locale::Payload& Locale::Payload::operator=(const Payload& other) { + if (this != &other) { + setToBogus(); + copy(other); + } + return *this; +} + +Locale::Payload& Locale::Payload::operator=(Payload&& other) noexcept { + if (this != &other) { + setToBogus(); + move(std::move(other)); + } + return *this; +} + +void Locale::Payload::setToBogus() { + this->~Payload(); + type = eBOGUS; +} + +template T& Locale::Payload::emplace(Args&&... args) { + if constexpr (std::is_same_v) { + this->~Payload(); + ::new (&nest) Nest(std::forward(args)...); + return nest; + } + if constexpr (std::is_same_v) { + U_ASSERT(type != eHEAP); + ::new (&heap) Heap(std::forward(args)...); + return heap; + } +} + +template <> Locale::Nest* Locale::Payload::get() { return type == eNEST ? &nest : nullptr; } +template <> Locale::Heap* Locale::Payload::get() { return type == eHEAP ? &heap : nullptr; } + UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Locale) /*Character separating the posix id fields*/ @@ -243,22 +452,10 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Locale) #define SEP_CHAR '_' #define NULL_CHAR '\0' -Locale::~Locale() -{ - if ((baseName != fullName) && (baseName != fullNameBuffer)) { - uprv_free(baseName); - } - baseName = nullptr; - /*if fullName is on the heap, we free it*/ - if (fullName != fullNameBuffer) - { - uprv_free(fullName); - fullName = nullptr; - } -} +Locale::~Locale() = default; Locale::Locale() - : UObject(), fullName(fullNameBuffer), baseName(nullptr) + : UObject(), payload() { init(nullptr, false); } @@ -269,9 +466,8 @@ Locale::Locale() * the default locale.) */ Locale::Locale(Locale::ELocaleType) - : UObject(), fullName(fullNameBuffer), baseName(nullptr) + : UObject(), payload() { - setToBogus(); } @@ -279,7 +475,7 @@ Locale::Locale( const char * newLanguage, const char * newCountry, const char * newVariant, const char * newKeywords) - : UObject(), fullName(fullNameBuffer), baseName(nullptr) + : UObject(), payload() { if( (newLanguage==nullptr) && (newCountry == nullptr) && (newVariant == nullptr) ) { @@ -300,7 +496,6 @@ Locale::Locale( const char * newLanguage, { lsize = static_cast(uprv_strlen(newLanguage)); if ( lsize < 0 || lsize > ULOC_STRING_LIMIT ) { // int32 wrap - setToBogus(); return; } } @@ -312,7 +507,6 @@ Locale::Locale( const char * newLanguage, { csize = static_cast(uprv_strlen(newCountry)); if ( csize < 0 || csize > ULOC_STRING_LIMIT ) { // int32 wrap - setToBogus(); return; } } @@ -329,7 +523,6 @@ Locale::Locale( const char * newLanguage, // remove trailing _'s vsize = static_cast(uprv_strlen(newVariant)); if ( vsize < 0 || vsize > ULOC_STRING_LIMIT ) { // int32 wrap - setToBogus(); return; } while( (vsize>1) && (newVariant[vsize-1] == SEP_CHAR) ) @@ -342,7 +535,6 @@ Locale::Locale( const char * newLanguage, { ksize = static_cast(uprv_strlen(newKeywords)); if ( ksize < 0 || ksize > ULOC_STRING_LIMIT ) { - setToBogus(); return; } } @@ -383,7 +575,6 @@ Locale::Locale( const char * newLanguage, if (U_FAILURE(status)) { // Something went wrong with appending, etc. - setToBogus(); return; } // Parse it, because for example 'language' might really be a complete @@ -392,82 +583,11 @@ Locale::Locale( const char * newLanguage, } } -Locale::Locale(const Locale &other) - : UObject(other), fullName(fullNameBuffer), baseName(nullptr) -{ - *this = other; -} - -Locale::Locale(Locale&& other) noexcept - : UObject(other), fullName(fullNameBuffer), baseName(fullName) { - *this = std::move(other); -} - -Locale& Locale::operator=(const Locale& other) { - if (this == &other) { - return *this; - } - - setToBogus(); - - if (other.fullName == other.fullNameBuffer) { - uprv_strcpy(fullNameBuffer, other.fullNameBuffer); - } else if (other.fullName == nullptr) { - fullName = nullptr; - } else { - fullName = uprv_strdup(other.fullName); - if (fullName == nullptr) return *this; - } - - if (other.baseName == other.fullName) { - baseName = fullName; - } else if (other.baseName != nullptr) { - baseName = uprv_strdup(other.baseName); - if (baseName == nullptr) return *this; - } - - uprv_strcpy(language, other.language); - uprv_strcpy(script, other.script); - uprv_strcpy(country, other.country); - - variantBegin = other.variantBegin; - fIsBogus = other.fIsBogus; - - return *this; -} - -Locale& Locale::operator=(Locale&& other) noexcept { - if ((baseName != fullName) && (baseName != fullNameBuffer)) uprv_free(baseName); - if (fullName != fullNameBuffer) uprv_free(fullName); +Locale::Locale(const Locale&) = default; +Locale::Locale(Locale&&) noexcept = default; - if (other.fullName == other.fullNameBuffer || other.baseName == other.fullNameBuffer) { - uprv_strcpy(fullNameBuffer, other.fullNameBuffer); - } - if (other.fullName == other.fullNameBuffer) { - fullName = fullNameBuffer; - } else { - fullName = other.fullName; - } - - if (other.baseName == other.fullNameBuffer) { - baseName = fullNameBuffer; - } else if (other.baseName == other.fullName) { - baseName = fullName; - } else { - baseName = other.baseName; - } - - uprv_strcpy(language, other.language); - uprv_strcpy(script, other.script); - uprv_strcpy(country, other.country); - - variantBegin = other.variantBegin; - fIsBogus = other.fIsBogus; - - other.baseName = other.fullName = other.fullNameBuffer; - - return *this; -} +Locale& Locale::operator=(const Locale&) = default; +Locale& Locale::operator=(Locale&&) noexcept = default; Locale * Locale::clone() const { @@ -477,7 +597,7 @@ Locale::clone() const { bool Locale::operator==( const Locale& other) const { - return (uprv_strcmp(other.fullName, fullName) == 0); + return uprv_strcmp(other.getName(), getName()) == 0; } namespace { @@ -1073,7 +1193,7 @@ class AliasReplacer { } // Check the fields inside locale, if need to replace fields, - // place the the replaced locale ID in out and return true. + // place the replaced locale ID in out and return true. // Otherwise return false for no replacement or error. bool replace( const Locale& locale, CharString& out, UErrorCode& status); @@ -1836,16 +1956,8 @@ Locale& Locale::init(const char* localeID, UBool canonicalize) /*This function initializes a Locale from a C locale ID*/ Locale& Locale::init(StringPiece localeID, UBool canonicalize) { - fIsBogus = false; /* Free our current storage */ - if ((baseName != fullName) && (baseName != fullNameBuffer)) { - uprv_free(baseName); - } - baseName = nullptr; - if(fullName != fullNameBuffer) { - uprv_free(fullName); - fullName = fullNameBuffer; - } + Nest& nest = payload.emplace(); // not a loop: // just an easy way to have a common error-exit @@ -1859,9 +1971,6 @@ Locale& Locale::init(StringPiece localeID, UBool canonicalize) int32_t length; UErrorCode err; - /* preset all fields to empty */ - language[0] = script[0] = country[0] = 0; - const auto parse = [canonicalize](std::string_view localeID, char* name, int32_t nameCapacity, @@ -1879,17 +1988,17 @@ Locale& Locale::init(StringPiece localeID, UBool canonicalize) }; // "canonicalize" the locale ID to ICU/Java format + char* fullName = nest.baseName; err = U_ZERO_ERROR; - length = parse(localeID, fullName, sizeof fullNameBuffer, err); + length = parse(localeID, fullName, sizeof Nest::baseName, err); - if (err == U_BUFFER_OVERFLOW_ERROR || length >= static_cast(sizeof(fullNameBuffer))) { - U_ASSERT(baseName == nullptr); + FixedString fullNameBuffer; + if (err == U_BUFFER_OVERFLOW_ERROR || length >= static_cast(sizeof Nest::baseName)) { /*Go to heap for the fullName if necessary*/ - char* newFullName = static_cast(uprv_malloc(sizeof(char) * (length + 1))); - if (newFullName == nullptr) { + if (!fullNameBuffer.reserve(length + 1)) { break; // error: out of memory } - fullName = newFullName; + fullName = fullNameBuffer.getAlias(); err = U_ZERO_ERROR; length = parse(localeID, fullName, length + 1, err); } @@ -1898,7 +2007,10 @@ Locale& Locale::init(StringPiece localeID, UBool canonicalize) break; } - variantBegin = length; + std::string_view language; + std::string_view script; + std::string_view region; + int32_t variantBegin = length; /* after uloc_getName/canonicalize() we know that only '_' are separators */ /* But _ could also appeared in timezone such as "en@timezone=America/Los_Angeles" */ @@ -1923,8 +2035,9 @@ Locale& Locale::init(StringPiece localeID, UBool canonicalize) } else { fieldLen[fieldIdx - 1] = length - static_cast(field[fieldIdx - 1] - fullName); } + bool hasKeywords = at != nullptr && uprv_strchr(at + 1, '=') != nullptr; - if (fieldLen[0] >= static_cast(sizeof(language))) + if (fieldLen[0] >= ULOC_LANG_CAPACITY) { break; // error: the language field is too long } @@ -1932,22 +2045,19 @@ Locale& Locale::init(StringPiece localeID, UBool canonicalize) variantField = 1; /* Usually the 2nd one, except when a script or country is also used. */ if (fieldLen[0] > 0) { /* We have a language */ - uprv_memcpy(language, fullName, fieldLen[0]); - language[fieldLen[0]] = 0; + language = {fullName, static_cast(fieldLen[0])}; } if (fieldLen[1] == 4 && uprv_isASCIILetter(field[1][0]) && uprv_isASCIILetter(field[1][1]) && uprv_isASCIILetter(field[1][2]) && uprv_isASCIILetter(field[1][3])) { /* We have at least a script */ - uprv_memcpy(script, field[1], fieldLen[1]); - script[fieldLen[1]] = 0; + script = {field[1], static_cast(fieldLen[1])}; variantField++; } if (fieldLen[variantField] == 2 || fieldLen[variantField] == 3) { /* We have a country */ - uprv_memcpy(country, field[variantField], fieldLen[variantField]); - country[fieldLen[variantField]] = 0; + region = {field[variantField], static_cast(fieldLen[variantField])}; variantField++; } else if (fieldLen[variantField] == 0) { variantField++; /* script or country empty but variant in next field (i.e. en__POSIX) */ @@ -1956,16 +2066,52 @@ Locale& Locale::init(StringPiece localeID, UBool canonicalize) if (fieldLen[variantField] > 0) { /* We have a variant */ variantBegin = static_cast(field[variantField] - fullName); + } else if (hasKeywords) { + // The original computation of variantBegin leaves it equal to the length + // of fullName if there is no variant. It should instead be + // the length of the baseName. + variantBegin = static_cast(at - fullName); } - err = U_ZERO_ERROR; - initBaseName(err); - if (U_FAILURE(err)) { - break; + if (!hasKeywords && Nest::fits(length, language, script, region)) { + U_ASSERT(fullName == nest.baseName); + U_ASSERT(fullNameBuffer.isEmpty()); + nest.init(language, script, region, variantBegin); + } else { + if (fullName == nest.baseName) { + U_ASSERT(fullNameBuffer.isEmpty()); + fullNameBuffer = {fullName, static_cast(length)}; + if (fullNameBuffer.isEmpty()) { + break; // error: out of memory + } + if (!language.empty()) { + language = {fullNameBuffer.data(), language.size()}; + } + if (!script.empty()) { + script = {fullNameBuffer.data() + (script.data() - fullName), script.size()}; + } + if (!region.empty()) { + region = {fullNameBuffer.data() + (region.data() - fullName), region.size()}; + } + } + Heap& heap = payload.emplace(language, script, region, variantBegin); + if (isBogus()) { + break; // error: out of memory + } + U_ASSERT(!fullNameBuffer.isEmpty()); + heap.ptr->fullName = std::move(fullNameBuffer); + if (hasKeywords) { + if (std::string_view::size_type baseNameLength = at - fullName; baseNameLength > 0) { + heap.ptr->baseName = {heap.ptr->fullName.data(), baseNameLength}; + if (heap.ptr->baseName.isEmpty()) { + break; // error: out of memory + } + } + } } if (canonicalize) { - if (!isKnownCanonicalizedLocale(fullName, err)) { + if (!isKnownCanonicalizedLocale(getName(), err)) { CharString replaced; // Not sure it is already canonicalized if (canonicalizeLocale(*this, replaced, err)) { @@ -1989,67 +2135,16 @@ Locale& Locale::init(StringPiece localeID, UBool canonicalize) return *this; } -/* - * Set up the base name. - * If there are no key words, it's exactly the full name. - * If key words exist, it's the full name truncated at the '@' character. - * Need to set up both at init() and after setting a keyword. - */ -void -Locale::initBaseName(UErrorCode &status) { - if (U_FAILURE(status)) { - return; - } - U_ASSERT(baseName==nullptr || baseName==fullName); - const char *atPtr = uprv_strchr(fullName, '@'); - const char *eqPtr = uprv_strchr(fullName, '='); - if (atPtr && eqPtr && atPtr < eqPtr) { - // Key words exist. - int32_t baseNameLength = static_cast(atPtr - fullName); - char* newBaseName = static_cast(uprv_malloc(baseNameLength + 1)); - if (newBaseName == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - baseName = newBaseName; - uprv_strncpy(baseName, fullName, baseNameLength); - baseName[baseNameLength] = 0; - - // The original computation of variantBegin leaves it equal to the length - // of fullName if there is no variant. It should instead be - // the length of the baseName. - if (variantBegin > baseNameLength) { - variantBegin = baseNameLength; - } - } else { - baseName = fullName; - } -} - - int32_t Locale::hashCode() const { - return ustr_hashCharsN(fullName, static_cast(uprv_strlen(fullName))); + return ustr_hashCharsN(getName(), static_cast(uprv_strlen(getName()))); } void Locale::setToBogus() { /* Free our current storage */ - if((baseName != fullName) && (baseName != fullNameBuffer)) { - uprv_free(baseName); - } - baseName = nullptr; - if(fullName != fullNameBuffer) { - uprv_free(fullName); - fullName = fullNameBuffer; - } - *fullNameBuffer = 0; - *language = 0; - *script = 0; - *country = 0; - fIsBogus = true; - variantBegin = 0; + payload.setToBogus(); } const Locale& U_EXPORT2 @@ -2088,9 +2183,12 @@ Locale::addLikelySubtags(UErrorCode& status) { return; } - CharString maximizedLocaleID = ulocimp_addLikelySubtags(fullName, status); + CharString maximizedLocaleID = ulocimp_addLikelySubtags(getName(), status); if (U_FAILURE(status)) { + if (status == U_MEMORY_ALLOCATION_ERROR) { + setToBogus(); + } return; } @@ -2110,9 +2208,12 @@ Locale::minimizeSubtags(bool favorScript, UErrorCode& status) { return; } - CharString minimizedLocaleID = ulocimp_minimizeSubtags(fullName, favorScript, status); + CharString minimizedLocaleID = ulocimp_minimizeSubtags(getName(), favorScript, status); if (U_FAILURE(status)) { + if (status == U_MEMORY_ALLOCATION_ERROR) { + setToBogus(); + } return; } @@ -2131,8 +2232,11 @@ Locale::canonicalize(UErrorCode& status) { status = U_ILLEGAL_ARGUMENT_ERROR; return; } - CharString uncanonicalized(fullName, status); + CharString uncanonicalized(getName(), status); if (U_FAILURE(status)) { + if (status == U_MEMORY_ALLOCATION_ERROR) { + setToBogus(); + } return; } init(uncanonicalized.data(), /*canonicalize=*/true); @@ -2191,12 +2295,12 @@ Locale::toLanguageTag(ByteSink& sink, UErrorCode& status) const return; } - if (fIsBogus) { + if (isBogus()) { status = U_ILLEGAL_ARGUMENT_ERROR; return; } - ulocimp_toLanguageTag(fullName, sink, /*strict=*/false, status); + ulocimp_toLanguageTag(getName(), sink, /*strict=*/false, status); } Locale U_EXPORT2 @@ -2229,14 +2333,14 @@ Locale::createCanonical(const char* name) { const char * Locale::getISO3Language() const { - return uloc_getISO3Language(fullName); + return uloc_getISO3Language(getName()); } const char * Locale::getISO3Country() const { - return uloc_getISO3Country(fullName); + return uloc_getISO3Country(getName()); } /** @@ -2249,7 +2353,7 @@ Locale::getISO3Country() const uint32_t Locale::getLCID() const { - return uloc_getLCID(fullName); + return uloc_getLCID(getName()); } const char* const* U_EXPORT2 Locale::getISOCountries() @@ -2428,8 +2532,9 @@ Locale::getLocaleCache() class KeywordEnumeration : public StringEnumeration { protected: - CharString keywords; + FixedString keywords; private: + int32_t length; const char *current; static const char fgClassID; @@ -2438,13 +2543,17 @@ class KeywordEnumeration : public StringEnumeration { virtual UClassID getDynamicClassID() const override { return getStaticClassID(); } public: KeywordEnumeration(const char *keys, int32_t keywordLen, int32_t currentIndex, UErrorCode &status) - : keywords(), current(keywords.data()) { + : keywords(), length(keywordLen), current(nullptr) { if(U_SUCCESS(status) && keywordLen != 0) { if(keys == nullptr || keywordLen < 0) { status = U_ILLEGAL_ARGUMENT_ERROR; } else { - keywords.append(keys, keywordLen, status); - current = keywords.data() + currentIndex; + keywords = {keys, static_cast(length)}; + if (keywords.isEmpty()) { + status = U_MEMORY_ALLOCATION_ERROR; + } else { + current = keywords.data() + currentIndex; + } } } } @@ -2455,7 +2564,7 @@ class KeywordEnumeration : public StringEnumeration { { UErrorCode status = U_ZERO_ERROR; return new KeywordEnumeration( - keywords.data(), keywords.length(), + keywords.data(), length, static_cast(current - keywords.data()), status); } @@ -2556,8 +2665,8 @@ Locale::createKeywords(UErrorCode &status) const return result; } - const char* variantStart = uprv_strchr(fullName, '@'); - const char* assignment = uprv_strchr(fullName, '='); + const char* variantStart = uprv_strchr(getName(), '@'); + const char* assignment = uprv_strchr(getName(), '='); if(variantStart) { if(assignment > variantStart) { CharString keywords = ulocimp_getKeywords(variantStart + 1, '@', false, status); @@ -2583,8 +2692,8 @@ Locale::createUnicodeKeywords(UErrorCode &status) const return result; } - const char* variantStart = uprv_strchr(fullName, '@'); - const char* assignment = uprv_strchr(fullName, '='); + const char* variantStart = uprv_strchr(getName(), '@'); + const char* assignment = uprv_strchr(getName(), '='); if(variantStart) { if(assignment > variantStart) { CharString keywords = ulocimp_getKeywords(variantStart + 1, '@', false, status); @@ -2604,7 +2713,7 @@ Locale::createUnicodeKeywords(UErrorCode &status) const int32_t Locale::getKeywordValue(const char* keywordName, char *buffer, int32_t bufLen, UErrorCode &status) const { - return uloc_getKeywordValue(fullName, keywordName, buffer, bufLen, &status); + return uloc_getKeywordValue(getName(), keywordName, buffer, bufLen, &status); } void @@ -2613,12 +2722,12 @@ Locale::getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& sta return; } - if (fIsBogus) { + if (isBogus()) { status = U_ILLEGAL_ARGUMENT_ERROR; return; } - ulocimp_getKeywordValue(fullName, keywordName, sink, status); + ulocimp_getKeywordValue(getName(), keywordName, sink, status); } void @@ -2664,51 +2773,77 @@ Locale::setKeywordValue(StringPiece keywordName, status = U_ZERO_ERROR; } - int32_t length = static_cast(uprv_strlen(fullName)); - int32_t capacity = fullName == fullNameBuffer ? ULOC_FULLNAME_CAPACITY : length + 1; - - const char* start = locale_getKeywordsStart(fullName); - int32_t offset = start == nullptr ? length : start - fullName; - - for (;;) { - // Remove -1 from the capacity so that this function can guarantee NUL termination. - CheckedArrayByteSink sink(fullName + offset, capacity - offset - 1); - - int32_t reslen = ulocimp_setKeywordValue( - {fullName + offset, static_cast(length - offset)}, - keywordName, - keywordValue, - sink, - status); + CharString localeID(getName(), -1, status); + ulocimp_setKeywordValue(keywordName, keywordValue, localeID, status); + if (U_FAILURE(status)) { + if (status == U_MEMORY_ALLOCATION_ERROR) { + setToBogus(); + } + return; + } - if (status == U_BUFFER_OVERFLOW_ERROR) { - capacity = reslen + offset + 1; - char* newFullName = static_cast(uprv_malloc(capacity)); - if (newFullName == nullptr) { + const char* at = locale_getKeywordsStart(localeID.toStringPiece()); + bool hasKeywords = at != nullptr && uprv_strchr(at + 1, '=') != nullptr; + + Nest* nest = payload.get(); + if (!hasKeywords) { + if (nest == nullptr) { + // There are no longer any keywords left, so it might now be + // possible to move the payload from Heap to Nest. + Heap* heap = payload.get(); + U_ASSERT(heap != nullptr); + if (Nest::fits(localeID.length(), heap->language, heap->script, heap->region)) { + int32_t variantBegin = heap->ptr->variantBegin; + U_ASSERT(variantBegin >= 0); + U_ASSERT(static_cast(variantBegin) < sizeof Nest::baseName); + nest = &payload.emplace(std::move(*heap), static_cast(variantBegin)); + localeID.extract(nest->baseName, sizeof Nest::baseName, status); + } else { + heap->ptr->baseName.clear(); + heap->ptr->fullName = localeID.toStringPiece(); + if (heap->ptr->fullName.isEmpty()) { + status = U_MEMORY_ALLOCATION_ERROR; + setToBogus(); + return; + } + } + } + } else { + Heap* heap = nullptr; + if (nest != nullptr) { + // A keyword has been added, so the payload now needs to be moved + // from Nest to Heap so that it can get a baseName. + Nest copy(*nest); + heap = &payload.emplace(copy.language, + copy.script, + copy.region, + copy.variantBegin); + if (isBogus()) { status = U_MEMORY_ALLOCATION_ERROR; return; } - uprv_memcpy(newFullName, fullName, length + 1); - if (fullName != fullNameBuffer) { - if (baseName == fullName) { - baseName = newFullName; // baseName should not point to freed memory. + } else { + heap = payload.get(); + } + U_ASSERT(heap != nullptr); + heap->ptr->fullName = localeID.toStringPiece(); + if (heap->ptr->fullName.isEmpty()) { + status = U_MEMORY_ALLOCATION_ERROR; + setToBogus(); + return; + } + + if (heap->ptr->baseName.isEmpty()) { + // Has added the first keyword, meaning that the fullName is no longer also the baseName. + if (std::string_view::size_type baseNameLength = at - localeID.data(); baseNameLength > 0) { + heap->ptr->baseName = {heap->ptr->fullName.data(), baseNameLength}; + if (heap->ptr->baseName.isEmpty()) { + status = U_MEMORY_ALLOCATION_ERROR; + setToBogus(); + return; } - // if fullName is already on the heap, need to free it. - uprv_free(fullName); } - fullName = newFullName; - status = U_ZERO_ERROR; - continue; } - - if (U_FAILURE(status)) { return; } - u_terminateChars(fullName, capacity, reslen + offset, &status); - break; - } - - if (baseName == fullName) { - // May have added the first keyword, meaning that the fullName is no longer also the baseName. - initBaseName(status); } } @@ -2741,9 +2876,42 @@ Locale::setUnicodeKeywordValue(StringPiece keywordName, setKeywordValue(*legacy_key, value, status); } -const char * +const char* +Locale::getCountry() const { + return getField<&Nest::getRegion, &Heap::getRegion>(); +} + +const char* +Locale::getLanguage() const { + return getField<&Nest::getLanguage, &Heap::getLanguage>(); +} + +const char* +Locale::getScript() const { + return getField<&Nest::getScript, &Heap::getScript>(); +} + +const char* +Locale::getVariant() const { + return getField<&Nest::getVariant, &Heap::getVariant>(); +} + +const char* +Locale::getName() const { + return getField<&Nest::getBaseName, &Heap::getFullName>(); +} + +const char* Locale::getBaseName() const { - return baseName; + return getField<&Nest::getBaseName, &Heap::getBaseName>(); +} + +template +const char* Locale::getField() const { + return payload.visit([] { return ""; }, + [](const Nest& nest) { return (nest.*NEST)(); }, + [](const Heap& heap) { return (heap.*HEAP)(); }); } Locale::Iterator::~Iterator() = default; diff --git a/deps/icu-small/source/common/loclikely.cpp b/deps/icu-small/source/common/loclikely.cpp index f87fd8dd61ca13..1c9447fa2bf3b5 100644 --- a/deps/icu-small/source/common/loclikely.cpp +++ b/deps/icu-small/source/common/loclikely.cpp @@ -495,7 +495,7 @@ bool RegionValidateMap::equals(const RegionValidateMap& that) const { // The code transform two letter a-z to a integer valued between -1, 26x26. // -1 indicate the region is outside the range of two letter a-z // the rest of value is between 0 and 676 (= 26x26) and used as an index -// the the bigmap in map. The map is an array of 22 int32_t. +// the bigmap in map. The map is an array of 22 int32_t. // since 32x21 < 676/32 < 32x22 we store this 676 bits bitmap into 22 int32_t. int32_t RegionValidateMap::value(const char* region) const { if (uprv_isASCIILetter(region[0]) && uprv_isASCIILetter(region[1]) && diff --git a/deps/icu-small/source/common/loclikelysubtags.cpp b/deps/icu-small/source/common/loclikelysubtags.cpp index 7245a779816ce7..b37aaeec718e15 100644 --- a/deps/icu-small/source/common/loclikelysubtags.cpp +++ b/deps/icu-small/source/common/loclikelysubtags.cpp @@ -715,13 +715,29 @@ LSR LikelySubtags::maximize(StringPiece language, StringPiece script, StringPiec } else { iter.resetToState64(state); value = trieNext(iter, "", 0); - U_ASSERT(value > 0); + U_ASSERT(value != 0); + // For the case of und_Latn + if (value < 0) { + retainLanguage = !language.empty(); + retainScript = !script.empty(); + retainRegion = !region.empty(); + // Fallback to und_$region => + iter.resetToState64(trieUndState); // "und" ("*") + value = trieNext(iter, "", 0); + U_ASSERT(value == 0); + int64_t trieUndEmptyState = iter.getState64(); + value = trieNext(iter, region, 0); + // Fallback to und => + if (value < 0) { + iter.resetToState64(trieUndEmptyState); + value = trieNext(iter, "", 0); + U_ASSERT(value > 0); + } + } } } } U_ASSERT(value < lsrsLength); - const LSR &matched = lsrs[value]; - if (returnInputIfUnmatch && (!(matchLanguage || matchScript || (matchRegion && language.empty())))) { return LSR("", "", "", LSR::EXPLICIT_LSR, errorCode); // no matching. @@ -731,18 +747,23 @@ LSR LikelySubtags::maximize(StringPiece language, StringPiece script, StringPiec } if (!(retainLanguage || retainScript || retainRegion)) { + U_ASSERT(value >= 0); // Quickly return a copy of the lookup-result LSR // without new allocation of the subtags. + const LSR &matched = lsrs[value]; return LSR(matched.language, matched.script, matched.region, matched.flags); } if (!retainLanguage) { - language = matched.language; + U_ASSERT(value >= 0); + language = lsrs[value].language; } if (!retainScript) { - script = matched.script; + U_ASSERT(value >= 0); + script = lsrs[value].script; } if (!retainRegion) { - region = matched.region; + U_ASSERT(value >= 0); + region = lsrs[value].region; } int32_t retainMask = (retainLanguage ? 4 : 0) + (retainScript ? 2 : 0) + (retainRegion ? 1 : 0); // retainOldMask flags = LSR explicit-subtag flags diff --git a/deps/icu-small/source/common/lstmbe.cpp b/deps/icu-small/source/common/lstmbe.cpp index c1a142469c44d6..470e939ab02a28 100644 --- a/deps/icu-small/source/common/lstmbe.cpp +++ b/deps/icu-small/source/common/lstmbe.cpp @@ -809,7 +809,15 @@ U_CAPI const LSTMData* U_EXPORT2 CreateLSTMDataForScript(UScriptCode script, UEr U_CAPI const LSTMData* U_EXPORT2 CreateLSTMData(UResourceBundle* rb, UErrorCode& status) { - return new LSTMData(rb, status); + if (U_FAILURE(status)) { + return nullptr; + } + const LSTMData* result = new LSTMData(rb, status); + if (U_FAILURE(status)) { + delete result; + return nullptr; + } + return result; } U_CAPI const LanguageBreakEngine* U_EXPORT2 diff --git a/deps/icu-small/source/common/messagepattern.cpp b/deps/icu-small/source/common/messagepattern.cpp index 96555ce8ae3356..cd2976da164d10 100644 --- a/deps/icu-small/source/common/messagepattern.cpp +++ b/deps/icu-small/source/common/messagepattern.cpp @@ -914,8 +914,9 @@ MessagePattern::parseArgNumber(const UnicodeString &s, int32_t start, int32_t li if(0x30<=c && c<=0x39) { if(number>=INT32_MAX/10) { badNumber=true; // overflow + } else { + number=number*10+(c-0x30); } - number=number*10+(c-0x30); } else { return UMSGPAT_ARG_NAME_NOT_NUMBER; } diff --git a/deps/icu-small/source/common/norm2_nfc_data.h b/deps/icu-small/source/common/norm2_nfc_data.h index 89d0287c5429f0..562c2b2513e61c 100644 --- a/deps/icu-small/source/common/norm2_nfc_data.h +++ b/deps/icu-small/source/common/norm2_nfc_data.h @@ -10,14 +10,14 @@ #ifdef INCLUDED_FROM_NORMALIZER2_CPP static const UVersionInfo norm2_nfc_data_formatVersion={5,0,0,0}; -static const UVersionInfo norm2_nfc_data_dataVersion={0x10,0,0,0}; +static const UVersionInfo norm2_nfc_data_dataVersion={0x11,0,0,0}; static const int32_t norm2_nfc_data_indexes[Normalizer2Impl::IX_COUNT]={ -0x58,0x4e84,0x8c60,0x8d60,0x8d60,0x8d60,0x8d60,0x8d60,0xc0,0x300,0xb0c,0x2a6a,0x3cf0,0xfbc4,0x12c2,0x3c26, +0x58,0x4eec,0x8cc8,0x8dc8,0x8dc8,0x8dc8,0x8dc8,0x8dc8,0xc0,0x300,0xb0c,0x2a6a,0x3cf0,0xfbc4,0x12c2,0x3c26, 0x3cbe,0x3cf0,0x300,0,0xfb10,0xfb9e }; -static const uint16_t norm2_nfc_data_trieIndex[1869]={ +static const uint16_t norm2_nfc_data_trieIndex[1888]={ 0,0x40,0x7b,0xbb,0xfb,0x13a,0x17a,0x1b2,0x1f2,0x226,0x254,0x226,0x294,0x2d4,0x313,0x353, 0x393,0x3d2,0x40f,0x44e,0x226,0x226,0x488,0x4c8,0x4f8,0x530,0x226,0x570,0x59f,0x5de,0x226,0x5f3, 0x631,0x65f,0x688,0x6be,0x6fe,0x73b,0x75b,0x79a,0x7d9,0x816,0x835,0x872,0x75b,0x8ab,0x8d9,0x918, @@ -82,7 +82,7 @@ static const uint16_t norm2_nfc_data_trieIndex[1869]={ 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x1881,0x18c1,0x1901,0x1941,0x1981,0x19c1,0x1a01,0x1a41,0x1a64,0x1aa4,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ac4,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x6cf,0x6df,0x6f7,0x716,0x72b,0x72b,0x72b,0x72f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x6e2,0x6f2,0x70a,0x729,0x73e,0x73e,0x73e,0x742,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xc0c,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x54f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x40c, @@ -91,53 +91,54 @@ static const uint16_t norm2_nfc_data_trieIndex[1869]={ 0x1b1a,0x226,0x226,0x1b2a,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xdf8,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x1b3a,0x226,0x226,0x226,0x1b42,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x1608,0x226,0x226,0x226,0x226,0x66b,0x226,0x226,0x226,0x226,0x1b50,0x54f,0x226,0x226,0x1b60,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x81d,0x226,0x226,0x1b70,0x226,0x1b80,0x1b8d,0x1b99,0x226,0x226, -0x226,0x226,0x414,0x226,0x1ba4,0x1bb4,0x226,0x226,0x226,0x812,0x226,0x226,0x226,0x226,0x1bc4,0x226, -0x226,0x226,0x1bcf,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bd6,0x226,0x226, -0x226,0x226,0x1be1,0x1bf0,0x928,0x1bfe,0x412,0x1c0c,0x1c1c,0x226,0x1c24,0x1c32,0x87f,0x226,0x226,0x226, -0x226,0x1c42,0x7ca,0x226,0x226,0x226,0x226,0x226,0x1c52,0x1c61,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x908,0x1c69,0x1c79,0x226,0x226,0x226,0x9ec,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x1c83,0x226,0x226,0x226,0x226,0x226,0x226,0x818,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c80,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c93,0x812,0x226,0x226,0x226,0x226, +0x1608,0x226,0x226,0x226,0x226,0x1b50,0x226,0x226,0x226,0x226,0x1b60,0x54f,0x226,0x226,0x1b70,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x81d,0x226,0x226,0x1b80,0x226,0x1b90,0x1b9d,0x1ba9,0x226,0x226, +0x226,0x226,0x414,0x226,0x1bb4,0x1bc4,0x226,0x226,0x226,0x812,0x226,0x226,0x226,0x226,0x1bd4,0x226, +0x226,0x226,0x1bdf,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1be6,0x226,0x226, +0x226,0x226,0x1bf1,0x1c00,0x928,0x1c0e,0x412,0x1c1c,0x1c2c,0x226,0x1c34,0x1c42,0x87f,0x226,0x226,0x226, +0x226,0x1c52,0x7ca,0x226,0x226,0x226,0x226,0x226,0x1c62,0x1c71,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x908,0x1c79,0x1c89,0x226,0x226,0x226,0x9ec,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x1c93,0x226,0x226,0x226,0x226,0x226,0x226,0x818,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c90,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ca3,0x812,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x87f,0x226,0x226,0x226,0x81f,0x81c,0x226,0x226,0x226,0x226,0x81a, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x9ec,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xc06,0x226,0x226,0x226,0x226,0x81c,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0xc09,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x1ca2,0x1cb1,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x1cc1,0x226,0x226,0x226,0xf2d,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1cce, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x1cb2,0x1cc1,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x1cd1,0x226,0x226,0x226,0xf2d,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1cde, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ce0,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x1cef,0x1cff,0x1d0d,0x1d1a,0x226,0x1d26,0x1d34,0x1d44,0x226,0x226,0x226,0x226,0xd1c,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1cee, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1cf0,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x1cff,0x1d0f,0x1d1d,0x1d2a,0x226,0x1d36,0x1d44,0x1d54,0x226,0x226,0x226,0x226,0xd1c,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1d54,0x1d5c,0x1d6a,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1d64,0x1d6c,0x1d7a,0x226,0x226,0x226,0x226,0x226, 0x4f9,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xf2d,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x7ca,0x226,0x226,0x226,0x4fc,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1d75,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1d85,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x5c1,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1d85,0x226,0x226,0x226, -0x226,0x226,0x226,0x1d91,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1da1, -0x1db1,0x1dc1,0x1dd1,0x1de1,0x1df1,0x1e01,0x1e11,0x1e21,0x1e31,0x1e41,0x1e51,0x1e61,0x1e71,0x1e81,0x1e91,0x1ea1, -0x1eb1,0x1ec1,0x1ed1,0x1ee1,0x1ef1,0x1f01,0x1f11,0x1f21,0x1f31,0x1f41,0x1f51,0x1f61,0x1f71,0x1f81,0x1f91,0x1fa1, -0x1fb1,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x408, -0x428,0x440,0xc4,0xc4,0x460,0x46f,0x486,0x4a2,0x4bf,0x4dd,0x4fa,0x517,0x536,0x553,0x56d,0xc4, -0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x582, -0xc4,0xc4,0xc4,0xc4,0x595,0x5a9,0x5c0,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1d95,0x7d3,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1da5, +0x226,0x226,0x226,0x226,0x226,0x226,0x1db1,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x1dc1,0x1dd1,0x1de1,0x1df1,0x1e01,0x1e11,0x1e21,0x1e31,0x1e41,0x1e51,0x1e61,0x1e71,0x1e81,0x1e91, +0x1ea1,0x1eb1,0x1ec1,0x1ed1,0x1ee1,0x1ef1,0x1f01,0x1f11,0x1f21,0x1f31,0x1f41,0x1f51,0x1f61,0x1f71,0x1f81,0x1f91, +0x1fa1,0x1fb1,0x1fc1,0x1fd1,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x408,0x428,0x440,0xc4,0xc4,0x460,0x46f,0x486,0x4a2,0x4bf,0x4dd,0x4fa,0x517,0x536, +0x553,0x56d,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, +0xc4,0xc4,0x582,0xc4,0xc4,0xc4,0xc4,0x595,0x5a9,0x5c0,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, 0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, -0xc4,0xc4,0xc4,0xc4,0xc4,0x5e0,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x5eb,0x608, -0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x628,0x63e,0x650,0xc4,0x66f,0xc4,0xc4,0xc4,0xc4,0xc4, +0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x5e0,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, +0xc4,0x5eb,0x608,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x628,0x63e,0x650,0x66f,0x682,0xc4,0xc4, 0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, -0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x68f,0x6af +0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x6a2,0x6c2 }; -static const uint16_t norm2_nfc_data_trieData[8129]={ +static const uint16_t norm2_nfc_data_trieData[8162]={ 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,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, @@ -371,9 +372,9 @@ static const uint16_t norm2_nfc_data_trieData[8129]={ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8, 0xffb8,0xffcc,0xffcc,0xffb8,1,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8, -0xffcc,0xffcc,0xffcc,0xffcc,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,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffb8,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc, +0xffd4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,0x8c4,0x1a65,0x8c8,0x1a6b,0x8cc,0x1a71,0x8d0,0x1a77,0x8d4,0x1a7d,1, 1,0x8d8,0x1a83,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,1,1,1, @@ -575,6 +576,7 @@ static const uint16_t norm2_nfc_data_trieData[8129]={ 1,1,1,1,1,1,1,0xffb8,1,0xffcc,1,1,1,1,1,1, 1,1,0xffcc,0xfe02,0xffb8,1,1,1,1,0xfe12,1,1,1,1,0xffcc,0xffcc, 0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +1,1,1,1,1,1,1,1,1,1,0xffb8,0xffb8,1,0xffb8,0xffb8,0xffb8, 1,1,1,1,1,1,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffb8,0xffb8,0xffb8, 1,1,0xffcc,0xffb8,0xffcc,0xffb8,1,1,1,1,1,1,1,1,1,1, 0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12, @@ -610,7 +612,8 @@ static const uint16_t norm2_nfc_data_trieData[8129]={ 1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc, 0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,1, 0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1, -1,0xffd0,0xffd0,0xffb8,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1,1,1,1, +1,0xffd0,0xffd0,0xffb8,0xffcc,1,1,1,0xffcc,1,1,0xffcc,1,1,1,1, +1,1,1,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1,1,1,1, 1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xfe0e,1,1,1,1, 1,0x33e5,0x33e9,0x33ed,0x33f1,0x33f7,0x2fd7,0x33fb,0x33ff,0x3403,0x3407,0x2fdb,0x340b,0x340f,0x3413,0x2fdf, 0x3419,0x341d,0x3421,0x3425,0x342b,0x342f,0x3433,0x3437,0x343d,0x3441,0x3445,0x3449,0x30c9,0x344d,0x3453,0x3457, @@ -646,13 +649,13 @@ static const uint16_t norm2_nfc_data_trieData[8129]={ 0x3b5f,0x3b63,0x3b67,0x3b6d,0x3b71,0x3b75,0x3b79,0x3b7d,0x3b83,0x3b89,0x3b8d,0x3b91,0x3b95,0x3b9b,0x3b9f,0x31d1, 0x31d1,0x3ba5,0x3ba9,0x3baf,0x3bb3,0x3bb7,0x3bbb,0x3bbf,0x3bc3,0x3bc7,0x3bcb,0x31d5,0x3bd1,0x3bd5,0x3bd9,0x3bdd, 0x3be1,0x3be5,0x3beb,0x3bef,0x3bf5,0x3bfb,0x3c01,0x3c05,0x3c09,0x3c0d,0x3c11,0x3c15,0x3c19,0x3c1d,0x3c21,1, -1 +1,1 }; static const UCPTrie norm2_nfc_data_trie={ norm2_nfc_data_trieIndex, { norm2_nfc_data_trieData }, - 1869, 8129, + 1888, 8162, 0x2fc00, 0x30, 0, 0, 0, 0, @@ -1160,7 +1163,7 @@ static const uint16_t norm2_nfc_data_extraData[7918]={ static const uint8_t norm2_nfc_data_smallFCD[256]={ 0xc0,0xef,3,0x7f,0xdf,0x70,0xcf,0x87,0xd7,0xe6,0x66,0x46,0x66,0x46,0x66,0x5b, -0x12,0,0,4,0,0,0,0x43,0x20,2,0x69,0xae,0xc2,0xc0,0xff,0xff, +0x12,0,0,4,0,0,0,0x43,0x20,2,0xe9,0xae,0xc2,0xc0,0xff,0xff, 0xc0,0x72,0xbf,0,0,0,0,0,0,0,0x40,0,0x80,0x88,0,0, 0xfe,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, diff --git a/deps/icu-small/source/common/normalizer2impl.h b/deps/icu-small/source/common/normalizer2impl.h index 5999190bae9bc8..94047336f223db 100644 --- a/deps/icu-small/source/common/normalizer2impl.h +++ b/deps/icu-small/source/common/normalizer2impl.h @@ -243,32 +243,36 @@ class U_COMMON_API ReorderingBuffer : public UMemory { * this normalizer2impl.h and in the design doc at * https://unicode-org.github.io/icu/design/normalization/custom.html */ -class U_COMMON_API Normalizer2Impl : public UObject { +class U_COMMON_API_CLASS Normalizer2Impl : public UObject { public: - Normalizer2Impl() : normTrie(nullptr), fCanonIterData(nullptr) {} - virtual ~Normalizer2Impl(); + U_COMMON_API Normalizer2Impl() : normTrie(nullptr), fCanonIterData(nullptr) {} + U_COMMON_API virtual ~Normalizer2Impl(); - void init(const int32_t *inIndexes, const UCPTrie *inTrie, - const uint16_t *inExtraData, const uint8_t *inSmallFCD); + U_COMMON_API void init(const int32_t* inIndexes, + const UCPTrie* inTrie, + const uint16_t* inExtraData, + const uint8_t* inSmallFCD); - void addLcccChars(UnicodeSet &set) const; - void addPropertyStarts(const USetAdder *sa, UErrorCode &errorCode) const; - void addCanonIterPropertyStarts(const USetAdder *sa, UErrorCode &errorCode) const; + U_COMMON_API void addLcccChars(UnicodeSet& set) const; + U_COMMON_API void addPropertyStarts(const USetAdder* sa, UErrorCode& errorCode) const; + U_COMMON_API void addCanonIterPropertyStarts(const USetAdder* sa, UErrorCode& errorCode) const; // low-level properties ------------------------------------------------ *** - UBool ensureCanonIterData(UErrorCode &errorCode) const; + U_COMMON_API UBool ensureCanonIterData(UErrorCode& errorCode) const; // The trie stores values for lead surrogate code *units*. // Surrogate code *points* are inert. - uint16_t getNorm16(UChar32 c) const { + U_COMMON_API uint16_t getNorm16(UChar32 c) const { return U_IS_LEAD(c) ? static_cast(INERT) : UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c); } - uint16_t getRawNorm16(UChar32 c) const { return UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c); } + U_COMMON_API uint16_t getRawNorm16(UChar32 c) const { + return UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c); + } - UNormalizationCheckResult getCompQuickCheck(uint16_t norm16) const { + U_COMMON_API UNormalizationCheckResult getCompQuickCheck(uint16_t norm16) const { if(norm16=MIN_NORMAL_MAYBE_YES) { return getCCFromNormalYesOrMaybe(norm16); } @@ -290,13 +300,13 @@ class U_COMMON_API Normalizer2Impl : public UObject { } return getCCFromNoNo(norm16); } - static uint8_t getCCFromNormalYesOrMaybe(uint16_t norm16) { + U_COMMON_API static uint8_t getCCFromNormalYesOrMaybe(uint16_t norm16) { return static_cast(norm16 >> OFFSET_SHIFT); } - static uint8_t getCCFromYesOrMaybeYes(uint16_t norm16) { + U_COMMON_API static uint8_t getCCFromYesOrMaybeYes(uint16_t norm16) { return norm16>=MIN_NORMAL_MAYBE_YES ? getCCFromNormalYesOrMaybe(norm16) : 0; } - uint8_t getCCFromYesOrMaybeYesCP(UChar32 c) const { + U_COMMON_API uint8_t getCCFromYesOrMaybeYesCP(UChar32 c) const { if (c < minCompNoMaybeCP) { return 0; } return getCCFromYesOrMaybeYes(getNorm16(c)); } @@ -306,7 +316,7 @@ class U_COMMON_API Normalizer2Impl : public UObject { * @param c A Unicode code point. * @return The lccc(c) in bits 15..8 and tccc(c) in bits 7..0. */ - uint16_t getFCD16(UChar32 c) const { + U_COMMON_API uint16_t getFCD16(UChar32 c) const { if(c>8]; if(bits==0) { return false; } return (bits >> ((lead >> 5) & 7)) & 1; } /** Returns the FCD value from the regular normalization data. */ - uint16_t getFCD16FromNormData(UChar32 c) const; + U_COMMON_API uint16_t getFCD16FromNormData(UChar32 c) const; - uint16_t getFCD16FromMaybeOrNonZeroCC(uint16_t norm16) const; + U_COMMON_API uint16_t getFCD16FromMaybeOrNonZeroCC(uint16_t norm16) const; /** * Gets the decomposition for one code point. @@ -378,7 +388,7 @@ class U_COMMON_API Normalizer2Impl : public UObject { * @param length out-only, takes the length of the decomposition, if any * @return pointer to the decomposition, or NULL if none */ - const char16_t *getDecomposition(UChar32 c, char16_t buffer[4], int32_t &length) const; + U_COMMON_API const char16_t* getDecomposition(UChar32 c, char16_t buffer[4], int32_t& length) const; /** * Gets the raw decomposition for one code point. @@ -387,12 +397,14 @@ class U_COMMON_API Normalizer2Impl : public UObject { * @param length out-only, takes the length of the decomposition, if any * @return pointer to the decomposition, or NULL if none */ - const char16_t *getRawDecomposition(UChar32 c, char16_t buffer[30], int32_t &length) const; + U_COMMON_API const char16_t* getRawDecomposition(UChar32 c, + char16_t buffer[30], + int32_t& length) const; - UChar32 composePair(UChar32 a, UChar32 b) const; + U_COMMON_API UChar32 composePair(UChar32 a, UChar32 b) const; - UBool isCanonSegmentStarter(UChar32 c) const; - UBool getCanonStartSet(UChar32 c, UnicodeSet &set) const; + U_COMMON_API UBool isCanonSegmentStarter(UChar32 c) const; + U_COMMON_API UBool getCanonStartSet(UChar32 c, UnicodeSet& set) const; enum { // Fixed norm16 values. @@ -481,71 +493,90 @@ class U_COMMON_API Normalizer2Impl : public UObject { // higher-level functionality ------------------------------------------ *** // NFD without an NFD Normalizer2 instance. - UnicodeString &decompose(const UnicodeString &src, UnicodeString &dest, - UErrorCode &errorCode) const; + U_COMMON_API UnicodeString& decompose(const UnicodeString& src, + UnicodeString& dest, + UErrorCode& errorCode) const; /** * Decomposes [src, limit[ and writes the result to dest. * limit can be NULL if src is NUL-terminated. * destLengthEstimate is the initial dest buffer capacity and can be -1. */ - void decompose(const char16_t *src, const char16_t *limit, - UnicodeString &dest, int32_t destLengthEstimate, - UErrorCode &errorCode) const; - - const char16_t *decompose(const char16_t *src, const char16_t *limit, - ReorderingBuffer *buffer, UErrorCode &errorCode) const; - void decomposeAndAppend(const char16_t *src, const char16_t *limit, - UBool doDecompose, - UnicodeString &safeMiddle, - ReorderingBuffer &buffer, - UErrorCode &errorCode) const; + U_COMMON_API void decompose(const char16_t* src, + const char16_t* limit, + UnicodeString& dest, + int32_t destLengthEstimate, + UErrorCode& errorCode) const; + + U_COMMON_API const char16_t* decompose(const char16_t* src, + const char16_t* limit, + ReorderingBuffer* buffer, + UErrorCode& errorCode) const; + U_COMMON_API void decomposeAndAppend(const char16_t* src, + const char16_t* limit, + UBool doDecompose, + UnicodeString& safeMiddle, + ReorderingBuffer& buffer, + UErrorCode& errorCode) const; /** sink==nullptr: isNormalized()/spanQuickCheckYes() */ - const uint8_t *decomposeUTF8(uint32_t options, - const uint8_t *src, const uint8_t *limit, - ByteSink *sink, Edits *edits, UErrorCode &errorCode) const; - - UBool compose(const char16_t *src, const char16_t *limit, - UBool onlyContiguous, - UBool doCompose, - ReorderingBuffer &buffer, - UErrorCode &errorCode) const; - const char16_t *composeQuickCheck(const char16_t *src, const char16_t *limit, - UBool onlyContiguous, - UNormalizationCheckResult *pQCResult) const; - void composeAndAppend(const char16_t *src, const char16_t *limit, - UBool doCompose, - UBool onlyContiguous, - UnicodeString &safeMiddle, - ReorderingBuffer &buffer, - UErrorCode &errorCode) const; + U_COMMON_API const uint8_t* decomposeUTF8(uint32_t options, + const uint8_t* src, + const uint8_t* limit, + ByteSink* sink, + Edits* edits, + UErrorCode& errorCode) const; + + U_COMMON_API UBool compose(const char16_t* src, + const char16_t* limit, + UBool onlyContiguous, + UBool doCompose, + ReorderingBuffer& buffer, + UErrorCode& errorCode) const; + U_COMMON_API const char16_t* composeQuickCheck(const char16_t* src, + const char16_t* limit, + UBool onlyContiguous, + UNormalizationCheckResult* pQCResult) const; + U_COMMON_API void composeAndAppend(const char16_t* src, + const char16_t* limit, + UBool doCompose, + UBool onlyContiguous, + UnicodeString& safeMiddle, + ReorderingBuffer& buffer, + UErrorCode& errorCode) const; /** sink==nullptr: isNormalized() */ - UBool composeUTF8(uint32_t options, UBool onlyContiguous, - const uint8_t *src, const uint8_t *limit, - ByteSink *sink, icu::Edits *edits, UErrorCode &errorCode) const; - - const char16_t *makeFCD(const char16_t *src, const char16_t *limit, - ReorderingBuffer *buffer, UErrorCode &errorCode) const; - void makeFCDAndAppend(const char16_t *src, const char16_t *limit, - UBool doMakeFCD, - UnicodeString &safeMiddle, - ReorderingBuffer &buffer, - UErrorCode &errorCode) const; - - UBool hasDecompBoundaryBefore(UChar32 c) const; - UBool norm16HasDecompBoundaryBefore(uint16_t norm16) const; - UBool hasDecompBoundaryAfter(UChar32 c) const; - UBool norm16HasDecompBoundaryAfter(uint16_t norm16) const; - UBool isDecompInert(UChar32 c) const { return isDecompYesAndZeroCC(getNorm16(c)); } - - UBool hasCompBoundaryBefore(UChar32 c) const { + U_COMMON_API UBool composeUTF8(uint32_t options, + UBool onlyContiguous, + const uint8_t* src, + const uint8_t* limit, + ByteSink* sink, + icu::Edits* edits, + UErrorCode& errorCode) const; + + U_COMMON_API const char16_t* makeFCD(const char16_t* src, + const char16_t* limit, + ReorderingBuffer* buffer, + UErrorCode& errorCode) const; + U_COMMON_API void makeFCDAndAppend(const char16_t* src, + const char16_t* limit, + UBool doMakeFCD, + UnicodeString& safeMiddle, + ReorderingBuffer& buffer, + UErrorCode& errorCode) const; + + U_COMMON_API UBool hasDecompBoundaryBefore(UChar32 c) const; + U_COMMON_API UBool norm16HasDecompBoundaryBefore(uint16_t norm16) const; + U_COMMON_API UBool hasDecompBoundaryAfter(UChar32 c) const; + U_COMMON_API UBool norm16HasDecompBoundaryAfter(uint16_t norm16) const; + U_COMMON_API UBool isDecompInert(UChar32 c) const { return isDecompYesAndZeroCC(getNorm16(c)); } + + U_COMMON_API UBool hasCompBoundaryBefore(UChar32 c) const { return c