diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 237f4c9cc3..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: 'ecma-262' - -on: [pull_request, push] - -jobs: - build: - name: 'build & lint ecmarkup' - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae - name: 'nvm install lts/* && npm ci' - with: - node-version: lts/* - use-npm-ci: true - - run: npm run build-head diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 424c2d3f97..0000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: 'ecma-262 deploy' - -on: - push: - branches: - - main - -jobs: - deploy: - name: 'deploy github pages' - runs-on: ubuntu-latest - if: ${{ github.repository == 'tc39/ecma262' }} - - steps: - - uses: actions/checkout@v3 - - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae - name: 'nvm install lts/* && npm ci' - with: - node-version: lts/* - use-npm-ci: true - - run: npm run build-only - - run: ./scripts/auto-deploy.sh - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/enforce-format.yml b/.github/workflows/enforce-format.yml deleted file mode 100644 index d2358e0e47..0000000000 --- a/.github/workflows/enforce-format.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: 'enforce format' - -on: [pull_request] - -jobs: - build: - name: 'enforce format' - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae - name: 'nvm install lts/* && npm ci' - with: - node-version: lts/* - use-npm-ci: true - - run: 'if ! npx emu-format --check spec.html; then echo "You need to run \`npm run format\`"; exit 1; fi' diff --git a/.github/workflows/esmeta-typecheck.yml b/.github/workflows/esmeta-typecheck.yml deleted file mode 100644 index 6dc9325942..0000000000 --- a/.github/workflows/esmeta-typecheck.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: 'esmeta typecheck' - -on: [pull_request] - -jobs: - esmeta-typecheck: - name: 'esmeta typecheck' - runs-on: ubuntu-latest - - env: - ESMETA_HOME: vendor/esmeta - - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup JDK - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - - name: download esmeta - run: | - mkdir -p "${ESMETA_HOME}" - cd "${ESMETA_HOME}" - git init - git remote add origin https://github.com/es-meta/esmeta.git - git fetch --depth 1 origin 088029201f0de736fdb8f30ca0a96bef26a52089 ;# v0.4.1 - git checkout FETCH_HEAD - - name: build esmeta - run: | - cd "${ESMETA_HOME}" - sbt assembly - - name: link - run: | - rmdir "${ESMETA_HOME}"/ecma262 \ - && ln -s "$(pwd)" "${ESMETA_HOME}"/ecma262 - - name: typecheck - run: '"${ESMETA_HOME}"/bin/esmeta tycheck -status -tycheck:log -tycheck:ignore=esmeta-ignore.json' - diff --git a/.github/workflows/ipr.yml b/.github/workflows/ipr.yml deleted file mode 100644 index 608b514867..0000000000 --- a/.github/workflows/ipr.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: 'ecma-262' - -on: - pull_request_target: - branches: - - '*' - push: - branches: - - main - -jobs: - build: - name: 'check IPR form' - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae - name: 'nvm install lts/* && npm ci' - with: - node-version: lts/* - use-npm-ci: true - - run: 'npm run ipr-check' - env: - GH_TOKEN: ${{ secrets.GH_IPR_TOKEN }} - GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml deleted file mode 100644 index d2dd361ea5..0000000000 --- a/.github/workflows/preview-build.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Build Preview - -on: [pull_request] - -jobs: - build: - name: 'build PR preview' - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae - name: 'nvm install lts/* && npm ci' - with: - node-version: lts/* - use-npm-ci: true - - run: npm run build-only - - run: node scripts/insert_snapshot_warning - - run: echo ${{ github.event.number }} > out/pr.txt - - uses: actions/upload-artifact@v3 - with: - name: out - path: out/ diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml deleted file mode 100644 index c3ab4f7f83..0000000000 --- a/.github/workflows/preview.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Upload Preview - -on: - workflow_run: - workflows: ["Build Preview"] - types: - - completed - -jobs: - upload: - name: 'upload PR preview' - runs-on: ubuntu-latest - if: > - ${{ - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' && - github.repository == 'tc39/ecma262' - }} - - steps: - - uses: actions/checkout@v3 - - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae - name: 'nvm install lts/* && npm ci' - with: - node-version: lts/* - use-npm-ci: true - - name: 'Download artifact' - uses: actions/github-script@v3.1.0 - with: - script: | - const { owner, repo } = context.repo; - const artifacts = await github.actions.listWorkflowRunArtifacts({ - owner, - repo, - run_id: ${{ github.event.workflow_run.id }}, - }); - const { id: artifact_id } = artifacts.data.artifacts.find((artifact) => artifact.name == 'out'); - const download = await github.actions.downloadArtifact({ - owner, - repo, - artifact_id, - archive_format: 'zip', - }); - const fs = require('fs'); - fs.writeFileSync('${{ github.workspace }}/out.zip', Buffer.from(download.data)); - - run: unzip -o out.zip -d out - - name: 'debug info' - uses: actions/github-script@v3.1.0 - with: - script: | - console.log(${{ toJson(github.event) }}); - - run: head -n1 out/pr.txt | grep -e '^[1-9][0-9]*$' - name: 'validate PR number from archive' - - run: echo "PULL_REQUEST=$(head -n1 out/pr.txt)" >> $GITHUB_ENV - - run: rm out/pr.txt && echo $PULL_REQUEST - - run: node scripts/publish-preview - env: - CI_PREVIEW_TOKEN: ${{ secrets.CI_PREVIEW_TOKEN }} - GITHUB_HEAD_SHA: ${{ github.event.workflow_run.head_commit.id }} diff --git a/.github/workflows/publish-biblio.yml b/.github/workflows/publish-biblio.yml deleted file mode 100644 index dad842ff86..0000000000 --- a/.github/workflows/publish-biblio.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: 'ecma-262-biblio' - -on: - push: - branches: - - main - -jobs: - publish: - name: 'publish ecma262-biblio' - runs-on: ubuntu-latest - if: ${{ github.repository == 'tc39/ecma262' }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 'lts/*' - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: npm ci - - - name: Publish biblio - run: scripts/publish-biblio.sh - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_FOR_TC39_USER }} diff --git a/.github/workflows/require-allow-edits.yml b/.github/workflows/require-allow-edits.yml deleted file mode 100644 index 9021ca22ef..0000000000 --- a/.github/workflows/require-allow-edits.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Require “Allow Edits” - -on: [pull_request] - -jobs: - _: - name: "Require “Allow Edits”" - - runs-on: ubuntu-latest - - steps: - - uses: ljharb/require-allow-edits@main diff --git a/spec.html b/spec.html index 9823aaa49e..2ca052e900 100644 --- a/spec.html +++ b/spec.html @@ -37827,6 +37827,63 @@

Properties of the RegExp Constructor

  • has the following properties:
  • + +

    RegExp.escape ( _S_ )

    +

    This function returns a copy of _S_ in which characters that are potentially special in a regular expression |Pattern| have been replaced by equivalent escape sequences.

    +

    It performs the following steps when called:

    + + + 1. If _S_ is not a String, throw a *TypeError* exception. + 1. Let _escaped_ be the empty String. + 1. Let _cpList_ be StringToCodePoints(_S_). + 1. For each code point _c_ of _cpList_, do + 1. If _escaped_ is the empty String and _c_ is matched by either |DecimalDigit| or |AsciiLetter|, then + 1. NOTE: Escaping a leading digit ensures that output corresponds with pattern text which may be used after a `\0` character escape or a |DecimalEscape| such as `\1` and still match _S_ rather than be interpreted as an extension of the preceding escape sequence. Escaping a leading ASCII letter does the same for the context after `\c`. + 1. Let _numericValue_ be the numeric value of _c_. + 1. Let _hex_ be Number::toString(𝔽(_numericValue_), 16). + 1. Assert: The length of _hex_ is 2. + 1. Set _escaped_ to the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS), *"x"*, and _hex_. + 1. Else, + 1. Set _escaped_ to the string-concatenation of _escaped_ and EncodeForRegExpEscape(_c_). + 1. Return _escaped_. + + + +

    Despite having similar names, EscapeRegExpPattern and `RegExp.escape` do not perform similar actions. The former escapes a pattern for representation as a string, while this function escapes a string for representation inside a pattern.

    +
    + + +

    + EncodeForRegExpEscape ( + _c_: a code point, + ): a String +

    +
    +
    description
    +
    It returns a string representing a |Pattern| for matching _c_. If _c_ is white space or an ASCII punctuator, the returned value is an escape sequence. Otherwise, the returned value is a string representation of _c_ itself.
    +
    + + + 1. If _c_ is matched by |SyntaxCharacter| or _c_ is U+002F (SOLIDUS), then + 1. Return the string-concatenation of 0x005C (REVERSE SOLIDUS) and UTF16EncodeCodePoint(_c_). + 1. Else if _c_ is the code point listed in some cell of the “Code Point” column of , then + 1. Return the string-concatenation of 0x005C (REVERSE SOLIDUS) and the string in the “ControlEscape” column of the row whose “Code Point” column contains _c_. + 1. Let _otherPunctuators_ be the string-concatenation of *",-=<>#&!%:;@~'`"* and the code unit 0x0022 (QUOTATION MARK). + 1. Let _toEscape_ be StringToCodePoints(_otherPunctuators_). + 1. If _toEscape_ contains _c_, _c_ is matched by |WhiteSpace| or |LineTerminator|, or _c_ has the same numeric value as a leading surrogate or trailing surrogate, then + 1. If the numeric value of _c_ ≤ 0xFF, then + 1. Let _hex_ be Number::toString(𝔽(_c_), 16). + 1. Return the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS), *"x"*, and StringPad(_hex_, 2, *"0"*, ~start~). + 1. Let _escaped_ be the empty String. + 1. Let _codeUnits_ be UTF16EncodeCodePoint(_c_). + 1. For each code unit _cu_ of _codeUnits_, do + 1. Set _escaped_ to the string-concatenation of _escaped_ and UnicodeEscape(_cu_). + 1. Return _escaped_. + 1. Return UTF16EncodeCodePoint(_c_). + +
    +
    +

    RegExp.prototype

    The initial value of `RegExp.prototype` is the RegExp prototype object.