diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b754ef0a8d..6e302f18de 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -24,9 +24,8 @@ updates: - '/gemfiles/3.2' - '/gemfiles/3.3' - '/gemfiles/3.4' - - '/gemfiles/3.5' - - '/gemfiles/jruby' - - '/gemfiles/truffleruby' + - '/gemfiles/4.0' + - '/gemfiles/4.1' - '/gemfiles/typecheck' schedule: interval: 'weekly' @@ -34,3 +33,5 @@ updates: ruby-deps: patterns: - "*" + ignore: + - dependency-name: "sorbet" diff --git a/.github/workflows/build-artifacts.yml b/.github/workflows/build-artifacts.yml index ec57121d3c..a2f754b94a 100644 --- a/.github/workflows/build-artifacts.yml +++ b/.github/workflows/build-artifacts.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/cpp-bindings.yml b/.github/workflows/cpp-bindings.yml index 12176470a5..54593ff548 100644 --- a/.github/workflows/cpp-bindings.yml +++ b/.github/workflows/cpp-bindings.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/.github/workflows/cruby-bindings.yml b/.github/workflows/cruby-bindings.yml index 5458d80694..d635e550f0 100644 --- a/.github/workflows/cruby-bindings.yml +++ b/.github/workflows/cruby-bindings.yml @@ -12,14 +12,23 @@ on: jobs: test-all: - runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + # Some tests in this repository are only run against parse.y + # We test them here in order to not fail ruby/ruby CI. + parser: + - prism + - parse.y + + runs-on: ubuntu-24.04 steps: - name: Set up latest ruby head uses: ruby/setup-ruby@v1 with: ruby-version: head bundler: none - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: repository: ruby/ruby path: ruby/ruby @@ -29,7 +38,7 @@ jobs: set -x sudo apt-get update -q || : sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev autoconf ruby - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: path: ruby/prism fetch-depth: 1 @@ -37,10 +46,14 @@ jobs: working-directory: ruby/ruby - name: Build Ruby run: | + ruby tool/downloader.rb -d tool -e gnu config.guess config.sub autoconf - ./configure -C --disable-install-doc - make -j2 + ./configure -C --disable-install-doc --with-parser=${{ matrix.parser }} + make -j$(nproc) working-directory: ruby/ruby - name: make test-all - run: make -j2 -s test-all TESTS="prism --no-retry" + env: + RUN_OPTS: --parser=${{ matrix.parser }} + EXCLUDES: ${{ matrix.parser == 'parse.y' && './test/.excludes-parsey' }} + run: make -j$(nproc) -s test-all working-directory: ruby/ruby diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 43300482c1..c5258a2f5e 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -14,7 +14,7 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -23,7 +23,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: "1.71.1" + toolchain: stable - name: Install doxygen and dependencies run: | sudo apt-get update diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index 14c368c737..217af4a47b 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: @@ -36,7 +36,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: "1.71.1" + toolchain: stable - name: Install doxygen and dependencies run: | sudo apt-get update @@ -59,7 +59,7 @@ jobs: cargo doc --no-deps --target-dir ../doc/rust working-directory: rust - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v4 with: path: doc diff --git a/.github/workflows/java-wasm-bindings.yml b/.github/workflows/java-wasm-bindings.yml index b3e427add0..5d130c07e1 100644 --- a/.github/workflows/java-wasm-bindings.yml +++ b/.github/workflows/java-wasm-bindings.yml @@ -15,7 +15,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -35,7 +35,7 @@ jobs: run: make java-wasm WASI_SDK_PATH=$(pwd)/wasi-sdk-25.0-x86_64-linux - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: '17' @@ -45,7 +45,7 @@ jobs: run: mvn -B install working-directory: java-wasm - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 with: name: prism.wasm - path: java-wasm/src/test/resources/prism.wasm + path: java-wasm/src/main/resources/prism.wasm diff --git a/.github/workflows/javascript-bindings.yml b/.github/workflows/javascript-bindings.yml index fc91523a64..6e7d51f282 100644 --- a/.github/workflows/javascript-bindings.yml +++ b/.github/workflows/javascript-bindings.yml @@ -15,7 +15,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -34,12 +34,12 @@ jobs: - name: Build the project run: make wasm WASI_SDK_PATH=$(pwd)/wasi-sdk-25.0-x86_64-linux - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 with: name: prism.wasm path: javascript/src/prism.wasm - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v6 with: node-version: 20.x diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bfe8e9b0ca..7b7f43650e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -28,7 +28,7 @@ jobs: env: BUNDLE_GEMFILE: gemfiles/2.7/Gemfile steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -44,7 +44,7 @@ jobs: env: BUNDLE_GEMFILE: gemfiles/typecheck/Gemfile steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -65,10 +65,10 @@ jobs: - ubuntu-latest - ubuntu-24.04-arm - macos-latest - # - windows-latest <-- failing with fiddle error, temporarily disabled + - windows-latest runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -78,20 +78,41 @@ jobs: run: bundle exec rake shell: bash + build-ibm: + if: github.repository == 'ruby/prism' + strategy: + fail-fast: false + matrix: + os: + - ubuntu-24.04-ppc64le + - ubuntu-24.04-s390x + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v6 + - name: Set up Ruby + run: | + sudo apt-get update + sudo apt-get install ruby-full bundler libyaml-dev + - name: Install dependencies + run: sudo bundle install --jobs $(nproc) + - name: Run Ruby tests + run: bundle exec rake + shell: bash + build-ffi: strategy: fail-fast: false matrix: target: - - { ruby: "head", gemfile: "3.5" } - - { ruby: "jruby", gemfile: "jruby" } - - { ruby: "truffleruby", gemfile: "truffleruby" } + - { ruby: "head", gemfile: "4.1" } + - { ruby: "jruby-10.0.0.0", gemfile: ".." } # https://github.com/jruby/jruby/issues/8923 + - { ruby: "truffleruby", gemfile: ".." } runs-on: ubuntu-latest env: PRISM_FFI_BACKEND: "true" BUNDLE_GEMFILE: gemfiles/${{ matrix.target.gemfile }}/Gemfile steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -104,10 +125,10 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, ubuntu-22.04] + os: [ubuntu-22.04, ubuntu-24.04] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -124,10 +145,10 @@ jobs: - ubuntu-latest - ubuntu-24.04-arm - macos-latest - # - windows-latest <-- failing with fiddle error, temporarily disabled + - windows-latest runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -141,7 +162,7 @@ jobs: build-minimal: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -157,7 +178,7 @@ jobs: env: JRUBY_OPTS: "--dev" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up JRuby uses: ruby/setup-ruby@v1 with: @@ -169,7 +190,7 @@ jobs: lex-ruby: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -181,7 +202,7 @@ jobs: lex-discourse: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -193,7 +214,7 @@ jobs: lex-top-100: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -213,7 +234,7 @@ jobs: memcheck: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install valgrind run: | sudo apt-get update @@ -229,14 +250,14 @@ jobs: gem-package: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: ruby/setup-ruby@v1 with: ruby-version: head bundler-cache: true - run: bundle config --local frozen false - run: bundle exec rake build:dev - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 with: name: gem-package path: pkg @@ -254,9 +275,10 @@ jobs: - { ruby: "3.2", os: "ubuntu-latest", gemfile: "3.2" } - { ruby: "3.3", os: "ubuntu-latest", gemfile: "3.3" } - { ruby: "3.4", os: "ubuntu-latest", gemfile: "3.4" } - - { ruby: "head", os: "ubuntu-latest", gemfile: "3.5" } - - { ruby: "jruby", os: "ubuntu-latest", gemfile: "jruby" } - - { ruby: "truffleruby", os: "ubuntu-latest", gemfile: "truffleruby" } + - { ruby: "4.0", os: "ubuntu-latest", gemfile: "4.0" } + - { ruby: "head", os: "ubuntu-latest", gemfile: "4.1" } + - { ruby: "jruby-10.0.0.0", os: "ubuntu-latest", gemfile: ".." } # https://github.com/jruby/jruby/issues/8923 + - { ruby: "truffleruby", os: "ubuntu-latest", gemfile: ".." } - { ruby: "2.7", os: "macos-latest", gemfile: "2.7" } - { ruby: "3.0", os: "macos-latest", gemfile: "3.0" } @@ -264,9 +286,10 @@ jobs: - { ruby: "3.2", os: "macos-latest", gemfile: "3.2" } - { ruby: "3.3", os: "macos-latest", gemfile: "3.3" } - { ruby: "3.4", os: "macos-latest", gemfile: "3.4" } - - { ruby: "head", os: "macos-latest", gemfile: "3.5" } - - { ruby: "jruby", os: "macos-latest", gemfile: "jruby" } - - { ruby: "truffleruby", os: "macos-latest", gemfile: "truffleruby" } + - { ruby: "4.0", os: "macos-latest", gemfile: "4.0" } + - { ruby: "head", os: "macos-latest", gemfile: "4.1" } + - { ruby: "jruby-10.0.0.0", os: "macos-latest", gemfile: ".." } # https://github.com/jruby/jruby/issues/8923 + - { ruby: "truffleruby", os: "macos-latest", gemfile: ".." } - { ruby: "2.7", os: "windows-latest", gemfile: "2.7" } - { ruby: "3.0", os: "windows-latest", gemfile: "3.0" } @@ -274,17 +297,18 @@ jobs: - { ruby: "3.2", os: "windows-latest", gemfile: "3.2" } - { ruby: "3.3", os: "windows-latest", gemfile: "3.3" } - { ruby: "3.4", os: "windows-latest", gemfile: "3.4" } - # - { ruby: "head", os: "windows-latest", gemfile: "3.5" } <-- failing certs, temporarily disabled - - { ruby: "jruby", os: "windows-latest", gemfile: "jruby" } + - { ruby: "4.0", os: "windows-latest", gemfile: "4.0" } + # - { ruby: "head", os: "windows-latest", gemfile: "4.1" } TODO: No windows build yet + - { ruby: "jruby-10.0.0.0", os: "windows-latest", gemfile: ".." } # https://github.com/jruby/jruby/issues/8923 env: BUNDLE_GEMFILE: gemfiles/${{ matrix.target.gemfile }}/Gemfile runs-on: ${{ matrix.target.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.target.ruby }} - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v7 with: name: gem-package path: pkg @@ -302,7 +326,7 @@ jobs: gcc-analyzer: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -315,7 +339,7 @@ jobs: clang-analyzer: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/.github/workflows/publish-crate.yml b/.github/workflows/publish-crate.yml new file mode 100644 index 0000000000..6ad2cb0f1f --- /dev/null +++ b/.github/workflows/publish-crate.yml @@ -0,0 +1,30 @@ +name: Publish to crates.io +on: + push: + tags: ['v*'] # Triggers when pushing tags starting with 'v' +jobs: + publish: + if: github.repository == 'ruby/prism' + runs-on: ubuntu-latest + environment: release # Optional: for enhanced security + permissions: + id-token: write # Required for OIDC token exchange + steps: + - name: Harden Runner + uses: step-security/harden-runner@v2 + with: + egress-policy: audit + - uses: actions/checkout@v6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - uses: rust-lang/crates-io-auth-action@v1 + id: auth + + - run: bundle exec rake cargo:publish:real + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml new file mode 100644 index 0000000000..87d6cf5657 --- /dev/null +++ b/.github/workflows/publish-gem.yml @@ -0,0 +1,39 @@ +name: Publish gem to rubygems.org + +on: + push: + tags: + - 'v*' + +permissions: + contents: read + +jobs: + push: + if: github.repository == 'ruby/prism' + runs-on: ubuntu-latest + + environment: + name: rubygems.org + url: https://rubygems.org/gems/prism + + permissions: + contents: write + id-token: write + + steps: + - name: Harden Runner + uses: step-security/harden-runner@v2 + with: + egress-policy: audit + + - uses: actions/checkout@v6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Publish to RubyGems + uses: rubygems/release-gem@v1 diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000000..e14746a155 --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,46 @@ +name: Publish to npmjs.com +on: + push: + tags: ['v*'] # Triggers when pushing tags starting with 'v' +jobs: + publish: + if: github.repository == 'ruby/prism' + runs-on: ubuntu-latest + environment: release # Optional: for enhanced security + permissions: + id-token: write # Required for OIDC token exchange + steps: + - name: Harden Runner + uses: step-security/harden-runner@v2 + with: + egress-policy: audit + - uses: actions/checkout@v6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Set up node + uses: actions/setup-node@v6 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: rake templates + run: bundle exec rake templates + + - name: Set up WASI-SDK + run: | + wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz + tar xvf wasi-sdk-25.0-x86_64-linux.tar.gz + + - name: Build the project + run: make wasm WASI_SDK_PATH=$(pwd)/wasi-sdk-25.0-x86_64-linux + + - name: Update npm + run: npm install -g npm@latest + + - run: npm publish + working-directory: javascript diff --git a/.github/workflows/rust-bindings.yml b/.github/workflows/rust-bindings.yml index 85e766adb8..51e90fdaf0 100644 --- a/.github/workflows/rust-bindings.yml +++ b/.github/workflows/rust-bindings.yml @@ -20,61 +20,57 @@ jobs: name: cargo:test strategy: fail-fast: false - runs-on: ubuntu-latest + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: head + ruby-version: 3.4 bundler-cache: true - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: "1.71.1" - targets: wasm32-wasi - - uses: actions/cache@v4 + toolchain: stable + targets: wasm32-wasip1 + - uses: actions/cache@v5 with: path: | ~/.cargo/registry ~/.cargo/git target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }} - ${{ runner.os }}-cargo + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} - name: Run tests run: bundle exec rake cargo:test + - name: Run examples + if: ${{ matrix.os != 'windows-latest' }} run: bundle exec rake cargo:examples lint: name: cargo:lint - strategy: - fail-fast: false runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: head + ruby-version: 3.4 bundler-cache: true - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: "1.71.1" + toolchain: "1.91.1" components: clippy, rustfmt - - uses: actions/cache@v4 + - uses: actions/cache@v5 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo--${{ hashFiles('**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }} - ${{ runner.os }}-cargo - name: rake cargo:build run: bundle exec rake cargo:build - name: rake cargo:lint @@ -88,52 +84,18 @@ jobs: matrix: sanitizer: [address] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: head + ruby-version: 3.4 bundler-cache: true - name: rake cargo:build run: bundle exec rake cargo:build - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-10-24 + toolchain: nightly target: "x86_64-unknown-linux-gnu" components: "rust-src" - name: Test with sanitizer run: bundle exec rake cargo:sanitize:${{ matrix.sanitizer }} - - # We need to figure out what to do here. When you run publish it checks - # against the latest version published to crates, which means if we have any - # breaking changes in the bindings then this fails. - # - # publish: - # name: cargo:publish - # strategy: - # fail-fast: false - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Set up Ruby - # uses: ruby/setup-ruby@v1 - # with: - # ruby-version: head - # bundler-cache: true - # - name: Set up Rust - # uses: dtolnay/rust-toolchain@master - # with: - # toolchain: "1.71.1" - # targets: wasm32-wasi - # - uses: actions/cache@v4 - # with: - # path: | - # ~/.cargo/registry - # ~/.cargo/git - # target - # key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - # restore-keys: | - # ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }} - # ${{ runner.os }}-cargo - # - name: Publish crates (dry-run) - # run: bundle exec rake cargo:publish:dry diff --git a/.github/workflows/sync-ruby.yml b/.github/workflows/sync-ruby.yml new file mode 100644 index 0000000000..66a736ed85 --- /dev/null +++ b/.github/workflows/sync-ruby.yml @@ -0,0 +1,33 @@ +name: Sync ruby +on: + push: + branches: [main] +jobs: + sync: + name: Sync ruby + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'ruby' }} + steps: + - uses: actions/checkout@v6 + + - name: Create GitHub App token + id: app-token + uses: actions/create-github-app-token@v2 + with: + app-id: 2060836 + private-key: ${{ secrets.RUBY_SYNC_DEFAULT_GEMS_PRIVATE_KEY }} + owner: ruby + repositories: ruby + + - name: Sync to ruby/ruby + uses: convictional/trigger-workflow-and-wait@v1.6.5 + with: + owner: ruby + repo: ruby + workflow_file_name: sync_default_gems.yml + github_token: ${{ steps.app-token.outputs.token }} + ref: master + client_payload: | + {"gem":"${{ github.event.repository.name }}","before":"${{ github.event.before }}","after":"${{ github.event.after }}"} + propagate_failure: true + wait_interval: 10 diff --git a/.gitignore b/.gitignore index 1122263535..6706482b64 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ /spec/reports/ /top-100-gems/ tmp/ -/vendor/bundle +vendor/ /build/ /lib/prism/prism.* diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bcded51f4d..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: ruby - -dist: jammy - -matrix: - include: - - arch: ppc64le - - arch: s390x - fast_finish: true - -before_install: - - sudo apt update -yq - - sudo apt -yq install gcc-11 - - gcc-11 --version - -before_script: - # Enable the verbose option in mkmf.rb to print the compiling commands. - - export MAKEFLAGS="V=1 CC=gcc-11" - -notifications: - email: - recipients: - - jun.aruga@gmail.com - on_success: never - on_failure: always diff --git a/CHANGELOG.md b/CHANGELOG.md index aa17d500bb..47309f6955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,90 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.8.0] - 2026-01-12 + +### Added + +- Optimize ruby visitor. +- Report unterminated construct errors at opening token. + +### Changed + +- Correctly expose ripper state. +- Use one file for versioned parser classes. +- Fix denominator of rational float literal. +- Decouple ripper translator from ripper library. +- Sync Prism::Translation::ParserCurrent with Ruby 4.0. + ## [Unreleased] +## [1.7.0] - 2025-12-18 + +### Added + +- Support `4.1` as a version option. +- Add `equal_loc` to `CallNode`. +- Add `len()`/`is_empty()` to `ConstantList` and `NodeList` in the Rust API. + +### Changed + +- Rename version `3.5` to version `4.0`. +- Fix compiling the gem from source on Windows. +- Fix parsing of unary method calls like `42.~@`. +- Reject `def f a, (b) = 1`. +- Reject endless method as a block parameter default. +- Reject variable capture in alternative pattern. +- Many fixes in regards to memory safety, found through fuzzing. +- Many fixes to better handle invalid syntax, also found through fuzzing. +- Fix the ruby version used by the `ripper` translator. +- Fix `ruby_parser` translation comment processing. + +## [1.6.0] - 2025-10-16 + +### Added + +- Add support for passing `"current"` as the version option to `Prism.*` APIs. + +### Changed + +- Remove a compiler warning for a missing unsigned cast for a shift value. + +## [1.5.2] - 2025-10-09 + +### Changed + +- Fix character literal forced encoding when a unicode escape sequence is used. +- Reject `1 if foo = bar baz`. +- Clear static literal flag on interpolated strings. +- Reject optional argument/endless method definition ambiguity. + +## [1.5.1] - 2025-09-13 + +### Changed + +- Revert of a bug introduced with static literal flags on interpolated strings. + +## [1.5.0] - 2025-09-12 + +### Added + +- Add `Prism::Translation::ParserCurrent`. +- Add `Integer::to_u32_digits` for the Rust API. +- Add `pm_comment_type_t` field for the Rust API. +- Support leading logical operators for CRuby 3.5+. + +### Changed + +- Mark Prism as ractor-safe. +- Enforce a minimum version for the parser translation layer. +- Many fixes to the parser translation layer. +- Accept a newline after the `defined?` keyword. +- Reject `true && not true`. +- Make `it = it` assign nil to match parse.y behavior [Bug #21139]. +- Some fixes to the ruby parser translation layer. +- Ensure call nodes have the correct ending location. +- Reject `foo && return bar`. + ## [1.4.0] - 2025-03-18 ### Added @@ -649,7 +731,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a - 🎉 Initial release! 🎉 -[unreleased]: https://github.com/ruby/prism/compare/v1.4.0...HEAD +[unreleased]: https://github.com/ruby/prism/compare/v1.8.0...HEAD +[1.8.0]: https://github.com/ruby/prism/compare/v1.7.0...v1.8.0 +[1.7.0]: https://github.com/ruby/prism/compare/v1.6.0...v1.7.0 +[1.6.0]: https://github.com/ruby/prism/compare/v1.5.2...v1.6.0 +[1.5.2]: https://github.com/ruby/prism/compare/v1.5.1...v1.5.2 +[1.5.1]: https://github.com/ruby/prism/compare/v1.5.0...v1.5.1 +[1.5.0]: https://github.com/ruby/prism/compare/v1.4.0...v1.5.0 [1.4.0]: https://github.com/ruby/prism/compare/v1.3.0...v1.4.0 [1.3.0]: https://github.com/ruby/prism/compare/v1.2.0...v1.3.0 [1.2.0]: https://github.com/ruby/prism/compare/v1.1.0...v1.2.0 diff --git a/Gemfile b/Gemfile index 7a7950b399..1a1ed1b269 100644 --- a/Gemfile +++ b/Gemfile @@ -5,15 +5,16 @@ source "https://rubygems.org" gemspec gem "benchmark-ips" +gem "parser" gem "rake" gem "rake-compiler" +gem "ruby_parser" gem "test-unit" platforms :mri, :mswin, :mingw, :x64_mingw do gem "ffi" - gem "parser" + gem "irb" gem "ruby_memcheck" - gem "ruby_parser" gem "rdoc" end diff --git a/Gemfile.lock b/Gemfile.lock index a34b551d7b..918c0a66e2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,49 +1,76 @@ PATH remote: . specs: - prism (1.4.0) + prism (1.8.0) GEM remote: https://rubygems.org/ specs: ast (2.4.3) benchmark-ips (2.14.0) - date (3.4.1) - ffi (1.17.1) - mini_portile2 (2.8.8) - nokogiri (1.18.5) + date (3.5.1) + date (3.5.1-java) + erb (6.0.1) + erb (6.0.1-java) + ffi (1.17.3) + io-console (0.8.2) + io-console (0.8.2-java) + irb (1.16.0) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jar-dependencies (0.5.5) + mini_portile2 (2.8.9) + nokogiri (1.19.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) + nokogiri (1.19.0-java) + racc (~> 1.4) onigmo (0.1.0) - parser (3.3.7.2) + parser (3.3.10.0) ast (~> 2.4.1) racc - power_assert (2.0.5) - psych (5.2.3) + power_assert (3.0.1) + pp (0.6.3) + prettyprint + prettyprint (0.2.0) + psych (5.3.1) date stringio + psych (5.3.1-java) + date + jar-dependencies (>= 0.1.7) racc (1.8.1) - rake (13.2.1) - rake-compiler (1.2.9) + racc (1.8.1-java) + rake (13.3.1) + rake-compiler (1.3.1) rake - rdoc (6.12.0) + rdoc (7.0.3) + erb psych (>= 4.0.0) + tsort + reline (0.6.3) + io-console (~> 0.5) ruby_memcheck (3.0.1) nokogiri - ruby_parser (3.21.1) + ruby_parser (3.22.0) racc (~> 1.5) sexp_processor (~> 4.16) - sexp_processor (4.17.3) - stringio (3.1.5) - test-unit (3.6.7) + sexp_processor (4.17.5) + stringio (3.2.0) + test-unit (3.7.6) power_assert + tsort (0.2.0) PLATFORMS + java ruby + universal-java DEPENDENCIES benchmark-ips ffi + irb onigmo parser prism! diff --git a/Makefile b/Makefile index afeb58ecd0..42dbb07e8d 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ CFLAGS := -g -O2 -std=c99 -Wall -Werror -Wextra -Wpedantic -Wundef -Wconversion JAVA_WASM_CFLAGS := -g -Oz -std=c99 -Wall -Werror -Wextra -Wpedantic -Wundef -Wconversion -Wno-missing-braces -fPIC -fvisibility=hidden -Wimplicit-fallthrough $(JAVA_WASM_CFLAGS) CC ?= cc AR ?= ar +ARFLAGS ?= -r$(V0:1=v) WASI_SDK_PATH := /opt/wasi-sdk MAKEDIRS ?= mkdir -p @@ -30,7 +31,7 @@ all: shared static shared: build/libprism.$(SOEXT) static: build/libprism.a wasm: javascript/src/prism.wasm -java-wasm: java-wasm/src/test/resources/prism.wasm +java-wasm: java-wasm/src/main/resources/prism.wasm build/libprism.$(SOEXT): $(SHARED_OBJECTS) $(ECHO) "linking $@ with $(CC)" @@ -38,14 +39,21 @@ build/libprism.$(SOEXT): $(SHARED_OBJECTS) build/libprism.a: $(STATIC_OBJECTS) $(ECHO) "building $@ with $(AR)" - $(Q) $(AR) $(ARFLAGS) $@ $(STATIC_OBJECTS) $(Q1:0=>/dev/null) + $(Q) $(AR) $(ARFLAGS) $@ $(STATIC_OBJECTS) javascript/src/prism.wasm: Makefile $(SOURCES) $(HEADERS) $(ECHO) "building $@" - $(Q) $(WASI_SDK_PATH)/bin/clang --sysroot=$(WASI_SDK_PATH)/share/wasi-sysroot/ $(DEBUG_FLAGS) -DPRISM_EXPORT_SYMBOLS -D_WASI_EMULATED_MMAN -lwasi-emulated-mman $(CPPFLAGS) $(CFLAGS) -Wl,--export-all -Wl,--no-entry -mexec-model=reactor -o $@ $(SOURCES) - -java-wasm/src/test/resources/prism.wasm: Makefile $(SOURCES) $(HEADERS) + $(Q) $(WASI_SDK_PATH)/bin/clang --sysroot=$(WASI_SDK_PATH)/share/wasi-sysroot/ \ + $(DEBUG_FLAGS) \ + -DPRISM_EXPORT_SYMBOLS -DPRISM_EXCLUDE_PRETTYPRINT -DPRISM_EXCLUDE_JSON -DPRISM_EXCLUDE_PACK \ + -D_WASI_EMULATED_MMAN -lwasi-emulated-mman $(CPPFLAGS) $(CFLAGS) \ + -Wl,--export-all -Wl,--gc-sections -Wl,--strip-all -Wl,--lto-O3 -Wl,--no-entry -mexec-model=reactor \ + -Oz -g0 -flto -fdata-sections -ffunction-sections \ + -o $@ $(SOURCES) + +java-wasm/src/main/resources/prism.wasm: Makefile $(SOURCES) $(HEADERS) $(ECHO) "building $@" + $(Q) $(MAKEDIRS) $(@D) $(Q) $(WASI_SDK_PATH)/bin/clang $(DEBUG_FLAGS) -DPRISM_EXCLUDE_PRETTYPRINT -DPRISM_EXPORT_SYMBOLS -D_WASI_EMULATED_MMAN -lwasi-emulated-mman $(CPPFLAGS) $(JAVA_WASM_CFLAGS) -Wl,--export-all -Wl,--no-entry -mexec-model=reactor -lc++ -lc++abi -o $@ $(SOURCES) build/shared/%.o: src/%.c Makefile $(HEADERS) @@ -62,12 +70,12 @@ build/fuzz.%: $(SOURCES) fuzz/%.c fuzz/fuzz.c $(ECHO) "building $* fuzzer" $(Q) $(MAKEDIRS) $(@D) $(ECHO) "building main fuzz binary" - $(Q) AFL_HARDEN=1 afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@ $^ + $(Q) afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@ $^ $(ECHO) "building cmplog binary" - $(Q) AFL_HARDEN=1 AFL_LLVM_CMPLOG=1 afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@.cmplog $^ + $(Q) AFL_LLVM_CMPLOG=1 afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@.cmplog $^ build/fuzz.heisenbug.%: $(SOURCES) fuzz/%.c fuzz/heisenbug.c - $(Q) AFL_HARDEN=1 afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@ $^ + $(Q) afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@ $^ fuzz-debug: $(ECHO) "entering debug shell" diff --git a/README.md b/README.md index b601ee5262..e92ef7bfb3 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ Prism has been integrated into the majority of Ruby runtimes, many libraries, an * [JRuby](https://github.com/jruby/jruby/pull/8103) (via Java) * [Natalie](https://github.com/natalie-lang/natalie/pull/1213) (via C++ and Ruby) * [Opal](https://github.com/opal/opal/pull/2642) (via Ruby and WASM) -* [TruffleRuby](https://github.com/oracle/truffleruby/issues/3117) (via Java) +* [TruffleRuby](https://github.com/truffleruby/truffleruby/issues/3117) (via Java) ### Libraries @@ -135,7 +135,9 @@ Prism has been integrated into the majority of Ruby runtimes, many libraries, an * [sorbet-eraser](https://github.com/kddnewton/sorbet-eraser/pull/25) * [synvert](https://github.com/xinminlabs/synvert-core-ruby) * [typeprof](https://github.com/ruby/typeprof) +* [unparser](https://github.com/mbj/unparser) (via parser translator) ### Applications * [gem.sh](https://github.com/marcoroth/gem.sh/pull/96) +* [Sorbet](https://github.com/sorbet/sorbet) diff --git a/Rakefile b/Rakefile index 7a5e537039..6e79e08b7f 100644 --- a/Rakefile +++ b/Rakefile @@ -11,7 +11,10 @@ desc "Generate all ERB template based files" task templates: Prism::Template::TEMPLATES make = RUBY_PLATFORM.match?(/openbsd|freebsd/) ? "gmake" : "make" -task(make: :templates) { sh(make) } +task(make: :templates) { + ENV["MAKEFLAGS"] ||= "-j" + sh(make) +} task(make_no_debug: :templates) { sh("#{make} all-no-debug") } task(make_minimal: :templates) { sh("#{make} minimal") } @@ -52,6 +55,7 @@ end CLOBBER.concat(Prism::Template::TEMPLATES) CLOBBER.concat(["build"]) CLOBBER << "lib/prism/prism.#{RbConfig::CONFIG["DLEXT"]}" +CLOBBER << "java-wasm/src/main/resources/prism.wasm" Prism::Template::TEMPLATES.each do |filepath| desc "Generate #{filepath}" diff --git a/Steepfile b/Steepfile index f415408746..1aafafc523 100644 --- a/Steepfile +++ b/Steepfile @@ -10,11 +10,13 @@ target :lib do # TODO: Type-checking these files is still WIP ignore "lib/prism/desugar_compiler.rb" ignore "lib/prism/lex_compat.rb" + ignore "lib/prism/lex_ripper.rb" ignore "lib/prism/serialize.rb" ignore "lib/prism/ffi.rb" ignore "lib/prism/translation" ignore "lib/prism/polyfill/append_as_bytes.rb" ignore "lib/prism/polyfill/byteindex.rb" + ignore "lib/prism/polyfill/scan_byte.rb" ignore "lib/prism/polyfill/unpack1.rb" end diff --git a/bin/compare b/bin/compare new file mode 100755 index 0000000000..d83de5dc64 --- /dev/null +++ b/bin/compare @@ -0,0 +1,111 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# Usage: bin/compare main feature-branch . + +$:.unshift(File.expand_path("../lib", __dir__)) + +require "json" +require "socket" + +def create_prism(ref) + parent_socket, child_socket = UNIXSocket.pair + + system("git checkout #{ref}", exception: true) + system("bundle exec rake compile", exception: true) + + pid = fork do + parent_socket.close + require "prism" + + child_socket.puts("Compiling done for #{ref}") + + while (data = child_socket.gets(chomp: true)) + command, path = data.split("\x00", 2) + case command + when "dump" + begin + child_socket.puts(Prism.dump_file(path).hash) + rescue Errno::EISDIR, Errno::EACCES + # Folder might end with `.rb` and get caught by the glob + # Some gems may contain files that are not readable by the current user + child_socket.puts("") + end + when "details" + parse_result = Prism.parse_file(path) + child_socket.puts({ + valid: parse_result.success?, + errors: parse_result.errors.map(&:inspect).hash, + warnings: parse_result.warnings.map(&:inspect).hash, + ast: parse_result.value.inspect.hash, + }.to_json) + else + raise "Unknown command #{command}" + end + end + + exit!(0) + end + + child_socket.close + parent_socket.gets + [pid, parent_socket] +end + +base_ref = ARGV.shift +compare_ref = ARGV.shift +path = ARGV.shift + +pid_baseline, socket_baseline = create_prism(base_ref) +pid_compare, socket_compare = create_prism(compare_ref) + +result = +"" +files = Dir.glob(File.join(path, "**/*.rb")) + +start = Process.clock_gettime(Process::CLOCK_MONOTONIC) + +def what_changed(baseline, compare, source_path) + if baseline[:valid] != compare[:valid] + return "#{source_path} changed from valid(#{baseline[:valid]}) to valid(#{compare[:valid]})" + end + + changed = [] + %i[ast errors warnings].each do |type| + changed << type if baseline[type] != compare[type] + end + raise "Unknown changes for #{source_path}" if changed.empty? + "#{source_path} is valid(#{baseline[:valid]}) with changed #{changed.join(", ")}" +end + +files.each_with_index do |source_path, i| + puts "#{i}/#{files.size}" if i % 1000 == 0 + + socket_baseline.puts("dump\x00#{source_path}") + socket_compare.puts("dump\x00#{source_path}") + + dump_baseline = socket_baseline.gets(chomp: true) + dump_compare = socket_compare.gets(chomp: true) + + if dump_baseline != dump_compare + socket_baseline.puts("details\x00#{source_path}") + socket_compare.puts("details\x00#{source_path}") + + details_baseline = JSON.parse(socket_baseline.gets(chomp: true), symbolize_names: true) + details_compare = JSON.parse(socket_compare.gets(chomp: true), symbolize_names: true) + result << what_changed(details_baseline, details_compare, source_path) + "\n" + end +end + +if result.empty? + puts "All good!" +else + puts "Oops:" + puts result +end + +puts "Took #{Process.clock_gettime(Process::CLOCK_MONOTONIC) - start} seconds" + +socket_baseline.close +socket_compare.close +Process.wait(pid_baseline) +Process.wait(pid_compare) diff --git a/bin/prism b/bin/prism index 14878dee90..d91d9990bf 100755 --- a/bin/prism +++ b/bin/prism @@ -15,11 +15,13 @@ module Prism when "encoding" then encoding(argv) when "error" then error(argv) when "lex" then lex(argv) + when "lex_compat" then lex_compat(argv) when "locals" then locals(argv) when "parse" then parse(argv) when "parser" then parser(argv) when "ripper" then ripper(argv) when "rubyparser" then rubyparser(argv) + when "repl" then repl else puts <<~TXT Usage: @@ -30,11 +32,13 @@ module Prism bin/prism encoding [encoding] bin/prism error [name] [source] bin/prism lex [source] + bin/prism lex_compat [source] bin/prism locals [source] bin/prism parse [source] bin/prism parser [source] bin/prism ripper [source] bin/prism rubyparser [source] + bin/prism repl TXT end end @@ -95,9 +99,8 @@ module Prism ["3.2", ["3.2"]], ["3.3", ["3.3"]], ["3.4", ["3.4", "typecheck"]], - ["3.5", ["3.5"]], - ["jruby", ["jruby"]], - ["truffleruby", ["truffleruby"]] + ["4.0", ["4.0"]], + ["4.1", ["4.1"]], ].each do |ruby_version, gemfiles| gemfiles.each do |gemfile| system( @@ -193,6 +196,21 @@ module Prism # bin/prism lex [source] def lex(argv) source, filepath = read_source(argv) + prism = Prism.lex(source, filepath: filepath) + max_token_type_length = prism.value.max_by { |token,| token.type.length }[0].type.length + + prism.value.each do |token,| + loc = token.location + puts(format( + "%-#{max_token_type_length + 1}s(%s,%s)-(%s,%s) %s", + token.type, loc.start_line, loc.start_column, loc.end_line, loc.end_column, token.value.inspect + )) + end + end + + # bin/prism lex_compat [source] + def lex_compat(argv) + source, filepath = read_source(argv) ripper_value = begin @@ -324,6 +342,25 @@ module Prism pp prism end + # bin/prism repl + def repl + loop do + print "Prism> " + + input = gets + break if input.nil? + + result = Prism.parse(input.chomp) + + statements_node = result.value.statements + statements = statements_node.body + + result.errors.each { |e| p(e) } + + p(statements.one? ? statements.first : statements) + end + end + ############################################################################ # Helpers ############################################################################ diff --git a/config.yml b/config.yml index 3d5eee190f..4e5b077a35 100644 --- a/config.yml +++ b/config.yml @@ -60,6 +60,7 @@ errors: - CONDITIONAL_WHILE_PREDICATE - CONSTANT_PATH_COLON_COLON_CONSTANT - DEF_ENDLESS + - DEF_ENDLESS_PARAMETERS - DEF_ENDLESS_SETTER - DEF_NAME - DEF_PARAMS_TERM @@ -101,6 +102,8 @@ errors: - EXPECT_FOR_DELIMITER - EXPECT_IDENT_REQ_PARAMETER - EXPECT_IN_DELIMITER + - EXPECT_LPAREN_AFTER_NOT_LPAREN + - EXPECT_LPAREN_AFTER_NOT_OTHER - EXPECT_LPAREN_REQ_PARAMETER - EXPECT_MESSAGE - EXPECT_RBRACKET @@ -216,6 +219,7 @@ errors: - PARAMETER_WILD_LOOSE_COMMA - PATTERN_ARRAY_MULTIPLE_RESTS - PATTERN_CAPTURE_DUPLICATE + - PATTERN_CAPTURE_IN_ALTERNATIVE - PATTERN_EXPRESSION_AFTER_BRACKET - PATTERN_EXPRESSION_AFTER_COMMA - PATTERN_EXPRESSION_AFTER_HROCKET @@ -277,6 +281,7 @@ errors: - UNEXPECTED_INDEX_KEYWORDS - UNEXPECTED_LABEL - UNEXPECTED_MULTI_WRITE + - UNEXPECTED_PARAMETER_DEFAULT_VALUE - UNEXPECTED_RANGE_OPERATOR - UNEXPECTED_SAFE_NAVIGATION - UNEXPECTED_TOKEN_CLOSE_CONTEXT @@ -320,13 +325,44 @@ warnings: - UNUSED_LOCAL_VARIABLE - VOID_STATEMENT tokens: + # The order of the tokens at the beginning is important, because we use them + # for a lookup table. - name: EOF value: 1 comment: final token in the file - - name: MISSING - comment: "a token that was expected but not found" - - name: NOT_PROVIDED - comment: "a token that was not present but it is okay" + - name: BRACE_RIGHT + comment: "}" + - name: COMMA + comment: "," + - name: EMBEXPR_END + comment: "}" + - name: KEYWORD_DO + comment: "do" + - name: KEYWORD_ELSE + comment: "else" + - name: KEYWORD_ELSIF + comment: "elsif" + - name: KEYWORD_END + comment: "end" + - name: KEYWORD_ENSURE + comment: "ensure" + - name: KEYWORD_IN + comment: "in" + - name: KEYWORD_RESCUE + comment: "rescue" + - name: KEYWORD_THEN + comment: "then" + - name: KEYWORD_WHEN + comment: "when" + - name: NEWLINE + comment: "a newline character outside of other tokens" + - name: PARENTHESIS_RIGHT + comment: ")" + - name: PIPE + comment: "|" + - name: SEMICOLON + comment: ";" + # Tokens from here on are not used for lookup, and can be in any order. - name: AMPERSAND comment: "&" - name: AMPERSAND_AMPERSAND @@ -349,8 +385,6 @@ tokens: comment: "!~" - name: BRACE_LEFT comment: "{" - - name: BRACE_RIGHT - comment: "}" - name: BRACKET_LEFT comment: "[" - name: BRACKET_LEFT_ARRAY @@ -373,8 +407,6 @@ tokens: comment: ":" - name: COLON_COLON comment: "::" - - name: COMMA - comment: "," - name: COMMENT comment: "a comment" - name: CONSTANT @@ -393,8 +425,6 @@ tokens: comment: "a line inside of embedded documentation" - name: EMBEXPR_BEGIN comment: "#{" - - name: EMBEXPR_END - comment: "}" - name: EMBVAR comment: "#" - name: EQUAL @@ -461,20 +491,10 @@ tokens: comment: "def" - name: KEYWORD_DEFINED comment: "defined?" - - name: KEYWORD_DO - comment: "do" - name: KEYWORD_DO_LOOP comment: "do keyword for a predicate in a while, until, or for loop" - - name: KEYWORD_ELSE - comment: "else" - - name: KEYWORD_ELSIF - comment: "elsif" - - name: KEYWORD_END - comment: "end" - name: KEYWORD_END_UPCASE comment: "END" - - name: KEYWORD_ENSURE - comment: "ensure" - name: KEYWORD_FALSE comment: "false" - name: KEYWORD_FOR @@ -483,8 +503,6 @@ tokens: comment: "if" - name: KEYWORD_IF_MODIFIER comment: "if in the modifier form" - - name: KEYWORD_IN - comment: "in" - name: KEYWORD_MODULE comment: "module" - name: KEYWORD_NEXT @@ -497,8 +515,6 @@ tokens: comment: "or" - name: KEYWORD_REDO comment: "redo" - - name: KEYWORD_RESCUE - comment: "rescue" - name: KEYWORD_RESCUE_MODIFIER comment: "rescue in the modifier form" - name: KEYWORD_RETRY @@ -509,8 +525,6 @@ tokens: comment: "self" - name: KEYWORD_SUPER comment: "super" - - name: KEYWORD_THEN - comment: "then" - name: KEYWORD_TRUE comment: "true" - name: KEYWORD_UNDEF @@ -523,8 +537,6 @@ tokens: comment: "until" - name: KEYWORD_UNTIL_MODIFIER comment: "until in the modifier form" - - name: KEYWORD_WHEN - comment: "when" - name: KEYWORD_WHILE comment: "while" - name: KEYWORD_WHILE_MODIFIER @@ -561,16 +573,12 @@ tokens: comment: "-=" - name: MINUS_GREATER comment: "->" - - name: NEWLINE - comment: "a newline character outside of other tokens" - name: NUMBERED_REFERENCE comment: "a numbered reference to a capture group in the previous regular expression match" - name: PARENTHESIS_LEFT comment: "(" - name: PARENTHESIS_LEFT_PARENTHESES comment: "( for a parentheses node" - - name: PARENTHESIS_RIGHT - comment: ")" - name: PERCENT comment: "%" - name: PERCENT_EQUAL @@ -585,8 +593,6 @@ tokens: comment: "%I" - name: PERCENT_UPPER_W comment: "%W" - - name: PIPE - comment: "|" - name: PIPE_EQUAL comment: "|=" - name: PIPE_PIPE @@ -603,8 +609,6 @@ tokens: comment: "the beginning of a regular expression" - name: REGEXP_END comment: "the end of a regular expression" - - name: SEMICOLON - comment: ";" - name: SLASH comment: "/" - name: SLASH_EQUAL @@ -649,6 +653,10 @@ tokens: comment: "a separator between words in a list" - name: __END__ comment: "marker for the point in the file at which the parser should stop" + - name: MISSING + comment: "a token that was expected but not found" + - name: NOT_PROVIDED + comment: "a token that was not present but it is okay" flags: - name: ArgumentsNodeFlags values: @@ -987,8 +995,19 @@ nodes: - name: constant type: node? kind: - - ConstantReadNode - ConstantPathNode + - ConstantReadNode + comment: | + Represents the optional constant preceding the Array + + foo in Bar[] + ^^^ + + foo in Bar[1, 2, 3] + ^^^ + + foo in Bar::Baz[1, 2, 3] + ^^^^^^^^ - name: requireds type: node[] kind: pattern expression @@ -1250,17 +1269,17 @@ nodes: - name: opening_loc type: location comment: | - Represents the location of the opening `|`. + Represents the location of the opening `{` or `do`. [1, 2, 3].each { |i| puts x } - ^ + ^ - name: closing_loc type: location comment: | - Represents the location of the closing `|`. + Represents the location of the closing `}` or `end`. [1, 2, 3].each { |i| puts x } - ^ + ^ comment: | Represents a block of ruby code. @@ -1498,6 +1517,16 @@ nodes: foo(bar) ^ + - name: equal_loc + type: location? + comment: | + Represents the location of the equal sign, in the case that this is an attribute write. + + foo.bar = value + ^ + + foo[bar] = value + ^ - name: block type: node? kind: @@ -1784,7 +1813,7 @@ nodes: Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). case true; when false; end - ^^^^ + ^^^^ - name: conditions type: node[] kind: WhenNode @@ -1828,6 +1857,11 @@ nodes: type: constant[] - name: class_keyword_loc type: location + comment: | + Represents the location of the `class` keyword. + + class Foo end + ^^^^^ - name: constant_path type: node kind: @@ -1836,18 +1870,43 @@ nodes: - on error: CallNode # class 0.X end - name: inheritance_operator_loc type: location? + comment: | + Represents the location of the `<` operator. + + class Foo < Bar + ^ - name: superclass type: node? kind: non-void expression + comment: | + Represents the superclass of the class. + + class Foo < Bar + ^^^ - name: body type: node? kind: - StatementsNode - BeginNode + comment: | + Represents the body of the class. + + class Foo + foo + ^^^ - name: end_keyword_loc type: location + comment: | + Represents the location of the `end` keyword. + + class Foo end + ^^^ - name: name type: constant + comment: | + The name of the class. + + class Foo end # name `:Foo` comment: | Represents a class declaration involving the `class` keyword. @@ -2374,23 +2433,68 @@ nodes: - name: constant type: node? kind: - - ConstantReadNode - ConstantPathNode + - ConstantReadNode + comment: | + Represents the optional constant preceding the pattern + + foo in Foo(*bar, baz, *qux) + ^^^ - name: left type: node kind: SplatNode + comment: | + Represents the first wildcard node in the pattern. + + foo in *bar, baz, *qux + ^^^^ + + foo in Foo(*bar, baz, *qux) + ^^^^ - name: requireds type: node[] kind: pattern expression + comment: | + Represents the nodes in between the wildcards. + + foo in *bar, baz, *qux + ^^^ + + foo in Foo(*bar, baz, 1, *qux) + ^^^^^^ - name: right type: node kind: - SplatNode - on error: MissingNode + comment: | + Represents the second wildcard node in the pattern. + + foo in *bar, baz, *qux + ^^^^ + + foo in Foo(*bar, baz, *qux) + ^^^^ - name: opening_loc type: location? + comment: | + The location of the opening brace. + + foo in [*bar, baz, *qux] + ^ + + foo in Foo(*bar, baz, *qux) + ^ - name: closing_loc type: location? + comment: | + The location of the closing brace. + + foo in [*bar, baz, *qux] + ^ + + foo in Foo(*bar, baz, *qux) + ^ comment: | Represents a find pattern in pattern matching. @@ -2402,6 +2506,9 @@ nodes: foo in Foo(*bar, baz, *qux) ^^^^^^^^^^^^^^^^^^^^ + + foo => *bar, baz, *qux + ^^^^^^^^^^^^^^^ - name: FlipFlopNode flags: RangeFlags fields: @@ -2521,11 +2628,18 @@ nodes: - name: block type: node? kind: BlockNode + comment: | + All other arguments are forwarded as normal, except the original block is replaced with the new block. comment: | - Represents the use of the `super` keyword without parentheses or arguments. + Represents the use of the `super` keyword without parentheses or arguments, but which might have a block. super ^^^^^ + + super { 123 } + ^^^^^^^^^^^^^ + + If it has any other arguments, it would be a `SuperNode` instead. - name: GlobalVariableAndWriteNode fields: - name: name @@ -2679,20 +2793,60 @@ nodes: - name: constant type: node? kind: - - ConstantReadNode - ConstantPathNode + - ConstantReadNode + comment: | + Represents the optional constant preceding the Hash. + + foo => Bar[a: 1, b: 2] + ^^^ + + foo => Bar::Baz[a: 1, b: 2] + ^^^^^^^^ - name: elements type: node[] kind: AssocNode + comment: | + Represents the explicit named hash keys and values. + + foo => { a: 1, b:, ** } + ^^^^^^^^ - name: rest type: node? kind: - AssocSplatNode - NoKeywordsParameterNode + comment: | + Represents the rest of the Hash keys and values. This can be named, unnamed, or explicitly forbidden via `**nil`, this last one results in a `NoKeywordsParameterNode`. + + foo => { a: 1, b:, **c } + ^^^ + + foo => { a: 1, b:, ** } + ^^ + + foo => { a: 1, b:, **nil } + ^^^^^ - name: opening_loc type: location? + comment: | + The location of the opening brace. + + foo => { a: 1 } + ^ + + foo => Bar[a: 1] + ^ - name: closing_loc type: location? + comment: | + The location of the closing brace. + + foo => { a: 1 } + ^ + + foo => Bar[a: 1] + ^ comment: | Represents a hash pattern in pattern matching. @@ -2701,6 +2855,12 @@ nodes: foo => { a: 1, b: 2, **c } ^^^^^^^^^^^^^^^^^^^ + + foo => Bar[a: 1, b: 2] + ^^^^^^^^^^^^^^^ + + foo in { a: 1, b: 2 } + ^^^^^^^^^^^^^^ - name: IfNode fields: - name: if_keyword_loc @@ -3146,6 +3306,9 @@ nodes: - EmbeddedVariableNode - InterpolatedStringNode # `"a" "#{b}"` - on error: XStringNode # `<<`FOO` "bar" + - on error: InterpolatedXStringNode + - on error: SymbolNode + - on error: InterpolatedSymbolNode - name: closing_loc type: location? newline: parts @@ -3353,6 +3516,9 @@ nodes: foo, bar = baz ^^^ ^^^ + + foo => baz + ^^^ - name: LocalVariableWriteNode fields: - name: name @@ -3443,11 +3609,65 @@ nodes: - name: value type: node kind: non-void expression + comment: | + Represents the left-hand side of the operator. + + foo => bar + ^^^ - name: pattern type: node kind: pattern expression + comment: | + Represents the right-hand side of the operator. The type of the node depends on the expression. + + Anything that looks like a local variable name (including `_`) will result in a `LocalVariableTargetNode`. + + foo => a # This is equivalent to writing `a = foo` + ^ + + Using an explicit `Array` or combining expressions with `,` will result in a `ArrayPatternNode`. This can be preceded by a constant. + + foo => [a] + ^^^ + + foo => a, b + ^^^^ + + foo => Bar[a, b] + ^^^^^^^^^ + + If the array pattern contains at least two wildcard matches, a `FindPatternNode` is created instead. + + foo => *, 1, *a + ^^^^^ + + Using an explicit `Hash` or a constant with square brackets and hash keys in the square brackets will result in a `HashPatternNode`. + + foo => { a: 1, b: } + + foo => Bar[a: 1, b:] + + foo => Bar[**] + + To use any variable that needs run time evaluation, pinning is required. This results in a `PinnedVariableNode` + + foo => ^a + ^^ + + Similar, any expression can be used with pinning. This results in a `PinnedExpressionNode`. + + foo => ^(a + 1) + + Anything else will result in the regular node for that expression, for example a `ConstantReadNode`. + + foo => CONST - name: operator_loc type: location + comment: | + The location of the operator. + + foo => bar + ^^ comment: | Represents the use of the `=>` operator. @@ -3877,12 +4097,32 @@ nodes: - name: expression type: node kind: non-void expression + comment: | + The expression used in the pinned expression + + foo in ^(bar) + ^^^ - name: operator_loc type: location + comment: | + The location of the `^` operator + + foo in ^(bar) + ^ - name: lparen_loc type: location + comment: | + The location of the opening parenthesis. + + foo in ^(bar) + ^ - name: rparen_loc type: location + comment: | + The location of the closing parenthesis. + + foo in ^(bar) + ^ comment: | Represents the use of the `^` operator for pinning an expression in a pattern matching expression. @@ -3901,8 +4141,18 @@ nodes: - NumberedReferenceReadNode # foo in ^$1 - ItLocalVariableReadNode # proc { 1 in ^it } - on error: MissingNode # foo in ^Bar + comment: | + The variable used in the pinned expression + + foo in ^bar + ^^^ - name: operator_loc type: location + comment: | + The location of the `^` operator + + foo in ^bar + ^ comment: | Represents the use of the `^` operator for pinning a variable in a pattern matching expression. @@ -4268,6 +4518,7 @@ nodes: - name: arguments type: node? kind: ArgumentsNode + comment: "Can be only `nil` when there are empty parentheses, like `super()`." - name: rparen_loc type: location? - name: block @@ -4283,6 +4534,8 @@ nodes: super foo, bar ^^^^^^^^^^^^^^ + + If no arguments are provided (except for a block), it would be a `ForwardingSuperNode` instead. - name: SymbolNode flags: SymbolFlags fields: diff --git a/docs/build_system.md b/docs/build_system.md index 98581f3898..3595c69741 100644 --- a/docs/build_system.md +++ b/docs/build_system.md @@ -58,12 +58,12 @@ prism's `Makefile` is not used at all in CRuby. Instead, CRuby's `Makefile` is u ### Building prism as part of TruffleRuby -[This script](https://github.com/oracle/truffleruby/blob/master/tool/import-prism.sh) imports prism sources in TruffleRuby. +[This script](https://github.com/truffleruby/truffleruby/blob/master/tool/import-prism.sh) imports prism sources in TruffleRuby. The script generates the templates when importing. Then when `mx build` builds TruffleRuby and the `prism` mx project inside, it runs `make`. -Then the `prism bindings` mx project is built, which contains the [bindings](https://github.com/oracle/truffleruby/blob/vm-24.1.1/src/main/c/yarp_bindings/src/yarp_bindings.c) +Then the `prism bindings` mx project is built, which contains the [bindings](https://github.com/truffleruby/truffleruby/blob/vm-24.1.1/src/main/c/yarp_bindings/src/yarp_bindings.c) and links to `libprism.a` (to avoid exporting symbols, so no conflict when installing the prism gem). ### Building prism as part of JRuby diff --git a/docs/cruby_compilation.md b/docs/cruby_compilation.md index 8440e9058c..8d98ef9eaa 100644 --- a/docs/cruby_compilation.md +++ b/docs/cruby_compilation.md @@ -1,6 +1,6 @@ # Compiling Prism's AST -One important class of consumers of Prism's AST is compilers. Currently [CRuby](https://github.com/ruby/ruby), [JRuby](https://github.com/jruby/jruby), [TruffleRuby](https://github.com/oracle/truffleruby), and [Natalie](https://github.com/natalie-lang/natalie) have all built compilation code on top of Prism's AST. +One important class of consumers of Prism's AST is compilers. Currently [CRuby](https://github.com/ruby/ruby), [JRuby](https://github.com/jruby/jruby), [TruffleRuby](https://github.com/truffleruby/truffleruby), and [Natalie](https://github.com/natalie-lang/natalie) have all built compilation code on top of Prism's AST. This document will describe, at a high level, how CRuby's compilation of Prism's AST works. diff --git a/docs/design.md b/docs/design.md index 15045a10ce..e1bbe78168 100644 --- a/docs/design.md +++ b/docs/design.md @@ -18,11 +18,11 @@ The templated files contain all of the code required to allocate and initialize In order to provide the best possible error tolerance, the parser is hand-written. It is structured using Pratt parsing, a technique developed by Vaughan Pratt back in the 1970s. Below are a bunch of links to articles and papers that explain Pratt parsing in more detail. -* https://web.archive.org/web/20151223215421/http://hall.org.ua/halls/wizzard/pdf/Vaughan.Pratt.TDOP.pdf +* https://github.com/tdop/tdop.github.io/raw/master/original.pdf * https://tdop.github.io/ * https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/ * https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing.html -* https://chidiwilliams.com/post/on-recursive-descent-and-pratt-parsing/ +* https://chidiwilliams.com/posts/on-recursive-descent-and-pratt-parsing You can find most of the functions that correspond to constructs in the Pratt parsing algorithm in `prism.c`. As a couple of examples: diff --git a/docs/parser_translation.md b/docs/parser_translation.md index 55fd3e4c22..8c080070fe 100644 --- a/docs/parser_translation.md +++ b/docs/parser_translation.md @@ -20,26 +20,5 @@ Prism::Translation::ParserCurrent.parse("puts 'Hello World!'") All the parsers are autoloaded, so you don't have to worry about requiring them yourself. -### RuboCop - -Prism as a parser engine is directly supported since RuboCop 1.62. - -First, specify `prism` in your Gemfile: - -```ruby -gem "prism" -``` - -To use Prism with RuboCop, specify `ParserEngine` and `TargetRubyVersion` in your RuboCop configuration file: - -```yaml -AllCops: - ParserEngine: parser_prism - TargetRubyVersion: 3.3 -``` - -The default value for `ParserEngine` is `parser_whitequark`, which indicates the Parser gem. You need to explicitly switch it to `parser_prism` to indicate Prism. Additionally, the value for `TargetRubyVersion` must be specified as `3.3` or higher, as Prism supports parsing versions of Ruby 3.3 and higher. -The parser class is determined by the combination of values for `ParserEngine` and `TargetRubyVersion`. For example, if `TargetRubyVersion: 3.3`, parsing is performed by `Prism::Translation::Parser33`, and for `TargetRubyVersion 3.4`, parsing is performed by `Prism::Translation::Parser34`. - -For further information, please refer to the RuboCop documentation: -https://docs.rubocop.org/rubocop/configuration.html#setting-the-parser-engine +If you also need to parse Ruby versions below 3.3 (for which the `prism` translation layer does not have explicit support), check out +[this guide](https://github.com/whitequark/parser/blob/master/doc/PRISM_TRANSLATION.md) from the `parser` gem on how to use both in conjunction. diff --git a/docs/releasing.md b/docs/releasing.md index d17602a320..a7d3cf5eb3 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -40,14 +40,15 @@ ruby -pi -e 'gsub(/^ruby-prism-sys = \{ version = ".+?"/, %Q{ruby-prism-sys = \{ * Update the `Gemfile.lock` file: ```sh -chruby ruby-3.5.0-dev +chruby ruby-4.0.0-dev bundle install ``` * Update the version-specific lockfiles: ```sh -bin/prism bundle install +for VERSION in "2.7" "3.0" "3.1" "3.2" "3.3" "3.4" "4.0"; do docker run -it --rm -v "$PWD":/usr/src/app -w /usr/src/app -e BUNDLE_GEMFILE="gemfiles/$VERSION/Gemfile" "ruby:$VERSION" bundle update; done +chruby ruby-4.1.0-dev && BUNDLE_GEMFILE=gemfiles/4.1/Gemfile bundle install ``` * Update the cargo lockfiles: @@ -71,26 +72,4 @@ git push ## Publishing * Update the GitHub release page with a copy of the latest entry in the `CHANGELOG.md` file. -* Publish the gem to [rubygems.org](rubygems.org). Note that you must have access to the `prism` gem to do this. - -```sh -bundle exec rake release -``` - -* Generate the `wasm` artifact (or download it from GitHub actions and put it in `javascript/src/prism.wasm`). - -```sh -make wasm -``` - -* Publish the JavaScript package to [npmjs.com](npmjs.com). Note that you must have access to the `@ruby/prism` package to do this. - -```sh -npm publish -``` - -* Publish the rust crate to [crates.io](crates.io). Note that you must have access to the `ruby-prism-sys` and `ruby-prism` crates to do this. - -```sh -bundle exec rake cargo:publish:real -``` +* Push a new tag to the GitHub repository, following the `vX.Y.Z` format. diff --git a/docs/ripper_translation.md b/docs/ripper_translation.md index af765da56f..92bbe74569 100644 --- a/docs/ripper_translation.md +++ b/docs/ripper_translation.md @@ -1,22 +1,6 @@ # Ripper translation -Prism provides the ability to mirror the `Ripper` standard library. You can do this by: - -```ruby -require "prism/translation/ripper/shim" -``` - -This provides the APIs like: - -```ruby -Ripper.lex -Ripper.parse -Ripper.sexp_raw -Ripper.sexp - -Ripper::SexpBuilder -Ripper::SexpBuilderPP -``` +Prism provides the ability to mirror the `Ripper` standard library. It is available under `Prism::Translation::Ripper`. You can use the entire public API, and also some undocumented features that are commonly used. Briefly, `Ripper` is a streaming parser that allows you to construct your own syntax tree. As an example: @@ -49,13 +33,20 @@ ArithmeticRipper.new("1 + 2 - 3").parse # => [0] The exact names of the `on_*` methods are listed in the `Ripper` source. +You can can also automatically use the ripper translation in places that don't explicitly use the translation layer by doing the following: + +```ruby +# Will redirect access of the `Ripper` constant to `Prism::Translation::Ripper`. +require "prism/translation/ripper/shim" +``` + ## Background It is helpful to understand the differences between the `Ripper` library and the `Prism` library. Both libraries perform parsing and provide you with APIs to manipulate and understand the resulting syntax tree. However, there are a few key differences. ### Design -`Ripper` is a streaming parser. This means as it is parsing Ruby code, it dispatches events back to the consumer. This allows quite a bit of flexibility. You can use it to build your own syntax tree or to find specific patterns in the code. `Prism` on the other hand returns to your the completed syntax tree _before_ it allows you to manipulate it. This means the tree that you get back is the only representation that can be generated by the parser _at parse time_ (but of course can be manipulated later). +`Ripper` is a streaming parser. This means as it is parsing Ruby code, it dispatches events back to the consumer. This allows quite a bit of flexibility. You can use it to build your own syntax tree or to find specific patterns in the code. `Prism` on the other hand returns to you the completed syntax tree _before_ it allows you to manipulate it. This means the tree that you get back is the only representation that can be generated by the parser _at parse time_ (but of course can be manipulated later). ### Fields diff --git a/docs/ruby_api.md b/docs/ruby_api.md index 6cfde4c1f3..c378417cfc 100644 --- a/docs/ruby_api.md +++ b/docs/ruby_api.md @@ -36,6 +36,7 @@ Once you have nodes in hand coming out of a parse result, there are a number of * `#accept(visitor)` - a method that will immediately call `visit_*` to specialize for the node type * `#child_nodes` - a positional array of the child nodes of the node, with `nil` values for any missing children * `#compact_child_nodes` - a positional array of the child nodes of the node with no `nil` values +* `#each_child_node` - with a block given yields all child nodes, without a block return an enumerator containing all child nodes * `#copy(**keys)` - a method that allows creating a shallow copy of the node with the given keys overridden * `#deconstruct`/`#deconstruct_keys(keys)` - the pattern matching interface for nodes * `#inspect` - a string representation that looks like the syntax tree of the node diff --git a/ext/prism/extconf.rb b/ext/prism/extconf.rb index 20ba28fe46..ae1691c979 100644 --- a/ext/prism/extconf.rb +++ b/ext/prism/extconf.rb @@ -37,7 +37,7 @@ def generate_templates Dir.chdir(File.expand_path("../..", __dir__)) do if !File.exist?("include/prism/ast.h") && Dir.exist?(".git") - system("templates/template.rb", exception: true) + system(RbConfig.ruby, "templates/template.rb", exception: true) end end end diff --git a/ext/prism/extension.c b/ext/prism/extension.c index 1533ca7bb3..71c2d91b98 100644 --- a/ext/prism/extension.c +++ b/ext/prism/extension.c @@ -25,6 +25,7 @@ VALUE rb_cPrismLexResult; VALUE rb_cPrismParseLexResult; VALUE rb_cPrismStringQuery; VALUE rb_cPrismScope; +VALUE rb_cPrismCurrentVersionError; VALUE rb_cPrismDebugEncoding; @@ -199,7 +200,12 @@ build_options_i(VALUE key, VALUE value, VALUE argument) { if (!NIL_P(value)) { const char *version = check_string(value); - if (!pm_options_version_set(options, version, RSTRING_LEN(value))) { + if (RSTRING_LEN(value) == 7 && strncmp(version, "current", 7) == 0) { + const char *current_version = RSTRING_PTR(rb_const_get(rb_cObject, rb_intern("RUBY_VERSION"))); + if (!pm_options_version_set(options, current_version, 3)) { + rb_exc_raise(rb_exc_new_cstr(rb_cPrismCurrentVersionError, current_version)); + } + } else if (!pm_options_version_set(options, version, RSTRING_LEN(value))) { rb_raise(rb_eArgError, "invalid version: %" PRIsVALUE, value); } } @@ -888,7 +894,7 @@ parse_input(pm_string_t *input, const pm_options_t *options) { * version of Ruby syntax (which you can trigger with `nil` or * `"latest"`). You may also restrict the syntax to a specific version of * Ruby, e.g., with `"3.3.0"`. To parse with the same syntax version that - * the current Ruby is running use `version: RUBY_VERSION`. Raises + * the current Ruby is running use `version: "current"`. Raises * ArgumentError if the version is not currently supported by Prism. */ static VALUE @@ -994,6 +1000,14 @@ profile_file(int argc, VALUE *argv, VALUE self) { return Qnil; } +static int +parse_stream_eof(void *stream) { + if (rb_funcall((VALUE) stream, rb_intern("eof?"), 0)) { + return 1; + } + return 0; +} + /** * An implementation of fgets that is suitable for use with Ruby IO objects. */ @@ -1034,7 +1048,7 @@ parse_stream(int argc, VALUE *argv, VALUE self) { pm_parser_t parser; pm_buffer_t buffer; - pm_node_t *node = pm_parse_stream(&parser, &buffer, (void *) stream, parse_stream_fgets, &options); + pm_node_t *node = pm_parse_stream(&parser, &buffer, (void *) stream, parse_stream_fgets, parse_stream_eof, &options); rb_encoding *encoding = rb_enc_find(parser.encoding->name); VALUE source = pm_source_new(&parser, encoding, options.freeze); @@ -1356,6 +1370,8 @@ Init_prism(void) { rb_cPrismStringQuery = rb_define_class_under(rb_cPrism, "StringQuery", rb_cObject); rb_cPrismScope = rb_define_class_under(rb_cPrism, "Scope", rb_cObject); + rb_cPrismCurrentVersionError = rb_const_get(rb_cPrism, rb_intern("CurrentVersionError")); + // Intern all of the IDs eagerly that we support so that we don't have to do // it every time we parse. rb_id_option_command_line = rb_intern_const("command_line"); diff --git a/ext/prism/extension.h b/ext/prism/extension.h index 506da2fd6f..510faa48e8 100644 --- a/ext/prism/extension.h +++ b/ext/prism/extension.h @@ -1,7 +1,7 @@ #ifndef PRISM_EXT_NODE_H #define PRISM_EXT_NODE_H -#define EXPECTED_PRISM_VERSION "1.4.0" +#define EXPECTED_PRISM_VERSION "1.8.0" #include #include diff --git a/fuzz/docker/Dockerfile b/fuzz/docker/Dockerfile index 56a0e22c04..839732dd7d 100644 --- a/fuzz/docker/Dockerfile +++ b/fuzz/docker/Dockerfile @@ -1,8 +1,9 @@ -FROM aflplusplus/aflplusplus +FROM aflplusplus/aflplusplus:v4.32c ARG USERNAME=prism ARG USER_UID=1000 ARG USER_GID=$USER_UID +ARG RUBY_VERSION=3.3.10 ENV MAKEFLAGS=-j8 RUN groupadd --gid $USER_GID $USERNAME \ @@ -12,10 +13,10 @@ RUN groupadd --gid $USER_GID $USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME -RUN wget https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz -RUN tar -xvf ruby-3.2.2.tar.gz +RUN wget https://cache.ruby-lang.org/pub/ruby/3.3/ruby-${RUBY_VERSION}.tar.gz -O ruby.tar.gz +RUN mkdir ruby-source && tar -xvf ruby.tar.gz -C ruby-source --strip-components=1 RUN apt update && apt -y install libyaml-dev libz-dev libssl-dev -RUN cd ruby-3.2.2 && ./configure --disable-install-doc && make && make install +RUN cd ruby-source && ./configure --disable-install-doc && make && make install RUN gem install rake-compiler ruby_memcheck RUN git clone https://github.com/pwndbg/pwndbg && cd pwndbg && ./setup.sh ENV LC_CTYPE=C.UTF-8 diff --git a/gemfiles/2.7/Gemfile b/gemfiles/2.7/Gemfile index 35cf9d18b1..8d1fbb82cd 100644 --- a/gemfiles/2.7/Gemfile +++ b/gemfiles/2.7/Gemfile @@ -11,4 +11,5 @@ gem "parser" gem "rake-compiler" gem "rake" gem "rbs" +gem "ruby_parser" gem "test-unit" diff --git a/gemfiles/2.7/Gemfile.lock b/gemfiles/2.7/Gemfile.lock index 573b04b2f2..9ade0c96f1 100644 --- a/gemfiles/2.7/Gemfile.lock +++ b/gemfiles/2.7/Gemfile.lock @@ -1,23 +1,27 @@ PATH remote: ../.. specs: - prism (1.4.0) + prism (1.8.0) GEM remote: https://rubygems.org/ specs: - ast (2.4.2) + ast (2.4.3) onigmo (0.1.0) - parser (3.3.7.2) + parser (3.3.10.1) ast (~> 2.4.1) racc - power_assert (2.0.5) + power_assert (3.0.1) racc (1.8.1) - rake (13.2.1) - rake-compiler (1.2.9) + rake (13.3.1) + rake-compiler (1.3.1) rake rbs (3.1.3) - test-unit (3.6.7) + ruby_parser (3.21.1) + racc (~> 1.5) + sexp_processor (~> 4.16) + sexp_processor (4.17.4) + test-unit (3.7.7) power_assert PLATFORMS @@ -30,6 +34,7 @@ DEPENDENCIES rake rake-compiler rbs + ruby_parser test-unit RUBY VERSION diff --git a/gemfiles/3.0/Gemfile b/gemfiles/3.0/Gemfile index e53808b48d..c52f90eaf8 100644 --- a/gemfiles/3.0/Gemfile +++ b/gemfiles/3.0/Gemfile @@ -12,4 +12,5 @@ gem "rake-compiler" gem "rake" gem "rbs" gem "ruby_memcheck" +gem "ruby_parser" gem "test-unit" diff --git a/gemfiles/3.0/Gemfile.lock b/gemfiles/3.0/Gemfile.lock index 212ccb05d9..ad6244bfbd 100644 --- a/gemfiles/3.0/Gemfile.lock +++ b/gemfiles/3.0/Gemfile.lock @@ -1,31 +1,35 @@ PATH remote: ../.. specs: - prism (1.4.0) + prism (1.8.0) GEM remote: https://rubygems.org/ specs: - ast (2.4.2) - logger (1.6.1) - mini_portile2 (2.8.8) + ast (2.4.3) + logger (1.7.0) + mini_portile2 (2.8.9) nokogiri (1.17.2) mini_portile2 (~> 2.8.2) racc (~> 1.4) onigmo (0.1.0) - parser (3.3.7.2) + parser (3.3.10.1) ast (~> 2.4.1) racc - power_assert (2.0.4) + power_assert (3.0.1) racc (1.8.1) - rake (13.2.1) - rake-compiler (1.2.9) + rake (13.3.1) + rake-compiler (1.3.1) rake rbs (3.6.1) logger ruby_memcheck (3.0.1) nokogiri - test-unit (3.6.7) + ruby_parser (3.21.1) + racc (~> 1.5) + sexp_processor (~> 4.16) + sexp_processor (4.17.4) + test-unit (3.7.7) power_assert PLATFORMS @@ -39,6 +43,7 @@ DEPENDENCIES rake-compiler rbs ruby_memcheck + ruby_parser test-unit RUBY VERSION diff --git a/gemfiles/3.1/Gemfile b/gemfiles/3.1/Gemfile index 39ac18ab72..b17401ffc3 100644 --- a/gemfiles/3.1/Gemfile +++ b/gemfiles/3.1/Gemfile @@ -12,4 +12,5 @@ gem "rake-compiler" gem "rake" gem "rbs" gem "ruby_memcheck" +gem "ruby_parser" gem "test-unit" diff --git a/gemfiles/3.1/Gemfile.lock b/gemfiles/3.1/Gemfile.lock index 33fc2feb03..54b6cbb4c2 100644 --- a/gemfiles/3.1/Gemfile.lock +++ b/gemfiles/3.1/Gemfile.lock @@ -1,31 +1,35 @@ PATH remote: ../.. specs: - prism (1.4.0) + prism (1.8.0) GEM remote: https://rubygems.org/ specs: ast (2.4.3) - logger (1.6.6) - mini_portile2 (2.8.8) - nokogiri (1.18.5) + logger (1.7.0) + mini_portile2 (2.8.9) + nokogiri (1.18.10) mini_portile2 (~> 2.8.2) racc (~> 1.4) onigmo (0.1.0) - parser (3.3.7.2) + parser (3.3.10.1) ast (~> 2.4.1) racc - power_assert (2.0.5) + power_assert (3.0.1) racc (1.8.1) - rake (13.2.1) - rake-compiler (1.2.9) + rake (13.3.1) + rake-compiler (1.3.1) rake - rbs (3.9.1) + rbs (3.10.2) logger ruby_memcheck (3.0.1) nokogiri - test-unit (3.6.7) + ruby_parser (3.21.1) + racc (~> 1.5) + sexp_processor (~> 4.16) + sexp_processor (4.17.4) + test-unit (3.7.7) power_assert PLATFORMS @@ -39,10 +43,11 @@ DEPENDENCIES rake-compiler rbs ruby_memcheck + ruby_parser test-unit RUBY VERSION ruby 3.1.4p223 BUNDLED WITH - 2.3.26 + 2.3.27 diff --git a/gemfiles/3.2/Gemfile b/gemfiles/3.2/Gemfile index 5c87ea3074..009b09ec1a 100644 --- a/gemfiles/3.2/Gemfile +++ b/gemfiles/3.2/Gemfile @@ -12,4 +12,5 @@ gem "rake-compiler" gem "rake" gem "rbs" gem "ruby_memcheck" +gem "ruby_parser" gem "test-unit" diff --git a/gemfiles/3.2/Gemfile.lock b/gemfiles/3.2/Gemfile.lock index a10e7b2c8d..c859d7f8d4 100644 --- a/gemfiles/3.2/Gemfile.lock +++ b/gemfiles/3.2/Gemfile.lock @@ -1,31 +1,35 @@ PATH remote: ../.. specs: - prism (1.4.0) + prism (1.8.0) GEM remote: https://rubygems.org/ specs: ast (2.4.3) - logger (1.6.6) - mini_portile2 (2.8.8) - nokogiri (1.18.5) + logger (1.7.0) + mini_portile2 (2.8.9) + nokogiri (1.19.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) onigmo (0.1.0) - parser (3.3.7.2) + parser (3.3.10.1) ast (~> 2.4.1) racc - power_assert (2.0.5) + power_assert (3.0.1) racc (1.8.1) - rake (13.2.1) - rake-compiler (1.2.9) + rake (13.3.1) + rake-compiler (1.3.1) rake - rbs (3.9.1) + rbs (3.10.2) logger ruby_memcheck (3.0.1) nokogiri - test-unit (3.6.7) + ruby_parser (3.22.0) + racc (~> 1.5) + sexp_processor (~> 4.16) + sexp_processor (4.17.5) + test-unit (3.7.7) power_assert PLATFORMS @@ -39,10 +43,11 @@ DEPENDENCIES rake-compiler rbs ruby_memcheck + ruby_parser test-unit RUBY VERSION ruby 3.2.3p157 BUNDLED WITH - 2.4.19 + 2.6.2 diff --git a/gemfiles/3.3/Gemfile b/gemfiles/3.3/Gemfile index 245b121938..73006ce144 100644 --- a/gemfiles/3.3/Gemfile +++ b/gemfiles/3.3/Gemfile @@ -12,4 +12,5 @@ gem "rake-compiler" gem "rake" gem "rbs" gem "ruby_memcheck" +gem "ruby_parser" gem "test-unit" diff --git a/gemfiles/3.3/Gemfile.lock b/gemfiles/3.3/Gemfile.lock index 792c529c22..74c43f1841 100644 --- a/gemfiles/3.3/Gemfile.lock +++ b/gemfiles/3.3/Gemfile.lock @@ -1,31 +1,35 @@ PATH remote: ../.. specs: - prism (1.4.0) + prism (1.8.0) GEM remote: https://rubygems.org/ specs: ast (2.4.3) - logger (1.6.6) - mini_portile2 (2.8.8) - nokogiri (1.18.5) + logger (1.7.0) + mini_portile2 (2.8.9) + nokogiri (1.19.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) onigmo (0.1.0) - parser (3.3.7.2) + parser (3.3.10.1) ast (~> 2.4.1) racc - power_assert (2.0.5) + power_assert (3.0.1) racc (1.8.1) - rake (13.2.1) - rake-compiler (1.2.9) + rake (13.3.1) + rake-compiler (1.3.1) rake - rbs (3.9.1) + rbs (3.10.2) logger ruby_memcheck (3.0.1) nokogiri - test-unit (3.6.7) + ruby_parser (3.22.0) + racc (~> 1.5) + sexp_processor (~> 4.16) + sexp_processor (4.17.5) + test-unit (3.7.7) power_assert PLATFORMS @@ -39,10 +43,11 @@ DEPENDENCIES rake-compiler rbs ruby_memcheck + ruby_parser test-unit RUBY VERSION ruby 3.3.0p0 BUNDLED WITH - 2.5.16 + 2.5.22 diff --git a/gemfiles/3.4/Gemfile b/gemfiles/3.4/Gemfile index eb904ae3b2..2e86887f58 100644 --- a/gemfiles/3.4/Gemfile +++ b/gemfiles/3.4/Gemfile @@ -12,4 +12,5 @@ gem "rake-compiler" gem "rake" gem "rbs" gem "ruby_memcheck" +gem "ruby_parser" gem "test-unit" diff --git a/gemfiles/3.4/Gemfile.lock b/gemfiles/3.4/Gemfile.lock index be614dd47f..6588db982a 100644 --- a/gemfiles/3.4/Gemfile.lock +++ b/gemfiles/3.4/Gemfile.lock @@ -1,31 +1,35 @@ PATH remote: ../.. specs: - prism (1.4.0) + prism (1.8.0) GEM remote: https://rubygems.org/ specs: ast (2.4.3) - logger (1.6.6) - mini_portile2 (2.8.8) - nokogiri (1.18.5) + logger (1.7.0) + mini_portile2 (2.8.9) + nokogiri (1.19.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) onigmo (0.1.0) - parser (3.3.7.2) + parser (3.3.10.1) ast (~> 2.4.1) racc - power_assert (2.0.5) + power_assert (3.0.1) racc (1.8.1) - rake (13.2.1) - rake-compiler (1.2.9) + rake (13.3.1) + rake-compiler (1.3.1) rake - rbs (3.9.1) + rbs (3.10.2) logger ruby_memcheck (3.0.1) nokogiri - test-unit (3.6.7) + ruby_parser (3.22.0) + racc (~> 1.5) + sexp_processor (~> 4.16) + sexp_processor (4.17.5) + test-unit (3.7.7) power_assert PLATFORMS @@ -39,10 +43,11 @@ DEPENDENCIES rake-compiler rbs ruby_memcheck + ruby_parser test-unit RUBY VERSION ruby 3.4.1p0 BUNDLED WITH - 2.6.2 + 2.6.9 diff --git a/gemfiles/3.5/Gemfile b/gemfiles/4.0/Gemfile similarity index 86% rename from gemfiles/3.5/Gemfile rename to gemfiles/4.0/Gemfile index 84787640b0..f3fef38fe8 100644 --- a/gemfiles/3.5/Gemfile +++ b/gemfiles/4.0/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -ruby "~> 3.5.0.dev" +ruby "~> 4.0.0" gemspec path: "../.." @@ -13,4 +13,5 @@ gem "rake-compiler" gem "rake" gem "rbs" gem "ruby_memcheck" +gem "ruby_parser" gem "test-unit" diff --git a/gemfiles/3.5/Gemfile.lock b/gemfiles/4.0/Gemfile.lock similarity index 54% rename from gemfiles/3.5/Gemfile.lock rename to gemfiles/4.0/Gemfile.lock index c654e57020..639c008144 100644 --- a/gemfiles/3.5/Gemfile.lock +++ b/gemfiles/4.0/Gemfile.lock @@ -1,32 +1,36 @@ PATH remote: ../.. specs: - prism (1.4.0) + prism (1.8.0) GEM remote: https://rubygems.org/ specs: ast (2.4.3) - ffi (1.17.1) - logger (1.6.6) - mini_portile2 (2.8.8) - nokogiri (1.18.5) + ffi (1.17.3) + logger (1.7.0) + mini_portile2 (2.8.9) + nokogiri (1.19.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) onigmo (0.1.0) - parser (3.3.7.2) + parser (3.3.10.1) ast (~> 2.4.1) racc - power_assert (2.0.5) + power_assert (3.0.1) racc (1.8.1) - rake (13.2.1) - rake-compiler (1.2.9) + rake (13.3.1) + rake-compiler (1.3.1) rake - rbs (3.9.1) + rbs (3.10.2) logger ruby_memcheck (3.0.1) nokogiri - test-unit (3.6.7) + ruby_parser (3.22.0) + racc (~> 1.5) + sexp_processor (~> 4.16) + sexp_processor (4.17.5) + test-unit (3.7.7) power_assert PLATFORMS @@ -41,10 +45,11 @@ DEPENDENCIES rake-compiler rbs ruby_memcheck + ruby_parser test-unit RUBY VERSION - ruby 3.5.0.dev + ruby 4.0.0 BUNDLED WITH - 2.7.0.dev + 4.0.3 diff --git a/gemfiles/truffleruby/Gemfile b/gemfiles/4.1/Gemfile similarity index 57% rename from gemfiles/truffleruby/Gemfile rename to gemfiles/4.1/Gemfile index f9b1976fa9..3fde9d4ac1 100644 --- a/gemfiles/truffleruby/Gemfile +++ b/gemfiles/4.1/Gemfile @@ -2,11 +2,16 @@ source "https://rubygems.org" -ruby "~> 3.3.5", engine: "truffleruby", engine_version: "~> 24.2.0" +ruby ">= 4.1.0.dev" gemspec path: "../.." +gem "ffi" +gem "onigmo", platforms: :ruby gem "parser" -gem "rake" gem "rake-compiler" +gem "rake" +gem "rbs" +gem "ruby_memcheck" +gem "ruby_parser" gem "test-unit" diff --git a/gemfiles/4.1/Gemfile.lock b/gemfiles/4.1/Gemfile.lock new file mode 100644 index 0000000000..b0741aa37f --- /dev/null +++ b/gemfiles/4.1/Gemfile.lock @@ -0,0 +1,55 @@ +PATH + remote: ../.. + specs: + prism (1.8.0) + +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.3) + ffi (1.17.3) + logger (1.7.0) + mini_portile2 (2.8.9) + nokogiri (1.19.0) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + onigmo (0.1.0) + parser (3.3.10.1) + ast (~> 2.4.1) + racc + power_assert (3.0.1) + racc (1.8.1) + rake (13.3.1) + rake-compiler (1.3.1) + rake + rbs (3.10.2) + logger + ruby_memcheck (3.0.1) + nokogiri + ruby_parser (3.22.0) + racc (~> 1.5) + sexp_processor (~> 4.16) + sexp_processor (4.17.5) + test-unit (3.7.7) + power_assert + +PLATFORMS + ruby + +DEPENDENCIES + ffi + onigmo + parser + prism! + rake + rake-compiler + rbs + ruby_memcheck + ruby_parser + test-unit + +RUBY VERSION + ruby 4.1.0.dev + +BUNDLED WITH + 4.1.0.dev diff --git a/gemfiles/jruby/Gemfile b/gemfiles/jruby/Gemfile deleted file mode 100644 index 6d2ca211b6..0000000000 --- a/gemfiles/jruby/Gemfile +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" - -ruby "~> 3.1.4", engine: "jruby", engine_version: "~> 9.4.5" - -gemspec path: "../.." - -gem "parser" -gem "rake" -gem "rake-compiler" -gem "test-unit" diff --git a/gemfiles/jruby/Gemfile.lock b/gemfiles/jruby/Gemfile.lock deleted file mode 100644 index d388c683bb..0000000000 --- a/gemfiles/jruby/Gemfile.lock +++ /dev/null @@ -1,42 +0,0 @@ -PATH - remote: ../.. - specs: - prism (1.4.0) - -GEM - remote: https://rubygems.org/ - specs: - ast (2.4.3) - parser (3.3.7.2) - ast (~> 2.4.1) - racc - power_assert (2.0.5) - racc (1.8.1) - racc (1.8.1-java) - rake (13.2.1) - rake-compiler (1.2.9) - rake - test-unit (3.6.7) - power_assert - -PLATFORMS - universal-java-11 - universal-java-17 - universal-java-20 - universal-java-21 - universal-java-22 - universal-java-23 - x86_64-linux - -DEPENDENCIES - parser - prism! - rake - rake-compiler - test-unit - -RUBY VERSION - ruby 3.1.4p0 (jruby 9.4.5.0) - -BUNDLED WITH - 2.3.26 diff --git a/gemfiles/truffleruby/Gemfile.lock b/gemfiles/truffleruby/Gemfile.lock deleted file mode 100644 index 1bf4241a4b..0000000000 --- a/gemfiles/truffleruby/Gemfile.lock +++ /dev/null @@ -1,35 +0,0 @@ -PATH - remote: ../.. - specs: - prism (1.4.0) - -GEM - remote: https://rubygems.org/ - specs: - ast (2.4.3) - parser (3.3.7.2) - ast (~> 2.4.1) - racc - power_assert (2.0.5) - racc (1.8.1) - rake (13.2.1) - rake-compiler (1.2.9) - rake - test-unit (3.6.7) - power_assert - -PLATFORMS - ruby - -DEPENDENCIES - parser - prism! - rake - rake-compiler - test-unit - -RUBY VERSION - ruby 3.3.5p0 (truffleruby 24.2.0) - -BUNDLED WITH - 2.4.19 diff --git a/gemfiles/typecheck/Gemfile b/gemfiles/typecheck/Gemfile index 906239ced5..b535d28729 100644 --- a/gemfiles/typecheck/Gemfile +++ b/gemfiles/typecheck/Gemfile @@ -8,7 +8,7 @@ gem "rake-compiler" gem "rake" gem "rbs" gem "ruby_parser" -gem "sorbet" +gem "sorbet", "<= 0.6.12666" # until tapioca is bumped gem "steep", ">= 1.7.0.dev.1" gem "tapioca" gem "test-unit" diff --git a/gemfiles/typecheck/Gemfile.lock b/gemfiles/typecheck/Gemfile.lock index 59c461344d..d3d512dc9e 100644 --- a/gemfiles/typecheck/Gemfile.lock +++ b/gemfiles/typecheck/Gemfile.lock @@ -1,79 +1,81 @@ GEM remote: https://rubygems.org/ specs: - activesupport (8.0.2) + activesupport (8.1.1) base64 - benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json logger (>= 1.4.2) minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) ast (2.4.3) - base64 (0.2.0) - benchmark (0.4.0) - bigdecimal (3.1.9) + base64 (0.3.0) + benchmark (0.5.0) + bigdecimal (3.3.1) concurrent-ruby (1.3.5) - connection_pool (2.5.0) - csv (3.3.3) - drb (2.2.1) + connection_pool (2.5.4) + csv (3.3.5) + drb (2.2.3) erubi (1.13.1) - ffi (1.17.1-arm64-darwin) - ffi (1.17.1-x86_64-linux-gnu) - fileutils (1.7.3) + ffi (1.17.3-arm64-darwin) + ffi (1.17.3-x86_64-linux-gnu) + fileutils (1.8.0) i18n (1.14.7) concurrent-ruby (~> 1.0) - json (2.10.2) - language_server-protocol (3.17.0.4) + json (2.16.0) + language_server-protocol (3.17.0.5) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.6) - minitest (5.25.5) + logger (1.7.0) + minitest (6.0.1) + prism (~> 1.5) mutex_m (0.3.0) netrc (0.11.0) - parallel (1.26.3) - parser (3.3.7.2) + parallel (1.27.0) + parser (3.3.10.1) ast (~> 2.4.1) racc - power_assert (2.0.5) - prism (1.4.0) + power_assert (3.0.1) + prism (1.7.0) racc (1.8.1) rainbow (3.1.1) - rake (13.2.1) - rake-compiler (1.2.9) + rake (13.3.1) + rake-compiler (1.3.1) rake rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rbi (0.3.1) + rbi (0.3.7) prism (~> 1.0) rbs (>= 3.4.4) - sorbet-runtime (>= 0.5.9204) - rbs (3.9.1) + rbs (3.10.2) logger - ruby_parser (3.21.1) + rexml (3.4.4) + ruby_parser (3.22.0) racc (~> 1.5) sexp_processor (~> 4.16) securerandom (0.4.1) - sexp_processor (4.17.3) - sorbet (0.5.11953) - sorbet-static (= 0.5.11953) - sorbet-runtime (0.5.11953) - sorbet-static (0.5.11953-universal-darwin) - sorbet-static (0.5.11953-x86_64-linux) - sorbet-static-and-runtime (0.5.11953) - sorbet (= 0.5.11953) - sorbet-runtime (= 0.5.11953) - spoom (1.6.1) + sexp_processor (4.17.4) + sorbet (0.6.12666) + sorbet-static (= 0.6.12666) + sorbet-runtime (0.6.12666) + sorbet-static (0.6.12666-universal-darwin) + sorbet-static (0.6.12666-x86_64-linux) + sorbet-static-and-runtime (0.6.12666) + sorbet (= 0.6.12666) + sorbet-runtime (= 0.6.12666) + spoom (1.6.3) erubi (>= 1.10.0) prism (>= 0.28.0) - rbi (>= 0.2.3) + rbi (>= 0.3.3) + rexml (>= 3.2.6) sorbet-static-and-runtime (>= 0.5.10187) thor (>= 0.19.2) steep (1.10.0) @@ -93,7 +95,7 @@ GEM strscan (>= 1.0.0) terminal-table (>= 2, < 5) uri (>= 0.12.0) - strscan (3.1.2) + strscan (3.1.5) tapioca (0.16.11) benchmark bundler (>= 2.2.25) @@ -106,15 +108,15 @@ GEM yard-sorbet terminal-table (4.0.0) unicode-display_width (>= 1.1.1, < 4) - test-unit (3.6.7) + test-unit (3.7.7) power_assert - thor (1.3.2) + thor (1.4.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (3.1.4) - unicode-emoji (~> 4.0, >= 4.0.4) - unicode-emoji (4.0.4) - uri (1.0.3) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) + uri (1.1.1) yard (0.9.37) yard-sorbet (0.9.0) sorbet-runtime @@ -131,7 +133,7 @@ DEPENDENCIES rake-compiler rbs ruby_parser - sorbet + sorbet (<= 0.6.12666) steep (>= 1.7.0.dev.1) tapioca test-unit diff --git a/include/prism.h b/include/prism.h index 317568aa0c..c468db18be 100644 --- a/include/prism.h +++ b/include/prism.h @@ -49,10 +49,15 @@ PRISM_EXPORTED_FUNCTION const char * pm_version(void); /** * Initialize a parser with the given start and end pointers. * + * The resulting parser must eventually be freed with `pm_parser_free()`. + * * @param parser The parser to initialize. * @param source The source to parse. * @param size The size of the source. - * @param options The optional options to use when parsing. + * @param options The optional options to use when parsing. These options must + * live for the whole lifetime of this parser. + * + * \public \memberof pm_parser */ PRISM_EXPORTED_FUNCTION void pm_parser_init(pm_parser_t *parser, const uint8_t *source, size_t size, const pm_options_t *options); @@ -62,13 +67,20 @@ PRISM_EXPORTED_FUNCTION void pm_parser_init(pm_parser_t *parser, const uint8_t * * * @param parser The parser to register the callback with. * @param callback The callback to register. + * + * \public \memberof pm_parser */ PRISM_EXPORTED_FUNCTION void pm_parser_register_encoding_changed_callback(pm_parser_t *parser, pm_encoding_changed_callback_t callback); /** * Free any memory associated with the given parser. * + * This does not free the `pm_options_t` object that was used to initialize the + * parser. + * * @param parser The parser to free. + * + * \public \memberof pm_parser */ PRISM_EXPORTED_FUNCTION void pm_parser_free(pm_parser_t *parser); @@ -77,16 +89,25 @@ PRISM_EXPORTED_FUNCTION void pm_parser_free(pm_parser_t *parser); * * @param parser The parser to use. * @return The AST representing the source. + * + * \public \memberof pm_parser */ PRISM_EXPORTED_FUNCTION pm_node_t * pm_parse(pm_parser_t *parser); /** - * This function is used in pm_parse_stream to retrieve a line of input from a + * This function is used in pm_parse_stream() to retrieve a line of input from a * stream. It closely mirrors that of fgets so that fgets can be used as the * default implementation. */ typedef char * (pm_parse_stream_fgets_t)(char *string, int size, void *stream); +/** + * This function is used in pm_parse_stream to check whether a stream is EOF. + * It closely mirrors that of feof so that feof can be used as the + * default implementation. + */ +typedef int (pm_parse_stream_feof_t)(void *stream); + /** * Parse a stream of Ruby source and return the tree. * @@ -94,10 +115,13 @@ typedef char * (pm_parse_stream_fgets_t)(char *string, int size, void *stream); * @param buffer The buffer to use. * @param stream The stream to parse. * @param stream_fgets The function to use to read from the stream. + * @param stream_feof The function to use to determine if the stream has hit eof. * @param options The optional options to use when parsing. * @return The AST representing the source. + * + * \public \memberof pm_parser */ -PRISM_EXPORTED_FUNCTION pm_node_t * pm_parse_stream(pm_parser_t *parser, pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets, const pm_options_t *options); +PRISM_EXPORTED_FUNCTION pm_node_t * pm_parse_stream(pm_parser_t *parser, pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets, pm_parse_stream_feof_t *stream_feof, const pm_options_t *options); // We optionally support serializing to a binary string. For systems that don't // want or need this functionality, it can be turned off with the @@ -111,9 +135,10 @@ PRISM_EXPORTED_FUNCTION pm_node_t * pm_parse_stream(pm_parser_t *parser, pm_buff * @param buffer The buffer to serialize to. * @param stream The stream to parse. * @param stream_fgets The function to use to read from the stream. + * @param stream_feof The function to use to tell if the stream has hit eof. * @param data The optional data to pass to the parser. */ -PRISM_EXPORTED_FUNCTION void pm_serialize_parse_stream(pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets, const char *data); +PRISM_EXPORTED_FUNCTION void pm_serialize_parse_stream(pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets, pm_parse_stream_feof_t *stream_feof, const char *data); /** * Serialize the given list of comments to the given buffer. @@ -289,7 +314,7 @@ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_method_name(const uint * dependencies. It is currently being integrated into * [CRuby](https://github.com/ruby/ruby), * [JRuby](https://github.com/jruby/jruby), - * [TruffleRuby](https://github.com/oracle/truffleruby), + * [TruffleRuby](https://github.com/truffleruby/truffleruby), * [Sorbet](https://github.com/sorbet/sorbet), and * [Syntax Tree](https://github.com/ruby-syntax-tree/syntax_tree). * @@ -307,10 +332,10 @@ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_method_name(const uint * to want to use and be aware of are: * * * `pm_parser_t` - the main parser structure - * * `pm_parser_init` - initialize a parser - * * `pm_parse` - parse and return the root node - * * `pm_node_destroy` - deallocate the root node returned by `pm_parse` - * * `pm_parser_free` - free the internal memory of the parser + * * `pm_parser_init()` - initialize a parser + * * `pm_parse()` - parse and return the root node + * * `pm_node_destroy()` - deallocate the root node returned by `pm_parse()` + * * `pm_parser_free()` - free the internal memory of the parser * * Putting all of this together would look something like: * @@ -327,8 +352,8 @@ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_method_name(const uint * } * ``` * - * All of the nodes "inherit" from `pm_node_t` by embedding those structures as - * their first member. This means you can downcast and upcast any node in the + * All of the nodes "inherit" from `pm_node_t` by embedding those structures + * as their first member. This means you can downcast and upcast any node in the * tree to a `pm_node_t`. * * @section serializing Serializing @@ -340,9 +365,9 @@ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_method_name(const uint * use and be aware of are: * * * `pm_buffer_t` - a small buffer object that will hold the serialized AST - * * `pm_buffer_free` - free the memory associated with the buffer - * * `pm_serialize` - serialize the AST into a buffer - * * `pm_serialize_parse` - parse and serialize the AST into a buffer + * * `pm_buffer_free()` - free the memory associated with the buffer + * * `pm_serialize()` - serialize the AST into a buffer + * * `pm_serialize_parse()` - parse and serialize the AST into a buffer * * Putting all of this together would look something like: * @@ -360,7 +385,7 @@ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_method_name(const uint * @section inspecting Inspecting * * Prism provides the ability to inspect the AST by pretty-printing nodes. You - * can do this with the `pm_prettyprint` function, which you would use like: + * can do this with the `pm_prettyprint()` function, which you would use like: * * ```c * void prettyprint(const uint8_t *source, size_t length) { diff --git a/include/prism/options.h b/include/prism/options.h index 2f64701b0c..c00c7bf755 100644 --- a/include/prism/options.h +++ b/include/prism/options.h @@ -82,14 +82,26 @@ typedef void (*pm_options_shebang_callback_t)(struct pm_options *options, const * parse in the same way as a specific version of CRuby would have. */ typedef enum { - /** The current version of prism. */ - PM_OPTIONS_VERSION_LATEST = 0, + /** If an explicit version is not provided, the current version of prism will be used. */ + PM_OPTIONS_VERSION_UNSET = 0, /** The vendored version of prism in CRuby 3.3.x. */ PM_OPTIONS_VERSION_CRUBY_3_3 = 1, /** The vendored version of prism in CRuby 3.4.x. */ - PM_OPTIONS_VERSION_CRUBY_3_4 = 2 + PM_OPTIONS_VERSION_CRUBY_3_4 = 2, + + /** The vendored version of prism in CRuby 4.0.x. */ + PM_OPTIONS_VERSION_CRUBY_3_5 = 3, + + /** The vendored version of prism in CRuby 4.0.x. */ + PM_OPTIONS_VERSION_CRUBY_4_0 = 3, + + /** The vendored version of prism in CRuby 4.1.x. */ + PM_OPTIONS_VERSION_CRUBY_4_1 = 4, + + /** The current version of prism. */ + PM_OPTIONS_VERSION_LATEST = PM_OPTIONS_VERSION_CRUBY_4_1 } pm_options_version_t; /** @@ -231,6 +243,8 @@ static const uint8_t PM_OPTIONS_COMMAND_LINE_X = 0x20; * @param shebang_callback The shebang callback to set. * @param shebang_callback_data Any additional data that should be passed along * to the callback. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_shebang_callback_set(pm_options_t *options, pm_options_shebang_callback_t shebang_callback, void *shebang_callback_data); @@ -239,6 +253,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_shebang_callback_set(pm_options_t *optio * * @param options The options struct to set the filepath on. * @param filepath The filepath to set. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_filepath_set(pm_options_t *options, const char *filepath); @@ -247,6 +263,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_filepath_set(pm_options_t *options, cons * * @param options The options struct to set the line on. * @param line The line to set. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_line_set(pm_options_t *options, int32_t line); @@ -255,6 +273,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_line_set(pm_options_t *options, int32_t * * @param options The options struct to set the encoding on. * @param encoding The encoding to set. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_encoding_set(pm_options_t *options, const char *encoding); @@ -263,6 +283,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_encoding_set(pm_options_t *options, cons * * @param options The options struct to set the encoding_locked value on. * @param encoding_locked The encoding_locked value to set. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_encoding_locked_set(pm_options_t *options, bool encoding_locked); @@ -271,6 +293,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_encoding_locked_set(pm_options_t *option * * @param options The options struct to set the frozen string literal value on. * @param frozen_string_literal The frozen string literal value to set. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_literal); @@ -279,6 +303,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_frozen_string_literal_set(pm_options_t * * * @param options The options struct to set the command line option on. * @param command_line The command_line value to set. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_command_line_set(pm_options_t *options, uint8_t command_line); @@ -291,6 +317,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_command_line_set(pm_options_t *options, * @param version The version to set. * @param length The length of the version string. * @return Whether or not the version was parsed successfully. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION bool pm_options_version_set(pm_options_t *options, const char *version, size_t length); @@ -299,6 +327,8 @@ PRISM_EXPORTED_FUNCTION bool pm_options_version_set(pm_options_t *options, const * * @param options The options struct to set the main script value on. * @param main_script The main script value to set. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_main_script_set(pm_options_t *options, bool main_script); @@ -307,6 +337,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_main_script_set(pm_options_t *options, b * * @param options The options struct to set the partial script value on. * @param partial_script The partial script value to set. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_partial_script_set(pm_options_t *options, bool partial_script); @@ -315,6 +347,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_partial_script_set(pm_options_t *options * * @param options The options struct to set the freeze value on. * @param freeze The freeze value to set. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_freeze_set(pm_options_t *options, bool freeze); @@ -324,6 +358,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_freeze_set(pm_options_t *options, bool f * @param options The options struct to initialize the scopes array on. * @param scopes_count The number of scopes to allocate. * @return Whether or not the scopes array was initialized successfully. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION bool pm_options_scopes_init(pm_options_t *options, size_t scopes_count); @@ -333,6 +369,8 @@ PRISM_EXPORTED_FUNCTION bool pm_options_scopes_init(pm_options_t *options, size_ * @param options The options struct to get the scope from. * @param index The index of the scope to get. * @return A pointer to the scope at the given index. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION const pm_options_scope_t * pm_options_scope_get(const pm_options_t *options, size_t index); @@ -343,6 +381,8 @@ PRISM_EXPORTED_FUNCTION const pm_options_scope_t * pm_options_scope_get(const pm * @param scope The scope struct to initialize. * @param locals_count The number of locals to allocate. * @return Whether or not the scope was initialized successfully. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION bool pm_options_scope_init(pm_options_scope_t *scope, size_t locals_count); @@ -352,6 +392,8 @@ PRISM_EXPORTED_FUNCTION bool pm_options_scope_init(pm_options_scope_t *scope, si * @param scope The scope struct to get the local from. * @param index The index of the local to get. * @return A pointer to the local at the given index. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION const pm_string_t * pm_options_scope_local_get(const pm_options_scope_t *scope, size_t index); @@ -360,6 +402,8 @@ PRISM_EXPORTED_FUNCTION const pm_string_t * pm_options_scope_local_get(const pm_ * * @param scope The scope struct to set the forwarding on. * @param forwarding The forwarding value to set. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_scope_forwarding_set(pm_options_scope_t *scope, uint8_t forwarding); @@ -367,6 +411,8 @@ PRISM_EXPORTED_FUNCTION void pm_options_scope_forwarding_set(pm_options_scope_t * Free the internal memory associated with the options. * * @param options The options struct whose internal memory should be freed. + * + * \public \memberof pm_options */ PRISM_EXPORTED_FUNCTION void pm_options_free(pm_options_t *options); diff --git a/include/prism/parser.h b/include/prism/parser.h index 992729d655..95d7aac710 100644 --- a/include/prism/parser.h +++ b/include/prism/parser.h @@ -299,6 +299,9 @@ typedef enum { /** a rescue else statement within a do..end block */ PM_CONTEXT_BLOCK_ELSE, + /** expressions in block parameters `foo do |...| end ` */ + PM_CONTEXT_BLOCK_PARAMETERS, + /** a rescue statement within a do..end block */ PM_CONTEXT_BLOCK_RESCUE, diff --git a/include/prism/regexp.h b/include/prism/regexp.h index c0b3163e93..5366b5a5a0 100644 --- a/include/prism/regexp.h +++ b/include/prism/regexp.h @@ -17,12 +17,12 @@ #include /** - * This callback is called when a named capture group is found. + * This callback is called by pm_regexp_parse() when a named capture group is found. */ typedef void (*pm_regexp_name_callback_t)(const pm_string_t *name, void *data); /** - * This callback is called when a parse error is found. + * This callback is called by pm_regexp_parse() when a parse error is found. */ typedef void (*pm_regexp_error_callback_t)(const uint8_t *start, const uint8_t *end, const char *message, void *data); diff --git a/include/prism/util/pm_buffer.h b/include/prism/util/pm_buffer.h index f3c20ab2a5..cb80f8b3ce 100644 --- a/include/prism/util/pm_buffer.h +++ b/include/prism/util/pm_buffer.h @@ -51,6 +51,8 @@ bool pm_buffer_init_capacity(pm_buffer_t *buffer, size_t capacity); * * @param buffer The buffer to initialize. * @returns True if the buffer was initialized successfully, false otherwise. + * + * \public \memberof pm_buffer_t */ PRISM_EXPORTED_FUNCTION bool pm_buffer_init(pm_buffer_t *buffer); @@ -59,6 +61,8 @@ PRISM_EXPORTED_FUNCTION bool pm_buffer_init(pm_buffer_t *buffer); * * @param buffer The buffer to get the value of. * @returns The value of the buffer. + * + * \public \memberof pm_buffer_t */ PRISM_EXPORTED_FUNCTION char * pm_buffer_value(const pm_buffer_t *buffer); @@ -67,6 +71,8 @@ PRISM_EXPORTED_FUNCTION char * pm_buffer_value(const pm_buffer_t *buffer); * * @param buffer The buffer to get the length of. * @returns The length of the buffer. + * + * \public \memberof pm_buffer_t */ PRISM_EXPORTED_FUNCTION size_t pm_buffer_length(const pm_buffer_t *buffer); @@ -222,6 +228,8 @@ void pm_buffer_insert(pm_buffer_t *buffer, size_t index, const char *value, size * Free the memory associated with the buffer. * * @param buffer The buffer to free. + * + * \public \memberof pm_buffer_t */ PRISM_EXPORTED_FUNCTION void pm_buffer_free(pm_buffer_t *buffer); diff --git a/include/prism/util/pm_integer.h b/include/prism/util/pm_integer.h index a9e2966703..304665e620 100644 --- a/include/prism/util/pm_integer.h +++ b/include/prism/util/pm_integer.h @@ -112,6 +112,8 @@ void pm_integers_reduce(pm_integer_t *numerator, pm_integer_t *denominator); * * @param buffer The buffer to append the string to. * @param integer The integer to convert to a string. + * + * \public \memberof pm_integer_t */ PRISM_EXPORTED_FUNCTION void pm_integer_string(pm_buffer_t *buffer, const pm_integer_t *integer); @@ -120,6 +122,8 @@ PRISM_EXPORTED_FUNCTION void pm_integer_string(pm_buffer_t *buffer, const pm_int * the integer exceeds the size of a single node in the linked list. * * @param integer The integer to free. + * + * \public \memberof pm_integer_t */ PRISM_EXPORTED_FUNCTION void pm_integer_free(pm_integer_t *integer); diff --git a/include/prism/util/pm_list.h b/include/prism/util/pm_list.h index 3512dee979..f544bb2943 100644 --- a/include/prism/util/pm_list.h +++ b/include/prism/util/pm_list.h @@ -68,6 +68,8 @@ typedef struct { * * @param list The list to check. * @return True if the given list is empty, otherwise false. + * + * \public \memberof pm_list_t */ PRISM_EXPORTED_FUNCTION bool pm_list_empty_p(pm_list_t *list); @@ -76,6 +78,8 @@ PRISM_EXPORTED_FUNCTION bool pm_list_empty_p(pm_list_t *list); * * @param list The list to check. * @return The size of the list. + * + * \public \memberof pm_list_t */ PRISM_EXPORTED_FUNCTION size_t pm_list_size(pm_list_t *list); @@ -91,6 +95,8 @@ void pm_list_append(pm_list_t *list, pm_list_node_t *node); * Deallocate the internal state of the given list. * * @param list The list to free. + * + * \public \memberof pm_list_t */ PRISM_EXPORTED_FUNCTION void pm_list_free(pm_list_t *list); diff --git a/include/prism/util/pm_string.h b/include/prism/util/pm_string.h index f99f1abdf3..d8456ff294 100644 --- a/include/prism/util/pm_string.h +++ b/include/prism/util/pm_string.h @@ -45,11 +45,11 @@ typedef struct { /** This is a slice of another string, and should not be freed. */ PM_STRING_SHARED, - /** This string owns its memory, and should be freed using `pm_string_free`. */ + /** This string owns its memory, and should be freed using `pm_string_free()`. */ PM_STRING_OWNED, #ifdef PRISM_HAS_MMAP - /** This string is a memory-mapped file, and should be freed using `pm_string_free`. */ + /** This string is a memory-mapped file, and should be freed using `pm_string_free()`. */ PM_STRING_MAPPED #endif } type; @@ -130,6 +130,8 @@ typedef enum { * @param string The string to initialize. * @param filepath The filepath to read. * @return The success of the read, indicated by the value of the enum. + * + * \public \memberof pm_string_t */ PRISM_EXPORTED_FUNCTION pm_string_init_result_t pm_string_mapped_init(pm_string_t *string, const char *filepath); @@ -141,6 +143,8 @@ PRISM_EXPORTED_FUNCTION pm_string_init_result_t pm_string_mapped_init(pm_string_ * @param string The string to initialize. * @param filepath The filepath to read. * @return The success of the read, indicated by the value of the enum. + * + * \public \memberof pm_string_t */ PRISM_EXPORTED_FUNCTION pm_string_init_result_t pm_string_file_init(pm_string_t *string, const char *filepath); @@ -169,6 +173,8 @@ int pm_string_compare(const pm_string_t *left, const pm_string_t *right); * * @param string The string to get the length of. * @return The length of the string. + * + * \public \memberof pm_string_t */ PRISM_EXPORTED_FUNCTION size_t pm_string_length(const pm_string_t *string); @@ -177,6 +183,8 @@ PRISM_EXPORTED_FUNCTION size_t pm_string_length(const pm_string_t *string); * * @param string The string to get the start pointer of. * @return The start pointer of the string. + * + * \public \memberof pm_string_t */ PRISM_EXPORTED_FUNCTION const uint8_t * pm_string_source(const pm_string_t *string); @@ -184,6 +192,8 @@ PRISM_EXPORTED_FUNCTION const uint8_t * pm_string_source(const pm_string_t *stri * Free the associated memory of the given string. * * @param string The string to free. + * + * \public \memberof pm_string_t */ PRISM_EXPORTED_FUNCTION void pm_string_free(pm_string_t *string); diff --git a/include/prism/version.h b/include/prism/version.h index 0a2a8c8fce..0ef7435c17 100644 --- a/include/prism/version.h +++ b/include/prism/version.h @@ -14,7 +14,7 @@ /** * The minor version of the Prism library as an int. */ -#define PRISM_VERSION_MINOR 4 +#define PRISM_VERSION_MINOR 8 /** * The patch version of the Prism library as an int. @@ -24,6 +24,6 @@ /** * The version of the Prism library as a constant string. */ -#define PRISM_VERSION "1.4.0" +#define PRISM_VERSION "1.8.0" #endif diff --git a/java-wasm/README.md b/java-wasm/README.md new file mode 100644 index 0000000000..2ff93a66d7 --- /dev/null +++ b/java-wasm/README.md @@ -0,0 +1,23 @@ +This dir contains the chicory-prism artifact, a version of prism compiled to WASM and then AOT compiled to JVM bytecode by the Chicory project. + +Generate the templated sources: + +``` +PRISM_EXCLUDE_PRETTYPRINT=1 PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS=1 PRISM_JAVA_BACKEND=jruby bundle exec rake templates +``` + +Compile to WASM using WASI SDK version 25: + +``` +make java-wasm WASI_SDK_PATH=.../wasi-sdk-25.0-arm64-macos +``` + +Build the AOT-compiled machine and wrapper library: + +``` +mvn -f java-wasm/pom.xml clean package +``` + +This should build the chicory-wasm jar file and pass some basic tests. + +The jar will be under `java-wasm/target/chicory-prism-#####-SNAPSHOT.jar` or can be installed by using `install` instead of `pacakge` in the `mvn` command line above. diff --git a/java-wasm/pom.xml b/java-wasm/pom.xml index ba0b66da9c..bc43ba7274 100644 --- a/java-wasm/pom.xml +++ b/java-wasm/pom.xml @@ -2,11 +2,11 @@ 4.0.0 - com.prism - java-prism - 999-SNAPSHOT + org.jruby + chicory-prism + 0.0.1-SNAPSHOT Java Prism - Pure Java Prism interpreting WASM + Pure Java Prism using Chicory WASM runtime @@ -15,8 +15,8 @@ 11 11 - 1.2.1 - 5.12.1 + 1.6.1 + 6.0.2 @@ -36,20 +36,34 @@ com.dylibso.chicory runtime + + com.dylibso.chicory + log + com.dylibso.chicory wasi + + com.dylibso.chicory + wasm + org.junit.jupiter junit-jupiter-engine ${junit.version} + test com.dylibso.chicory - host-module-annotations-experimental + annotations provided + + org.jruby + jruby-base + 10.0.2.0 + @@ -57,7 +71,7 @@ org.codehaus.mojo templating-maven-plugin - 3.0.0 + 3.1.0 filtering-java-templates @@ -70,13 +84,13 @@ org.apache.maven.plugins maven-compiler-plugin - 3.14.0 + 3.14.1 11 com.dylibso.chicory - host-module-processor-experimental + annotations-processor ${chicory.version} @@ -85,12 +99,12 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.3 + 3.5.4 org.codehaus.mojo build-helper-maven-plugin - 3.6.0 + 3.6.1 generate-sources @@ -107,17 +121,17 @@ com.dylibso.chicory - aot-maven-plugin-experimental + chicory-compiler-maven-plugin ${chicory.version} prism - wasm-aot-gen + compile - org.prism.Prism - src/test/resources/prism.wasm + org.prism.PrismParser + src/main/resources/prism.wasm diff --git a/java-wasm/src/main/java-templates/org/prism/WasmResource.java b/java-wasm/src/main/java-templates/org/prism/WasmResource.java index 48f2671714..ccf1d0bcdd 100644 --- a/java-wasm/src/main/java-templates/org/prism/WasmResource.java +++ b/java-wasm/src/main/java-templates/org/prism/WasmResource.java @@ -1,7 +1,7 @@ package org.prism; public final class WasmResource { - public static final String absoluteFile = "file://${project.basedir}/src/test/resources/prism.wasm"; + public static final String absoluteFile = "file://${project.basedir}/src/main/resources/prism.wasm"; private WasmResource() {} } diff --git a/java-wasm/src/main/java/org/prism/Prism.java b/java-wasm/src/main/java/org/prism/Prism.java index a4a8e65111..51552569e6 100644 --- a/java-wasm/src/main/java/org/prism/Prism.java +++ b/java-wasm/src/main/java/org/prism/Prism.java @@ -1,11 +1,12 @@ package org.prism; +import com.dylibso.chicory.annotations.WasmModuleInterface; import com.dylibso.chicory.runtime.ByteArrayMemory; -import com.dylibso.chicory.experimental.hostmodule.annotations.WasmModuleInterface; import com.dylibso.chicory.runtime.ImportValues; import com.dylibso.chicory.runtime.Instance; import com.dylibso.chicory.wasi.WasiOptions; import com.dylibso.chicory.wasi.WasiPreview1; +import com.dylibso.chicory.wasm.WasmModule; import com.dylibso.chicory.wasm.types.MemoryLimits; import java.nio.charset.StandardCharsets; @@ -21,9 +22,11 @@ public Prism() { } public Prism(WasiOptions wasiOpts) { wasi = WasiPreview1.builder().withOptions(wasiOpts).build(); - instance = Instance.builder(PrismModule.load()) + WasmModule module = PrismParser.load(); + PrismParser parser = new PrismParser(); + instance = Instance.builder(module) .withMemoryFactory(limits -> new ByteArrayMemory(new MemoryLimits(10, MemoryLimits.MAX_PAGES))) - .withMachineFactory(PrismModule::create) + .withMachineFactory(parser.machineFactory()) .withImportValues(ImportValues.builder().addFunction(wasi.toHostFunctions()).build()) .build(); exports = new Prism_ModuleExports(instance); @@ -37,10 +40,9 @@ public byte[] serialize(byte[] packedOptions, byte[] source, int sourceLength) { int sourcePointer = 0; int optionsPointer = 0; int bufferPointer = 0; - int resultPointer = 0; byte[] result; try { - sourcePointer = exports.calloc(1, sourceLength); + sourcePointer = exports.calloc(sourceLength, 1); exports.memory().write(sourcePointer, source); optionsPointer = exports.calloc(1, packedOptions.length); @@ -51,10 +53,8 @@ public byte[] serialize(byte[] packedOptions, byte[] source, int sourceLength) { exports.pmSerializeParse(bufferPointer, sourcePointer, sourceLength, optionsPointer); - resultPointer = exports.pmBufferValue(bufferPointer); - result = instance.memory().readBytes( - resultPointer, + exports.pmBufferValue(bufferPointer), exports.pmBufferLength(bufferPointer)); } finally { if (sourcePointer != 0) { @@ -64,11 +64,9 @@ public byte[] serialize(byte[] packedOptions, byte[] source, int sourceLength) { exports.free(optionsPointer); } if (bufferPointer != 0) { + exports.pmBufferFree(bufferPointer); exports.free(bufferPointer); } - if (resultPointer != 0) { - exports.free(resultPointer); - } } return result; diff --git a/java-wasm/src/test/resources/.gitignore b/java-wasm/src/main/resources/.gitignore similarity index 100% rename from java-wasm/src/test/resources/.gitignore rename to java-wasm/src/main/resources/.gitignore diff --git a/java/org/prism/ParsingOptions.java b/java/org/prism/ParsingOptions.java index ff2e995e6b..be0a8a7dba 100644 --- a/java/org/prism/ParsingOptions.java +++ b/java/org/prism/ParsingOptions.java @@ -12,9 +12,12 @@ public abstract class ParsingOptions { * See pm_options_version_t in include/prism/options.h. */ public enum SyntaxVersion { - LATEST(0), + LATEST(0), // Handled in pm_parser_init V3_3(1), - V3_4(2); + V3_4(2), + V3_5(3), + V4_0(3), + V4_1(4); private final int value; @@ -63,15 +66,15 @@ public static class Scope { private byte[][] locals; private Forwarding[] forwarding; - Scope(byte[][] locals) { + public Scope(byte[][] locals) { this(locals, new Forwarding[0]); } - Scope(Forwarding[] forwarding) { + public Scope(Forwarding[] forwarding) { this(new byte[0][], forwarding); } - Scope(byte[][] locals, Forwarding[] forwarding) { + public Scope(byte[][] locals, Forwarding[] forwarding) { this.locals = locals; this.forwarding = forwarding; } diff --git a/javascript/package.json b/javascript/package.json index 75c1e78468..e99e83e219 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -1,6 +1,6 @@ { "name": "@ruby/prism", - "version": "1.4.0", + "version": "1.8.0", "description": "Prism Ruby parser", "type": "module", "main": "src/index.js", @@ -11,5 +11,9 @@ "type": "tsc --allowJs -d --target ES2015 --emitDeclarationOnly --outDir src src/index.js" }, "author": "Shopify ", - "license": "MIT" + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ruby/prism.git" + } } diff --git a/javascript/src/parsePrism.js b/javascript/src/parsePrism.js index 535e6e9a0f..38084da3f1 100644 --- a/javascript/src/parsePrism.js +++ b/javascript/src/parsePrism.js @@ -140,12 +140,16 @@ function dumpOptions(options) { values.push(dumpCommandLineOptions(options)); template.push("C"); - if (!options.version || options.version === "latest" || options.version.match(/^3\.5(\.\d+)?$/)) { - values.push(0); + if (!options.version || options.version === "latest") { + values.push(0); // Handled in pm_parser_init } else if (options.version.match(/^3\.3(\.\d+)?$/)) { values.push(1); } else if (options.version.match(/^3\.4(\.\d+)?$/)) { values.push(2); + } else if (options.version.match(/^3\.5(\.\d+)?$/) || options.version.match(/^4\.0(\.\d+)?$/)) { + values.push(3); + } else if (options.version.match(/^4\.1(\.\d+)?$/)) { + values.push(4); } else { throw new Error(`Unsupported version '${options.version}' in compiler options`); } diff --git a/lib/prism.rb b/lib/prism.rb index eaab5cbfed..dab3420377 100644 --- a/lib/prism.rb +++ b/lib/prism.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown # The Prism Ruby parser. # @@ -19,7 +20,7 @@ module Prism autoload :DSL, "prism/dsl" autoload :InspectVisitor, "prism/inspect_visitor" autoload :LexCompat, "prism/lex_compat" - autoload :LexRipper, "prism/lex_compat" + autoload :LexRipper, "prism/lex_ripper" autoload :MutationCompiler, "prism/mutation_compiler" autoload :Pack, "prism/pack" autoload :Pattern, "prism/pattern" @@ -36,12 +37,31 @@ module Prism private_constant :LexCompat private_constant :LexRipper + # Raised when requested to parse as the currently running Ruby version but Prism has no support for it. + class CurrentVersionError < ArgumentError + # Initialize a new exception for the given ruby version string. + def initialize(version) + message = +"invalid version: Requested to parse as `version: 'current'`; " + segments = + if version.match?(/\A\d+\.\d+.\d+\z/) + version.split(".").map(&:to_i) + end + + if segments && ((segments[0] < 3) || (segments[0] == 3 && segments[1] < 3)) + message << " #{version} is below the minimum supported syntax." + else + message << " #{version} is unknown. Please update the `prism` gem." + end + + super(message) + end + end + # :call-seq: # Prism::lex_compat(source, **options) -> LexCompat::Result # # Returns a parse result whose value is an array of tokens that closely - # resembles the return value of Ripper::lex. The main difference is that the - # `:on_sp` token is not emitted. + # resembles the return value of Ripper::lex. # # For supported options, see Prism::parse. def self.lex_compat(source, **options) @@ -51,9 +71,8 @@ def self.lex_compat(source, **options) # :call-seq: # Prism::lex_ripper(source) -> Array # - # This lexes with the Ripper lex. It drops any space events but otherwise - # returns the same tokens. Raises SyntaxError if the syntax in source is - # invalid. + # This wraps the result of Ripper.lex. It produces almost exactly the + # same tokens. Raises SyntaxError if the syntax in source is invalid. def self.lex_ripper(source) LexRipper.new(source).result # steep:ignore end diff --git a/lib/prism/desugar_compiler.rb b/lib/prism/desugar_compiler.rb index e3b15fc3b0..5d7d38d841 100644 --- a/lib/prism/desugar_compiler.rb +++ b/lib/prism/desugar_compiler.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown module Prism class DesugarAndWriteNode # :nodoc: diff --git a/lib/prism/ffi.rb b/lib/prism/ffi.rb index a0da0b6195..d4c9d60c9a 100644 --- a/lib/prism/ffi.rb +++ b/lib/prism/ffi.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown # typed: ignore # This file is responsible for mirroring the API provided by the C extension by @@ -85,6 +86,7 @@ def self.load_exported_functions_from(header, *functions, callbacks) end callback :pm_parse_stream_fgets_t, [:pointer, :int, :pointer], :pointer + callback :pm_parse_stream_feof_t, [:pointer], :int enum :pm_string_init_result_t, %i[PM_STRING_INIT_SUCCESS PM_STRING_INIT_ERROR_GENERIC PM_STRING_INIT_ERROR_DIRECTORY] enum :pm_string_query_t, [:PM_STRING_QUERY_ERROR, -1, :PM_STRING_QUERY_FALSE, :PM_STRING_QUERY_TRUE] @@ -100,7 +102,7 @@ def self.load_exported_functions_from(header, *functions, callbacks) "pm_string_query_local", "pm_string_query_constant", "pm_string_query_method_name", - [:pm_parse_stream_fgets_t] + [:pm_parse_stream_fgets_t, :pm_parse_stream_feof_t] ) load_exported_functions_from( @@ -280,12 +282,14 @@ def parse_stream(stream, **options) end } + eof_callback = -> (_) { stream.eof? } + # In the pm_serialize_parse_stream function it accepts a pointer to the # IO object as a void* and then passes it through to the callback as the # third argument, but it never touches it itself. As such, since we have # access to the IO object already through the closure of the lambda, we # can pass a null pointer here and not worry. - LibRubyParser.pm_serialize_parse_stream(buffer.pointer, nil, callback, dump_options(options)) + LibRubyParser.pm_serialize_parse_stream(buffer.pointer, nil, callback, eof_callback, dump_options(options)) Prism.load(source, buffer.read, options.fetch(:freeze, false)) end end @@ -419,17 +423,25 @@ def dump_options_command_line(options) # Return the value that should be dumped for the version option. def dump_options_version(version) - case version + current = version == "current" + + case current ? RUBY_VERSION : version when nil, "latest" - 0 + 0 # Handled in pm_parser_init when /\A3\.3(\.\d+)?\z/ 1 when /\A3\.4(\.\d+)?\z/ 2 - when /\A3\.5(\.\d+)?\z/ - 0 + when /\A3\.5(\.\d+)?\z/, /\A4\.0(\.\d+)?\z/ + 3 + when /\A4\.1(\.\d+)?\z/ + 4 else - raise ArgumentError, "invalid version: #{version}" + if current + raise CurrentVersionError, RUBY_VERSION + else + raise ArgumentError, "invalid version: #{version}" + end end end diff --git a/lib/prism/lex_compat.rb b/lib/prism/lex_compat.rb index a83c24cb41..597e63c73e 100644 --- a/lib/prism/lex_compat.rb +++ b/lib/prism/lex_compat.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true +# :markup: markdown require "delegate" -require "ripper" module Prism # This class is responsible for lexing the source using prism and then @@ -225,16 +225,8 @@ def state end end - # Ripper doesn't include the rest of the token in the event, so we need to - # trim it down to just the content on the first line when comparing. - class EndContentToken < Token - def ==(other) # :nodoc: - [self[0], self[1], self[2][0..self[2].index("\n")], self[3]] == other - end - end - # Tokens where state should be ignored - # used for :on_comment, :on_heredoc_end, :on_embexpr_end + # used for :on_sp, :on_comment, :on_heredoc_end, :on_embexpr_end class IgnoreStateToken < Token def ==(other) # :nodoc: self[0...-1] == other[0...-1] @@ -248,8 +240,8 @@ def ==(other) # :nodoc: class IdentToken < Token def ==(other) # :nodoc: (self[0...-1] == other[0...-1]) && ( - (other[3] == Ripper::EXPR_LABEL | Ripper::EXPR_END) || - (other[3] & Ripper::EXPR_ARG_ANY != 0) + (other[3] == Translation::Ripper::EXPR_LABEL | Translation::Ripper::EXPR_END) || + (other[3] & (Translation::Ripper::EXPR_ARG | Translation::Ripper::EXPR_CMDARG) != 0) ) end end @@ -260,8 +252,8 @@ class IgnoredNewlineToken < Token def ==(other) # :nodoc: return false unless self[0...-1] == other[0...-1] - if self[3] == Ripper::EXPR_ARG | Ripper::EXPR_LABELED - other[3] & Ripper::EXPR_ARG | Ripper::EXPR_LABELED != 0 + if self[3] == Translation::Ripper::EXPR_ARG | Translation::Ripper::EXPR_LABELED + other[3] & Translation::Ripper::EXPR_ARG | Translation::Ripper::EXPR_LABELED != 0 else self[3] == other[3] end @@ -279,8 +271,8 @@ def ==(other) # :nodoc: class ParamToken < Token def ==(other) # :nodoc: (self[0...-1] == other[0...-1]) && ( - (other[3] == Ripper::EXPR_END) || - (other[3] == Ripper::EXPR_END | Ripper::EXPR_LABEL) + (other[3] == Translation::Ripper::EXPR_END) || + (other[3] == Translation::Ripper::EXPR_END | Translation::Ripper::EXPR_LABEL) ) end end @@ -614,10 +606,15 @@ def self.build(opening) private_constant :Heredoc - attr_reader :source, :options + # In previous versions of Ruby, Ripper wouldn't flush the bom before the + # first token, so we had to have a hack in place to account for that. + BOM_FLUSHED = RUBY_VERSION >= "3.3.0" + private_constant :BOM_FLUSHED + + attr_reader :options - def initialize(source, **options) - @source = source + def initialize(code, **options) + @code = code @options = options end @@ -627,16 +624,14 @@ def result state = :default heredoc_stack = [[]] #: Array[Array[Heredoc::PlainHeredoc | Heredoc::DashHeredoc | Heredoc::DedentingHeredoc]] - result = Prism.lex(source, **options) + result = Prism.lex(@code, **options) + source = result.source result_value = result.value - previous_state = nil #: Ripper::Lexer::State? + previous_state = nil #: State? last_heredoc_end = nil #: Integer? + eof_token = nil - # In previous versions of Ruby, Ripper wouldn't flush the bom before the - # first token, so we had to have a hack in place to account for that. This - # checks for that behavior. - bom_flushed = Ripper.lex("\xEF\xBB\xBF# test")[0][0][1] == 0 - bom = source.byteslice(0..2) == "\xEF\xBB\xBF" + bom = source.slice(0, 3) == "\xEF\xBB\xBF" result_value.each_with_index do |(token, lex_state), index| lineno = token.location.start_line @@ -650,7 +645,7 @@ def result if bom && lineno == 1 column -= 3 - if index == 0 && column == 0 && !bom_flushed + if index == 0 && column == 0 && !BOM_FLUSHED flushed = case token.type when :BACK_REFERENCE, :INSTANCE_VARIABLE, :CLASS_VARIABLE, @@ -674,12 +669,15 @@ def result event = RIPPER.fetch(token.type) value = token.value - lex_state = Ripper::Lexer::State.new(lex_state) + lex_state = Translation::Ripper::Lexer::State.cached(lex_state) token = case event when :on___end__ - EndContentToken.new([[lineno, column], event, value, lex_state]) + # Ripper doesn't include the rest of the token in the event, so we need to + # trim it down to just the content on the first line. + value = value[0..value.index("\n")] + Token.new([[lineno, column], event, value, lex_state]) when :on_comment IgnoreStateToken.new([[lineno, column], event, value, lex_state]) when :on_heredoc_end @@ -688,7 +686,7 @@ def result last_heredoc_end = token.location.end_offset IgnoreStateToken.new([[lineno, column], event, value, lex_state]) when :on_ident - if lex_state == Ripper::EXPR_END + if lex_state == Translation::Ripper::EXPR_END # If we have an identifier that follows a method name like: # # def foo bar @@ -698,7 +696,7 @@ def result # yet. We do this more accurately, so we need to allow comparing # against both END and END|LABEL. ParamToken.new([[lineno, column], event, value, lex_state]) - elsif lex_state == Ripper::EXPR_END | Ripper::EXPR_LABEL + elsif lex_state == Translation::Ripper::EXPR_END | Translation::Ripper::EXPR_LABEL # In the event that we're comparing identifiers, we're going to # allow a little divergence. Ripper doesn't account for local # variables introduced through named captures in regexes, and we @@ -738,13 +736,14 @@ def result counter += { on_embexpr_beg: -1, on_embexpr_end: 1 }[current_event] || 0 end - Ripper::Lexer::State.new(result_value[current_index][1]) + Translation::Ripper::Lexer::State.cached(result_value[current_index][1]) else previous_state end Token.new([[lineno, column], event, value, lex_state]) when :on_eof + eof_token = token previous_token = result_value[index - 1][0] # If we're at the end of the file and the previous token was a @@ -767,7 +766,7 @@ def result end_offset += 3 end - tokens << Token.new([[lineno, 0], :on_nl, source.byteslice(start_offset...end_offset), lex_state]) + tokens << Token.new([[lineno, 0], :on_nl, source.slice(start_offset, end_offset - start_offset), lex_state]) end end @@ -861,67 +860,91 @@ def result # We sort by location to compare against Ripper's output tokens.sort_by!(&:location) - Result.new(tokens, result.comments, result.magic_comments, result.data_loc, result.errors, result.warnings, Source.for(source)) - end - end - - private_constant :LexCompat - - # This is a class that wraps the Ripper lexer to produce almost exactly the - # same tokens. - class LexRipper # :nodoc: - attr_reader :source + # Add :on_sp tokens + tokens = add_on_sp_tokens(tokens, source, result.data_loc, bom, eof_token) - def initialize(source) - @source = source + Result.new(tokens, result.comments, result.magic_comments, result.data_loc, result.errors, result.warnings, source) end - def result - previous = [] #: [[Integer, Integer], Symbol, String, untyped] | [] - results = [] #: Array[[[Integer, Integer], Symbol, String, untyped]] - - lex(source).each do |token| - case token[1] - when :on_sp - # skip - when :on_tstring_content - if previous[1] == :on_tstring_content && (token[2].start_with?("\#$") || token[2].start_with?("\#@")) - previous[2] << token[2] - else - results << token - previous = token - end - when :on_words_sep - if previous[1] == :on_words_sep - previous[2] << token[2] + def add_on_sp_tokens(tokens, source, data_loc, bom, eof_token) + new_tokens = [] + + prev_token_state = Translation::Ripper::Lexer::State.cached(Translation::Ripper::EXPR_BEG) + prev_token_end = bom ? 3 : 0 + + tokens.each do |token| + line, column = token.location + start_offset = source.line_to_byte_offset(line) + column + # Ripper reports columns on line 1 without counting the BOM, so we adjust to get the real offset + start_offset += 3 if line == 1 && bom + + if start_offset > prev_token_end + sp_value = source.slice(prev_token_end, start_offset - prev_token_end) + sp_line = source.line(prev_token_end) + sp_column = source.column(prev_token_end) + # Ripper reports columns on line 1 without counting the BOM + sp_column -= 3 if sp_line == 1 && bom + continuation_index = sp_value.byteindex("\\") + + # ripper emits up to three :on_sp tokens when line continuations are used + if continuation_index + next_whitespace_index = continuation_index + 1 + next_whitespace_index += 1 if sp_value.byteslice(next_whitespace_index) == "\r" + next_whitespace_index += 1 + first_whitespace = sp_value[0...continuation_index] + continuation = sp_value[continuation_index...next_whitespace_index] + second_whitespace = sp_value[next_whitespace_index..] + + new_tokens << IgnoreStateToken.new([ + [sp_line, sp_column], + :on_sp, + first_whitespace, + prev_token_state + ]) unless first_whitespace.empty? + + new_tokens << IgnoreStateToken.new([ + [sp_line, sp_column + continuation_index], + :on_sp, + continuation, + prev_token_state + ]) + + new_tokens << IgnoreStateToken.new([ + [sp_line + 1, 0], + :on_sp, + second_whitespace, + prev_token_state + ]) unless second_whitespace.empty? else - results << token - previous = token + new_tokens << IgnoreStateToken.new([ + [sp_line, sp_column], + :on_sp, + sp_value, + prev_token_state + ]) end - else - results << token - previous = token end - end - results - end - - private - - if Ripper.method(:lex).parameters.assoc(:keyrest) - def lex(source) - Ripper.lex(source, raise_errors: true) + new_tokens << token + prev_token_state = token.state + prev_token_end = start_offset + token.value.bytesize end - else - def lex(source) - ripper = Ripper::Lexer.new(source) - ripper.lex.tap do |result| - raise SyntaxError, ripper.errors.map(&:message).join(' ;') if ripper.errors.any? + + unless data_loc # no trailing :on_sp with __END__ as it is always preceded by :on_nl + end_offset = eof_token.location.end_offset + if prev_token_end < end_offset + new_tokens << IgnoreStateToken.new([ + [source.line(prev_token_end), source.column(prev_token_end)], + :on_sp, + source.slice(prev_token_end, end_offset - prev_token_end), + prev_token_state + ]) end end + + new_tokens end end - private_constant :LexRipper + private_constant :LexCompat end diff --git a/lib/prism/lex_ripper.rb b/lib/prism/lex_ripper.rb new file mode 100644 index 0000000000..2054cf55ac --- /dev/null +++ b/lib/prism/lex_ripper.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true +# :markup: markdown + +require "ripper" + +module Prism + # This is a class that wraps the Ripper lexer to produce almost exactly the + # same tokens. + class LexRipper # :nodoc: + attr_reader :source + + def initialize(source) + @source = source + end + + def result + previous = [] #: [[Integer, Integer], Symbol, String, untyped] | [] + results = [] #: Array[[[Integer, Integer], Symbol, String, untyped]] + + lex(source).each do |token| + case token[1] + when :on_tstring_content + if previous[1] == :on_tstring_content && (token[2].start_with?("\#$") || token[2].start_with?("\#@")) + previous[2] << token[2] + else + results << token + previous = token + end + when :on_words_sep + if previous[1] == :on_words_sep + previous[2] << token[2] + else + results << token + previous = token + end + else + results << token + previous = token + end + end + + results + end + + private + + if Ripper.method(:lex).parameters.assoc(:keyrest) + def lex(source) + Ripper.lex(source, raise_errors: true) + end + else + def lex(source) + ripper = Ripper::Lexer.new(source) + ripper.lex.tap do |result| + raise SyntaxError, ripper.errors.map(&:message).join(' ;') if ripper.errors.any? + end + end + end + end + + private_constant :LexRipper +end diff --git a/lib/prism/node_ext.rb b/lib/prism/node_ext.rb index b007a051ea..469e54ca0c 100644 --- a/lib/prism/node_ext.rb +++ b/lib/prism/node_ext.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true +# :markup: markdown +#-- # Here we are reopening the prism module to provide methods on nodes that aren't # templated and are meant as convenience methods. +#++ module Prism class Node def deprecated(*replacements) # :nodoc: diff --git a/lib/prism/pack.rb b/lib/prism/pack.rb index c0de8ab8b7..166c04c3c0 100644 --- a/lib/prism/pack.rb +++ b/lib/prism/pack.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true +# :markup: markdown # typed: ignore +# module Prism # A parser for the pack template language. module Pack diff --git a/lib/prism/parse_result.rb b/lib/prism/parse_result.rb index 9a3e7c5b79..12d19da562 100644 --- a/lib/prism/parse_result.rb +++ b/lib/prism/parse_result.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown module Prism # This represents a source of Ruby code that has been parsed. It is used in @@ -75,6 +76,15 @@ def slice(byte_offset, length) source.byteslice(byte_offset, length) or raise end + # Converts the line number to a byte offset corresponding to the start of that line + def line_to_byte_offset(line) + l = line - @start_line + if l < 0 || l >= offsets.size + raise ArgumentError, "line #{line} is out of range" + end + offsets[l] + end + # Binary search through the offsets to find the line number for the given # byte offset. def line(byte_offset) @@ -154,21 +164,8 @@ def deep_freeze # Binary search through the offsets to find the line number for the given # byte offset. def find_line(byte_offset) - left = 0 - right = offsets.length - 1 - - while left <= right - mid = left + (right - left) / 2 - return mid if (offset = offsets[mid]) == byte_offset - - if offset < byte_offset - left = mid + 1 - else - right = mid - 1 - end - end - - left - 1 + index = offsets.bsearch_index { |offset| offset > byte_offset } || offsets.length + index - 1 end end diff --git a/lib/prism/parse_result/comments.rb b/lib/prism/parse_result/comments.rb index 22c4148b2c..3e93316aff 100644 --- a/lib/prism/parse_result/comments.rb +++ b/lib/prism/parse_result/comments.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown module Prism class ParseResult < Result diff --git a/lib/prism/parse_result/errors.rb b/lib/prism/parse_result/errors.rb index eb4f317248..26c376b3ce 100644 --- a/lib/prism/parse_result/errors.rb +++ b/lib/prism/parse_result/errors.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown require "stringio" diff --git a/lib/prism/parse_result/newlines.rb b/lib/prism/parse_result/newlines.rb index 37f64f8ae2..e7fd62cafe 100644 --- a/lib/prism/parse_result/newlines.rb +++ b/lib/prism/parse_result/newlines.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown module Prism class ParseResult < Result diff --git a/lib/prism/pattern.rb b/lib/prism/pattern.rb index 03fec26789..6ad2d9e5b9 100644 --- a/lib/prism/pattern.rb +++ b/lib/prism/pattern.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown module Prism # A pattern is an object that wraps a Ruby pattern matching expression. The diff --git a/lib/prism/polyfill/scan_byte.rb b/lib/prism/polyfill/scan_byte.rb new file mode 100644 index 0000000000..9276e509fc --- /dev/null +++ b/lib/prism/polyfill/scan_byte.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require "strscan" + +# Polyfill for StringScanner#scan_byte, which didn't exist until Ruby 3.4. +if !(StringScanner.method_defined?(:scan_byte)) + StringScanner.include( + Module.new { + def scan_byte # :nodoc: + get_byte&.b&.ord + end + } + ) +end diff --git a/lib/prism/polyfill/warn.rb b/lib/prism/polyfill/warn.rb index 560380d308..76a4264623 100644 --- a/lib/prism/polyfill/warn.rb +++ b/lib/prism/polyfill/warn.rb @@ -7,17 +7,14 @@ Kernel.prepend( Module.new { def warn(*msgs, uplevel: nil, category: nil) # :nodoc: - uplevel = - case uplevel - when nil - 1 - when Integer - uplevel + 1 - else - uplevel.to_int + 1 - end - - super(*msgs, uplevel: uplevel) + case uplevel + when nil + super(*msgs) + when Integer + super(*msgs, uplevel: uplevel + 1) + else + super(*msgs, uplevel: uplevel.to_int + 1) + end end } ) @@ -25,17 +22,14 @@ def warn(*msgs, uplevel: nil, category: nil) # :nodoc: Object.prepend( Module.new { def warn(*msgs, uplevel: nil, category: nil) # :nodoc: - uplevel = - case uplevel - when nil - 1 - when Integer - uplevel + 1 - else - uplevel.to_int + 1 - end - - super(*msgs, uplevel: uplevel) + case uplevel + when nil + super(*msgs) + when Integer + super(*msgs, uplevel: uplevel + 1) + else + super(*msgs, uplevel: uplevel.to_int + 1) + end end } ) diff --git a/lib/prism/relocation.rb b/lib/prism/relocation.rb index 163d2012c5..3e9210a785 100644 --- a/lib/prism/relocation.rb +++ b/lib/prism/relocation.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown module Prism # Prism parses deterministically for the same input. This provides a nice diff --git a/lib/prism/string_query.rb b/lib/prism/string_query.rb index 9011051d2b..547f58d2fa 100644 --- a/lib/prism/string_query.rb +++ b/lib/prism/string_query.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown module Prism # Query methods that allow categorizing strings based on their context for diff --git a/lib/prism/translation.rb b/lib/prism/translation.rb index 511c80febc..57b57135bc 100644 --- a/lib/prism/translation.rb +++ b/lib/prism/translation.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown module Prism # This module is responsible for converting the prism syntax tree into other @@ -6,9 +7,11 @@ module Prism module Translation # steep:ignore autoload :Parser, "prism/translation/parser" autoload :ParserCurrent, "prism/translation/parser_current" - autoload :Parser33, "prism/translation/parser33" - autoload :Parser34, "prism/translation/parser34" - autoload :Parser35, "prism/translation/parser35" + autoload :Parser33, "prism/translation/parser_versions" + autoload :Parser34, "prism/translation/parser_versions" + autoload :Parser35, "prism/translation/parser_versions" + autoload :Parser40, "prism/translation/parser_versions" + autoload :Parser41, "prism/translation/parser_versions" autoload :Ripper, "prism/translation/ripper" autoload :RubyParser, "prism/translation/ruby_parser" end diff --git a/lib/prism/translation/parser.rb b/lib/prism/translation/parser.rb index d43ad7c1e4..fed4ac4cd1 100644 --- a/lib/prism/translation/parser.rb +++ b/lib/prism/translation/parser.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown begin required_version = ">= 3.3.7.2" @@ -18,6 +19,13 @@ module Translation # whitequark/parser gem's syntax tree. It inherits from the base parser for # the parser gem, and overrides the parse* methods to parse with prism and # then translate. + # + # Note that this version of the parser always parses using the latest + # version of Ruby syntax supported by Prism. If you want specific version + # support, use one of the version-specific subclasses, such as + # `Prism::Translation::Parser34`. If you want to parse using the same + # version of Ruby syntax as the currently running version of Ruby, use + # `Prism::Translation::ParserCurrent`. class Parser < ::Parser::Base Diagnostic = ::Parser::Diagnostic # :nodoc: private_constant :Diagnostic @@ -76,7 +84,7 @@ def initialize(builder = Prism::Translation::Parser::Builder.new, parser: Prism) end def version # :nodoc: - 34 + 41 end # The default encoding for Ruby files is UTF-8. @@ -348,8 +356,10 @@ def convert_for_prism(version) "3.3.1" when 34 "3.4.0" - when 35 - "3.5.0" + when 35, 40 + "4.0.0" + when 41 + "4.1.0" else "latest" end diff --git a/lib/prism/translation/parser/builder.rb b/lib/prism/translation/parser/builder.rb index d3b51f4275..6b620c25bc 100644 --- a/lib/prism/translation/parser/builder.rb +++ b/lib/prism/translation/parser/builder.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown module Prism module Translation diff --git a/lib/prism/translation/parser/compiler.rb b/lib/prism/translation/parser/compiler.rb index acf4e77ee4..8805614603 100644 --- a/lib/prism/translation/parser/compiler.rb +++ b/lib/prism/translation/parser/compiler.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown module Prism module Translation @@ -216,7 +217,7 @@ def visit_begin_node(node) rescue_clause.exceptions.any? ? builder.array(nil, visit_all(rescue_clause.exceptions), nil) : nil, token(rescue_clause.operator_loc), visit(rescue_clause.reference), - srange_find(find_start_offset, find_end_offset, ";"), + srange_semicolon(find_start_offset, find_end_offset), visit(rescue_clause.statements) ) end until (rescue_clause = rescue_clause.subsequent).nil? @@ -322,7 +323,7 @@ def visit_call_node(node) visit_all(arguments), token(node.closing_loc), ), - srange_find(node.message_loc.end_offset, node.arguments.arguments.last.location.start_offset, "="), + token(node.equal_loc), visit(node.arguments.arguments.last) ), block @@ -339,7 +340,7 @@ def visit_call_node(node) if name.end_with?("=") && !message_loc.slice.end_with?("=") && node.arguments && block.nil? builder.assign( builder.attr_asgn(visit(node.receiver), call_operator, token(message_loc)), - srange_find(message_loc.end_offset, node.arguments.location.start_offset, "="), + token(node.equal_loc), visit(node.arguments.arguments.last) ) else @@ -788,7 +789,7 @@ def visit_for_node(node) if (do_keyword_loc = node.do_keyword_loc) token(do_keyword_loc) else - srange_find(node.collection.location.end_offset, (node.statements&.location || node.end_keyword_loc).start_offset, ";") + srange_semicolon(node.collection.location.end_offset, (node.statements&.location || node.end_keyword_loc).start_offset) end, visit(node.statements), token(node.end_keyword_loc) @@ -920,7 +921,7 @@ def visit_if_node(node) if (then_keyword_loc = node.then_keyword_loc) token(then_keyword_loc) else - srange_find(node.predicate.location.end_offset, (node.statements&.location || node.subsequent&.location || node.end_keyword_loc).start_offset, ";") + srange_semicolon(node.predicate.location.end_offset, (node.statements&.location || node.subsequent&.location || node.end_keyword_loc).start_offset) end, visit(node.statements), case node.subsequent @@ -986,7 +987,7 @@ def visit_in_node(node) if (then_loc = node.then_loc) token(then_loc) else - srange_find(node.pattern.location.end_offset, node.statements&.location&.start_offset, ";") + srange_semicolon(node.pattern.location.end_offset, node.statements&.location&.start_offset) end, visit(node.statements) ) @@ -1052,7 +1053,7 @@ def visit_index_target_node(node) builder.index_asgn( visit(node.receiver), token(node.opening_loc), - visit_all(node.arguments.arguments), + visit_all(node.arguments&.arguments || []), token(node.closing_loc), ) end @@ -1481,7 +1482,8 @@ def visit_parentheses_node(node) # foo => ^(bar) # ^^^^^^ def visit_pinned_expression_node(node) - expression = builder.begin(token(node.lparen_loc), visit(node.expression), token(node.rparen_loc)) + parts = node.expression.accept(copy_compiler(in_pattern: false)) # Don't treat * and similar as match_rest + expression = builder.begin(token(node.lparen_loc), parts, token(node.rparen_loc)) builder.pin(token(node.operator_loc), expression) end @@ -1806,7 +1808,7 @@ def visit_unless_node(node) if (then_keyword_loc = node.then_keyword_loc) token(then_keyword_loc) else - srange_find(node.predicate.location.end_offset, (node.statements&.location || node.else_clause&.location || node.end_keyword_loc).start_offset, ";") + srange_semicolon(node.predicate.location.end_offset, (node.statements&.location || node.else_clause&.location || node.end_keyword_loc).start_offset) end, visit(node.else_clause), token(node.else_clause&.else_keyword_loc), @@ -1837,7 +1839,7 @@ def visit_until_node(node) if (do_keyword_loc = node.do_keyword_loc) token(do_keyword_loc) else - srange_find(node.predicate.location.end_offset, (node.statements&.location || node.closing_loc).start_offset, ";") + srange_semicolon(node.predicate.location.end_offset, (node.statements&.location || node.closing_loc).start_offset) end, visit(node.statements), token(node.closing_loc) @@ -1861,7 +1863,7 @@ def visit_when_node(node) if (then_keyword_loc = node.then_keyword_loc) token(then_keyword_loc) else - srange_find(node.conditions.last.location.end_offset, node.statements&.location&.start_offset, ";") + srange_semicolon(node.conditions.last.location.end_offset, node.statements&.location&.start_offset) end, visit(node.statements) ) @@ -1881,7 +1883,7 @@ def visit_while_node(node) if (do_keyword_loc = node.do_keyword_loc) token(do_keyword_loc) else - srange_find(node.predicate.location.end_offset, (node.statements&.location || node.closing_loc).start_offset, ";") + srange_semicolon(node.predicate.location.end_offset, (node.statements&.location || node.closing_loc).start_offset) end, visit(node.statements), token(node.closing_loc) @@ -2010,16 +2012,16 @@ def srange_offsets(start_offset, end_offset) Range.new(source_buffer, offset_cache[start_offset], offset_cache[end_offset]) end - # Constructs a new source range by finding the given character between - # the given start offset and end offset. If the needle is not found, it - # returns nil. Importantly it does not search past newlines or comments. + # Constructs a new source range by finding a semicolon between the given + # start offset and end offset. If the semicolon is not found, it returns + # nil. Importantly it does not search past newlines or comments. # # Note that end_offset is allowed to be nil, in which case this will # search until the end of the string. - def srange_find(start_offset, end_offset, character) - if (match = source_buffer.source.byteslice(start_offset...end_offset)[/\A\s*#{character}/]) + def srange_semicolon(start_offset, end_offset) + if (match = source_buffer.source.byteslice(start_offset...end_offset)[/\A\s*;/]) final_offset = start_offset + match.bytesize - [character, Range.new(source_buffer, offset_cache[final_offset - character.bytesize], offset_cache[final_offset])] + [";", Range.new(source_buffer, offset_cache[final_offset - 1], offset_cache[final_offset])] end end diff --git a/lib/prism/translation/parser/lexer.rb b/lib/prism/translation/parser/lexer.rb index 8f2d065b73..75c48ef667 100644 --- a/lib/prism/translation/parser/lexer.rb +++ b/lib/prism/translation/parser/lexer.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true +# :markup: markdown require "strscan" require_relative "../../polyfill/append_as_bytes" +require_relative "../../polyfill/scan_byte" module Prism module Translation @@ -201,7 +203,7 @@ class Lexer # The following token types are listed as those classified as `tLPAREN`. LPAREN_CONVERSION_TOKEN_TYPES = Set.new([ :kBREAK, :tCARET, :kCASE, :tDIVIDE, :kFOR, :kIF, :kNEXT, :kRETURN, :kUNTIL, :kWHILE, :tAMPER, :tANDOP, :tBANG, :tCOMMA, :tDOT2, :tDOT3, - :tEQL, :tLPAREN, :tLPAREN2, :tLPAREN_ARG, :tLSHFT, :tNL, :tOP_ASGN, :tOROP, :tPIPE, :tSEMI, :tSTRING_DBEG, :tUMINUS, :tUPLUS + :tEQL, :tLPAREN, :tLPAREN2, :tLPAREN_ARG, :tLSHFT, :tNL, :tOP_ASGN, :tOROP, :tPIPE, :tSEMI, :tSTRING_DBEG, :tUMINUS, :tUPLUS, :tLCURLY ]) # Types of tokens that are allowed to continue a method call with comments in-between. @@ -275,20 +277,20 @@ def to_a when :tCOMMENT if token.type == :EMBDOC_BEGIN - while !((next_token = lexed[index][0]) && next_token.type == :EMBDOC_END) && (index < length - 1) + while !((next_token = lexed[index]&.first) && next_token.type == :EMBDOC_END) && (index < length - 1) value += next_token.value index += 1 end value += next_token.value - location = range(token.location.start_offset, lexed[index][0].location.end_offset) + location = range(token.location.start_offset, next_token.location.end_offset) index += 1 else is_at_eol = value.chomp!.nil? location = range(token.location.start_offset, token.location.end_offset + (is_at_eol ? 0 : -1)) - prev_token = lexed[index - 2][0] if index - 2 >= 0 - next_token = lexed[index][0] + prev_token, _ = lexed[index - 2] if index - 2 >= 0 + next_token, _ = lexed[index] is_inline_comment = prev_token&.location&.start_line == token.location.start_line if is_inline_comment && !is_at_eol && !COMMENT_CONTINUATION_TYPES.include?(next_token&.type) @@ -307,7 +309,7 @@ def to_a end end when :tNL - next_token = next_token = lexed[index][0] + next_token, _ = lexed[index] # Newlines after comments are emitted out of order. if next_token&.type == :COMMENT comment_newline_location = location @@ -344,8 +346,8 @@ def to_a location = range(token.location.start_offset, token.location.start_offset + percent_array_leading_whitespace(value)) value = nil when :tSTRING_BEG - next_token = lexed[index][0] - next_next_token = lexed[index + 1][0] + next_token, _ = lexed[index] + next_next_token, _ = lexed[index + 1] basic_quotes = value == '"' || value == "'" if basic_quotes && next_token&.type == :STRING_END @@ -413,7 +415,8 @@ def to_a while token.type == :STRING_CONTENT current_length += token.value.bytesize # Heredoc interpolation can have multiple STRING_CONTENT nodes on the same line. - is_first_token_on_line = lexed[index - 1] && token.location.start_line != lexed[index - 2][0].location&.start_line + prev_token, _ = lexed[index - 2] if index - 2 >= 0 + is_first_token_on_line = prev_token && token.location.start_line != prev_token.location.start_line # The parser gem only removes indentation when the heredoc is not nested not_nested = heredoc_stack.size == 1 if is_percent_array @@ -423,11 +426,16 @@ def to_a end current_string << unescape_string(value, quote_stack.last) - if (backslash_count = token.value[/(\\{1,})\n/, 1]&.length).nil? || backslash_count.even? || !interpolation?(quote_stack.last) + relevant_backslash_count = if quote_stack.last.start_with?("%W", "%I") + 0 # the last backslash escapes the newline + else + token.value[/(\\{1,})\n/, 1]&.length || 0 + end + if relevant_backslash_count.even? || !interpolation?(quote_stack.last) tokens << [:tSTRING_CONTENT, [current_string, range(start_offset, start_offset + current_length)]] break end - token = lexed[index][0] + token, _ = lexed[index] index += 1 end else @@ -482,7 +490,7 @@ def to_a end if percent_array?(quote_stack.pop) - prev_token = lexed[index - 2][0] if index - 2 >= 0 + prev_token, _ = lexed[index - 2] if index - 2 >= 0 empty = %i[PERCENT_LOWER_I PERCENT_LOWER_W PERCENT_UPPER_I PERCENT_UPPER_W].include?(prev_token&.type) ends_with_whitespace = prev_token&.type == :WORDS_SEP # parser always emits a space token after content in a percent array, even if no actual whitespace is present. @@ -491,7 +499,7 @@ def to_a end end when :tSYMBEG - if (next_token = lexed[index][0]) && next_token.type != :STRING_CONTENT && next_token.type != :EMBEXPR_BEGIN && next_token.type != :EMBVAR && next_token.type != :STRING_END + if (next_token = lexed[index]&.first) && next_token.type != :STRING_CONTENT && next_token.type != :EMBEXPR_BEGIN && next_token.type != :EMBVAR && next_token.type != :STRING_END next_location = token.location.join(next_token.location) type = :tSYMBOL value = next_token.value @@ -506,13 +514,13 @@ def to_a type = :tIDENTIFIER end when :tXSTRING_BEG - if (next_token = lexed[index][0]) && !%i[STRING_CONTENT STRING_END EMBEXPR_BEGIN].include?(next_token.type) + if (next_token = lexed[index]&.first) && !%i[STRING_CONTENT STRING_END EMBEXPR_BEGIN].include?(next_token.type) # self.`() type = :tBACK_REF2 end quote_stack.push(value) when :tSYMBOLS_BEG, :tQSYMBOLS_BEG, :tWORDS_BEG, :tQWORDS_BEG - if (next_token = lexed[index][0]) && next_token.type == :WORDS_SEP + if (next_token = lexed[index]&.first) && next_token.type == :WORDS_SEP index += 1 end @@ -588,9 +596,9 @@ def calculate_heredoc_whitespace(heredoc_token_index) previous_line = -1 result = Float::MAX - while (lexed[next_token_index] && next_token = lexed[next_token_index][0]) + while (next_token = lexed[next_token_index]&.first) next_token_index += 1 - next_next_token = lexed[next_token_index] && lexed[next_token_index][0] + next_next_token, _ = lexed[next_token_index] first_token_on_line = next_token.location.start_column == 0 # String content inside nested heredocs and interpolation is ignored @@ -761,12 +769,12 @@ def escape_read(result, scanner, control, meta) elsif (value = scanner.scan(/M-\\?(?=[[:print:]])/)) # \M-x where x is an ASCII printable character escape_read(result, scanner, control, true) - elsif (byte = scanner.get_byte) + elsif (byte = scanner.scan_byte) # Something else after an escape. - if control && byte == "?" + if control && byte == 0x3f # ASCII '?' result.append_as_bytes(escape_build(0x7f, false, meta)) else - result.append_as_bytes(escape_build(byte.ord, control, meta)) + result.append_as_bytes(escape_build(byte, control, meta)) end end end diff --git a/lib/prism/translation/parser33.rb b/lib/prism/translation/parser33.rb deleted file mode 100644 index b09266e06a..0000000000 --- a/lib/prism/translation/parser33.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -module Prism - module Translation - # This class is the entry-point for Ruby 3.3 of `Prism::Translation::Parser`. - class Parser33 < Parser - def version # :nodoc: - 33 - end - end - end -end diff --git a/lib/prism/translation/parser34.rb b/lib/prism/translation/parser34.rb deleted file mode 100644 index 0ead70ad3c..0000000000 --- a/lib/prism/translation/parser34.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -module Prism - module Translation - # This class is the entry-point for Ruby 3.4 of `Prism::Translation::Parser`. - class Parser34 < Parser - def version # :nodoc: - 34 - end - end - end -end diff --git a/lib/prism/translation/parser35.rb b/lib/prism/translation/parser35.rb deleted file mode 100644 index a6abc12589..0000000000 --- a/lib/prism/translation/parser35.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -module Prism - module Translation - # This class is the entry-point for Ruby 3.5 of `Prism::Translation::Parser`. - class Parser35 < Parser - def version # :nodoc: - 35 - end - end - end -end diff --git a/lib/prism/translation/parser_current.rb b/lib/prism/translation/parser_current.rb index b44769fde7..f13eff6bbe 100644 --- a/lib/prism/translation/parser_current.rb +++ b/lib/prism/translation/parser_current.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true +# :markup: markdown # typed: ignore +# module Prism module Translation case RUBY_VERSION @@ -8,11 +10,13 @@ module Translation ParserCurrent = Parser33 when /^3\.4\./ ParserCurrent = Parser34 - when /^3\.5\./ - ParserCurrent = Parser35 + when /^3\.5\./, /^4\.0\./ + ParserCurrent = Parser40 + when /^4\.1\./ + ParserCurrent = Parser41 else # Keep this in sync with released Ruby. - parser = Parser34 + parser = Parser40 major, minor, _patch = Gem::Version.new(RUBY_VERSION).segments warn "warning: `Prism::Translation::Current` is loading #{parser.name}, " \ "but you are running #{major}.#{minor}." diff --git a/lib/prism/translation/parser_versions.rb b/lib/prism/translation/parser_versions.rb new file mode 100644 index 0000000000..720c7d548c --- /dev/null +++ b/lib/prism/translation/parser_versions.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true +# :markup: markdown + +module Prism + module Translation + # This class is the entry-point for Ruby 3.3 of `Prism::Translation::Parser`. + class Parser33 < Parser + def version # :nodoc: + 33 + end + end + + # This class is the entry-point for Ruby 3.4 of `Prism::Translation::Parser`. + class Parser34 < Parser + def version # :nodoc: + 34 + end + end + + # This class is the entry-point for Ruby 4.0 of `Prism::Translation::Parser`. + class Parser40 < Parser + def version # :nodoc: + 40 + end + end + + Parser35 = Parser40 # :nodoc: + + # This class is the entry-point for Ruby 4.1 of `Prism::Translation::Parser`. + class Parser41 < Parser + def version # :nodoc: + 41 + end + end + end +end diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb index 95f366ac91..735217d2e0 100644 --- a/lib/prism/translation/ripper.rb +++ b/lib/prism/translation/ripper.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true - -require "ripper" +# :markup: markdown module Prism module Translation @@ -70,7 +69,7 @@ def self.parse(src, filename = "(ripper)", lineno = 1) # [[1, 13], :on_kw, "end", END ]] # def self.lex(src, filename = "-", lineno = 1, raise_errors: false) - result = Prism.lex_compat(src, filepath: filename, line: lineno) + result = Prism.lex_compat(src, filepath: filename, line: lineno, version: "current") if result.failure? && raise_errors raise SyntaxError, result.errors.first.message @@ -79,6 +78,19 @@ def self.lex(src, filename = "-", lineno = 1, raise_errors: false) end end + # Tokenizes the Ruby program and returns an array of strings. + # The +filename+ and +lineno+ arguments are mostly ignored, since the + # return value is just the tokenized input. + # By default, this method does not handle syntax errors in +src+, + # use the +raise_errors+ keyword to raise a SyntaxError for an error in +src+. + # + # p Ripper.tokenize("def m(a) nil end") + # # => ["def", " ", "m", "(", "a", ")", " ", "nil", " ", "end"] + # + def self.tokenize(...) + lex(...).map(&:value) + end + # This contains a table of all of the parser events and their # corresponding arity. PARSER_EVENT_TABLE = { @@ -425,9 +437,35 @@ def self.sexp_raw(src, filename = "-", lineno = 1, raise_errors: false) end end + autoload :Filter, "prism/translation/ripper/filter" + autoload :Lexer, "prism/translation/ripper/lexer" autoload :SexpBuilder, "prism/translation/ripper/sexp" autoload :SexpBuilderPP, "prism/translation/ripper/sexp" + # :stopdoc: + # This is not part of the public API but used by some gems. + + # Ripper-internal bitflags. + LEX_STATE_NAMES = %i[ + BEG END ENDARG ENDFN ARG CMDARG MID FNAME DOT CLASS LABEL LABELED FITEM + ].map.with_index.to_h { |name, i| [2 ** i, name] }.freeze + private_constant :LEX_STATE_NAMES + + LEX_STATE_NAMES.each do |value, key| + const_set("EXPR_#{key}", value) + end + EXPR_NONE = 0 + EXPR_VALUE = EXPR_BEG + EXPR_BEG_ANY = EXPR_BEG | EXPR_MID | EXPR_CLASS + EXPR_ARG_ANY = EXPR_ARG | EXPR_CMDARG + EXPR_END_ANY = EXPR_END | EXPR_ENDARG | EXPR_ENDFN + + def self.lex_state_name(state) + LEX_STATE_NAMES.filter_map { |flag, name| name if state & flag != 0 }.join("|") + end + + # :startdoc: + # The source that is being parsed. attr_reader :source @@ -794,7 +832,7 @@ def visit_array_pattern_node(node) # foo(bar) # ^^^ def visit_arguments_node(node) - arguments, _ = visit_call_node_arguments(node, nil, false) + arguments, _, _ = visit_call_node_arguments(node, nil, false) arguments end @@ -1004,16 +1042,16 @@ def visit_call_node(node) case node.name when :[] receiver = visit(node.receiver) - arguments, block = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc)) + arguments, block, has_ripper_block = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc)) bounds(node.location) call = on_aref(receiver, arguments) - if block.nil? - call - else + if has_ripper_block bounds(node.location) on_method_add_block(call, block) + else + call end when :[]= receiver = visit(node.receiver) @@ -1072,9 +1110,9 @@ def visit_call_node(node) if node.variable_call? on_vcall(message) else - arguments, block = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc || node.location)) + arguments, block, has_ripper_block = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc || node.location)) call = - if node.opening_loc.nil? && arguments&.any? + if node.opening_loc.nil? && get_arguments_and_block(node.arguments, node.block).first.any? bounds(node.location) on_command(message, arguments) elsif !node.opening_loc.nil? @@ -1085,11 +1123,11 @@ def visit_call_node(node) on_method_add_arg(on_fcall(message), on_args_new) end - if block.nil? - call - else + if has_ripper_block bounds(node.block.location) on_method_add_block(call, block) + else + call end end end @@ -1113,7 +1151,7 @@ def visit_call_node(node) bounds(node.location) on_assign(on_field(receiver, call_operator, message), value) else - arguments, block = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc || node.location)) + arguments, block, has_ripper_block = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc || node.location)) call = if node.opening_loc.nil? bounds(node.location) @@ -1131,27 +1169,35 @@ def visit_call_node(node) on_method_add_arg(on_call(receiver, call_operator, message), arguments) end - if block.nil? - call - else + if has_ripper_block bounds(node.block.location) on_method_add_block(call, block) + else + call end end end end - # Visit the arguments and block of a call node and return the arguments - # and block as they should be used. - private def visit_call_node_arguments(arguments_node, block_node, trailing_comma) + # Extract the arguments and block Ripper-style, which means if the block + # is like `&b` then it's moved to arguments. + private def get_arguments_and_block(arguments_node, block_node) arguments = arguments_node&.arguments || [] block = block_node if block.is_a?(BlockArgumentNode) - arguments << block + arguments += [block] block = nil end + [arguments, block] + end + + # Visit the arguments and block of a call node and return the arguments + # and block as they should be used. + private def visit_call_node_arguments(arguments_node, block_node, trailing_comma) + arguments, block = get_arguments_and_block(arguments_node, block_node) + [ if arguments.length == 1 && arguments.first.is_a?(ForwardingArgumentsNode) visit(arguments.first) @@ -1165,7 +1211,8 @@ def visit_call_node(node) on_args_add_block(args, false) end end, - visit(block) + visit(block), + block != nil, ] end @@ -1602,10 +1649,10 @@ def visit_def_node(node) end bounds(node.location) - if receiver.nil? - on_def(name, parameters, bodystmt) - else + if receiver on_defs(receiver, operator, name, parameters, bodystmt) + else + on_def(name, parameters, bodystmt) end end @@ -2003,7 +2050,7 @@ def visit_in_node(node) # ^^^^^^^^^^^^^^^ def visit_index_operator_write_node(node) receiver = visit(node.receiver) - arguments, _ = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc)) + arguments, _, _ = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc)) bounds(node.location) target = on_aref_field(receiver, arguments) @@ -2020,7 +2067,7 @@ def visit_index_operator_write_node(node) # ^^^^^^^^^^^^^^^^ def visit_index_and_write_node(node) receiver = visit(node.receiver) - arguments, _ = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc)) + arguments, _, _ = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc)) bounds(node.location) target = on_aref_field(receiver, arguments) @@ -2037,7 +2084,7 @@ def visit_index_and_write_node(node) # ^^^^^^^^^^^^^^^^ def visit_index_or_write_node(node) receiver = visit(node.receiver) - arguments, _ = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc)) + arguments, _, _ = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc)) bounds(node.location) target = on_aref_field(receiver, arguments) @@ -2054,7 +2101,7 @@ def visit_index_or_write_node(node) # ^^^^^^^^ def visit_index_target_node(node) receiver = visit(node.receiver) - arguments, _ = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc)) + arguments, _, _ = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.closing_loc)) bounds(node.location) on_aref_field(receiver, arguments) @@ -3084,7 +3131,7 @@ def visit_string_node(node) # super(foo) # ^^^^^^^^^^ def visit_super_node(node) - arguments, block = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.rparen_loc || node.location)) + arguments, block, has_ripper_block = visit_call_node_arguments(node.arguments, node.block, trailing_comma?(node.arguments&.location || node.location, node.rparen_loc || node.location)) if !node.lparen_loc.nil? bounds(node.lparen_loc) @@ -3094,11 +3141,11 @@ def visit_super_node(node) bounds(node.location) call = on_super(arguments) - if block.nil? - call - else + if has_ripper_block bounds(node.block.location) on_method_add_block(call, block) + else + call end end @@ -3294,7 +3341,7 @@ def visit_yield_node(node) # Lazily initialize the parse result. def result - @result ||= Prism.parse(source, partial_script: true) + @result ||= Prism.parse(source, partial_script: true, version: "current") end ########################################################################## @@ -3408,12 +3455,12 @@ def bounds(location) # :stopdoc: def _dispatch_0; end - def _dispatch_1(_); end - def _dispatch_2(_, _); end - def _dispatch_3(_, _, _); end - def _dispatch_4(_, _, _, _); end - def _dispatch_5(_, _, _, _, _); end - def _dispatch_7(_, _, _, _, _, _, _); end + def _dispatch_1(arg); arg end + def _dispatch_2(arg, _); arg end + def _dispatch_3(arg, _, _); arg end + def _dispatch_4(arg, _, _, _); arg end + def _dispatch_5(arg, _, _, _, _); arg end + def _dispatch_7(arg, _, _, _, _, _, _); arg end # :startdoc: # diff --git a/lib/prism/translation/ripper/filter.rb b/lib/prism/translation/ripper/filter.rb new file mode 100644 index 0000000000..19deef2d37 --- /dev/null +++ b/lib/prism/translation/ripper/filter.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module Prism + module Translation + class Ripper + class Filter # :nodoc: + # :stopdoc: + def initialize(src, filename = '-', lineno = 1) + @__lexer = Lexer.new(src, filename, lineno) + @__line = nil + @__col = nil + @__state = nil + end + + def filename + @__lexer.filename + end + + def lineno + @__line + end + + def column + @__col + end + + def state + @__state + end + + def parse(init = nil) + data = init + @__lexer.lex.each do |pos, event, tok, state| + @__line, @__col = *pos + @__state = state + data = if respond_to?(event, true) + then __send__(event, tok, data) + else on_default(event, tok, data) + end + end + data + end + + private + + def on_default(event, token, data) + data + end + # :startdoc: + end + end + end +end diff --git a/lib/prism/translation/ripper/lexer.rb b/lib/prism/translation/ripper/lexer.rb new file mode 100644 index 0000000000..bed863af08 --- /dev/null +++ b/lib/prism/translation/ripper/lexer.rb @@ -0,0 +1,135 @@ +# frozen_string_literal: true +# :markup: markdown + +require_relative "../ripper" + +module Prism + module Translation + class Ripper + class Lexer < Ripper # :nodoc: + # :stopdoc: + class State + + attr_reader :to_int, :to_s + + def initialize(i) + @to_int = i + @to_s = Ripper.lex_state_name(i) + freeze + end + + def [](index) + case index + when 0, :to_int + @to_int + when 1, :to_s + @to_s + else + nil + end + end + + alias to_i to_int + alias inspect to_s + def pretty_print(q) q.text(to_s) end + def ==(i) super or to_int == i end + def &(i) self.class.new(to_int & i) end + def |(i) self.class.new(to_int | i) end + def allbits?(i) to_int.allbits?(i) end + def anybits?(i) to_int.anybits?(i) end + def nobits?(i) to_int.nobits?(i) end + + # Instances are frozen and there are only a handful of them so we cache them here. + STATES = Hash.new { |h,k| h[k] = State.new(k) } + + def self.cached(i) + STATES[i] + end + end + + class Elem + attr_accessor :pos, :event, :tok, :state, :message + + def initialize(pos, event, tok, state, message = nil) + @pos = pos + @event = event + @tok = tok + @state = State.cached(state) + @message = message + end + + def [](index) + case index + when 0, :pos + @pos + when 1, :event + @event + when 2, :tok + @tok + when 3, :state + @state + when 4, :message + @message + else + nil + end + end + + def inspect + "#<#{self.class}: #{event}@#{pos[0]}:#{pos[1]}:#{state}: #{tok.inspect}#{": " if message}#{message}>" + end + + alias to_s inspect + + def pretty_print(q) + q.group(2, "#<#{self.class}:", ">") { + q.breakable + q.text("#{event}@#{pos[0]}:#{pos[1]}") + q.breakable + state.pretty_print(q) + q.breakable + q.text("token: ") + tok.pretty_print(q) + if message + q.breakable + q.text("message: ") + q.text(message) + end + } + end + + def to_a + if @message + [@pos, @event, @tok, @state, @message] + else + [@pos, @event, @tok, @state] + end + end + end + + # Pretty much just the same as Prism.lex_compat. + def lex(raise_errors: false) + Ripper.lex(@source, filename, lineno, raise_errors: raise_errors) + end + + # Returns the lex_compat result wrapped in `Elem`. Errors are omitted. + # Since ripper is a streaming parser, tokens are expected to be emitted in the order + # that the parser encounters them. This is not implemented. + def parse(...) + lex(...).map do |position, event, token, state| + Elem.new(position, event, token, state.to_int) + end + end + + # Similar to parse but ripper sorts the elements by position in the source. Also + # includes errors. Since prism does error recovery, in cases of syntax errors + # the result may differ greatly compared to ripper. + def scan(...) + parse(...) + end + + # :startdoc: + end + end + end +end diff --git a/lib/prism/translation/ripper/sexp.rb b/lib/prism/translation/ripper/sexp.rb index dc26a639a3..8cfefc8472 100644 --- a/lib/prism/translation/ripper/sexp.rb +++ b/lib/prism/translation/ripper/sexp.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# :markup: markdown require_relative "../ripper" diff --git a/lib/prism/translation/ruby_parser.rb b/lib/prism/translation/ruby_parser.rb index 8784e22d10..c026c4ad9c 100644 --- a/lib/prism/translation/ruby_parser.rb +++ b/lib/prism/translation/ruby_parser.rb @@ -1,12 +1,18 @@ # frozen_string_literal: true +# :markup: markdown begin - require "ruby_parser" + require "sexp" rescue LoadError - warn(%q{Error: Unable to load ruby_parser. Add `gem "ruby_parser"` to your Gemfile.}) + warn(%q{Error: Unable to load sexp. Add `gem "sexp_processor"` to your Gemfile.}) exit(1) end +class RubyParser # :nodoc: + class SyntaxError < RuntimeError # :nodoc: + end +end + module Prism module Translation # This module is the entry-point for converting a prism syntax tree into the @@ -15,7 +21,7 @@ class RubyParser # A prism visitor that builds Sexp objects. class Compiler < ::Prism::Compiler # This is the name of the file that we are compiling. We set it on every - # Sexp object that is generated, and also use it to compile __FILE__ + # Sexp object that is generated, and also use it to compile `__FILE__` # nodes. attr_reader :file @@ -34,26 +40,34 @@ def initialize(file, in_def: false, in_pattern: false) @in_pattern = in_pattern end + # ``` # alias foo bar # ^^^^^^^^^^^^^ + # ``` def visit_alias_method_node(node) s(node, :alias, visit(node.new_name), visit(node.old_name)) end + # ``` # alias $foo $bar # ^^^^^^^^^^^^^^^ + # ``` def visit_alias_global_variable_node(node) s(node, :valias, node.new_name.name, node.old_name.name) end + # ``` # foo => bar | baz # ^^^^^^^^^ + # ``` def visit_alternation_pattern_node(node) s(node, :or, visit(node.left), visit(node.right)) end + # ``` # a and b # ^^^^^^^ + # ``` def visit_and_node(node) left = visit(node.left) @@ -70,8 +84,10 @@ def visit_and_node(node) end end + # ``` # [] # ^^ + # ``` def visit_array_node(node) if in_pattern s(node, :array_pat, nil).concat(visit_all(node.elements)) @@ -80,8 +96,10 @@ def visit_array_node(node) end end + # ``` # foo => [bar] # ^^^^^ + # ``` def visit_array_pattern_node(node) if node.constant.nil? && node.requireds.empty? && node.rest.nil? && node.posts.empty? s(node, :array_pat) @@ -103,23 +121,29 @@ def visit_array_pattern_node(node) end end + # ``` # foo(bar) # ^^^ + # ``` def visit_arguments_node(node) raise "Cannot visit arguments directly" end + # ``` # { a: 1 } # ^^^^ + # ``` def visit_assoc_node(node) [visit(node.key), visit(node.value)] end + # ``` # def foo(**); bar(**); end # ^^ # # { **foo } # ^^^^^ + # ``` def visit_assoc_splat_node(node) if node.value.nil? [s(node, :kwsplat)] @@ -128,14 +152,18 @@ def visit_assoc_splat_node(node) end end + # ``` # $+ # ^^ + # ``` def visit_back_reference_read_node(node) - s(node, :back_ref, node.name.name.delete_prefix("$").to_sym) + s(node, :back_ref, node.name.to_s.delete_prefix("$").to_sym) end + # ``` # begin end # ^^^^^^^^^ + # ``` def visit_begin_node(node) result = node.statements.nil? ? s(node, :nil) : visit(node.statements) @@ -167,16 +195,20 @@ def visit_begin_node(node) result end + # ``` # foo(&bar) # ^^^^ + # ``` def visit_block_argument_node(node) s(node, :block_pass).tap do |result| result << visit(node.expression) unless node.expression.nil? end end + # ``` # foo { |; bar| } # ^^^ + # ``` def visit_block_local_variable_node(node) node.name end @@ -186,8 +218,10 @@ def visit_block_node(node) s(node, :block_pass, visit(node.expression)) end + # ``` # def foo(&bar); end # ^^^^ + # ``` def visit_block_parameter_node(node) :"&#{node.name}" end @@ -228,11 +262,13 @@ def visit_block_parameters_node(node) result end + # ``` # break # ^^^^^ # # break foo # ^^^^^^^^^ + # ``` def visit_break_node(node) if node.arguments.nil? s(node, :break) @@ -243,6 +279,7 @@ def visit_break_node(node) end end + # ``` # foo # ^^^ # @@ -251,6 +288,7 @@ def visit_break_node(node) # # foo.bar() {} # ^^^^^^^^^^^^ + # ``` def visit_call_node(node) case node.name when :!~ @@ -289,8 +327,10 @@ def visit_call_node(node) visit_block(node, result, block) end + # ``` # foo.bar += baz # ^^^^^^^^^^^^^^^ + # ``` def visit_call_operator_write_node(node) if op_asgn?(node) s(node, op_asgn_type(node, :op_asgn), visit(node.receiver), visit_write_value(node.value), node.read_name, node.binary_operator) @@ -299,8 +339,10 @@ def visit_call_operator_write_node(node) end end + # ``` # foo.bar &&= baz # ^^^^^^^^^^^^^^^ + # ``` def visit_call_and_write_node(node) if op_asgn?(node) s(node, op_asgn_type(node, :op_asgn), visit(node.receiver), visit_write_value(node.value), node.read_name, :"&&") @@ -309,8 +351,10 @@ def visit_call_and_write_node(node) end end + # ``` # foo.bar ||= baz # ^^^^^^^^^^^^^^^ + # ``` def visit_call_or_write_node(node) if op_asgn?(node) s(node, op_asgn_type(node, :op_asgn), visit(node.receiver), visit_write_value(node.value), node.read_name, :"||") @@ -332,32 +376,42 @@ def visit_call_or_write_node(node) node.safe_navigation? ? :"safe_#{type}" : type end + # ``` # foo.bar, = 1 # ^^^^^^^ + # ``` def visit_call_target_node(node) s(node, :attrasgn, visit(node.receiver), node.name) end + # ``` # foo => bar => baz # ^^^^^^^^^^ + # ``` def visit_capture_pattern_node(node) visit(node.target) << visit(node.value) end + # ``` # case foo; when bar; end # ^^^^^^^^^^^^^^^^^^^^^^^ + # ``` def visit_case_node(node) s(node, :case, visit(node.predicate)).concat(visit_all(node.conditions)) << visit(node.else_clause) end + # ``` # case foo; in bar; end # ^^^^^^^^^^^^^^^^^^^^^ + # ``` def visit_case_match_node(node) s(node, :case, visit(node.predicate)).concat(visit_all(node.conditions)) << visit(node.else_clause) end + # ``` # class Foo; end # ^^^^^^^^^^^^^^ + # ``` def visit_class_node(node) name = if node.constant_path.is_a?(ConstantReadNode) @@ -366,51 +420,67 @@ def visit_class_node(node) visit(node.constant_path) end - if node.body.nil? - s(node, :class, name, visit(node.superclass)) - elsif node.body.is_a?(StatementsNode) - compiler = copy_compiler(in_def: false) - s(node, :class, name, visit(node.superclass)).concat(node.body.body.map { |child| child.accept(compiler) }) - else - s(node, :class, name, visit(node.superclass), node.body.accept(copy_compiler(in_def: false))) - end + result = + if node.body.nil? + s(node, :class, name, visit(node.superclass)) + elsif node.body.is_a?(StatementsNode) + compiler = copy_compiler(in_def: false) + s(node, :class, name, visit(node.superclass)).concat(node.body.body.map { |child| child.accept(compiler) }) + else + s(node, :class, name, visit(node.superclass), node.body.accept(copy_compiler(in_def: false))) + end + + attach_comments(result, node) + result end + # ``` # @@foo # ^^^^^ + # ``` def visit_class_variable_read_node(node) s(node, :cvar, node.name) end + # ``` # @@foo = 1 # ^^^^^^^^^ # # @@foo, @@bar = 1 # ^^^^^ ^^^^^ + # ``` def visit_class_variable_write_node(node) s(node, class_variable_write_type, node.name, visit_write_value(node.value)) end + # ``` # @@foo += bar # ^^^^^^^^^^^^ + # ``` def visit_class_variable_operator_write_node(node) s(node, class_variable_write_type, node.name, s(node, :call, s(node, :cvar, node.name), node.binary_operator, visit_write_value(node.value))) end + # ``` # @@foo &&= bar # ^^^^^^^^^^^^^ + # ``` def visit_class_variable_and_write_node(node) s(node, :op_asgn_and, s(node, :cvar, node.name), s(node, class_variable_write_type, node.name, visit_write_value(node.value))) end + # ``` # @@foo ||= bar # ^^^^^^^^^^^^^ + # ``` def visit_class_variable_or_write_node(node) s(node, :op_asgn_or, s(node, :cvar, node.name), s(node, class_variable_write_type, node.name, visit_write_value(node.value))) end + # ``` # @@foo, = bar # ^^^^^ + # ``` def visit_class_variable_target_node(node) s(node, class_variable_write_type, node.name) end @@ -421,47 +491,61 @@ def visit_class_variable_target_node(node) in_def ? :cvasgn : :cvdecl end + # ``` # Foo # ^^^ + # ``` def visit_constant_read_node(node) s(node, :const, node.name) end + # ``` # Foo = 1 # ^^^^^^^ # # Foo, Bar = 1 # ^^^ ^^^ + # ``` def visit_constant_write_node(node) s(node, :cdecl, node.name, visit_write_value(node.value)) end + # ``` # Foo += bar # ^^^^^^^^^^^ + # ``` def visit_constant_operator_write_node(node) s(node, :cdecl, node.name, s(node, :call, s(node, :const, node.name), node.binary_operator, visit_write_value(node.value))) end + # ``` # Foo &&= bar # ^^^^^^^^^^^^ + # ``` def visit_constant_and_write_node(node) s(node, :op_asgn_and, s(node, :const, node.name), s(node, :cdecl, node.name, visit(node.value))) end + # ``` # Foo ||= bar # ^^^^^^^^^^^^ + # ``` def visit_constant_or_write_node(node) s(node, :op_asgn_or, s(node, :const, node.name), s(node, :cdecl, node.name, visit(node.value))) end + # ``` # Foo, = bar # ^^^ + # ``` def visit_constant_target_node(node) s(node, :cdecl, node.name) end + # ``` # Foo::Bar # ^^^^^^^^ + # ``` def visit_constant_path_node(node) if node.parent.nil? s(node, :colon3, node.name) @@ -470,35 +554,45 @@ def visit_constant_path_node(node) end end + # ``` # Foo::Bar = 1 # ^^^^^^^^^^^^ # # Foo::Foo, Bar::Bar = 1 # ^^^^^^^^ ^^^^^^^^ + # ``` def visit_constant_path_write_node(node) s(node, :cdecl, visit(node.target), visit_write_value(node.value)) end + # ``` # Foo::Bar += baz # ^^^^^^^^^^^^^^^ + # ``` def visit_constant_path_operator_write_node(node) s(node, :op_asgn, visit(node.target), node.binary_operator, visit_write_value(node.value)) end + # ``` # Foo::Bar &&= baz # ^^^^^^^^^^^^^^^^ + # ``` def visit_constant_path_and_write_node(node) s(node, :op_asgn_and, visit(node.target), visit_write_value(node.value)) end + # ``` # Foo::Bar ||= baz # ^^^^^^^^^^^^^^^^ + # ``` def visit_constant_path_or_write_node(node) s(node, :op_asgn_or, visit(node.target), visit_write_value(node.value)) end + # ``` # Foo::Bar, = baz # ^^^^^^^^ + # ``` def visit_constant_path_target_node(node) inner = if node.parent.nil? @@ -510,11 +604,13 @@ def visit_constant_path_target_node(node) s(node, :const, inner) end + # ``` # def foo; end # ^^^^^^^^^^^^ # # def self.foo; end # ^^^^^^^^^^^^^^^^^ + # ``` def visit_def_node(node) name = node.name_loc.slice.to_sym result = @@ -524,7 +620,9 @@ def visit_def_node(node) s(node, :defs, visit(node.receiver), name) end + attach_comments(result, node) result.line(node.name_loc.start_line) + if node.parameters.nil? result << s(node, :args).line(node.name_loc.start_line) else @@ -541,55 +639,71 @@ def visit_def_node(node) end end + # ``` # defined? a # ^^^^^^^^^^ # # defined?(a) # ^^^^^^^^^^^ + # ``` def visit_defined_node(node) s(node, :defined, visit(node.value)) end + # ``` # if foo then bar else baz end # ^^^^^^^^^^^^ + # ``` def visit_else_node(node) visit(node.statements) end + # ``` # "foo #{bar}" # ^^^^^^ + # ``` def visit_embedded_statements_node(node) result = s(node, :evstr) result << visit(node.statements) unless node.statements.nil? result end + # ``` # "foo #@bar" # ^^^^^ + # ``` def visit_embedded_variable_node(node) s(node, :evstr, visit(node.variable)) end + # ``` # begin; foo; ensure; bar; end # ^^^^^^^^^^^^ + # ``` def visit_ensure_node(node) node.statements.nil? ? s(node, :nil) : visit(node.statements) end + # ``` # false # ^^^^^ + # ``` def visit_false_node(node) s(node, :false) end + # ``` # foo => [*, bar, *] # ^^^^^^^^^^^ + # ``` def visit_find_pattern_node(node) s(node, :find_pat, visit_pattern_constant(node.constant), :"*#{node.left.expression&.name}", *visit_all(node.requireds), :"*#{node.right.expression&.name}") end + # ``` # if foo .. bar; end # ^^^^^^^^^^ + # ``` def visit_flip_flop_node(node) if node.left.is_a?(IntegerNode) && node.right.is_a?(IntegerNode) s(node, :lit, Range.new(node.left.value, node.right.value, node.exclude_end?)) @@ -598,86 +712,112 @@ def visit_flip_flop_node(node) end end + # ``` # 1.0 # ^^^ + # ``` def visit_float_node(node) s(node, :lit, node.value) end + # ``` # for foo in bar do end # ^^^^^^^^^^^^^^^^^^^^^ + # ``` def visit_for_node(node) s(node, :for, visit(node.collection), visit(node.index), visit(node.statements)) end + # ``` # def foo(...); bar(...); end # ^^^ + # ``` def visit_forwarding_arguments_node(node) s(node, :forward_args) end + # ``` # def foo(...); end # ^^^ + # ``` def visit_forwarding_parameter_node(node) s(node, :forward_args) end + # ``` # super # ^^^^^ # # super {} # ^^^^^^^^ + # ``` def visit_forwarding_super_node(node) visit_block(node, s(node, :zsuper), node.block) end + # ``` # $foo # ^^^^ + # ``` def visit_global_variable_read_node(node) s(node, :gvar, node.name) end + # ``` # $foo = 1 # ^^^^^^^^ # # $foo, $bar = 1 # ^^^^ ^^^^ + # ``` def visit_global_variable_write_node(node) s(node, :gasgn, node.name, visit_write_value(node.value)) end + # ``` # $foo += bar # ^^^^^^^^^^^ + # ``` def visit_global_variable_operator_write_node(node) s(node, :gasgn, node.name, s(node, :call, s(node, :gvar, node.name), node.binary_operator, visit(node.value))) end + # ``` # $foo &&= bar # ^^^^^^^^^^^^ + # ``` def visit_global_variable_and_write_node(node) s(node, :op_asgn_and, s(node, :gvar, node.name), s(node, :gasgn, node.name, visit_write_value(node.value))) end + # ``` # $foo ||= bar # ^^^^^^^^^^^^ + # ``` def visit_global_variable_or_write_node(node) s(node, :op_asgn_or, s(node, :gvar, node.name), s(node, :gasgn, node.name, visit_write_value(node.value))) end + # ``` # $foo, = bar # ^^^^ + # ``` def visit_global_variable_target_node(node) s(node, :gasgn, node.name) end + # ``` # {} # ^^ + # ``` def visit_hash_node(node) s(node, :hash).concat(node.elements.flat_map { |element| visit(element) }) end + # ``` # foo => {} # ^^ + # ``` def visit_hash_pattern_node(node) result = s(node, :hash_pat, visit_pattern_constant(node.constant)).concat(node.elements.flat_map { |element| visit(element) }) @@ -691,6 +831,7 @@ def visit_hash_pattern_node(node) result end + # ``` # if foo then bar end # ^^^^^^^^^^^^^^^^^^^ # @@ -699,6 +840,7 @@ def visit_hash_pattern_node(node) # # foo ? bar : baz # ^^^^^^^^^^^^^^^ + # ``` def visit_if_node(node) s(node, :if, visit(node.predicate), visit(node.statements), visit(node.subsequent)) end @@ -708,18 +850,24 @@ def visit_imaginary_node(node) s(node, :lit, node.value) end + # ``` # { foo: } # ^^^^ + # ``` def visit_implicit_node(node) end + # ``` # foo { |bar,| } # ^ + # ``` def visit_implicit_rest_node(node) end + # ``` # case foo; in bar; end # ^^^^^^^^^^^^^^^^^^^^^ + # ``` def visit_in_node(node) pattern = if node.pattern.is_a?(ConstantPathNode) @@ -731,8 +879,10 @@ def visit_in_node(node) s(node, :in, pattern).concat(node.statements.nil? ? [nil] : visit_all(node.statements.body)) end + # ``` # foo[bar] += baz # ^^^^^^^^^^^^^^^ + # ``` def visit_index_operator_write_node(node) arglist = nil @@ -744,8 +894,10 @@ def visit_index_operator_write_node(node) s(node, :op_asgn1, visit(node.receiver), arglist, node.binary_operator, visit_write_value(node.value)) end + # ``` # foo[bar] &&= baz # ^^^^^^^^^^^^^^^^ + # ``` def visit_index_and_write_node(node) arglist = nil @@ -757,8 +909,10 @@ def visit_index_and_write_node(node) s(node, :op_asgn1, visit(node.receiver), arglist, :"&&", visit_write_value(node.value)) end + # ``` # foo[bar] ||= baz # ^^^^^^^^^^^^^^^^ + # ``` def visit_index_or_write_node(node) arglist = nil @@ -770,8 +924,10 @@ def visit_index_or_write_node(node) s(node, :op_asgn1, visit(node.receiver), arglist, :"||", visit_write_value(node.value)) end + # ``` # foo[bar], = 1 # ^^^^^^^^ + # ``` def visit_index_target_node(node) arguments = visit_all(node.arguments&.arguments || []) arguments << visit(node.block) unless node.block.nil? @@ -779,53 +935,69 @@ def visit_index_target_node(node) s(node, :attrasgn, visit(node.receiver), :[]=).concat(arguments) end + # ``` # @foo # ^^^^ + # ``` def visit_instance_variable_read_node(node) s(node, :ivar, node.name) end + # ``` # @foo = 1 # ^^^^^^^^ # # @foo, @bar = 1 # ^^^^ ^^^^ + # ``` def visit_instance_variable_write_node(node) s(node, :iasgn, node.name, visit_write_value(node.value)) end + # ``` # @foo += bar # ^^^^^^^^^^^ + # ``` def visit_instance_variable_operator_write_node(node) s(node, :iasgn, node.name, s(node, :call, s(node, :ivar, node.name), node.binary_operator, visit_write_value(node.value))) end + # ``` # @foo &&= bar # ^^^^^^^^^^^^ + # ``` def visit_instance_variable_and_write_node(node) s(node, :op_asgn_and, s(node, :ivar, node.name), s(node, :iasgn, node.name, visit(node.value))) end + # ``` # @foo ||= bar # ^^^^^^^^^^^^ + # ``` def visit_instance_variable_or_write_node(node) s(node, :op_asgn_or, s(node, :ivar, node.name), s(node, :iasgn, node.name, visit(node.value))) end + # ``` # @foo, = bar # ^^^^ + # ``` def visit_instance_variable_target_node(node) s(node, :iasgn, node.name) end + # ``` # 1 # ^ + # ``` def visit_integer_node(node) s(node, :lit, node.value) end + # ``` # if /foo #{bar}/ then end # ^^^^^^^^^^^^ + # ``` def visit_interpolated_match_last_line_node(node) parts = visit_interpolated_parts(node.parts) regexp = @@ -841,8 +1013,10 @@ def visit_interpolated_match_last_line_node(node) s(node, :match, regexp) end + # ``` # /foo #{bar}/ # ^^^^^^^^^^^^ + # ``` def visit_interpolated_regular_expression_node(node) parts = visit_interpolated_parts(node.parts) @@ -856,22 +1030,28 @@ def visit_interpolated_regular_expression_node(node) end end + # ``` # "foo #{bar}" # ^^^^^^^^^^^^ + # ``` def visit_interpolated_string_node(node) parts = visit_interpolated_parts(node.parts) parts.length == 1 ? s(node, :str, parts.first) : s(node, :dstr).concat(parts) end + # ``` # :"foo #{bar}" # ^^^^^^^^^^^^^ + # ``` def visit_interpolated_symbol_node(node) parts = visit_interpolated_parts(node.parts) parts.length == 1 ? s(node, :lit, parts.first.to_sym) : s(node, :dsym).concat(parts) end + # ``` # `foo #{bar}` # ^^^^^^^^^^^^ + # ``` def visit_interpolated_x_string_node(node) source = node.heredoc? ? node.parts.first : node parts = visit_interpolated_parts(node.parts) @@ -951,23 +1131,29 @@ def visit_interpolated_x_string_node(node) results end + # ``` # -> { it } # ^^ + # ``` def visit_it_local_variable_read_node(node) s(node, :call, nil, :it) end + # ``` # foo(bar: baz) # ^^^^^^^^ + # ``` def visit_keyword_hash_node(node) s(node, :hash).concat(node.elements.flat_map { |element| visit(element) }) end + # ``` # def foo(**bar); end # ^^^^^ # # def foo(**); end # ^^ + # ``` def visit_keyword_rest_parameter_node(node) :"**#{node.name}" end @@ -976,8 +1162,8 @@ def visit_keyword_rest_parameter_node(node) def visit_lambda_node(node) parameters = case node.parameters - when nil, NumberedParametersNode - s(node, :args) + when nil, ItParametersNode, NumberedParametersNode + 0 else visit(node.parameters) end @@ -989,8 +1175,10 @@ def visit_lambda_node(node) end end + # ``` # foo # ^^^ + # ``` def visit_local_variable_read_node(node) if node.name.match?(/^_\d$/) s(node, :call, nil, node.name) @@ -999,59 +1187,77 @@ def visit_local_variable_read_node(node) end end + # ``` # foo = 1 # ^^^^^^^ # # foo, bar = 1 # ^^^ ^^^ + # ``` def visit_local_variable_write_node(node) s(node, :lasgn, node.name, visit_write_value(node.value)) end + # ``` # foo += bar # ^^^^^^^^^^ + # ``` def visit_local_variable_operator_write_node(node) s(node, :lasgn, node.name, s(node, :call, s(node, :lvar, node.name), node.binary_operator, visit_write_value(node.value))) end + # ``` # foo &&= bar # ^^^^^^^^^^^ + # ``` def visit_local_variable_and_write_node(node) s(node, :op_asgn_and, s(node, :lvar, node.name), s(node, :lasgn, node.name, visit_write_value(node.value))) end + # ``` # foo ||= bar # ^^^^^^^^^^^ + # ``` def visit_local_variable_or_write_node(node) s(node, :op_asgn_or, s(node, :lvar, node.name), s(node, :lasgn, node.name, visit_write_value(node.value))) end + # ``` # foo, = bar # ^^^ + # ``` def visit_local_variable_target_node(node) s(node, :lasgn, node.name) end + # ``` # if /foo/ then end # ^^^^^ + # ``` def visit_match_last_line_node(node) s(node, :match, s(node, :lit, Regexp.new(node.unescaped, node.options))) end + # ``` # foo in bar # ^^^^^^^^^^ + # ``` def visit_match_predicate_node(node) s(node, :case, visit(node.value), s(node, :in, node.pattern.accept(copy_compiler(in_pattern: true)), nil), nil) end + # ``` # foo => bar # ^^^^^^^^^^ + # ``` def visit_match_required_node(node) s(node, :case, visit(node.value), s(node, :in, node.pattern.accept(copy_compiler(in_pattern: true)), nil), nil) end + # ``` # /(?foo)/ =~ bar # ^^^^^^^^^^^^^^^^^^^^ + # ``` def visit_match_write_node(node) s(node, :match2, visit(node.call.receiver), visit(node.call.arguments.arguments.first)) end @@ -1063,8 +1269,10 @@ def visit_missing_node(node) raise "Cannot visit missing node directly" end + # ``` # module Foo; end # ^^^^^^^^^^^^^^^ + # ``` def visit_module_node(node) name = if node.constant_path.is_a?(ConstantReadNode) @@ -1073,18 +1281,24 @@ def visit_module_node(node) visit(node.constant_path) end - if node.body.nil? - s(node, :module, name) - elsif node.body.is_a?(StatementsNode) - compiler = copy_compiler(in_def: false) - s(node, :module, name).concat(node.body.body.map { |child| child.accept(compiler) }) - else - s(node, :module, name, node.body.accept(copy_compiler(in_def: false))) - end + result = + if node.body.nil? + s(node, :module, name) + elsif node.body.is_a?(StatementsNode) + compiler = copy_compiler(in_def: false) + s(node, :module, name).concat(node.body.body.map { |child| child.accept(compiler) }) + else + s(node, :module, name, node.body.accept(copy_compiler(in_def: false))) + end + + attach_comments(result, node) + result end + # ``` # foo, bar = baz # ^^^^^^^^ + # ``` def visit_multi_target_node(node) targets = [*node.lefts] targets << node.rest if !node.rest.nil? && !node.rest.is_a?(ImplicitRestNode) @@ -1093,8 +1307,10 @@ def visit_multi_target_node(node) s(node, :masgn, s(node, :array).concat(visit_all(targets))) end + # ``` # foo, bar = baz # ^^^^^^^^^^^^^^ + # ``` def visit_multi_write_node(node) targets = [*node.lefts] targets << node.rest if !node.rest.nil? && !node.rest.is_a?(ImplicitRestNode) @@ -1114,11 +1330,13 @@ def visit_multi_write_node(node) s(node, :masgn, s(node, :array).concat(visit_all(targets)), value) end + # ``` # next # ^^^^ # # next foo # ^^^^^^^^ + # ``` def visit_next_node(node) if node.arguments.nil? s(node, :next) @@ -1130,44 +1348,58 @@ def visit_next_node(node) end end + # ``` # nil # ^^^ + # ``` def visit_nil_node(node) s(node, :nil) end + # ``` # def foo(**nil); end # ^^^^^ + # ``` def visit_no_keywords_parameter_node(node) in_pattern ? s(node, :kwrest, :"**nil") : :"**nil" end + # ``` # -> { _1 + _2 } # ^^^^^^^^^^^^^^ + # ``` def visit_numbered_parameters_node(node) raise "Cannot visit numbered parameters directly" end + # ``` # $1 # ^^ + # ``` def visit_numbered_reference_read_node(node) s(node, :nth_ref, node.number) end + # ``` # def foo(bar: baz); end # ^^^^^^^^ + # ``` def visit_optional_keyword_parameter_node(node) s(node, :kwarg, node.name, visit(node.value)) end + # ``` # def foo(bar = 1); end # ^^^^^^^ + # ``` def visit_optional_parameter_node(node) s(node, :lasgn, node.name, visit(node.value)) end + # ``` # a or b # ^^^^^^ + # ``` def visit_or_node(node) left = visit(node.left) @@ -1184,11 +1416,13 @@ def visit_or_node(node) end end + # ``` # def foo(bar, *baz); end # ^^^^^^^^^ + # ``` def visit_parameters_node(node) children = - node.compact_child_nodes.map do |element| + node.each_child_node.map do |element| if element.is_a?(MultiTargetNode) visit_destructured_parameter(element) else @@ -1199,8 +1433,10 @@ def visit_parameters_node(node) s(node, :args).concat(children) end + # ``` # def foo((bar, baz)); end # ^^^^^^^^^^ + # ``` private def visit_destructured_parameter(node) children = [*node.lefts, *node.rest, *node.rights].map do |child| @@ -1219,11 +1455,13 @@ def visit_parameters_node(node) s(node, :masgn).concat(children) end + # ``` # () # ^^ # # (1) # ^^^ + # ``` def visit_parentheses_node(node) if node.body.nil? s(node, :nil) @@ -1232,14 +1470,18 @@ def visit_parentheses_node(node) end end + # ``` # foo => ^(bar) # ^^^^^^ + # ``` def visit_pinned_expression_node(node) node.expression.accept(copy_compiler(in_pattern: false)) end + # ``` # foo = 1 and bar => ^foo # ^^^^ + # ``` def visit_pinned_variable_node(node) if node.variable.is_a?(LocalVariableReadNode) && node.variable.name.match?(/^_\d$/) s(node, :lvar, node.variable.name) @@ -1263,8 +1505,10 @@ def visit_program_node(node) visit(node.statements) end + # ``` # 0..5 # ^^^^ + # ``` def visit_range_node(node) if !in_pattern && !node.left.nil? && !node.right.nil? && ([node.left.type, node.right.type] - %i[nil_node integer_node]).empty? left = node.left.value if node.left.is_a?(IntegerNode) @@ -1285,44 +1529,58 @@ def visit_range_node(node) end end + # ``` # 1r # ^^ + # ``` def visit_rational_node(node) s(node, :lit, node.value) end + # ``` # redo # ^^^^ + # ``` def visit_redo_node(node) s(node, :redo) end + # ``` # /foo/ # ^^^^^ + # ``` def visit_regular_expression_node(node) s(node, :lit, Regexp.new(node.unescaped, node.options)) end + # ``` # def foo(bar:); end # ^^^^ + # ``` def visit_required_keyword_parameter_node(node) s(node, :kwarg, node.name) end + # ``` # def foo(bar); end # ^^^ + # ``` def visit_required_parameter_node(node) node.name end + # ``` # foo rescue bar # ^^^^^^^^^^^^^^ + # ``` def visit_rescue_modifier_node(node) s(node, :rescue, visit(node.expression), s(node.rescue_expression, :resbody, s(node.rescue_expression, :array), visit(node.rescue_expression))) end + # ``` # begin; rescue; end # ^^^^^^^ + # ``` def visit_rescue_node(node) exceptions = if node.exceptions.length == 1 && node.exceptions.first.is_a?(SplatNode) @@ -1338,26 +1596,32 @@ def visit_rescue_node(node) s(node, :resbody, exceptions).concat(node.statements.nil? ? [nil] : visit_all(node.statements.body)) end + # ``` # def foo(*bar); end # ^^^^ # # def foo(*); end # ^ + # ``` def visit_rest_parameter_node(node) :"*#{node.name}" end + # ``` # retry # ^^^^^ + # ``` def visit_retry_node(node) s(node, :retry) end + # ``` # return # ^^^^^^ # # return 1 # ^^^^^^^^ + # ``` def visit_return_node(node) if node.arguments.nil? s(node, :return) @@ -1369,8 +1633,10 @@ def visit_return_node(node) end end + # ``` # self # ^^^^ + # ``` def visit_self_node(node) s(node, :self) end @@ -1380,33 +1646,42 @@ def visit_shareable_constant_node(node) visit(node.write) end + # ``` # class << self; end # ^^^^^^^^^^^^^^^^^^ + # ``` def visit_singleton_class_node(node) s(node, :sclass, visit(node.expression)).tap do |sexp| sexp << node.body.accept(copy_compiler(in_def: false)) unless node.body.nil? end end + # ``` # __ENCODING__ # ^^^^^^^^^^^^ + # ``` def visit_source_encoding_node(node) # TODO s(node, :colon2, s(node, :const, :Encoding), :UTF_8) end + # ``` # __FILE__ # ^^^^^^^^ + # ``` def visit_source_file_node(node) s(node, :str, node.filepath) end + # ``` # __LINE__ # ^^^^^^^^ + # ``` def visit_source_line_node(node) s(node, :lit, node.location.start_line) end + # ``` # foo(*bar) # ^^^^ # @@ -1415,6 +1690,7 @@ def visit_source_line_node(node) # # def foo(*); bar(*); end # ^ + # ``` def visit_splat_node(node) if node.expression.nil? s(node, :splat) @@ -1434,8 +1710,10 @@ def visit_statements_node(node) end end + # ``` # "foo" # ^^^^^ + # ``` def visit_string_node(node) unescaped = node.unescaped @@ -1447,8 +1725,10 @@ def visit_string_node(node) s(node, :str, unescaped) end + # ``` # super(foo) # ^^^^^^^^^^ + # ``` def visit_super_node(node) arguments = node.arguments&.arguments || [] block = node.block @@ -1461,60 +1741,76 @@ def visit_super_node(node) visit_block(node, s(node, :super).concat(visit_all(arguments)), block) end + # ``` # :foo # ^^^^ + # ``` def visit_symbol_node(node) node.value == "!@" ? s(node, :lit, :"!@") : s(node, :lit, node.unescaped.to_sym) end + # ``` # true # ^^^^ + # ``` def visit_true_node(node) s(node, :true) end + # ``` # undef foo # ^^^^^^^^^ + # ``` def visit_undef_node(node) names = node.names.map { |name| s(node, :undef, visit(name)) } names.length == 1 ? names.first : s(node, :block).concat(names) end + # ``` # unless foo; bar end # ^^^^^^^^^^^^^^^^^^^ # # bar unless foo # ^^^^^^^^^^^^^^ + # ``` def visit_unless_node(node) s(node, :if, visit(node.predicate), visit(node.else_clause), visit(node.statements)) end + # ``` # until foo; bar end # ^^^^^^^^^^^^^^^^^ # # bar until foo # ^^^^^^^^^^^^^ + # ``` def visit_until_node(node) s(node, :until, visit(node.predicate), visit(node.statements), !node.begin_modifier?) end + # ``` # case foo; when bar; end # ^^^^^^^^^^^^^ + # ``` def visit_when_node(node) s(node, :when, s(node, :array).concat(visit_all(node.conditions))).concat(node.statements.nil? ? [nil] : visit_all(node.statements.body)) end + # ``` # while foo; bar end # ^^^^^^^^^^^^^^^^^^ # # bar while foo # ^^^^^^^^^^^^^ + # ``` def visit_while_node(node) s(node, :while, visit(node.predicate), visit(node.statements), !node.begin_modifier?) end + # ``` # `foo` # ^^^^^ + # ``` def visit_x_string_node(node) result = s(node, :xstr, node.unescaped) @@ -1526,17 +1822,30 @@ def visit_x_string_node(node) result end + # ``` # yield # ^^^^^ # # yield 1 # ^^^^^^^ + # ``` def visit_yield_node(node) s(node, :yield).concat(visit_all(node.arguments&.arguments || [])) end private + # Attach prism comments to the given sexp. + def attach_comments(sexp, node) + return unless node.comments + return if node.comments.empty? + + extra = node.location.start_line - node.comments.last.location.start_line + comments = node.comments.map(&:slice) + comments.concat([nil] * [0, extra].max) + sexp.comments = comments.join("\n") + end + # Create a new compiler with the given options. def copy_compiler(in_def: self.in_def, in_pattern: self.in_pattern) Compiler.new(file, in_def: in_def, in_pattern: in_pattern) @@ -1615,6 +1924,14 @@ def parse_file(filepath) translate(Prism.parse_file(filepath, partial_script: true), filepath) end + # Parse the give file and translate it into the + # seattlerb/ruby_parser gem's Sexp format. This method is + # provided for API compatibility to RubyParser and takes an + # optional +timeout+ argument. + def process(ruby, file = "(string)", timeout = nil) + Timeout.timeout(timeout) { parse(ruby, file) } + end + class << self # Parse the given source and translate it into the seattlerb/ruby_parser # gem's Sexp format. @@ -1639,6 +1956,7 @@ def translate(result, filepath) raise ::RubyParser::SyntaxError, "#{filepath}:#{error.location.start_line} :: #{error.message}" end + result.attach_comments! result.value.accept(Compiler.new(filepath)) end end diff --git a/prism.gemspec b/prism.gemspec index 5cb5a98057..283c7b04aa 100644 --- a/prism.gemspec +++ b/prism.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "prism" - spec.version = "1.4.0" + spec.version = "1.8.0" spec.authors = ["Shopify"] spec.email = ["ruby@shopify.com"] @@ -77,6 +77,7 @@ Gem::Specification.new do |spec| "lib/prism/ffi.rb", "lib/prism/inspect_visitor.rb", "lib/prism/lex_compat.rb", + "lib/prism/lex_ripper.rb", "lib/prism/mutation_compiler.rb", "lib/prism/node_ext.rb", "lib/prism/node.rb", @@ -88,6 +89,7 @@ Gem::Specification.new do |spec| "lib/prism/pattern.rb", "lib/prism/polyfill/append_as_bytes.rb", "lib/prism/polyfill/byteindex.rb", + "lib/prism/polyfill/scan_byte.rb", "lib/prism/polyfill/unpack1.rb", "lib/prism/polyfill/warn.rb", "lib/prism/reflection.rb", @@ -97,13 +99,13 @@ Gem::Specification.new do |spec| "lib/prism/translation.rb", "lib/prism/translation/parser.rb", "lib/prism/translation/parser_current.rb", - "lib/prism/translation/parser33.rb", - "lib/prism/translation/parser34.rb", - "lib/prism/translation/parser35.rb", + "lib/prism/translation/parser_versions.rb", "lib/prism/translation/parser/builder.rb", "lib/prism/translation/parser/compiler.rb", "lib/prism/translation/parser/lexer.rb", "lib/prism/translation/ripper.rb", + "lib/prism/translation/ripper/filter.rb", + "lib/prism/translation/ripper/lexer.rb", "lib/prism/translation/ripper/sexp.rb", "lib/prism/translation/ripper/shim.rb", "lib/prism/translation/ruby_parser.rb", @@ -119,9 +121,7 @@ Gem::Specification.new do |spec| "rbi/prism/reflection.rbi", "rbi/prism/string_query.rbi", "rbi/prism/translation/parser.rbi", - "rbi/prism/translation/parser33.rbi", - "rbi/prism/translation/parser34.rbi", - "rbi/prism/translation/parser35.rbi", + "rbi/prism/translation/parser_versions.rbi", "rbi/prism/translation/ripper.rbi", "rbi/prism/visitor.rbi", "sig/prism.rbs", diff --git a/rakelib/cargo.rake b/rakelib/cargo.rake index 8f5d5266a9..cb6099582d 100644 --- a/rakelib/cargo.rake +++ b/rakelib/cargo.rake @@ -3,6 +3,9 @@ namespace :cargo do desc "Build and test the Rust packages" task build: [:templates] do + require "json" + require "yaml" + gemspec = Gem::Specification.load("prism.gemspec") prism_sys_dir = Pathname(File.expand_path(File.join(__dir__, "../rust", "ruby-prism-sys"))) @@ -18,7 +21,11 @@ namespace :cargo do rm_rf(prism_dir.join("vendor")) mkdir_p(prism_vendor_dir) - cp(File.expand_path("../config.yml", __dir__), prism_vendor_dir.join("config.yml")) + + # This used `serde_yaml` previously, which is now deprecated. Convert it to json + # so that `serde_json` can be used instead, keeping it strongly typed. + config_yaml = YAML.load_file(File.expand_path("../config.yml", __dir__)) + File.write(prism_vendor_dir.join("config.json"), JSON.dump(config_yaml)) # Align the Cargo.toml version with the gemspec version CRATES.each do |crate| @@ -97,7 +104,7 @@ namespace :cargo do CRATES.each do |crate| Dir.chdir("rust/#{crate}") do - sh("cargo +nightly-2023-10-24 test -Zbuild-std --target=#{current_target} -- --nocapture") + sh("cargo +nightly test -Zbuild-std --target=#{current_target} -- --nocapture") end end ensure diff --git a/rakelib/lex.rake b/rakelib/lex.rake index 327339f75d..59f7a52dd4 100644 --- a/rakelib/lex.rake +++ b/rakelib/lex.rake @@ -62,11 +62,10 @@ module Prism def parallelize(items, &block) Thread.abort_on_exception = true - queue = Queue.new - items.each { |item| queue << item } + queue = Queue.new(items).close workers = - ENV.fetch("WORKERS") { 16 }.to_i.times.map do + ENV.fetch("WORKERS", "16").to_i.times.map do parallelize_thread(queue, &block) end @@ -77,7 +76,11 @@ module Prism # Create a new thread with a minimal number of locals that it can access. def parallelize_thread(queue, &block) - Thread.new { block.call(queue.shift) until queue.empty? } + Thread.new do + while item = queue.pop + block.call(item) + end + end end end end @@ -123,7 +126,6 @@ TARGETS.each do |name, target| desc "Lex #{repo} and compare with lex_compat" task "lex:#{name}" => [dirpath, :compile] do $:.unshift(File.expand_path("../lib", __dir__)) - require "ripper" require "prism" plain_text = ENV.fetch("CI", false) @@ -166,7 +168,6 @@ end desc "Lex files and compare with lex_compat" task lex: :compile do $:.unshift(File.expand_path("../lib", __dir__)) - require "ripper" require "prism" plain_text = ENV.fetch("CI", false) @@ -198,7 +199,6 @@ desc "Lex against the most recent version of various rubygems" task "lex:rubygems": [:compile, "tmp/failing"] do $:.unshift(File.expand_path("../lib", __dir__)) require "net/http" - require "ripper" require "rubygems/package" require "tmpdir" require "prism" @@ -330,7 +330,6 @@ desc "Lex against the top 100 rubygems" task "lex:topgems": ["download:topgems", :compile] do $:.unshift(File.expand_path("../lib", __dir__)) require "net/http" - require "ripper" require "rubygems/package" require "tmpdir" require "prism" diff --git a/rakelib/lint.rake b/rakelib/lint.rake index 89d5a01ba5..e5ecdb28bc 100644 --- a/rakelib/lint.rake +++ b/rakelib/lint.rake @@ -5,17 +5,6 @@ task :lint do require "yaml" config = YAML.safe_load_file(File.expand_path("../config.yml", __dir__)) - tokens = config.fetch("tokens")[4..-1].map { |token| token.fetch("name") } - if tokens.sort != tokens - warn("Tokens are not sorted alphabetically") - - tokens.sort.zip(tokens).each do |(sorted, unsorted)| - warn("Expected #{sorted} got #{unsorted}") if sorted != unsorted - end - - exit(1) - end - nodes = config.fetch("nodes") names = nodes.map { |node| node.fetch("name") } if names.sort != names diff --git a/rakelib/typecheck.rake b/rakelib/typecheck.rake index 497282d6f0..b11df3a6be 100644 --- a/rakelib/typecheck.rake +++ b/rakelib/typecheck.rake @@ -4,20 +4,6 @@ namespace :typecheck do task tapioca: :templates do Rake::Task["compile:prism"].invoke - # Yard crashes parsing steep, which is all run because of tapioca. So to - # avoid this, we're going to monkey patch yard to ignore these kinds of - # crashes so tapioca can keep running. - require "yard" - YARD.singleton_class.prepend( - Module.new do - def parse(*args, **kwargs) - super - rescue RangeError - [] - end - end - ) - require "tapioca/internal" Tapioca::Cli.start(["configure"]) Tapioca::Cli.start(["gems", "--exclude", "prism"]) @@ -34,11 +20,14 @@ namespace :typecheck do File.write("sorbet/typed_overrides.yml", ERB.new(<<~YAML, trim_mode: "-").result_with_hash(locals)) false: - ./lib/prism/lex_compat.rb + - ./lib/prism/lex_ripper.rb - ./lib/prism/node_ext.rb - ./lib/prism/parse_result.rb - ./lib/prism/visitor.rb - ./lib/prism/translation/parser/lexer.rb - ./lib/prism/translation/ripper.rb + - ./lib/prism/translation/ripper/filter.rb + - ./lib/prism/translation/ripper/lexer.rb - ./lib/prism/translation/ripper/sexp.rb - ./lib/prism/translation/ruby_parser.rb - ./lib/prism/inspect_visitor.rb @@ -62,6 +51,7 @@ namespace :typecheck do --ignore=rakelib/ --ignore=Rakefile --ignore=top-100-gems/ + #{Dir.glob("*.rb").map { |f| "--ignore=/#{f}" }.join("\n")} # Treat all files as "typed: true" by default --typed=true # Use the typed-override file to revert some files to "typed: false" diff --git a/rbi/prism/translation/parser33.rbi b/rbi/prism/translation/parser33.rbi deleted file mode 100644 index de3f73131d..0000000000 --- a/rbi/prism/translation/parser33.rbi +++ /dev/null @@ -1,6 +0,0 @@ -# typed: strict - -class Prism::Translation::Parser33 < Prism::Translation::Parser - sig { override.returns(Integer) } - def version; end -end diff --git a/rbi/prism/translation/parser34.rbi b/rbi/prism/translation/parser34.rbi deleted file mode 100644 index 34fee5030b..0000000000 --- a/rbi/prism/translation/parser34.rbi +++ /dev/null @@ -1,6 +0,0 @@ -# typed: strict - -class Prism::Translation::Parser34 < Prism::Translation::Parser - sig { override.returns(Integer) } - def version; end -end diff --git a/rbi/prism/translation/parser35.rbi b/rbi/prism/translation/parser35.rbi deleted file mode 100644 index 0239fc82ad..0000000000 --- a/rbi/prism/translation/parser35.rbi +++ /dev/null @@ -1,6 +0,0 @@ -# typed: strict - -class Prism::Translation::Parser35 < Prism::Translation::Parser - sig { override.returns(Integer) } - def version; end -end diff --git a/rbi/prism/translation/parser_versions.rbi b/rbi/prism/translation/parser_versions.rbi new file mode 100644 index 0000000000..8a7297be3e --- /dev/null +++ b/rbi/prism/translation/parser_versions.rbi @@ -0,0 +1,23 @@ +# typed: strict + +class Prism::Translation::Parser33 < Prism::Translation::Parser + sig { override.returns(Integer) } + def version; end +end + +class Prism::Translation::Parser34 < Prism::Translation::Parser + sig { override.returns(Integer) } + def version; end +end + +class Prism::Translation::Parser40 < Prism::Translation::Parser + sig { override.returns(Integer) } + def version; end +end + +Prism::Translation::Parser35 = Prism::Translation::Parser40 + +class Prism::Translation::Parser40 < Prism::Translation::Parser + sig { override.returns(Integer) } + def version; end +end diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 25499d37f8..70d1bb1e99 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -13,17 +13,15 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.66.1" +version = "0.72.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +checksum = "4f72209734318d0b619a5e0f5129918b848c416e122a3c4ce054e03cb87b726f" dependencies = [ "bitflags", "cexpr", "clang-sys", - "lazy_static", - "lazycell", + "itertools", "log", - "peeking_take_while", "prettyplease", "proc-macro2", "quote", @@ -31,7 +29,6 @@ dependencies = [ "rustc-hash", "shlex", "syn", - "which", ] [[package]] @@ -81,22 +78,6 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "glob" version = "0.3.1" @@ -104,28 +85,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" - -[[package]] -name = "home" -version = "0.5.5" +name = "itertools" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "indexmap" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" -dependencies = [ - "equivalent", - "hashbrown", + "either", ] [[package]] @@ -134,18 +99,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" version = "0.2.150" @@ -162,12 +115,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" - [[package]] name = "log" version = "0.4.20" @@ -196,18 +143,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "prettyplease" version = "0.2.15" @@ -220,9 +155,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -267,16 +202,16 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "ruby-prism" -version = "1.3.0" +version = "1.8.0" dependencies = [ "ruby-prism-sys", "serde", - "serde_yaml", + "serde_json", ] [[package]] name = "ruby-prism-sys" -version = "1.3.0" +version = "1.8.0" dependencies = [ "bindgen", "cc", @@ -284,22 +219,9 @@ dependencies = [ [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustix" -version = "0.38.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "ryu" @@ -328,16 +250,14 @@ dependencies = [ ] [[package]] -name = "serde_yaml" -version = "0.9.27" +name = "serde_json" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c" +checksum = "cb0652c533506ad7a2e353cce269330d6afd8bdfb6d75e0ace5b35aacbd7b9e9" dependencies = [ - "indexmap", "itoa", "ryu", "serde", - "unsafe-libyaml", ] [[package]] @@ -363,24 +283,6 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unsafe-libyaml" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" - -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - [[package]] name = "winapi" version = "0.3.9" @@ -402,135 +304,3 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" diff --git a/rust/ruby-prism-sys/Cargo.toml b/rust/ruby-prism-sys/Cargo.toml index 223788fe6a..78e157273c 100644 --- a/rust/ruby-prism-sys/Cargo.toml +++ b/rust/ruby-prism-sys/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "ruby-prism-sys" -version = "1.4.0" +version = "1.8.0" edition = "2021" +license = "MIT" license-file = "../../LICENSE.md" repository = "https://github.com/ruby/prism" description = "Rust bindings to Ruby's prism parsing library" @@ -22,7 +23,7 @@ build = "build/main.rs" include = ["src/", "build/", "Cargo.toml", "Cargo.lock", "README.md", "vendor"] [build-dependencies] -bindgen = "0.66" +bindgen = "0.72" cc = { version = "1.0", optional = true } [features] diff --git a/rust/ruby-prism-sys/build/main.rs b/rust/ruby-prism-sys/build/main.rs index 82f75c3e47..798d06d8ff 100644 --- a/rust/ruby-prism-sys/build/main.rs +++ b/rust/ruby-prism-sys/build/main.rs @@ -108,7 +108,7 @@ fn generate_bindings(ruby_include_path: &Path) -> bindgen::Bindings { .impl_debug(true) .layout_tests(true) .merge_extern_blocks(true) - .parse_callbacks(Box::new(bindgen::CargoCallbacks)) + .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) .parse_callbacks(Box::new(Callbacks)) .prepend_enum_name(false) .size_t_is_usize(true) diff --git a/rust/ruby-prism-sys/build/vendored.rs b/rust/ruby-prism-sys/build/vendored.rs index 670df42d50..da01fa6a69 100644 --- a/rust/ruby-prism-sys/build/vendored.rs +++ b/rust/ruby-prism-sys/build/vendored.rs @@ -114,7 +114,7 @@ fn source_files>(root_dir: P) -> Vec { if Path::new(&path) .extension() - .map_or(false, |ext| ext.eq_ignore_ascii_case("c")) + .is_some_and(|ext| ext.eq_ignore_ascii_case("c")) { files.push(path); } diff --git a/rust/ruby-prism-sys/src/lib.rs b/rust/ruby-prism-sys/src/lib.rs index ecaf83a8f4..8d4c979f5d 100644 --- a/rust/ruby-prism-sys/src/lib.rs +++ b/rust/ruby-prism-sys/src/lib.rs @@ -4,7 +4,6 @@ //! #![deny(unused_extern_crates)] #![warn( - box_pointers, clippy::all, clippy::nursery, clippy::pedantic, @@ -25,6 +24,9 @@ #[allow(non_camel_case_types)] #[allow(non_snake_case)] #[allow(non_upper_case_globals)] +#[allow(unused_qualifications)] +#[allow(clippy::missing_const_for_fn)] +#[allow(clippy::use_self)] mod bindings { // In `build.rs`, we use `bindgen` to generate bindings based on C headers // and `libprism`. Here is where we pull in those bindings and make diff --git a/rust/ruby-prism-sys/tests/pack_tests.rs b/rust/ruby-prism-sys/tests/pack_tests.rs index c729aa6cdc..63bc1cb1ea 100644 --- a/rust/ruby-prism-sys/tests/pack_tests.rs +++ b/rust/ruby-prism-sys/tests/pack_tests.rs @@ -30,7 +30,7 @@ fn pack_parse_test() { endian_out.as_mut_ptr(), size_out.as_mut_ptr(), length_type_out.as_mut_ptr(), - &mut length_out, + &raw mut length_out, encoding_out.as_mut_ptr(), ); diff --git a/rust/ruby-prism-sys/tests/utils_tests.rs b/rust/ruby-prism-sys/tests/utils_tests.rs index ea1b8bc4a2..00db216347 100644 --- a/rust/ruby-prism-sys/tests/utils_tests.rs +++ b/rust/ruby-prism-sys/tests/utils_tests.rs @@ -12,7 +12,7 @@ fn version_test() { CStr::from_ptr(version) }; - assert_eq!(&cstring.to_string_lossy(), "1.4.0"); + assert_eq!(&cstring.to_string_lossy(), "1.8.0"); } #[test] @@ -66,13 +66,13 @@ mod string { let mut s = make_string(PM_STRING_SHARED); unsafe { - let len = pm_string_length(&s.pm_string); + let len = pm_string_length(&raw const s.pm_string); assert_eq!(len, 16); - let result_start = pm_string_source(&s.pm_string); + let result_start = pm_string_source(&raw const s.pm_string); assert_eq!(s.start_ptr(), result_start); - pm_string_free(&mut s.pm_string); + pm_string_free(&raw mut s.pm_string); } } @@ -81,10 +81,10 @@ mod string { let s = make_string(PM_STRING_OWNED); unsafe { - let result_len = pm_string_length(&s.pm_string); + let result_len = pm_string_length(&raw const s.pm_string); assert_eq!(result_len, 16); - let result_start = pm_string_source(&s.pm_string); + let result_start = pm_string_source(&raw const s.pm_string); assert_eq!(s.pm_string.source, result_start); // Don't drop the pm_string--we don't own it anymore! @@ -96,13 +96,13 @@ mod string { let mut s = make_string(PM_STRING_CONSTANT); unsafe { - let result_len = pm_string_length(&s.pm_string); + let result_len = pm_string_length(&raw const s.pm_string); assert_eq!(result_len, 16); - let result_start = pm_string_source(&s.pm_string); + let result_start = pm_string_source(&raw const s.pm_string); assert_eq!(s.pm_string.source, result_start); - pm_string_free(&mut s.pm_string); + pm_string_free(&raw mut s.pm_string); } } @@ -111,10 +111,10 @@ mod string { let s = make_string(PM_STRING_MAPPED); unsafe { - let result_len = pm_string_length(&s.pm_string); + let result_len = pm_string_length(&raw const s.pm_string); assert_eq!(result_len, 16); - let result_start = pm_string_source(&s.pm_string); + let result_start = pm_string_source(&raw const s.pm_string); assert_eq!(s.pm_string.source, result_start); } } diff --git a/rust/ruby-prism/Cargo.toml b/rust/ruby-prism/Cargo.toml index 4ef5d0f4b1..73cfa0314d 100644 --- a/rust/ruby-prism/Cargo.toml +++ b/rust/ruby-prism/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "ruby-prism" -version = "1.4.0" +version = "1.8.0" edition = "2021" +license = "MIT" license-file = "../../LICENSE.md" repository = "https://github.com/ruby/prism" description = "Rustified version of Ruby's prism parsing library" @@ -23,10 +24,10 @@ include = ["src/", "build.rs", "Cargo.toml", "Cargo.lock", "vendor"] [build-dependencies] serde = { version = "1.0", features = ["derive"] } -serde_yaml = "0.9" +serde_json = "1.0" [dependencies] -ruby-prism-sys = { version = "1.4.0", path = "../ruby-prism-sys" } +ruby-prism-sys = { version = "1.8.0", path = "../ruby-prism-sys" } [features] default = ["vendored"] diff --git a/rust/ruby-prism/build.rs b/rust/ruby-prism/build.rs index a43a159c5b..05cbee87d0 100644 --- a/rust/ruby-prism/build.rs +++ b/rust/ruby-prism/build.rs @@ -117,12 +117,12 @@ struct Config { /// fn main() -> Result<(), Box> { let prism_dir = format!("prism-{}", env!("CARGO_PKG_VERSION")); - let config_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("vendor").join(prism_dir).join("config.yml"); + let config_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("vendor").join(prism_dir).join("config.json"); let config_file = std::fs::File::open(&config_path)?; println!("cargo:rerun-if-changed={}", config_path.to_str().unwrap()); - let config: Config = serde_yaml::from_reader(config_file)?; + let config: Config = serde_json::from_reader(config_file)?; write_bindings(&config)?; Ok(()) @@ -142,10 +142,10 @@ fn struct_name(name: &str) -> String { result } -fn kind_to_type(kind: &String) -> String { - match kind.as_str() { +fn kind_to_type(kind: &str) -> String { + match kind { "non-void expression" | "pattern expression" | "Node" => String::new(), - _ => kind.to_string(), + _ => kind.to_owned(), } } @@ -247,14 +247,14 @@ fn write_node(file: &mut File, flags: &[Flags], node: &Node) -> Result<(), Box {}<'pr> {{", node.name)?; writeln!(file, " /// Converts this node to a generic node.")?; writeln!(file, " #[must_use]")?; - writeln!(file, " pub fn as_node(&self) -> Node<'pr> {{")?; + writeln!(file, " pub const fn as_node(&self) -> Node<'pr> {{")?; writeln!(file, " Node::{} {{ parser: self.parser, pointer: self.pointer, marker: PhantomData }}", node.name)?; writeln!(file, " }}")?; writeln!(file)?; writeln!(file, " /// Returns the location of this node.")?; writeln!(file, " #[must_use]")?; writeln!(file, " pub fn location(&self) -> Location<'pr> {{")?; - writeln!(file, " let pointer: *mut pm_location_t = unsafe {{ &mut (*self.pointer).base.location }};")?; + writeln!(file, " let pointer: *mut pm_location_t = unsafe {{ &raw mut (*self.pointer).base.location }};")?; writeln!(file, " Location::new(self.parser, unsafe {{ &(*pointer) }})")?; writeln!(file, " }}")?; writeln!(file)?; @@ -326,7 +326,7 @@ fn write_node(file: &mut File, flags: &[Flags], node: &Node) -> Result<(), Box { writeln!(file, " pub fn {}(&self) -> NodeList<'pr> {{", field.name)?; - writeln!(file, " let pointer: *mut pm_node_list = unsafe {{ &mut (*self.pointer).{} }};", field.name)?; + writeln!(file, " let pointer: *mut pm_node_list = unsafe {{ &raw mut (*self.pointer).{} }};", field.name)?; writeln!(file, " NodeList {{ parser: self.parser, pointer: unsafe {{ NonNull::new_unchecked(pointer) }}, marker: PhantomData }}")?; writeln!(file, " }}")?; }, @@ -359,19 +359,19 @@ fn write_node(file: &mut File, flags: &[Flags], node: &Node) -> Result<(), Box { writeln!(file, " pub fn {}(&self) -> ConstantList<'pr> {{", field.name)?; - writeln!(file, " let pointer: *mut pm_constant_id_list_t = unsafe {{ &mut (*self.pointer).{} }};", field.name)?; + writeln!(file, " let pointer: *mut pm_constant_id_list_t = unsafe {{ &raw mut (*self.pointer).{} }};", field.name)?; writeln!(file, " ConstantList {{ parser: self.parser, pointer: unsafe {{ NonNull::new_unchecked(pointer) }}, marker: PhantomData }}")?; writeln!(file, " }}")?; }, NodeFieldType::Location => { writeln!(file, " pub fn {}(&self) -> Location<'pr> {{", field.name)?; - writeln!(file, " let pointer: *mut pm_location_t = unsafe {{ &mut (*self.pointer).{} }};", field.name)?; + writeln!(file, " let pointer: *mut pm_location_t = unsafe {{ &raw mut (*self.pointer).{} }};", field.name)?; writeln!(file, " Location::new(self.parser, unsafe {{ &(*pointer) }})")?; writeln!(file, " }}")?; }, NodeFieldType::OptionalLocation => { writeln!(file, " pub fn {}(&self) -> Option> {{", field.name)?; - writeln!(file, " let pointer: *mut pm_location_t = unsafe {{ &mut (*self.pointer).{} }};", field.name)?; + writeln!(file, " let pointer: *mut pm_location_t = unsafe {{ &raw mut (*self.pointer).{} }};", field.name)?; writeln!(file, " let start = unsafe {{ (*pointer).start }};")?; writeln!(file, " if start.is_null() {{")?; writeln!(file, " None")?; @@ -392,7 +392,7 @@ fn write_node(file: &mut File, flags: &[Flags], node: &Node) -> Result<(), Box { writeln!(file, " pub fn {}(&self) -> Integer<'pr> {{", field.name)?; - writeln!(file, " Integer::new(unsafe {{ &(*self.pointer).{} }})", field.name)?; + writeln!(file, " Integer::new(unsafe {{ &raw const(*self.pointer).{} }})", field.name)?; writeln!(file, " }}")?; }, NodeFieldType::Double => { @@ -523,7 +523,7 @@ fn write_visit(file: &mut File, config: &Config) -> Result<(), Box { - writeln!(file, " for node in node.{}().iter() {{", field.name)?; + writeln!(file, " for node in &node.{}() {{", field.name)?; writeln!(file, " visitor.visit(&node);")?; writeln!(file, " }}")?; }, @@ -533,7 +533,7 @@ fn write_visit(file: &mut File, config: &Config) -> Result<(), Box(_visitor: &mut V, _node: &{}<'pr>)", struct_name(&node.name), node.name)?; + writeln!(file, "pub const fn visit{}<'pr, V>(_visitor: &mut V, _node: &{}<'pr>)", struct_name(&node.name), node.name)?; writeln!(file, "where")?; writeln!(file, " V: Visit<'pr> + ?Sized,")?; writeln!(file, "{{}}")?; @@ -552,14 +552,14 @@ fn write_bindings(config: &Config) -> Result<(), Box> { write!( file, - r#" + r" use std::marker::PhantomData; use std::ptr::NonNull; #[allow(clippy::wildcard_imports)] use ruby_prism_sys::*; use crate::{{ConstantId, ConstantList, Integer, Location, NodeList}}; -"# +" )?; for node in &config.nodes { @@ -578,7 +578,7 @@ use crate::{{ConstantId, ConstantList, Integer, Location, NodeList}}; writeln!(file, "pub enum Node<'pr> {{")?; for node in &config.nodes { - writeln!(file, " /// The {} node", node.name)?; + writeln!(file, " /// The `{}` node", node.name)?; writeln!(file, " {} {{", node.name)?; writeln!(file, " /// The pointer to the associated parser this node came from.")?; writeln!(file, " parser: NonNull,")?; @@ -596,7 +596,7 @@ use crate::{{ConstantId, ConstantList, Integer, Location, NodeList}}; writeln!( file, - r#" + r" impl<'pr> Node<'pr> {{ /// Creates a new node from the given pointer. /// @@ -607,7 +607,7 @@ impl<'pr> Node<'pr> {{ #[allow(clippy::not_unsafe_ptr_arg_deref)] pub(crate) fn new(parser: NonNull, node: *mut pm_node_t) -> Self {{ match unsafe {{ (*node).type_ }} {{ -"# +" )?; for node in &config.nodes { @@ -633,7 +633,7 @@ impl<'pr> Node<'pr> {{ for node in &config.nodes { writeln!(file, " /// Returns the node as a `{}`.", node.name)?; writeln!(file, " #[must_use]")?; - writeln!(file, " pub fn as{}(&self) -> Option<{}<'pr>> {{", struct_name(&node.name), node.name)?; + writeln!(file, " pub const fn as{}(&self) -> Option<{}<'pr>> {{", struct_name(&node.name), node.name)?; writeln!(file, " match *self {{")?; writeln!(file, " Self::{} {{ parser, pointer, marker }} => Some({} {{ parser, pointer, marker }}),", node.name, node.name)?; writeln!(file, " _ => None")?; diff --git a/rust/ruby-prism/examples/wasm/main.rs b/rust/ruby-prism/examples/wasm/main.rs index bfb8e0023f..8a49f634a0 100644 --- a/rust/ruby-prism/examples/wasm/main.rs +++ b/rust/ruby-prism/examples/wasm/main.rs @@ -7,7 +7,7 @@ fn main() { let comments_count = result.comments().count(); let warnings_count = result.warnings().count(); let errors_count = result.errors().count(); - println!(" comments: {}", comments_count); - println!(" warnings: {}", warnings_count); - println!(" errors: {}", errors_count); + println!(" comments: {comments_count}"); + println!(" warnings: {warnings_count}"); + println!(" errors: {errors_count}"); } diff --git a/rust/ruby-prism/examples/wasm/run.sh b/rust/ruby-prism/examples/wasm/run.sh index bd55ce69e0..f1f141df47 100755 --- a/rust/ruby-prism/examples/wasm/run.sh +++ b/rust/ruby-prism/examples/wasm/run.sh @@ -7,7 +7,7 @@ WASI_SDK_VERSION="$WASI_SDK_VERSION_MAJOR.0" TMPDIR="$(pwd)/tmp" WASI_SDK_PATH="${TMPDIR}/wasi-sdk-${WASI_SDK_VERSION}" WASI_SDK_TAR="${TMPDIR}/wasi-sdk.tar.gz" -WASM_BUILD_DIR="./target/wasm32-wasi/debug/examples" +WASM_BUILD_DIR="./target/wasm32-wasip1/debug/examples" WASM_FILE="${WASM_BUILD_DIR}/wasm.wasm" export WASI_SDK_PATH @@ -45,7 +45,7 @@ download_wasi_sdk() { } build_wasm() { - cargo build --target=wasm32-wasi --example wasm >&2 + cargo build --target=wasm32-wasip1 --example wasm >&2 echo "WASM built to ${WASM_FILE}" >&2 } diff --git a/rust/ruby-prism/src/lib.rs b/rust/ruby-prism/src/lib.rs index 36e7a5e957..3561761cc4 100644 --- a/rust/ruby-prism/src/lib.rs +++ b/rust/ruby-prism/src/lib.rs @@ -19,7 +19,7 @@ use std::mem::MaybeUninit; use std::ptr::NonNull; pub use self::bindings::*; -use ruby_prism_sys::{pm_comment_t, pm_constant_id_list_t, pm_constant_id_t, pm_diagnostic_t, pm_integer_t, pm_location_t, pm_magic_comment_t, pm_node_destroy, pm_node_list, pm_node_t, pm_parse, pm_parser_free, pm_parser_init, pm_parser_t}; +use ruby_prism_sys::{pm_comment_t, pm_comment_type_t, pm_constant_id_list_t, pm_constant_id_t, pm_diagnostic_t, pm_integer_t, pm_location_t, pm_magic_comment_t, pm_node_destroy, pm_node_list, pm_node_t, pm_parse, pm_parser_free, pm_parser_init, pm_parser_t}; /// A range in the source file. pub struct Location<'pr> { @@ -31,6 +31,8 @@ pub struct Location<'pr> { impl<'pr> Location<'pr> { /// Returns a byte slice for the range. + /// # Panics + /// Panics if the end offset is not greater than the start offset. #[must_use] pub fn as_slice(&self) -> &'pr [u8] { unsafe { @@ -41,7 +43,7 @@ impl<'pr> Location<'pr> { /// Return a Location from the given `pm_location_t`. #[must_use] - pub(crate) const fn new(parser: NonNull, loc: &'pr pm_location_t) -> Location<'pr> { + pub(crate) const fn new(parser: NonNull, loc: &'pr pm_location_t) -> Self { Location { parser, start: loc.start, @@ -54,7 +56,7 @@ impl<'pr> Location<'pr> { /// Returns None if both locations did not originate from the same parser, /// or if self starts after other. #[must_use] - pub fn join(&self, other: &Location<'pr>) -> Option> { + pub fn join(&self, other: &Self) -> Option { if self.parser != other.parser || self.start > other.start { None } else { @@ -68,6 +70,8 @@ impl<'pr> Location<'pr> { } /// Return the start offset from the beginning of the parsed source. + /// # Panics + /// Panics if the start offset is not greater than the parser's start. #[must_use] pub fn start_offset(&self) -> usize { unsafe { @@ -77,6 +81,8 @@ impl<'pr> Location<'pr> { } /// Return the end offset from the beginning of the parsed source. + /// # Panics + /// Panics if the end offset is not greater than the parser's start. #[must_use] pub fn end_offset(&self) -> usize { unsafe { @@ -133,9 +139,14 @@ pub struct NodeList<'pr> { } impl<'pr> NodeList<'pr> { + unsafe fn at(&self, index: usize) -> Node<'pr> { + let node: *mut pm_node_t = *(self.pointer.as_ref().nodes.add(index)); + Node::new(self.parser, node) + } + /// Returns an iterator over the nodes. #[must_use] - pub fn iter(&self) -> NodeListIter<'pr> { + pub const fn iter(&self) -> NodeListIter<'pr> { NodeListIter { parser: self.parser, pointer: self.pointer, @@ -143,6 +154,46 @@ impl<'pr> NodeList<'pr> { marker: PhantomData, } } + + /// Returns the length of the list. + #[must_use] + pub const fn len(&self) -> usize { + unsafe { self.pointer.as_ref().size } + } + + /// Returns whether the list is empty. + #[must_use] + pub const fn is_empty(&self) -> bool { + self.len() == 0 + } + + /// Returns the first element of the list, or `None` if it is empty. + #[must_use] + pub fn first(&self) -> Option> { + if self.is_empty() { + None + } else { + Some(unsafe { self.at(0) }) + } + } + + /// Returns the last element of the list, or `None` if it is empty. + #[must_use] + pub fn last(&self) -> Option> { + if self.is_empty() { + None + } else { + Some(unsafe { self.at(self.len() - 1) }) + } + } +} + +impl<'pr> IntoIterator for &NodeList<'pr> { + type Item = Node<'pr>; + type IntoIter = NodeListIter<'pr>; + fn into_iter(self) -> Self::IntoIter { + self.iter() + } } impl std::fmt::Debug for NodeList<'_> { @@ -159,7 +210,7 @@ pub struct ConstantId<'pr> { } impl<'pr> ConstantId<'pr> { - fn new(parser: NonNull, id: pm_constant_id_t) -> Self { + const fn new(parser: NonNull, id: pm_constant_id_t) -> Self { ConstantId { parser, id, marker: PhantomData } } @@ -219,9 +270,14 @@ pub struct ConstantList<'pr> { } impl<'pr> ConstantList<'pr> { + const unsafe fn at(&self, index: usize) -> ConstantId<'pr> { + let constant_id: pm_constant_id_t = *(self.pointer.as_ref().ids.add(index)); + ConstantId::new(self.parser, constant_id) + } + /// Returns an iterator over the constants in the list. #[must_use] - pub fn iter(&self) -> ConstantListIter<'pr> { + pub const fn iter(&self) -> ConstantListIter<'pr> { ConstantListIter { parser: self.parser, pointer: self.pointer, @@ -229,6 +285,46 @@ impl<'pr> ConstantList<'pr> { marker: PhantomData, } } + + /// Returns the length of the list. + #[must_use] + pub const fn len(&self) -> usize { + unsafe { self.pointer.as_ref().size } + } + + /// Returns whether the list is empty. + #[must_use] + pub const fn is_empty(&self) -> bool { + self.len() == 0 + } + + /// Returns the first element of the list, or `None` if it is empty. + #[must_use] + pub const fn first(&self) -> Option> { + if self.is_empty() { + None + } else { + Some(unsafe { self.at(0) }) + } + } + + /// Returns the last element of the list, or `None` if it is empty. + #[must_use] + pub const fn last(&self) -> Option> { + if self.is_empty() { + None + } else { + Some(unsafe { self.at(self.len() - 1) }) + } + } +} + +impl<'pr> IntoIterator for &ConstantList<'pr> { + type Item = ConstantId<'pr>; + type IntoIter = ConstantListIter<'pr>; + fn into_iter(self) -> Self::IntoIter { + self.iter() + } } impl std::fmt::Debug for ConstantList<'_> { @@ -246,10 +342,28 @@ pub struct Integer<'pr> { marker: PhantomData<&'pr mut pm_constant_id_t>, } -impl<'pr> Integer<'pr> { - fn new(pointer: *const pm_integer_t) -> Self { +impl Integer<'_> { + const fn new(pointer: *const pm_integer_t) -> Self { Integer { pointer, marker: PhantomData } } + + /// Returns the sign and the u32 digits representation of the integer, + /// ordered least significant digit first. + #[must_use] + pub const fn to_u32_digits(&self) -> (bool, &[u32]) { + let negative = unsafe { (*self.pointer).negative }; + let length = unsafe { (*self.pointer).length }; + let values = unsafe { (*self.pointer).values }; + + if values.is_null() { + let value_ptr = unsafe { std::ptr::addr_of!((*self.pointer).value) }; + let slice = unsafe { std::slice::from_raw_parts(value_ptr, 1) }; + (negative, slice) + } else { + let slice = unsafe { std::slice::from_raw_parts(values, length) }; + (negative, slice) + } + } } impl std::fmt::Debug for Integer<'_> { @@ -276,7 +390,7 @@ impl TryInto for Integer<'_> { /// A diagnostic message that came back from the parser. #[derive(Debug)] pub struct Diagnostic<'pr> { - diagnostic: NonNull, + diag: NonNull, parser: NonNull, marker: PhantomData<&'pr pm_diagnostic_t>, } @@ -291,26 +405,35 @@ impl<'pr> Diagnostic<'pr> { #[must_use] pub fn message(&self) -> &str { unsafe { - let message: *mut c_char = self.diagnostic.as_ref().message.cast_mut(); + let message: *mut c_char = self.diag.as_ref().message.cast_mut(); CStr::from_ptr(message).to_str().expect("prism allows only UTF-8 for diagnostics.") } } /// The location of the diagnostic in the source. #[must_use] - pub fn location(&self) -> Location<'pr> { - Location::new(self.parser, unsafe { &self.diagnostic.as_ref().location }) + pub const fn location(&self) -> Location<'pr> { + Location::new(self.parser, unsafe { &self.diag.as_ref().location }) } } /// A comment that was found during parsing. #[derive(Debug)] pub struct Comment<'pr> { - comment: NonNull, + content: NonNull, parser: NonNull, marker: PhantomData<&'pr pm_comment_t>, } +/// The type of the comment +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum CommentType { + /// `InlineComment` corresponds to comments that start with #. + InlineComment, + /// `EmbDocComment` corresponds to comments that are surrounded by =begin and =end. + EmbDocComment, +} + impl<'pr> Comment<'pr> { /// Returns the text of the comment. /// @@ -321,10 +444,21 @@ impl<'pr> Comment<'pr> { self.location().as_slice() } + /// Returns the type of the comment. + #[must_use] + pub fn type_(&self) -> CommentType { + let type_ = unsafe { self.content.as_ref().type_ }; + if type_ == pm_comment_type_t::PM_COMMENT_EMBDOC { + CommentType::EmbDocComment + } else { + CommentType::InlineComment + } + } + /// The location of the comment in the source. #[must_use] - pub fn location(&self) -> Location<'pr> { - Location::new(self.parser, unsafe { &self.comment.as_ref().location }) + pub const fn location(&self) -> Location<'pr> { + Location::new(self.parser, unsafe { &self.content.as_ref().location }) } } @@ -335,10 +469,10 @@ pub struct MagicComment<'pr> { marker: PhantomData<&'pr pm_magic_comment_t>, } -impl<'pr> MagicComment<'pr> { +impl MagicComment<'_> { /// Returns the text of the comment's key. #[must_use] - pub fn key(&self) -> &[u8] { + pub const fn key(&self) -> &[u8] { unsafe { let start = self.comment.as_ref().key_start; let len = self.comment.as_ref().key_length as usize; @@ -348,7 +482,7 @@ impl<'pr> MagicComment<'pr> { /// Returns the text of the comment's value. #[must_use] - pub fn value(&self) -> &[u8] { + pub const fn value(&self) -> &[u8] { unsafe { let start = self.comment.as_ref().value_start; let len = self.comment.as_ref().value_length as usize; @@ -370,7 +504,11 @@ impl<'pr> Iterator for Diagnostics<'pr> { fn next(&mut self) -> Option { if let Some(diagnostic) = NonNull::new(self.diagnostic) { - let current = Diagnostic { diagnostic, parser: self.parser, marker: PhantomData }; + let current = Diagnostic { + diag: diagnostic, + parser: self.parser, + marker: PhantomData, + }; self.diagnostic = unsafe { diagnostic.as_ref().node.next.cast::() }; Some(current) } else { @@ -392,7 +530,11 @@ impl<'pr> Iterator for Comments<'pr> { fn next(&mut self) -> Option { if let Some(comment) = NonNull::new(self.comment) { - let current = Comment { comment, parser: self.parser, marker: PhantomData }; + let current = Comment { + content: comment, + parser: self.parser, + marker: PhantomData, + }; self.comment = unsafe { comment.as_ref().node.next.cast::() }; Some(current) } else { @@ -531,7 +673,7 @@ impl<'pr> ParseResult<'pr> { } } -impl<'pr> Drop for ParseResult<'pr> { +impl Drop for ParseResult<'_> { fn drop(&mut self) { unsafe { pm_node_destroy(self.parser.as_ptr(), self.node.as_ptr()); @@ -575,6 +717,7 @@ mod tests { let result = parse(source.as_ref()); for comment in result.comments() { + assert_eq!(super::CommentType::InlineComment, comment.type_()); let text = std::str::from_utf8(comment.text()).unwrap(); assert!(text.starts_with("# comment")); } @@ -722,27 +865,42 @@ mod tests { #[test] fn constant_id_test() { - let source = "module Foo; x = 1; end"; + let source = "module Foo; x = 1; y = 2; end"; let result = parse(source.as_ref()); let node = result.node(); - let module = node.as_program_node().unwrap().statements().body().iter().next().unwrap(); + assert_eq!(node.as_program_node().unwrap().statements().body().len(), 1); + assert!(!node.as_program_node().unwrap().statements().body().is_empty()); + let module = node.as_program_node().and_then(|pn| pn.statements().body().first()).unwrap(); let module = module.as_module_node().unwrap(); - let locals = module.locals().iter().collect::>(); - assert_eq!(locals.len(), 1); + assert_eq!(module.locals().len(), 2); + assert!(!module.locals().is_empty()); - assert_eq!(locals[0].as_slice(), b"x"); + assert_eq!(module.locals().first().unwrap().as_slice(), b"x"); + assert_eq!(module.locals().last().unwrap().as_slice(), b"y"); + + let source = "module Foo; end"; + let result = parse(source.as_ref()); + + let node = result.node(); + assert_eq!(node.as_program_node().unwrap().statements().body().len(), 1); + assert!(!node.as_program_node().unwrap().statements().body().is_empty()); + let module = node.as_program_node().and_then(|pn| pn.statements().body().first()).unwrap(); + let module = module.as_module_node().unwrap(); + + assert_eq!(module.locals().len(), 0); + assert!(module.locals().is_empty()); } #[test] fn optional_loc_test() { - let source = r#" + let source = r" module Example x = call_func(3, 4) y = x.call_func 5, 6 end -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -811,9 +969,9 @@ end #[test] fn call_flags_test() { - let source = r#" + let source = r" x -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -821,9 +979,9 @@ x let call = call.as_call_node().unwrap(); assert!(call.is_variable_call()); - let source = r#" + let source = r" x&.foo -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -834,9 +992,9 @@ x&.foo #[test] fn integer_flags_test() { - let source = r#" + let source = r" 0b1 -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -847,9 +1005,9 @@ x&.foo assert!(!i.is_octal()); assert!(!i.is_hexadecimal()); - let source = r#" + let source = r" 1 -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -860,9 +1018,9 @@ x&.foo assert!(!i.is_octal()); assert!(!i.is_hexadecimal()); - let source = r#" + let source = r" 0o1 -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -873,9 +1031,9 @@ x&.foo assert!(i.is_octal()); assert!(!i.is_hexadecimal()); - let source = r#" + let source = r" 0x1 -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -889,9 +1047,9 @@ x&.foo #[test] fn range_flags_test() { - let source = r#" + let source = r" 0..1 -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -899,9 +1057,9 @@ x&.foo let range = range.as_range_node().unwrap(); assert!(!range.is_exclude_end()); - let source = r#" + let source = r" 0...1 -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -913,9 +1071,9 @@ x&.foo #[allow(clippy::too_many_lines, clippy::cognitive_complexity)] #[test] fn regex_flags_test() { - let source = r#" + let source = r" /a/i -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -930,9 +1088,9 @@ x&.foo assert!(!regex.is_utf_8()); assert!(!regex.is_once()); - let source = r#" + let source = r" /a/x -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -947,9 +1105,9 @@ x&.foo assert!(!regex.is_utf_8()); assert!(!regex.is_once()); - let source = r#" + let source = r" /a/m -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -964,9 +1122,9 @@ x&.foo assert!(!regex.is_utf_8()); assert!(!regex.is_once()); - let source = r#" + let source = r" /a/e -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -981,9 +1139,9 @@ x&.foo assert!(!regex.is_utf_8()); assert!(!regex.is_once()); - let source = r#" + let source = r" /a/n -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -998,9 +1156,9 @@ x&.foo assert!(!regex.is_utf_8()); assert!(!regex.is_once()); - let source = r#" + let source = r" /a/s -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -1015,9 +1173,9 @@ x&.foo assert!(!regex.is_utf_8()); assert!(!regex.is_once()); - let source = r#" + let source = r" /a/u -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -1032,9 +1190,9 @@ x&.foo assert!(regex.is_utf_8()); assert!(!regex.is_once()); - let source = r#" + let source = r" /a/o -"#; +"; let result = parse(source.as_ref()); let node = result.node(); @@ -1067,7 +1225,7 @@ x&.foo counts: NodeCounts, } - impl<'pr> Visit<'pr> for CountingVisitor { + impl Visit<'_> for CountingVisitor { fn visit_branch_node_enter(&mut self, _node: Node<'_>) { self.counts.pre_parent += 1; } @@ -1085,12 +1243,12 @@ x&.foo } } - let source = r#" + let source = r" module Example x = call_func(3, 4) y = x.call_func 5, 6 end -"#; +"; let result = parse(source.as_ref()); let node = result.node(); let mut visitor = CountingVisitor::default(); @@ -1126,12 +1284,12 @@ end } } - let source = r#" + let source = r" module Example x = call_func(3, 4) y = x.call_func 5, 6 end -"#; +"; let result = parse(source.as_ref()); let node = result.node(); let mut visitor = StackingNodeVisitor::default(); @@ -1144,11 +1302,32 @@ end #[test] fn integer_value_test() { let result = parse("0xA".as_ref()); - let value: i32 = result.node().as_program_node().unwrap().statements().body().iter().next().unwrap().as_integer_node().unwrap().value().try_into().unwrap(); + let integer = result.node().as_program_node().unwrap().statements().body().iter().next().unwrap().as_integer_node().unwrap().value(); + let value: i32 = integer.try_into().unwrap(); assert_eq!(value, 10); } + #[test] + fn integer_small_value_to_u32_digits_test() { + let result = parse("0xA".as_ref()); + let integer = result.node().as_program_node().unwrap().statements().body().iter().next().unwrap().as_integer_node().unwrap().value(); + let (negative, digits) = integer.to_u32_digits(); + + assert!(!negative); + assert_eq!(digits, &[10]); + } + + #[test] + fn integer_large_value_to_u32_digits_test() { + let result = parse("0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF".as_ref()); + let integer = result.node().as_program_node().unwrap().statements().body().iter().next().unwrap().as_integer_node().unwrap().value(); + let (negative, digits) = integer.to_u32_digits(); + + assert!(!negative); + assert_eq!(digits, &[4_294_967_295, 4_294_967_295, 4_294_967_295, 2_147_483_647]); + } + #[test] fn float_value_test() { let result = parse("1.0".as_ref()); @@ -1199,4 +1378,12 @@ end extractor.push_scope(node.as_program_node().unwrap().statements().body().iter().next().unwrap()); assert_eq!(3, extractor.scopes.len()); } + + #[test] + fn malformed_shebang() { + let source = "#!\x00"; + let result = parse(source.as_ref()); + assert!(result.errors().next().is_none()); + assert!(result.warnings().next().is_none()); + } } diff --git a/sample/prism/find_comments.rb b/sample/prism/find_comments.rb index 6a26cd32b7..314bbb9b8e 100644 --- a/sample/prism/find_comments.rb +++ b/sample/prism/find_comments.rb @@ -16,7 +16,7 @@ def initialize(target, comments, nesting = []) # method definition on the node. def visit_module_node(node) visitor = FindMethodComments.new(@target, @comments, [*@nesting, node.name]) - node.compact_child_nodes.each { |child| child.accept(visitor) } + node.each_child_node { |child| child.accept(visitor) } end def visit_class_node(node) @@ -26,7 +26,7 @@ def visit_class_node(node) # because then the state is immutable and it's easier to reason about. This # also provides for more debugging opportunity in the initializer. visitor = FindMethodComments.new(@target, @comments, [*@nesting, node.name]) - node.compact_child_nodes.each { |child| child.accept(visitor) } + node.each_child_node { |child| child.accept(visitor) } end def visit_def_node(node) diff --git a/sample/prism/locate_nodes.rb b/sample/prism/locate_nodes.rb index 7a51db4367..dd70f87850 100644 --- a/sample/prism/locate_nodes.rb +++ b/sample/prism/locate_nodes.rb @@ -40,11 +40,12 @@ def locate(node, line:, column:) while (node = queue.shift) result << node - # Nodes have `child_nodes` and `compact_child_nodes`. `child_nodes` have - # consistent indices but include `nil` for optional fields that are not - # present, whereas `compact_child_nodes` has inconsistent indices but does - # not include `nil` for optional fields that are not present. - node.compact_child_nodes.find do |child| + # Nodes have `child_nodes`, `compact_child_nodes`, and `each_child_node`. + # `child_nodes` have consistent indices but include `nil` for optional fields that + # are not present, whereas `compact_child_nodes` has inconsistent indices but does + # not include `nil` for optional fields that are not present. `each_child_node` is + # like `compact_child_nodes`, returning an enumerator instead of an array. + node.each_child_node.find do |child| queue << child if covers?(child.location, line: line, column: column) end end diff --git a/sig/prism/parse_result.rbs b/sig/prism/parse_result.rbs index e88e5f0664..d878ca2edd 100644 --- a/sig/prism/parse_result.rbs +++ b/sig/prism/parse_result.rbs @@ -14,6 +14,7 @@ module Prism def encoding: () -> Encoding def lines: () -> Array[String] def slice: (Integer byte_offset, Integer length) -> String + def line_to_byte_offset: (Integer line) -> Integer def line: (Integer byte_offset) -> Integer def line_start: (Integer byte_offset) -> Integer def line_end: (Integer byte_offset) -> Integer diff --git a/snapshots/3.3-3.3/block_args_in_array_assignment.txt b/snapshots/3.3-3.3/block_args_in_array_assignment.txt new file mode 100644 index 0000000000..aebf7deb8e --- /dev/null +++ b/snapshots/3.3-3.3/block_args_in_array_assignment.txt @@ -0,0 +1,53 @@ +@ ProgramNode (location: (1,0)-(1,21)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,21)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,21)) + ├── flags: newline, attribute_write + ├── receiver: + │ @ CallNode (location: (1,0)-(1,6)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :matrix + │ ├── message_loc: (1,0)-(1,6) = "matrix" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── call_operator_loc: ∅ + ├── name: :[]= + ├── message_loc: (1,6)-(1,17) = "[5, &block]" + ├── opening_loc: (1,6)-(1,7) = "[" + ├── arguments: + │ @ ArgumentsNode (location: (1,7)-(1,21)) + │ ├── flags: ∅ + │ └── arguments: (length: 2) + │ ├── @ IntegerNode (location: (1,7)-(1,8)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 5 + │ └── @ IntegerNode (location: (1,20)-(1,21)) + │ ├── flags: static_literal, decimal + │ └── value: 8 + ├── closing_loc: (1,16)-(1,17) = "]" + ├── equal_loc: (1,18)-(1,19) = "=" + └── block: + @ BlockArgumentNode (location: (1,10)-(1,16)) + ├── flags: ∅ + ├── expression: + │ @ CallNode (location: (1,11)-(1,16)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :block + │ ├── message_loc: (1,11)-(1,16) = "block" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + └── operator_loc: (1,10)-(1,11) = "&" diff --git a/snapshots/3.3-3.3/it.txt b/snapshots/3.3-3.3/it.txt new file mode 100644 index 0000000000..b2559ebe85 --- /dev/null +++ b/snapshots/3.3-3.3/it.txt @@ -0,0 +1,61 @@ +@ ProgramNode (location: (1,0)-(5,9)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(5,9)) + ├── flags: ∅ + └── body: (length: 2) + ├── @ CallNode (location: (1,0)-(3,3)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :x + │ ├── message_loc: (1,0)-(1,1) = "x" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (1,2)-(3,3)) + │ ├── flags: ∅ + │ ├── locals: [] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (2,2)-(2,4)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ CallNode (location: (2,2)-(2,4)) + │ │ ├── flags: newline, variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :it + │ │ ├── message_loc: (2,2)-(2,4) = "it" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── opening_loc: (1,2)-(1,4) = "do" + │ └── closing_loc: (3,0)-(3,3) = "end" + └── @ LambdaNode (location: (5,0)-(5,9)) + ├── flags: newline + ├── locals: [] + ├── operator_loc: (5,0)-(5,2) = "->" + ├── opening_loc: (5,3)-(5,4) = "{" + ├── closing_loc: (5,8)-(5,9) = "}" + ├── parameters: ∅ + └── body: + @ StatementsNode (location: (5,5)-(5,7)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (5,5)-(5,7)) + ├── flags: newline, variable_call, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :it + ├── message_loc: (5,5)-(5,7) = "it" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: ∅ diff --git a/snapshots/3.3-3.3/it_indirect_writes.txt b/snapshots/3.3-3.3/it_indirect_writes.txt new file mode 100644 index 0000000000..5b0e2e9d42 --- /dev/null +++ b/snapshots/3.3-3.3/it_indirect_writes.txt @@ -0,0 +1,473 @@ +@ ProgramNode (location: (1,0)-(23,24)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(23,24)) + ├── flags: ∅ + └── body: (length: 12) + ├── @ CallNode (location: (1,0)-(1,15)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (1,0)-(1,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (1,4)-(1,15)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (1,6)-(1,13)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ LocalVariableOperatorWriteNode (location: (1,6)-(1,13)) + │ │ ├── flags: newline + │ │ ├── name_loc: (1,6)-(1,8) = "it" + │ │ ├── binary_operator_loc: (1,9)-(1,11) = "+=" + │ │ ├── value: + │ │ │ @ IntegerNode (location: (1,12)-(1,13)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── name: :it + │ │ ├── binary_operator: :+ + │ │ └── depth: 0 + │ ├── opening_loc: (1,4)-(1,5) = "{" + │ └── closing_loc: (1,14)-(1,15) = "}" + ├── @ CallNode (location: (3,0)-(3,16)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (3,0)-(3,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (3,4)-(3,16)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (3,6)-(3,14)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ LocalVariableOrWriteNode (location: (3,6)-(3,14)) + │ │ ├── flags: newline + │ │ ├── name_loc: (3,6)-(3,8) = "it" + │ │ ├── operator_loc: (3,9)-(3,12) = "||=" + │ │ ├── value: + │ │ │ @ IntegerNode (location: (3,13)-(3,14)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── opening_loc: (3,4)-(3,5) = "{" + │ └── closing_loc: (3,15)-(3,16) = "}" + ├── @ CallNode (location: (5,0)-(5,16)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (5,0)-(5,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (5,4)-(5,16)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (5,6)-(5,14)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ LocalVariableAndWriteNode (location: (5,6)-(5,14)) + │ │ ├── flags: newline + │ │ ├── name_loc: (5,6)-(5,8) = "it" + │ │ ├── operator_loc: (5,9)-(5,12) = "&&=" + │ │ ├── value: + │ │ │ @ IntegerNode (location: (5,13)-(5,14)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── opening_loc: (5,4)-(5,5) = "{" + │ └── closing_loc: (5,15)-(5,16) = "}" + ├── @ CallNode (location: (7,0)-(7,19)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (7,0)-(7,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (7,4)-(7,19)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (7,6)-(7,17)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 2) + │ │ ├── @ CallNode (location: (7,6)-(7,8)) + │ │ │ ├── flags: newline, variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :it + │ │ │ ├── message_loc: (7,6)-(7,8) = "it" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ └── @ LocalVariableOperatorWriteNode (location: (7,10)-(7,17)) + │ │ ├── flags: newline + │ │ ├── name_loc: (7,10)-(7,12) = "it" + │ │ ├── binary_operator_loc: (7,13)-(7,15) = "+=" + │ │ ├── value: + │ │ │ @ IntegerNode (location: (7,16)-(7,17)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── name: :it + │ │ ├── binary_operator: :+ + │ │ └── depth: 0 + │ ├── opening_loc: (7,4)-(7,5) = "{" + │ └── closing_loc: (7,18)-(7,19) = "}" + ├── @ CallNode (location: (9,0)-(9,20)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (9,0)-(9,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (9,4)-(9,20)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (9,6)-(9,18)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 2) + │ │ ├── @ CallNode (location: (9,6)-(9,8)) + │ │ │ ├── flags: newline, variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :it + │ │ │ ├── message_loc: (9,6)-(9,8) = "it" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ └── @ LocalVariableOrWriteNode (location: (9,10)-(9,18)) + │ │ ├── flags: newline + │ │ ├── name_loc: (9,10)-(9,12) = "it" + │ │ ├── operator_loc: (9,13)-(9,16) = "||=" + │ │ ├── value: + │ │ │ @ IntegerNode (location: (9,17)-(9,18)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── opening_loc: (9,4)-(9,5) = "{" + │ └── closing_loc: (9,19)-(9,20) = "}" + ├── @ CallNode (location: (11,0)-(11,20)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (11,0)-(11,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (11,4)-(11,20)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (11,6)-(11,18)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 2) + │ │ ├── @ CallNode (location: (11,6)-(11,8)) + │ │ │ ├── flags: newline, variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :it + │ │ │ ├── message_loc: (11,6)-(11,8) = "it" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ └── @ LocalVariableAndWriteNode (location: (11,10)-(11,18)) + │ │ ├── flags: newline + │ │ ├── name_loc: (11,10)-(11,12) = "it" + │ │ ├── operator_loc: (11,13)-(11,16) = "&&=" + │ │ ├── value: + │ │ │ @ IntegerNode (location: (11,17)-(11,18)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── opening_loc: (11,4)-(11,5) = "{" + │ └── closing_loc: (11,19)-(11,20) = "}" + ├── @ CallNode (location: (13,0)-(13,19)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (13,0)-(13,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (13,4)-(13,19)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (13,6)-(13,17)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 2) + │ │ ├── @ LocalVariableOperatorWriteNode (location: (13,6)-(13,13)) + │ │ │ ├── flags: newline + │ │ │ ├── name_loc: (13,6)-(13,8) = "it" + │ │ │ ├── binary_operator_loc: (13,9)-(13,11) = "+=" + │ │ │ ├── value: + │ │ │ │ @ IntegerNode (location: (13,12)-(13,13)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── name: :it + │ │ │ ├── binary_operator: :+ + │ │ │ └── depth: 0 + │ │ └── @ LocalVariableReadNode (location: (13,15)-(13,17)) + │ │ ├── flags: newline + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── opening_loc: (13,4)-(13,5) = "{" + │ └── closing_loc: (13,18)-(13,19) = "}" + ├── @ CallNode (location: (15,0)-(15,20)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (15,0)-(15,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (15,4)-(15,20)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (15,6)-(15,18)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 2) + │ │ ├── @ LocalVariableOrWriteNode (location: (15,6)-(15,14)) + │ │ │ ├── flags: newline + │ │ │ ├── name_loc: (15,6)-(15,8) = "it" + │ │ │ ├── operator_loc: (15,9)-(15,12) = "||=" + │ │ │ ├── value: + │ │ │ │ @ IntegerNode (location: (15,13)-(15,14)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── name: :it + │ │ │ └── depth: 0 + │ │ └── @ LocalVariableReadNode (location: (15,16)-(15,18)) + │ │ ├── flags: newline + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── opening_loc: (15,4)-(15,5) = "{" + │ └── closing_loc: (15,19)-(15,20) = "}" + ├── @ CallNode (location: (17,0)-(17,20)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (17,0)-(17,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (17,4)-(17,20)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (17,6)-(17,18)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 2) + │ │ ├── @ LocalVariableAndWriteNode (location: (17,6)-(17,14)) + │ │ │ ├── flags: newline + │ │ │ ├── name_loc: (17,6)-(17,8) = "it" + │ │ │ ├── operator_loc: (17,9)-(17,12) = "&&=" + │ │ │ ├── value: + │ │ │ │ @ IntegerNode (location: (17,13)-(17,14)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── name: :it + │ │ │ └── depth: 0 + │ │ └── @ LocalVariableReadNode (location: (17,16)-(17,18)) + │ │ ├── flags: newline + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── opening_loc: (17,4)-(17,5) = "{" + │ └── closing_loc: (17,19)-(17,20) = "}" + ├── @ CallNode (location: (19,0)-(19,23)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (19,0)-(19,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (19,4)-(19,23)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (19,6)-(19,21)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 3) + │ │ ├── @ CallNode (location: (19,6)-(19,8)) + │ │ │ ├── flags: newline, variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :it + │ │ │ ├── message_loc: (19,6)-(19,8) = "it" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── @ LocalVariableOperatorWriteNode (location: (19,10)-(19,17)) + │ │ │ ├── flags: newline + │ │ │ ├── name_loc: (19,10)-(19,12) = "it" + │ │ │ ├── binary_operator_loc: (19,13)-(19,15) = "+=" + │ │ │ ├── value: + │ │ │ │ @ IntegerNode (location: (19,16)-(19,17)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── name: :it + │ │ │ ├── binary_operator: :+ + │ │ │ └── depth: 0 + │ │ └── @ LocalVariableReadNode (location: (19,19)-(19,21)) + │ │ ├── flags: newline + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── opening_loc: (19,4)-(19,5) = "{" + │ └── closing_loc: (19,22)-(19,23) = "}" + ├── @ CallNode (location: (21,0)-(21,24)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (21,0)-(21,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (21,4)-(21,24)) + │ ├── flags: ∅ + │ ├── locals: [:it] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (21,6)-(21,22)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 3) + │ │ ├── @ CallNode (location: (21,6)-(21,8)) + │ │ │ ├── flags: newline, variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :it + │ │ │ ├── message_loc: (21,6)-(21,8) = "it" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── @ LocalVariableOrWriteNode (location: (21,10)-(21,18)) + │ │ │ ├── flags: newline + │ │ │ ├── name_loc: (21,10)-(21,12) = "it" + │ │ │ ├── operator_loc: (21,13)-(21,16) = "||=" + │ │ │ ├── value: + │ │ │ │ @ IntegerNode (location: (21,17)-(21,18)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── name: :it + │ │ │ └── depth: 0 + │ │ └── @ LocalVariableReadNode (location: (21,20)-(21,22)) + │ │ ├── flags: newline + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── opening_loc: (21,4)-(21,5) = "{" + │ └── closing_loc: (21,23)-(21,24) = "}" + └── @ CallNode (location: (23,0)-(23,24)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :tap + ├── message_loc: (23,0)-(23,3) = "tap" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: + @ BlockNode (location: (23,4)-(23,24)) + ├── flags: ∅ + ├── locals: [:it] + ├── parameters: ∅ + ├── body: + │ @ StatementsNode (location: (23,6)-(23,22)) + │ ├── flags: ∅ + │ └── body: (length: 3) + │ ├── @ CallNode (location: (23,6)-(23,8)) + │ │ ├── flags: newline, variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :it + │ │ ├── message_loc: (23,6)-(23,8) = "it" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── @ LocalVariableAndWriteNode (location: (23,10)-(23,18)) + │ │ ├── flags: newline + │ │ ├── name_loc: (23,10)-(23,12) = "it" + │ │ ├── operator_loc: (23,13)-(23,16) = "&&=" + │ │ ├── value: + │ │ │ @ IntegerNode (location: (23,17)-(23,18)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── name: :it + │ │ └── depth: 0 + │ └── @ LocalVariableReadNode (location: (23,20)-(23,22)) + │ ├── flags: newline + │ ├── name: :it + │ └── depth: 0 + ├── opening_loc: (23,4)-(23,5) = "{" + └── closing_loc: (23,23)-(23,24) = "}" diff --git a/snapshots/3.3-3.3/it_read_and_assignment.txt b/snapshots/3.3-3.3/it_read_and_assignment.txt new file mode 100644 index 0000000000..1914c1208c --- /dev/null +++ b/snapshots/3.3-3.3/it_read_and_assignment.txt @@ -0,0 +1,85 @@ +@ ProgramNode (location: (1,0)-(1,30)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,30)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,30)) + ├── flags: newline + ├── receiver: + │ @ IntegerNode (location: (1,0)-(1,2)) + │ ├── flags: static_literal, decimal + │ └── value: 42 + ├── call_operator_loc: (1,2)-(1,3) = "." + ├── name: :tap + ├── message_loc: (1,3)-(1,6) = "tap" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: + @ BlockNode (location: (1,7)-(1,30)) + ├── flags: ∅ + ├── locals: [:it] + ├── parameters: ∅ + ├── body: + │ @ StatementsNode (location: (1,9)-(1,28)) + │ ├── flags: ∅ + │ └── body: (length: 3) + │ ├── @ CallNode (location: (1,9)-(1,13)) + │ │ ├── flags: newline, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :p + │ │ ├── message_loc: (1,9)-(1,10) = "p" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (1,11)-(1,13)) + │ │ │ ├── flags: ∅ + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ CallNode (location: (1,11)-(1,13)) + │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :it + │ │ │ ├── message_loc: (1,11)-(1,13) = "it" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── @ LocalVariableWriteNode (location: (1,15)-(1,22)) + │ │ ├── flags: newline + │ │ ├── name: :it + │ │ ├── depth: 0 + │ │ ├── name_loc: (1,15)-(1,17) = "it" + │ │ ├── value: + │ │ │ @ LocalVariableReadNode (location: (1,20)-(1,22)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :it + │ │ │ └── depth: 0 + │ │ └── operator_loc: (1,18)-(1,19) = "=" + │ └── @ CallNode (location: (1,24)-(1,28)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :p + │ ├── message_loc: (1,24)-(1,25) = "p" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (1,26)-(1,28)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ LocalVariableReadNode (location: (1,26)-(1,28)) + │ │ ├── flags: ∅ + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── opening_loc: (1,7)-(1,8) = "{" + └── closing_loc: (1,29)-(1,30) = "}" diff --git a/snapshots/3.3-3.3/it_with_ordinary_parameter.txt b/snapshots/3.3-3.3/it_with_ordinary_parameter.txt new file mode 100644 index 0000000000..cdd8ef59af --- /dev/null +++ b/snapshots/3.3-3.3/it_with_ordinary_parameter.txt @@ -0,0 +1,45 @@ +@ ProgramNode (location: (1,0)-(1,14)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,14)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,14)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :proc + ├── message_loc: (1,0)-(1,4) = "proc" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: + @ BlockNode (location: (1,5)-(1,14)) + ├── flags: ∅ + ├── locals: [] + ├── parameters: + │ @ BlockParametersNode (location: (1,7)-(1,9)) + │ ├── flags: ∅ + │ ├── parameters: ∅ + │ ├── locals: (length: 0) + │ ├── opening_loc: (1,7)-(1,8) = "|" + │ └── closing_loc: (1,8)-(1,9) = "|" + ├── body: + │ @ StatementsNode (location: (1,10)-(1,12)) + │ ├── flags: ∅ + │ └── body: (length: 1) + │ └── @ CallNode (location: (1,10)-(1,12)) + │ ├── flags: newline, variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :it + │ ├── message_loc: (1,10)-(1,12) = "it" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── opening_loc: (1,5)-(1,6) = "{" + └── closing_loc: (1,13)-(1,14) = "}" diff --git a/snapshots/3.3-3.3/keyword_args_in_array_assignment.txt b/snapshots/3.3-3.3/keyword_args_in_array_assignment.txt new file mode 100644 index 0000000000..8d8ee48547 --- /dev/null +++ b/snapshots/3.3-3.3/keyword_args_in_array_assignment.txt @@ -0,0 +1,58 @@ +@ ProgramNode (location: (1,0)-(1,23)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,23)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,23)) + ├── flags: newline, attribute_write + ├── receiver: + │ @ CallNode (location: (1,0)-(1,6)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :matrix + │ ├── message_loc: (1,0)-(1,6) = "matrix" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── call_operator_loc: ∅ + ├── name: :[]= + ├── message_loc: (1,6)-(1,19) = "[5, axis: :y]" + ├── opening_loc: (1,6)-(1,7) = "[" + ├── arguments: + │ @ ArgumentsNode (location: (1,7)-(1,23)) + │ ├── flags: contains_keywords + │ └── arguments: (length: 3) + │ ├── @ IntegerNode (location: (1,7)-(1,8)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 5 + │ ├── @ KeywordHashNode (location: (1,10)-(1,18)) + │ │ ├── flags: symbol_keys + │ │ └── elements: (length: 1) + │ │ └── @ AssocNode (location: (1,10)-(1,18)) + │ │ ├── flags: static_literal + │ │ ├── key: + │ │ │ @ SymbolNode (location: (1,10)-(1,15)) + │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── value_loc: (1,10)-(1,14) = "axis" + │ │ │ ├── closing_loc: (1,14)-(1,15) = ":" + │ │ │ └── unescaped: "axis" + │ │ ├── value: + │ │ │ @ SymbolNode (location: (1,16)-(1,18)) + │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ ├── opening_loc: (1,16)-(1,17) = ":" + │ │ │ ├── value_loc: (1,17)-(1,18) = "y" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "y" + │ │ └── operator_loc: ∅ + │ └── @ IntegerNode (location: (1,22)-(1,23)) + │ ├── flags: static_literal, decimal + │ └── value: 8 + ├── closing_loc: (1,18)-(1,19) = "]" + ├── equal_loc: (1,20)-(1,21) = "=" + └── block: ∅ diff --git a/snapshots/3.3-3.3/return_in_sclass.txt b/snapshots/3.3-3.3/return_in_sclass.txt new file mode 100644 index 0000000000..d8f298b23a --- /dev/null +++ b/snapshots/3.3-3.3/return_in_sclass.txt @@ -0,0 +1,25 @@ +@ ProgramNode (location: (1,0)-(1,23)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,23)) + ├── flags: ∅ + └── body: (length: 1) + └── @ SingletonClassNode (location: (1,0)-(1,23)) + ├── flags: newline + ├── locals: [] + ├── class_keyword_loc: (1,0)-(1,5) = "class" + ├── operator_loc: (1,6)-(1,8) = "<<" + ├── expression: + │ @ ConstantReadNode (location: (1,9)-(1,10)) + │ ├── flags: ∅ + │ └── name: :A + ├── body: + │ @ StatementsNode (location: (1,12)-(1,18)) + │ ├── flags: ∅ + │ └── body: (length: 1) + │ └── @ ReturnNode (location: (1,12)-(1,18)) + │ ├── flags: newline + │ ├── keyword_loc: (1,12)-(1,18) = "return" + │ └── arguments: ∅ + └── end_keyword_loc: (1,20)-(1,23) = "end" diff --git a/snapshots/3.4/circular_parameters.txt b/snapshots/3.4/circular_parameters.txt new file mode 100644 index 0000000000..967f1cb83c --- /dev/null +++ b/snapshots/3.4/circular_parameters.txt @@ -0,0 +1,169 @@ +@ ProgramNode (location: (1,0)-(4,19)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(4,19)) + ├── flags: ∅ + └── body: (length: 4) + ├── @ DefNode (location: (1,0)-(1,23)) + │ ├── flags: newline + │ ├── name: :foo + │ ├── name_loc: (1,4)-(1,7) = "foo" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,8)-(1,17)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (1,8)-(1,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :bar + │ │ │ ├── name_loc: (1,8)-(1,11) = "bar" + │ │ │ ├── operator_loc: (1,12)-(1,13) = "=" + │ │ │ └── value: + │ │ │ @ LocalVariableReadNode (location: (1,14)-(1,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :bar + │ │ │ └── depth: 0 + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (1,21)-(1,23)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ IntegerNode (location: (1,21)-(1,23)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 42 + │ ├── locals: [:bar] + │ ├── def_keyword_loc: (1,0)-(1,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (1,7)-(1,8) = "(" + │ ├── rparen_loc: (1,17)-(1,18) = ")" + │ ├── equal_loc: (1,19)-(1,20) = "=" + │ └── end_keyword_loc: ∅ + ├── @ DefNode (location: (2,0)-(2,22)) + │ ├── flags: newline + │ ├── name: :foo + │ ├── name_loc: (2,4)-(2,7) = "foo" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (2,8)-(2,16)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 1) + │ │ │ └── @ OptionalKeywordParameterNode (location: (2,8)-(2,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :bar + │ │ │ ├── name_loc: (2,8)-(2,12) = "bar:" + │ │ │ └── value: + │ │ │ @ LocalVariableReadNode (location: (2,13)-(2,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :bar + │ │ │ └── depth: 0 + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (2,20)-(2,22)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ IntegerNode (location: (2,20)-(2,22)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 42 + │ ├── locals: [:bar] + │ ├── def_keyword_loc: (2,0)-(2,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (2,7)-(2,8) = "(" + │ ├── rparen_loc: (2,16)-(2,17) = ")" + │ ├── equal_loc: (2,18)-(2,19) = "=" + │ └── end_keyword_loc: ∅ + ├── @ CallNode (location: (3,0)-(3,20)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :proc + │ ├── message_loc: (3,0)-(3,4) = "proc" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (3,5)-(3,20)) + │ ├── flags: ∅ + │ ├── locals: [:foo] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (3,7)-(3,18)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (3,8)-(3,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 1) + │ │ │ │ └── @ OptionalParameterNode (location: (3,8)-(3,17)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :foo + │ │ │ │ ├── name_loc: (3,8)-(3,11) = "foo" + │ │ │ │ ├── operator_loc: (3,12)-(3,13) = "=" + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableReadNode (location: (3,14)-(3,17)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :foo + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (3,7)-(3,8) = "|" + │ │ └── closing_loc: (3,17)-(3,18) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (3,5)-(3,6) = "{" + │ └── closing_loc: (3,19)-(3,20) = "}" + └── @ CallNode (location: (4,0)-(4,19)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :proc + ├── message_loc: (4,0)-(4,4) = "proc" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: + @ BlockNode (location: (4,5)-(4,19)) + ├── flags: ∅ + ├── locals: [:foo] + ├── parameters: + │ @ BlockParametersNode (location: (4,7)-(4,17)) + │ ├── flags: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (4,8)-(4,16)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 1) + │ │ │ └── @ OptionalKeywordParameterNode (location: (4,8)-(4,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :foo + │ │ │ ├── name_loc: (4,8)-(4,12) = "foo:" + │ │ │ └── value: + │ │ │ @ LocalVariableReadNode (location: (4,13)-(4,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :foo + │ │ │ └── depth: 0 + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── locals: (length: 0) + │ ├── opening_loc: (4,7)-(4,8) = "|" + │ └── closing_loc: (4,16)-(4,17) = "|" + ├── body: ∅ + ├── opening_loc: (4,5)-(4,6) = "{" + └── closing_loc: (4,18)-(4,19) = "}" diff --git a/snapshots/3.4/it.txt b/snapshots/3.4/it.txt new file mode 100644 index 0000000000..6567f94a32 --- /dev/null +++ b/snapshots/3.4/it.txt @@ -0,0 +1,47 @@ +@ ProgramNode (location: (1,0)-(5,9)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(5,9)) + ├── flags: ∅ + └── body: (length: 2) + ├── @ CallNode (location: (1,0)-(3,3)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :x + │ ├── message_loc: (1,0)-(1,1) = "x" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (1,2)-(3,3)) + │ ├── flags: ∅ + │ ├── locals: [] + │ ├── parameters: + │ │ @ ItParametersNode (location: (1,2)-(3,3)) + │ │ └── flags: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (2,2)-(2,4)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ ItLocalVariableReadNode (location: (2,2)-(2,4)) + │ │ └── flags: newline + │ ├── opening_loc: (1,2)-(1,4) = "do" + │ └── closing_loc: (3,0)-(3,3) = "end" + └── @ LambdaNode (location: (5,0)-(5,9)) + ├── flags: newline + ├── locals: [] + ├── operator_loc: (5,0)-(5,2) = "->" + ├── opening_loc: (5,3)-(5,4) = "{" + ├── closing_loc: (5,8)-(5,9) = "}" + ├── parameters: + │ @ ItParametersNode (location: (5,0)-(5,9)) + │ └── flags: ∅ + └── body: + @ StatementsNode (location: (5,5)-(5,7)) + ├── flags: ∅ + └── body: (length: 1) + └── @ ItLocalVariableReadNode (location: (5,5)-(5,7)) + └── flags: newline diff --git a/snapshots/3.4/it_assignment.txt b/snapshots/3.4/it_assignment.txt new file mode 100644 index 0000000000..83469791c0 --- /dev/null +++ b/snapshots/3.4/it_assignment.txt @@ -0,0 +1,58 @@ +@ ProgramNode (location: (1,0)-(1,24)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,24)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,24)) + ├── flags: newline + ├── receiver: + │ @ IntegerNode (location: (1,0)-(1,2)) + │ ├── flags: static_literal, decimal + │ └── value: 42 + ├── call_operator_loc: (1,2)-(1,3) = "." + ├── name: :tap + ├── message_loc: (1,3)-(1,6) = "tap" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + └── block: + @ BlockNode (location: (1,7)-(1,24)) + ├── flags: ∅ + ├── locals: [:it] + ├── parameters: ∅ + ├── body: + │ @ StatementsNode (location: (1,9)-(1,22)) + │ ├── flags: ∅ + │ └── body: (length: 2) + │ ├── @ LocalVariableWriteNode (location: (1,9)-(1,16)) + │ │ ├── flags: newline + │ │ ├── name: :it + │ │ ├── depth: 0 + │ │ ├── name_loc: (1,9)-(1,11) = "it" + │ │ ├── value: + │ │ │ @ LocalVariableReadNode (location: (1,14)-(1,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :it + │ │ │ └── depth: 0 + │ │ └── operator_loc: (1,12)-(1,13) = "=" + │ └── @ CallNode (location: (1,18)-(1,22)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :p + │ ├── message_loc: (1,18)-(1,19) = "p" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (1,20)-(1,22)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ LocalVariableReadNode (location: (1,20)-(1,22)) + │ │ ├── flags: ∅ + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── opening_loc: (1,7)-(1,8) = "{" + └── closing_loc: (1,23)-(1,24) = "}" diff --git a/snapshots/it_indirect_writes.txt b/snapshots/3.4/it_indirect_writes.txt similarity index 98% rename from snapshots/it_indirect_writes.txt rename to snapshots/3.4/it_indirect_writes.txt index 165aececc6..f62753346f 100644 --- a/snapshots/it_indirect_writes.txt +++ b/snapshots/3.4/it_indirect_writes.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,4)-(1,15)) │ ├── flags: ∅ @@ -45,6 +46,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,4)-(3,16)) │ ├── flags: ∅ @@ -75,6 +77,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,4)-(5,16)) │ ├── flags: ∅ @@ -105,6 +108,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,4)-(7,19)) │ ├── flags: ∅ @@ -140,6 +144,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (9,4)-(9,20)) │ ├── flags: ∅ @@ -174,6 +179,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (11,4)-(11,20)) │ ├── flags: ∅ @@ -208,6 +214,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (13,4)-(13,19)) │ ├── flags: ∅ @@ -243,6 +250,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (15,4)-(15,20)) │ ├── flags: ∅ @@ -277,6 +285,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (17,4)-(17,20)) │ ├── flags: ∅ @@ -311,6 +320,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (19,4)-(19,23)) │ ├── flags: ∅ @@ -350,6 +360,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (21,4)-(21,24)) │ ├── flags: ∅ @@ -388,6 +399,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (23,4)-(23,24)) ├── flags: ∅ diff --git a/snapshots/3.4/it_read_and_assignment.txt b/snapshots/3.4/it_read_and_assignment.txt new file mode 100644 index 0000000000..6801732cf2 --- /dev/null +++ b/snapshots/3.4/it_read_and_assignment.txt @@ -0,0 +1,78 @@ +@ ProgramNode (location: (1,0)-(1,30)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,30)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,30)) + ├── flags: newline + ├── receiver: + │ @ IntegerNode (location: (1,0)-(1,2)) + │ ├── flags: static_literal, decimal + │ └── value: 42 + ├── call_operator_loc: (1,2)-(1,3) = "." + ├── name: :tap + ├── message_loc: (1,3)-(1,6) = "tap" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: + @ BlockNode (location: (1,7)-(1,30)) + ├── flags: ∅ + ├── locals: [:it] + ├── parameters: + │ @ ItParametersNode (location: (1,7)-(1,30)) + │ └── flags: ∅ + ├── body: + │ @ StatementsNode (location: (1,9)-(1,28)) + │ ├── flags: ∅ + │ └── body: (length: 3) + │ ├── @ CallNode (location: (1,9)-(1,13)) + │ │ ├── flags: newline, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :p + │ │ ├── message_loc: (1,9)-(1,10) = "p" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (1,11)-(1,13)) + │ │ │ ├── flags: ∅ + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ ItLocalVariableReadNode (location: (1,11)-(1,13)) + │ │ │ └── flags: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── @ LocalVariableWriteNode (location: (1,15)-(1,22)) + │ │ ├── flags: newline + │ │ ├── name: :it + │ │ ├── depth: 0 + │ │ ├── name_loc: (1,15)-(1,17) = "it" + │ │ ├── value: + │ │ │ @ LocalVariableReadNode (location: (1,20)-(1,22)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :it + │ │ │ └── depth: 0 + │ │ └── operator_loc: (1,18)-(1,19) = "=" + │ └── @ CallNode (location: (1,24)-(1,28)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :p + │ ├── message_loc: (1,24)-(1,25) = "p" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (1,26)-(1,28)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ LocalVariableReadNode (location: (1,26)-(1,28)) + │ │ ├── flags: ∅ + │ │ ├── name: :it + │ │ └── depth: 0 + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── opening_loc: (1,7)-(1,8) = "{" + └── closing_loc: (1,29)-(1,30) = "}" diff --git a/snapshots/4.0/endless_methods_command_call.txt b/snapshots/4.0/endless_methods_command_call.txt new file mode 100644 index 0000000000..d2c58ec8b0 --- /dev/null +++ b/snapshots/4.0/endless_methods_command_call.txt @@ -0,0 +1,495 @@ +@ ProgramNode (location: (1,0)-(8,31)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(8,31)) + ├── flags: ∅ + └── body: (length: 8) + ├── @ CallNode (location: (1,0)-(1,30)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :private + │ ├── message_loc: (1,0)-(1,7) = "private" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (1,8)-(1,30)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ DefNode (location: (1,8)-(1,30)) + │ │ ├── flags: ∅ + │ │ ├── name: :foo + │ │ ├── name_loc: (1,12)-(1,15) = "foo" + │ │ ├── receiver: ∅ + │ │ ├── parameters: ∅ + │ │ ├── body: + │ │ │ @ StatementsNode (location: (1,18)-(1,30)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (1,18)-(1,30)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :puts + │ │ │ ├── message_loc: (1,18)-(1,22) = "puts" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (1,23)-(1,30)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ StringNode (location: (1,23)-(1,30)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (1,23)-(1,24) = "\"" + │ │ │ │ ├── content_loc: (1,24)-(1,29) = "Hello" + │ │ │ │ ├── closing_loc: (1,29)-(1,30) = "\"" + │ │ │ │ └── unescaped: "Hello" + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: [] + │ │ ├── def_keyword_loc: (1,8)-(1,11) = "def" + │ │ ├── operator_loc: ∅ + │ │ ├── lparen_loc: ∅ + │ │ ├── rparen_loc: ∅ + │ │ ├── equal_loc: (1,16)-(1,17) = "=" + │ │ └── end_keyword_loc: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (2,0)-(2,39)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :private + │ ├── message_loc: (2,0)-(2,7) = "private" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (2,8)-(2,39)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ DefNode (location: (2,8)-(2,39)) + │ │ ├── flags: ∅ + │ │ ├── name: :foo + │ │ ├── name_loc: (2,12)-(2,15) = "foo" + │ │ ├── receiver: ∅ + │ │ ├── parameters: ∅ + │ │ ├── body: + │ │ │ @ StatementsNode (location: (2,18)-(2,39)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (2,18)-(2,39)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :puts + │ │ │ ├── message_loc: (2,18)-(2,22) = "puts" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (2,23)-(2,39)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 2) + │ │ │ │ ├── @ StringNode (location: (2,23)-(2,30)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── opening_loc: (2,23)-(2,24) = "\"" + │ │ │ │ │ ├── content_loc: (2,24)-(2,29) = "Hello" + │ │ │ │ │ ├── closing_loc: (2,29)-(2,30) = "\"" + │ │ │ │ │ └── unescaped: "Hello" + │ │ │ │ └── @ StringNode (location: (2,32)-(2,39)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (2,32)-(2,33) = "\"" + │ │ │ │ ├── content_loc: (2,33)-(2,38) = "World" + │ │ │ │ ├── closing_loc: (2,38)-(2,39) = "\"" + │ │ │ │ └── unescaped: "World" + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: [] + │ │ ├── def_keyword_loc: (2,8)-(2,11) = "def" + │ │ ├── operator_loc: ∅ + │ │ ├── lparen_loc: ∅ + │ │ ├── rparen_loc: ∅ + │ │ ├── equal_loc: (2,16)-(2,17) = "=" + │ │ └── end_keyword_loc: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (3,0)-(3,42)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :private + │ ├── message_loc: (3,0)-(3,7) = "private" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (3,8)-(3,30)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ DefNode (location: (3,8)-(3,30)) + │ │ ├── flags: ∅ + │ │ ├── name: :foo + │ │ ├── name_loc: (3,12)-(3,15) = "foo" + │ │ ├── receiver: ∅ + │ │ ├── parameters: ∅ + │ │ ├── body: + │ │ │ @ StatementsNode (location: (3,18)-(3,30)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (3,18)-(3,30)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :puts + │ │ │ ├── message_loc: (3,18)-(3,22) = "puts" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (3,23)-(3,30)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ StringNode (location: (3,23)-(3,30)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (3,23)-(3,24) = "\"" + │ │ │ │ ├── content_loc: (3,24)-(3,29) = "Hello" + │ │ │ │ ├── closing_loc: (3,29)-(3,30) = "\"" + │ │ │ │ └── unescaped: "Hello" + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: [] + │ │ ├── def_keyword_loc: (3,8)-(3,11) = "def" + │ │ ├── operator_loc: ∅ + │ │ ├── lparen_loc: ∅ + │ │ ├── rparen_loc: ∅ + │ │ ├── equal_loc: (3,16)-(3,17) = "=" + │ │ └── end_keyword_loc: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (3,31)-(3,42)) + │ ├── flags: ∅ + │ ├── locals: [] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (3,34)-(3,38)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ CallNode (location: (3,34)-(3,38)) + │ │ ├── flags: newline, variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :expr + │ │ ├── message_loc: (3,34)-(3,38) = "expr" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── opening_loc: (3,31)-(3,33) = "do" + │ └── closing_loc: (3,39)-(3,42) = "end" + ├── @ CallNode (location: (4,0)-(4,32)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :private + │ ├── message_loc: (4,0)-(4,7) = "private" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (4,8)-(4,32)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ DefNode (location: (4,8)-(4,32)) + │ │ ├── flags: ∅ + │ │ ├── name: :foo + │ │ ├── name_loc: (4,12)-(4,15) = "foo" + │ │ ├── receiver: ∅ + │ │ ├── parameters: ∅ + │ │ ├── body: + │ │ │ @ StatementsNode (location: (4,20)-(4,32)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (4,20)-(4,32)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :puts + │ │ │ ├── message_loc: (4,20)-(4,24) = "puts" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (4,25)-(4,32)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ StringNode (location: (4,25)-(4,32)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (4,25)-(4,26) = "\"" + │ │ │ │ ├── content_loc: (4,26)-(4,31) = "Hello" + │ │ │ │ ├── closing_loc: (4,31)-(4,32) = "\"" + │ │ │ │ └── unescaped: "Hello" + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: [] + │ │ ├── def_keyword_loc: (4,8)-(4,11) = "def" + │ │ ├── operator_loc: ∅ + │ │ ├── lparen_loc: (4,15)-(4,16) = "(" + │ │ ├── rparen_loc: (4,16)-(4,17) = ")" + │ │ ├── equal_loc: (4,18)-(4,19) = "=" + │ │ └── end_keyword_loc: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (5,0)-(5,27)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :private + │ ├── message_loc: (5,0)-(5,7) = "private" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (5,8)-(5,27)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ DefNode (location: (5,8)-(5,27)) + │ │ ├── flags: ∅ + │ │ ├── name: :foo + │ │ ├── name_loc: (5,12)-(5,15) = "foo" + │ │ ├── receiver: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (5,16)-(5,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (5,16)-(5,17)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :x + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: ∅ + │ │ ├── body: + │ │ │ @ StatementsNode (location: (5,21)-(5,27)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (5,21)-(5,27)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :puts + │ │ │ ├── message_loc: (5,21)-(5,25) = "puts" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (5,26)-(5,27)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ LocalVariableReadNode (location: (5,26)-(5,27)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: [:x] + │ │ ├── def_keyword_loc: (5,8)-(5,11) = "def" + │ │ ├── operator_loc: ∅ + │ │ ├── lparen_loc: (5,15)-(5,16) = "(" + │ │ ├── rparen_loc: (5,17)-(5,18) = ")" + │ │ ├── equal_loc: (5,19)-(5,20) = "=" + │ │ └── end_keyword_loc: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (6,0)-(6,34)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :private + │ ├── message_loc: (6,0)-(6,7) = "private" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (6,8)-(6,34)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ DefNode (location: (6,8)-(6,34)) + │ │ ├── flags: ∅ + │ │ ├── name: :foo + │ │ ├── name_loc: (6,16)-(6,19) = "foo" + │ │ ├── receiver: + │ │ │ @ CallNode (location: (6,12)-(6,15)) + │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :obj + │ │ │ ├── message_loc: (6,12)-(6,15) = "obj" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── parameters: ∅ + │ │ ├── body: + │ │ │ @ StatementsNode (location: (6,22)-(6,34)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (6,22)-(6,34)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :puts + │ │ │ ├── message_loc: (6,22)-(6,26) = "puts" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (6,27)-(6,34)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ StringNode (location: (6,27)-(6,34)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (6,27)-(6,28) = "\"" + │ │ │ │ ├── content_loc: (6,28)-(6,33) = "Hello" + │ │ │ │ ├── closing_loc: (6,33)-(6,34) = "\"" + │ │ │ │ └── unescaped: "Hello" + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: [] + │ │ ├── def_keyword_loc: (6,8)-(6,11) = "def" + │ │ ├── operator_loc: (6,15)-(6,16) = "." + │ │ ├── lparen_loc: ∅ + │ │ ├── rparen_loc: ∅ + │ │ ├── equal_loc: (6,20)-(6,21) = "=" + │ │ └── end_keyword_loc: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (7,0)-(7,36)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :private + │ ├── message_loc: (7,0)-(7,7) = "private" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (7,8)-(7,36)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ DefNode (location: (7,8)-(7,36)) + │ │ ├── flags: ∅ + │ │ ├── name: :foo + │ │ ├── name_loc: (7,16)-(7,19) = "foo" + │ │ ├── receiver: + │ │ │ @ CallNode (location: (7,12)-(7,15)) + │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :obj + │ │ │ ├── message_loc: (7,12)-(7,15) = "obj" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── parameters: ∅ + │ │ ├── body: + │ │ │ @ StatementsNode (location: (7,24)-(7,36)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (7,24)-(7,36)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :puts + │ │ │ ├── message_loc: (7,24)-(7,28) = "puts" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (7,29)-(7,36)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ StringNode (location: (7,29)-(7,36)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (7,29)-(7,30) = "\"" + │ │ │ │ ├── content_loc: (7,30)-(7,35) = "Hello" + │ │ │ │ ├── closing_loc: (7,35)-(7,36) = "\"" + │ │ │ │ └── unescaped: "Hello" + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: [] + │ │ ├── def_keyword_loc: (7,8)-(7,11) = "def" + │ │ ├── operator_loc: (7,15)-(7,16) = "." + │ │ ├── lparen_loc: (7,19)-(7,20) = "(" + │ │ ├── rparen_loc: (7,20)-(7,21) = ")" + │ │ ├── equal_loc: (7,22)-(7,23) = "=" + │ │ └── end_keyword_loc: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + └── @ CallNode (location: (8,0)-(8,31)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :private + ├── message_loc: (8,0)-(8,7) = "private" + ├── opening_loc: ∅ + ├── arguments: + │ @ ArgumentsNode (location: (8,8)-(8,31)) + │ ├── flags: ∅ + │ └── arguments: (length: 1) + │ └── @ DefNode (location: (8,8)-(8,31)) + │ ├── flags: ∅ + │ ├── name: :foo + │ ├── name_loc: (8,16)-(8,19) = "foo" + │ ├── receiver: + │ │ @ CallNode (location: (8,12)-(8,15)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :obj + │ │ ├── message_loc: (8,12)-(8,15) = "obj" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (8,20)-(8,21)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (8,20)-(8,21)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :x + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (8,25)-(8,31)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ CallNode (location: (8,25)-(8,31)) + │ │ ├── flags: ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :puts + │ │ ├── message_loc: (8,25)-(8,29) = "puts" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (8,30)-(8,31)) + │ │ │ ├── flags: ∅ + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ LocalVariableReadNode (location: (8,30)-(8,31)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :x + │ │ │ └── depth: 0 + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── locals: [:x] + │ ├── def_keyword_loc: (8,8)-(8,11) = "def" + │ ├── operator_loc: (8,15)-(8,16) = "." + │ ├── lparen_loc: (8,19)-(8,20) = "(" + │ ├── rparen_loc: (8,21)-(8,22) = ")" + │ ├── equal_loc: (8,23)-(8,24) = "=" + │ └── end_keyword_loc: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: ∅ diff --git a/snapshots/4.0/leading_logical.txt b/snapshots/4.0/leading_logical.txt new file mode 100644 index 0000000000..9e043a88ce --- /dev/null +++ b/snapshots/4.0/leading_logical.txt @@ -0,0 +1,111 @@ +@ ProgramNode (location: (1,0)-(21,5)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(21,5)) + ├── flags: ∅ + └── body: (length: 8) + ├── @ AndNode (location: (1,0)-(3,4)) + │ ├── flags: newline + │ ├── left: + │ │ @ AndNode (location: (1,0)-(2,4)) + │ │ ├── flags: ∅ + │ │ ├── left: + │ │ │ @ IntegerNode (location: (1,0)-(1,1)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── right: + │ │ │ @ IntegerNode (location: (2,3)-(2,4)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 2 + │ │ └── operator_loc: (2,0)-(2,2) = "&&" + │ ├── right: + │ │ @ IntegerNode (location: (3,3)-(3,4)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 3 + │ └── operator_loc: (3,0)-(3,2) = "&&" + ├── @ OrNode (location: (5,0)-(7,4)) + │ ├── flags: newline + │ ├── left: + │ │ @ OrNode (location: (5,0)-(6,4)) + │ │ ├── flags: ∅ + │ │ ├── left: + │ │ │ @ IntegerNode (location: (5,0)-(5,1)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── right: + │ │ │ @ IntegerNode (location: (6,3)-(6,4)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 2 + │ │ └── operator_loc: (6,0)-(6,2) = "||" + │ ├── right: + │ │ @ IntegerNode (location: (7,3)-(7,4)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 3 + │ └── operator_loc: (7,0)-(7,2) = "||" + ├── @ AndNode (location: (9,0)-(11,5)) + │ ├── flags: newline + │ ├── left: + │ │ @ AndNode (location: (9,0)-(10,5)) + │ │ ├── flags: ∅ + │ │ ├── left: + │ │ │ @ IntegerNode (location: (9,0)-(9,1)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── right: + │ │ │ @ IntegerNode (location: (10,4)-(10,5)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 2 + │ │ └── operator_loc: (10,0)-(10,3) = "and" + │ ├── right: + │ │ @ IntegerNode (location: (11,4)-(11,5)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 3 + │ └── operator_loc: (11,0)-(11,3) = "and" + ├── @ OrNode (location: (13,0)-(15,4)) + │ ├── flags: newline + │ ├── left: + │ │ @ OrNode (location: (13,0)-(14,4)) + │ │ ├── flags: ∅ + │ │ ├── left: + │ │ │ @ IntegerNode (location: (13,0)-(13,1)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── right: + │ │ │ @ IntegerNode (location: (14,3)-(14,4)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 2 + │ │ └── operator_loc: (14,0)-(14,2) = "or" + │ ├── right: + │ │ @ IntegerNode (location: (15,3)-(15,4)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 3 + │ └── operator_loc: (15,0)-(15,2) = "or" + ├── @ IntegerNode (location: (17,0)-(17,1)) + │ ├── flags: newline, static_literal, decimal + │ └── value: 1 + ├── @ CallNode (location: (18,0)-(18,6)) + │ ├── flags: newline, variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :andfoo + │ ├── message_loc: (18,0)-(18,6) = "andfoo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ IntegerNode (location: (20,0)-(20,1)) + │ ├── flags: newline, static_literal, decimal + │ └── value: 2 + └── @ CallNode (location: (21,0)-(21,5)) + ├── flags: newline, variable_call, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :orfoo + ├── message_loc: (21,0)-(21,5) = "orfoo" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: ∅ diff --git a/snapshots/__END__.txt b/snapshots/__END__.txt new file mode 100644 index 0000000000..786532cacb --- /dev/null +++ b/snapshots/__END__.txt @@ -0,0 +1,18 @@ +@ ProgramNode (location: (1,0)-(1,3)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,3)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,3)) + ├── flags: newline, variable_call, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :foo + ├── message_loc: (1,0)-(1,3) = "foo" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: ∅ diff --git a/snapshots/arithmetic.txt b/snapshots/arithmetic.txt index 963080e0d9..c7a82a234c 100644 --- a/snapshots/arithmetic.txt +++ b/snapshots/arithmetic.txt @@ -28,6 +28,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -35,8 +36,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,8)) │ ├── flags: newline @@ -53,6 +56,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :-@ @@ -60,6 +64,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :* @@ -78,8 +83,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (5,0)-(5,9)) │ ├── flags: newline @@ -96,6 +103,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :+@ @@ -103,6 +111,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :** @@ -121,8 +130,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (7,0)-(7,8)) │ ├── flags: newline, ignore_visibility @@ -147,6 +158,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :~ @@ -154,8 +166,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (9,0)-(9,17)) │ ├── flags: newline @@ -172,6 +186,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :<< @@ -190,8 +205,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :<< @@ -210,8 +227,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (11,0)-(11,5)) │ ├── flags: newline @@ -234,6 +253,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :-@ @@ -241,6 +261,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (13,0)-(13,8)) ├── flags: newline @@ -254,4 +275,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/arrays.txt b/snapshots/arrays.txt index a8a334cd19..62944b80b8 100644 --- a/snapshots/arrays.txt +++ b/snapshots/arrays.txt @@ -21,6 +21,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,0)-(1,1) = "[" │ └── closing_loc: (1,3)-(1,4) = "]" @@ -36,6 +37,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[]= @@ -54,6 +56,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── @ CallNode (location: (3,9)-(3,12)) │ │ │ ├── flags: variable_call, ignore_visibility @@ -64,6 +67,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ ArrayNode (location: (3,16)-(3,23)) │ │ ├── flags: static_literal @@ -80,6 +84,7 @@ │ │ ├── opening_loc: ∅ │ │ └── closing_loc: ∅ │ ├── closing_loc: (3,12)-(3,13) = "]" + │ ├── equal_loc: (3,14)-(3,15) = "=" │ └── block: ∅ ├── @ ArrayNode (location: (5,0)-(5,13)) │ ├── flags: newline @@ -199,6 +204,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── value: │ │ │ @ CallNode (location: (28,8)-(28,11)) @@ -210,6 +216,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (28,5)-(28,7) = "=>" │ ├── opening_loc: (28,0)-(28,1) = "[" @@ -229,6 +236,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :[] @@ -247,8 +255,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: (30,7)-(30,8) = "]" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[]= @@ -267,6 +277,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (30,16)-(30,19)) │ │ ├── flags: variable_call, ignore_visibility @@ -277,8 +288,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (30,12)-(30,13) = "]" + │ ├── equal_loc: (30,14)-(30,15) = "=" │ └── block: ∅ ├── @ CallNode (location: (32,0)-(32,13)) │ ├── flags: newline @@ -295,6 +308,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :[] @@ -313,8 +327,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: (32,7)-(32,8) = "]" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -333,8 +349,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (32,12)-(32,13) = "]" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ ArrayNode (location: (34,0)-(35,1)) │ ├── flags: newline, static_literal @@ -353,6 +371,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -371,6 +390,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (37,9)-(37,12)) │ │ ├── flags: variable_call, ignore_visibility @@ -381,8 +401,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (37,12)-(37,13) = "]" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (39,0)-(39,19)) │ ├── flags: newline, attribute_write @@ -396,6 +418,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[]= @@ -414,6 +437,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── @ CallNode (location: (39,9)-(39,12)) │ │ │ ├── flags: variable_call, ignore_visibility @@ -424,6 +448,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (39,16)-(39,19)) │ │ ├── flags: variable_call, ignore_visibility @@ -434,8 +459,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (39,12)-(39,13) = "]" + │ ├── equal_loc: (39,14)-(39,15) = "=" │ └── block: ∅ ├── @ MultiWriteNode (location: (41,0)-(41,21)) │ ├── flags: newline @@ -452,6 +479,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (41,3)-(41,4) = "[" │ │ │ ├── arguments: @@ -475,6 +503,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (41,11)-(41,12) = "[" │ │ ├── arguments: @@ -515,6 +544,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -536,6 +566,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :[]= @@ -554,6 +585,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── @ CallNode (location: (43,15)-(43,18)) │ │ │ ├── flags: variable_call, ignore_visibility @@ -564,10 +596,13 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: (43,11)-(43,12) = "]" + │ │ ├── equal_loc: (43,13)-(43,14) = "=" │ │ └── block: ∅ │ ├── closing_loc: (43,18)-(43,19) = "]" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (45,0)-(45,8)) │ ├── flags: newline @@ -581,6 +616,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -599,8 +635,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (45,7)-(45,8) = "]" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (47,0)-(47,14)) │ ├── flags: newline, attribute_write @@ -614,6 +652,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[]= @@ -632,6 +671,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (47,11)-(47,14)) │ │ ├── flags: variable_call, ignore_visibility @@ -642,8 +682,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (47,7)-(47,8) = "]" + │ ├── equal_loc: (47,9)-(47,10) = "=" │ └── block: ∅ ├── @ ArrayNode (location: (49,0)-(49,6)) │ ├── flags: newline @@ -680,6 +722,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (51,1)-(51,3) = "**" │ ├── opening_loc: (51,0)-(51,1) = "[" @@ -705,6 +748,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (53,4)-(53,6) = "**" │ ├── opening_loc: (53,0)-(53,1) = "[" @@ -730,6 +774,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (55,4)-(55,6) = "**" │ │ ├── @ AssocSplatNode (location: (55,10)-(55,14)) @@ -753,6 +798,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (55,16)-(55,18) = "**" │ ├── opening_loc: (55,0)-(55,1) = "[" @@ -775,6 +821,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── value: │ │ │ @ CallNode (location: (58,9)-(58,12)) @@ -786,6 +833,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (58,6)-(58,8) = "=>" │ ├── opening_loc: (57,0)-(57,1) = "[" @@ -969,6 +1017,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (84,3)-(84,4) = "[" @@ -993,6 +1042,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (86,3)-(86,4) = "[" @@ -1016,6 +1066,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (88,3)-(88,4) = "[" @@ -1042,6 +1093,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (90,3)-(90,4) = "." │ │ ├── name: :foo @@ -1049,6 +1101,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (90,7)-(90,8) = "[" @@ -1076,6 +1129,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (92,3)-(92,4) = "." │ │ ├── name: :foo @@ -1083,6 +1137,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (92,7)-(92,8) = "[" @@ -1109,6 +1164,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (94,3)-(94,4) = "." │ │ ├── name: :foo @@ -1116,6 +1172,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (94,7)-(94,8) = "[" @@ -1139,6 +1196,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (96,3)-(96,4) = "[" @@ -1155,6 +1213,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (96,7)-(96,8) = "]" │ ├── block: ∅ @@ -1176,6 +1235,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (98,3)-(98,4) = "[" @@ -1192,6 +1252,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (98,7)-(98,8) = "]" │ ├── block: ∅ @@ -1212,6 +1273,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (100,3)-(100,4) = "[" @@ -1228,6 +1290,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (100,7)-(100,8) = "]" │ ├── block: ∅ @@ -1251,6 +1314,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (102,3)-(102,4) = "." │ │ ├── name: :foo @@ -1258,6 +1322,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (102,7)-(102,8) = "[" @@ -1274,6 +1339,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (102,11)-(102,12) = "]" │ ├── block: ∅ @@ -1298,6 +1364,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (104,3)-(104,4) = "." │ │ ├── name: :foo @@ -1305,6 +1372,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (104,7)-(104,8) = "[" @@ -1321,6 +1389,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (104,11)-(104,12) = "]" │ ├── block: ∅ @@ -1344,6 +1413,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (106,3)-(106,4) = "." │ │ ├── name: :foo @@ -1351,6 +1421,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── opening_loc: (106,7)-(106,8) = "[" @@ -1367,6 +1438,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (106,11)-(106,12) = "]" │ ├── block: ∅ @@ -1411,6 +1483,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :[] @@ -1425,6 +1498,7 @@ │ │ │ ├── operator_loc: (108,12)-(108,13) = "*" │ │ │ └── expression: ∅ │ │ ├── closing_loc: (108,13)-(108,14) = "]" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (108,0)-(108,3) = "def" @@ -1469,6 +1543,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :[] @@ -1486,6 +1561,7 @@ │ │ │ ├── operator_loc: (110,15)-(110,16) = "*" │ │ │ └── expression: ∅ │ │ ├── closing_loc: (110,16)-(110,17) = "]" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (110,0)-(110,3) = "def" @@ -1530,6 +1606,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :[]= @@ -1547,6 +1624,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: (112,13)-(112,14) = "]" + │ │ ├── equal_loc: (112,15)-(112,16) = "=" │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (112,0)-(112,3) = "def" @@ -1591,6 +1669,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :[]= @@ -1611,6 +1690,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: (114,16)-(114,17) = "]" + │ │ ├── equal_loc: (114,18)-(114,19) = "=" │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (114,0)-(114,3) = "def" @@ -1655,6 +1735,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── opening_loc: (116,11)-(116,12) = "[" @@ -1717,6 +1798,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── opening_loc: (118,11)-(118,12) = "[" @@ -1789,6 +1871,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── opening_loc: (120,21)-(120,22) = "[" │ │ │ │ ├── arguments: @@ -1858,6 +1941,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (122,21)-(122,22) = "[" │ │ │ ├── arguments: diff --git a/snapshots/begin_ensure.txt b/snapshots/begin_ensure.txt index 2f127cd11f..f78e6632c8 100644 --- a/snapshots/begin_ensure.txt +++ b/snapshots/begin_ensure.txt @@ -21,6 +21,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -41,6 +42,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (5,0)-(5,3) = "end" │ └── end_keyword_loc: (5,0)-(5,3) = "end" @@ -60,6 +62,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -80,6 +83,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (7,21)-(7,24) = "end" │ └── end_keyword_loc: (7,21)-(7,24) = "end" @@ -99,6 +103,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -119,6 +124,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (11,1)-(11,4) = "end" │ └── end_keyword_loc: (11,1)-(11,4) = "end" @@ -138,6 +144,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -158,6 +165,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (13,19)-(13,22) = "end" │ └── end_keyword_loc: (13,19)-(13,22) = "end" @@ -218,6 +226,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: │ │ │ │ │ @ BlockNode (location: (15,40)-(21,3)) │ │ │ │ │ ├── flags: ∅ @@ -260,6 +269,7 @@ │ │ │ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ │ │ │ └── block: │ │ │ │ │ │ │ │ @ BlockNode (location: (18,22)-(19,7)) │ │ │ │ │ │ │ │ ├── flags: ∅ @@ -275,6 +285,7 @@ │ │ │ │ └── end_keyword_loc: (21,4)-(21,7) = "end" │ │ │ └── end_keyword_loc: (21,4)-(21,7) = "end" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ diff --git a/snapshots/begin_rescue.txt b/snapshots/begin_rescue.txt index edfe88dac4..7e1ae368a1 100644 --- a/snapshots/begin_rescue.txt +++ b/snapshots/begin_rescue.txt @@ -21,6 +21,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (1,10)-(1,19)) @@ -43,6 +44,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: @@ -62,6 +64,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (1,30)-(1,33) = "end" │ ├── ensure_clause: ∅ @@ -82,6 +85,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (3,10)-(3,19)) @@ -104,6 +108,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: @@ -123,6 +128,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (3,30)-(3,36) = "ensure" │ ├── ensure_clause: @@ -142,6 +148,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (3,41)-(3,44) = "end" │ └── end_keyword_loc: (3,41)-(3,44) = "end" @@ -222,6 +229,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -243,6 +251,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -264,6 +273,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -285,6 +295,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -306,6 +317,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (24,0)-(29,1)) @@ -328,6 +340,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: │ │ @ RescueNode (location: (26,0)-(29,1)) @@ -350,6 +363,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: │ │ @ RescueNode (location: (28,0)-(29,1)) @@ -372,6 +386,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -393,6 +408,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (34,0)-(37,3)) @@ -422,6 +438,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: │ │ @ RescueNode (location: (36,0)-(37,3)) @@ -454,6 +471,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -475,6 +493,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (42,0)-(43,3)) @@ -504,6 +523,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -524,6 +544,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (46,0)-(46,3) = "end" │ └── end_keyword_loc: (46,0)-(46,3) = "end" @@ -549,6 +570,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (52,0)-(53,1)) @@ -571,6 +593,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -592,6 +615,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (56,8)-(56,16)) @@ -614,6 +638,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -635,6 +660,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (59,2)-(60,1)) @@ -657,6 +683,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -678,6 +705,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (64,0)-(65,1)) @@ -703,6 +731,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -724,6 +753,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (70,0)-(71,1)) @@ -752,6 +782,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -773,6 +804,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (76,0)-(77,3)) @@ -805,6 +837,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -826,6 +859,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: │ @ RescueNode (location: (82,0)-(83,3)) @@ -855,6 +889,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: ∅ ├── else_clause: ∅ diff --git a/snapshots/blocks.txt b/snapshots/blocks.txt index 4090abfd90..62943535e1 100644 --- a/snapshots/blocks.txt +++ b/snapshots/blocks.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -35,8 +36,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (1,7)-(1,8) = "]" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,9)-(1,16)) │ ├── flags: ∅ @@ -55,6 +58,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,9)-(1,10) = "{" │ └── closing_loc: (1,15)-(1,16) = "}" @@ -70,6 +74,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -88,8 +93,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (3,7)-(3,8) = "]" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,9)-(5,3)) │ ├── flags: ∅ @@ -108,6 +115,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (3,9)-(3,11) = "do" │ └── closing_loc: (5,0)-(5,3) = "end" @@ -123,6 +131,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (7,1)-(7,2) = "." │ ├── name: :reduce @@ -136,6 +145,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 0 │ ├── closing_loc: (7,10)-(7,11) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,12)-(7,35)) │ ├── flags: ∅ @@ -189,6 +199,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (9,4)-(9,10)) │ ├── flags: ∅ @@ -217,6 +228,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ ParenthesesNode (location: (11,9)-(11,21)) │ │ ├── flags: ∅ @@ -233,6 +245,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (11,14)-(11,20)) │ │ │ ├── flags: ∅ @@ -244,6 +257,7 @@ │ │ ├── opening_loc: (11,9)-(11,10) = "(" │ │ └── closing_loc: (11,20)-(11,21) = ")" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (13,0)-(13,14)) │ ├── flags: newline, ignore_visibility @@ -265,8 +279,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (13,8)-(13,14)) │ ├── flags: ∅ @@ -306,10 +322,13 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (15,12)-(15,18)) │ ├── flags: ∅ @@ -327,6 +346,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (17,4)-(18,3)) │ ├── flags: ∅ @@ -357,6 +377,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── call_operator_loc: ∅ │ │ │ │ ├── name: :[] @@ -370,6 +391,7 @@ │ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ │ └── value: 1 │ │ │ │ ├── closing_loc: (17,15)-(17,16) = "]" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── rest: ∅ │ │ │ ├── posts: (length: 0) @@ -391,6 +413,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (20,4)-(22,3)) │ ├── flags: ∅ @@ -425,6 +448,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (24,4)-(29,3)) │ ├── flags: ∅ @@ -443,6 +467,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (25,6)-(28,5)) │ │ ├── flags: ∅ @@ -461,6 +486,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (26,8)-(27,7)) │ │ │ ├── flags: ∅ @@ -485,6 +511,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -503,8 +530,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (31,7)-(31,8) = "]" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (31,9)-(31,16)) │ ├── flags: ∅ @@ -523,6 +552,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (31,9)-(31,10) = "{" │ └── closing_loc: (31,15)-(31,16) = "}" @@ -535,6 +565,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (33,4)-(33,24)) │ ├── flags: ∅ @@ -590,6 +621,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (35,4)-(35,11)) │ ├── flags: ∅ @@ -635,6 +667,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (38,5)-(39,3)) │ ├── flags: ∅ @@ -670,6 +703,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (41,5)-(41,12)) │ ├── flags: ∅ @@ -705,6 +739,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (43,2)-(44,3)) │ ├── flags: ∅ @@ -722,6 +757,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (46,2)-(46,4)) │ ├── flags: ∅ @@ -750,6 +786,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (48,11)-(52,1)) │ │ ├── flags: ∅ @@ -790,6 +827,7 @@ │ │ ├── opening_loc: (48,11)-(48,12) = "{" │ │ └── closing_loc: (52,0)-(52,1) = "}" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (54,0)-(54,17)) ├── flags: newline, ignore_visibility @@ -800,6 +838,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (54,4)-(54,17)) ├── flags: ∅ diff --git a/snapshots/bom_leading_space.txt b/snapshots/bom_leading_space.txt new file mode 100644 index 0000000000..b99334d213 --- /dev/null +++ b/snapshots/bom_leading_space.txt @@ -0,0 +1,32 @@ +@ ProgramNode (location: (1,4)-(1,10)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,4)-(1,10)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,4)-(1,10)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :p + ├── message_loc: (1,4)-(1,5) = "p" + ├── opening_loc: ∅ + ├── arguments: + │ @ ArgumentsNode (location: (1,6)-(1,10)) + │ ├── flags: ∅ + │ └── arguments: (length: 1) + │ └── @ ParenthesesNode (location: (1,6)-(1,10)) + │ ├── flags: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (1,7)-(1,9)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ IntegerNode (location: (1,7)-(1,9)) + │ │ ├── flags: newline, static_literal, decimal + │ │ └── value: 42 + │ ├── opening_loc: (1,6)-(1,7) = "(" + │ └── closing_loc: (1,9)-(1,10) = ")" + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: ∅ diff --git a/snapshots/bom_spaces.txt b/snapshots/bom_spaces.txt new file mode 100644 index 0000000000..445ea0efe9 --- /dev/null +++ b/snapshots/bom_spaces.txt @@ -0,0 +1,32 @@ +@ ProgramNode (location: (1,3)-(1,11)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,3)-(1,11)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,3)-(1,11)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :p + ├── message_loc: (1,3)-(1,4) = "p" + ├── opening_loc: ∅ + ├── arguments: + │ @ ArgumentsNode (location: (1,5)-(1,11)) + │ ├── flags: ∅ + │ └── arguments: (length: 1) + │ └── @ ParenthesesNode (location: (1,5)-(1,11)) + │ ├── flags: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (1,7)-(1,9)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ IntegerNode (location: (1,7)-(1,9)) + │ │ ├── flags: newline, static_literal, decimal + │ │ └── value: 42 + │ ├── opening_loc: (1,5)-(1,6) = "(" + │ └── closing_loc: (1,10)-(1,11) = ")" + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: ∅ diff --git a/snapshots/boolean_operators.txt b/snapshots/boolean_operators.txt index bde70d6509..57483e7e3e 100644 --- a/snapshots/boolean_operators.txt +++ b/snapshots/boolean_operators.txt @@ -19,6 +19,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── name: :a │ └── depth: 0 @@ -36,6 +37,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── name: :a │ ├── binary_operator: :+ @@ -54,6 +56,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── name: :a └── depth: 0 diff --git a/snapshots/break.txt b/snapshots/break.txt index 6e7bc9a2ee..df29276b90 100644 --- a/snapshots/break.txt +++ b/snapshots/break.txt @@ -1,10 +1,10 @@ -@ ProgramNode (location: (1,0)-(29,21)) +@ ProgramNode (location: (1,0)-(33,21)) ├── flags: ∅ ├── locals: [] └── statements: - @ StatementsNode (location: (1,0)-(29,21)) + @ StatementsNode (location: (1,0)-(33,21)) ├── flags: ∅ - └── body: (length: 13) + └── body: (length: 15) ├── @ CallNode (location: (1,0)-(1,13)) │ ├── flags: newline, ignore_visibility │ ├── receiver: ∅ @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,4)-(1,13)) │ ├── flags: ∅ @@ -38,6 +39,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,4)-(3,27)) │ ├── flags: ∅ @@ -98,6 +100,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,4)-(5,15)) │ ├── flags: ∅ @@ -128,6 +131,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,4)-(8,3)) │ ├── flags: ∅ @@ -164,6 +168,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (10,4)-(10,21)) │ ├── flags: ∅ @@ -200,6 +205,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (12,4)-(12,23)) │ ├── flags: ∅ @@ -241,6 +247,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (14,4)-(17,3)) │ ├── flags: ∅ @@ -282,6 +289,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (19,4)-(19,15)) │ ├── flags: ∅ @@ -314,6 +322,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (21,4)-(21,16)) │ ├── flags: ∅ @@ -343,76 +352,173 @@ │ │ └── keyword_loc: (21,6)-(21,11) = "break" │ ├── opening_loc: (21,4)-(21,5) = "{" │ └── closing_loc: (21,15)-(21,16) = "}" - ├── @ CallNode (location: (23,0)-(23,22)) + ├── @ CallNode (location: (23,0)-(23,17)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (23,0)-(23,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (23,4)-(23,17)) + │ ├── flags: ∅ + │ ├── locals: [] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (23,6)-(23,15)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ ParenthesesNode (location: (23,6)-(23,15)) + │ │ ├── flags: newline + │ │ ├── body: + │ │ │ @ StatementsNode (location: (23,7)-(23,14)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ BreakNode (location: (23,7)-(23,14)) + │ │ │ ├── flags: newline + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (23,13)-(23,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (23,13)-(23,14)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ └── keyword_loc: (23,7)-(23,12) = "break" + │ │ ├── opening_loc: (23,6)-(23,7) = "(" + │ │ └── closing_loc: (23,14)-(23,15) = ")" + │ ├── opening_loc: (23,4)-(23,5) = "{" + │ └── closing_loc: (23,16)-(23,17) = "}" + ├── @ CallNode (location: (25,0)-(25,24)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (25,0)-(25,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (25,4)-(25,24)) + │ ├── flags: ∅ + │ ├── locals: [] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (25,6)-(25,22)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ AndNode (location: (25,6)-(25,22)) + │ │ ├── flags: newline + │ │ ├── left: + │ │ │ @ CallNode (location: (25,6)-(25,9)) + │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :foo + │ │ │ ├── message_loc: (25,6)-(25,9) = "foo" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── right: + │ │ │ @ ParenthesesNode (location: (25,13)-(25,22)) + │ │ │ ├── flags: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (25,14)-(25,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ BreakNode (location: (25,14)-(25,21)) + │ │ │ │ ├── flags: newline + │ │ │ │ ├── arguments: + │ │ │ │ │ @ ArgumentsNode (location: (25,20)-(25,21)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── arguments: (length: 1) + │ │ │ │ │ └── @ IntegerNode (location: (25,20)-(25,21)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ └── keyword_loc: (25,14)-(25,19) = "break" + │ │ │ ├── opening_loc: (25,13)-(25,14) = "(" + │ │ │ └── closing_loc: (25,21)-(25,22) = ")" + │ │ └── operator_loc: (25,10)-(25,12) = "&&" + │ ├── opening_loc: (25,4)-(25,5) = "{" + │ └── closing_loc: (25,23)-(25,24) = "}" + ├── @ CallNode (location: (27,0)-(27,22)) │ ├── flags: newline │ ├── receiver: - │ │ @ CallNode (location: (23,0)-(23,16)) + │ │ @ CallNode (location: (27,0)-(27,16)) │ │ ├── flags: ignore_visibility │ │ ├── receiver: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :foo - │ │ ├── message_loc: (23,0)-(23,3) = "foo" + │ │ ├── message_loc: (27,0)-(27,3) = "foo" │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: - │ │ @ BlockNode (location: (23,4)-(23,16)) + │ │ @ BlockNode (location: (27,4)-(27,16)) │ │ ├── flags: ∅ │ │ ├── locals: [] │ │ ├── parameters: ∅ │ │ ├── body: - │ │ │ @ StatementsNode (location: (23,6)-(23,14)) + │ │ │ @ StatementsNode (location: (27,6)-(27,14)) │ │ │ ├── flags: ∅ │ │ │ └── body: (length: 1) - │ │ │ └── @ BreakNode (location: (23,6)-(23,14)) + │ │ │ └── @ BreakNode (location: (27,6)-(27,14)) │ │ │ ├── flags: newline │ │ │ ├── arguments: - │ │ │ │ @ ArgumentsNode (location: (23,12)-(23,14)) + │ │ │ │ @ ArgumentsNode (location: (27,12)-(27,14)) │ │ │ │ ├── flags: ∅ │ │ │ │ └── arguments: (length: 1) - │ │ │ │ └── @ IntegerNode (location: (23,12)-(23,14)) + │ │ │ │ └── @ IntegerNode (location: (27,12)-(27,14)) │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ └── value: 42 - │ │ │ └── keyword_loc: (23,6)-(23,11) = "break" - │ │ ├── opening_loc: (23,4)-(23,5) = "{" - │ │ └── closing_loc: (23,15)-(23,16) = "}" + │ │ │ └── keyword_loc: (27,6)-(27,11) = "break" + │ │ ├── opening_loc: (27,4)-(27,5) = "{" + │ │ └── closing_loc: (27,15)-(27,16) = "}" │ ├── call_operator_loc: ∅ │ ├── name: :== - │ ├── message_loc: (23,17)-(23,19) = "==" + │ ├── message_loc: (27,17)-(27,19) = "==" │ ├── opening_loc: ∅ │ ├── arguments: - │ │ @ ArgumentsNode (location: (23,20)-(23,22)) + │ │ @ ArgumentsNode (location: (27,20)-(27,22)) │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) - │ │ └── @ IntegerNode (location: (23,20)-(23,22)) + │ │ └── @ IntegerNode (location: (27,20)-(27,22)) │ │ ├── flags: static_literal, decimal │ │ └── value: 42 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ - ├── @ CallNode (location: (25,0)-(25,23)) + ├── @ CallNode (location: (29,0)-(29,23)) │ ├── flags: newline │ ├── receiver: - │ │ @ CallNode (location: (25,0)-(25,17)) + │ │ @ CallNode (location: (29,0)-(29,17)) │ │ ├── flags: ignore_visibility │ │ ├── receiver: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :foo - │ │ ├── message_loc: (25,0)-(25,3) = "foo" + │ │ ├── message_loc: (29,0)-(29,3) = "foo" │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: - │ │ @ BlockNode (location: (25,4)-(25,17)) + │ │ @ BlockNode (location: (29,4)-(29,17)) │ │ ├── flags: ∅ │ │ ├── locals: [:a] │ │ ├── parameters: - │ │ │ @ BlockParametersNode (location: (25,6)-(25,9)) + │ │ │ @ BlockParametersNode (location: (29,6)-(29,9)) │ │ │ ├── flags: ∅ │ │ │ ├── parameters: - │ │ │ │ @ ParametersNode (location: (25,7)-(25,8)) + │ │ │ │ @ ParametersNode (location: (29,7)-(29,8)) │ │ │ │ ├── flags: ∅ │ │ │ │ ├── requireds: (length: 1) - │ │ │ │ │ └── @ RequiredParameterNode (location: (25,7)-(25,8)) + │ │ │ │ │ └── @ RequiredParameterNode (location: (29,7)-(29,8)) │ │ │ │ │ ├── flags: ∅ │ │ │ │ │ └── name: :a │ │ │ │ ├── optionals: (length: 0) @@ -422,80 +528,83 @@ │ │ │ │ ├── keyword_rest: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── locals: (length: 0) - │ │ │ ├── opening_loc: (25,6)-(25,7) = "|" - │ │ │ └── closing_loc: (25,8)-(25,9) = "|" + │ │ │ ├── opening_loc: (29,6)-(29,7) = "|" + │ │ │ └── closing_loc: (29,8)-(29,9) = "|" │ │ ├── body: - │ │ │ @ StatementsNode (location: (25,10)-(25,15)) + │ │ │ @ StatementsNode (location: (29,10)-(29,15)) │ │ │ ├── flags: ∅ │ │ │ └── body: (length: 1) - │ │ │ └── @ BreakNode (location: (25,10)-(25,15)) + │ │ │ └── @ BreakNode (location: (29,10)-(29,15)) │ │ │ ├── flags: newline │ │ │ ├── arguments: ∅ - │ │ │ └── keyword_loc: (25,10)-(25,15) = "break" - │ │ ├── opening_loc: (25,4)-(25,5) = "{" - │ │ └── closing_loc: (25,16)-(25,17) = "}" + │ │ │ └── keyword_loc: (29,10)-(29,15) = "break" + │ │ ├── opening_loc: (29,4)-(29,5) = "{" + │ │ └── closing_loc: (29,16)-(29,17) = "}" │ ├── call_operator_loc: ∅ │ ├── name: :== - │ ├── message_loc: (25,18)-(25,20) = "==" + │ ├── message_loc: (29,18)-(29,20) = "==" │ ├── opening_loc: ∅ │ ├── arguments: - │ │ @ ArgumentsNode (location: (25,21)-(25,23)) + │ │ @ ArgumentsNode (location: (29,21)-(29,23)) │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) - │ │ └── @ IntegerNode (location: (25,21)-(25,23)) + │ │ └── @ IntegerNode (location: (29,21)-(29,23)) │ │ ├── flags: static_literal, decimal │ │ └── value: 42 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ - ├── @ WhileNode (location: (27,0)-(27,21)) + ├── @ WhileNode (location: (31,0)-(31,21)) │ ├── flags: newline - │ ├── keyword_loc: (27,0)-(27,5) = "while" + │ ├── keyword_loc: (31,0)-(31,5) = "while" │ ├── do_keyword_loc: ∅ - │ ├── closing_loc: (27,18)-(27,21) = "end" + │ ├── closing_loc: (31,18)-(31,21) = "end" │ ├── predicate: - │ │ @ AndNode (location: (27,6)-(27,16)) + │ │ @ AndNode (location: (31,6)-(31,16)) │ │ ├── flags: ∅ │ │ ├── left: - │ │ │ @ CallNode (location: (27,6)-(27,7)) + │ │ │ @ CallNode (location: (31,6)-(31,7)) │ │ │ ├── flags: variable_call, ignore_visibility │ │ │ ├── receiver: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :_ - │ │ │ ├── message_loc: (27,6)-(27,7) = "_" + │ │ │ ├── message_loc: (31,6)-(31,7) = "_" │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: - │ │ │ @ BreakNode (location: (27,11)-(27,16)) + │ │ │ @ BreakNode (location: (31,11)-(31,16)) │ │ │ ├── flags: ∅ │ │ │ ├── arguments: ∅ - │ │ │ └── keyword_loc: (27,11)-(27,16) = "break" - │ │ └── operator_loc: (27,8)-(27,10) = "&&" + │ │ │ └── keyword_loc: (31,11)-(31,16) = "break" + │ │ └── operator_loc: (31,8)-(31,10) = "&&" │ └── statements: ∅ - └── @ UntilNode (location: (29,0)-(29,21)) + └── @ UntilNode (location: (33,0)-(33,21)) ├── flags: newline - ├── keyword_loc: (29,0)-(29,5) = "until" + ├── keyword_loc: (33,0)-(33,5) = "until" ├── do_keyword_loc: ∅ - ├── closing_loc: (29,18)-(29,21) = "end" + ├── closing_loc: (33,18)-(33,21) = "end" ├── predicate: - │ @ AndNode (location: (29,6)-(29,16)) + │ @ AndNode (location: (33,6)-(33,16)) │ ├── flags: ∅ │ ├── left: - │ │ @ CallNode (location: (29,6)-(29,7)) + │ │ @ CallNode (location: (33,6)-(33,7)) │ │ ├── flags: variable_call, ignore_visibility │ │ ├── receiver: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :_ - │ │ ├── message_loc: (29,6)-(29,7) = "_" + │ │ ├── message_loc: (33,6)-(33,7) = "_" │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: - │ │ @ BreakNode (location: (29,11)-(29,16)) + │ │ @ BreakNode (location: (33,11)-(33,16)) │ │ ├── flags: ∅ │ │ ├── arguments: ∅ - │ │ └── keyword_loc: (29,11)-(29,16) = "break" - │ └── operator_loc: (29,8)-(29,10) = "&&" + │ │ └── keyword_loc: (33,11)-(33,16) = "break" + │ └── operator_loc: (33,8)-(33,10) = "&&" └── statements: ∅ diff --git a/snapshots/case.txt b/snapshots/case.txt index 3afc25826c..5a569ad6cf 100644 --- a/snapshots/case.txt +++ b/snapshots/case.txt @@ -65,6 +65,7 @@ │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "hi" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ WhenNode (location: (5,32)-(5,53)) │ │ ├── flags: ∅ @@ -95,6 +96,7 @@ │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "bye" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── else_clause: ∅ │ ├── case_keyword_loc: (5,0)-(5,4) = "case" @@ -120,6 +122,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: ∅ @@ -177,6 +180,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ WhenNode (location: (15,11)-(15,31)) @@ -214,6 +218,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :== @@ -232,8 +237,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: ∅ @@ -257,6 +264,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: ∅ @@ -280,6 +288,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ WhenNode (location: (28,3)-(28,10)) @@ -438,6 +447,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (47,0)-(48,3)) @@ -459,6 +469,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── right: │ │ │ │ │ @ CallNode (location: (47,14)-(47,15)) @@ -470,6 +481,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ └── operator_loc: (47,10)-(47,13) = "and" │ │ │ ├── then_keyword_loc: ∅ @@ -496,6 +508,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── in_loc: (47,0)-(47,2) = "in" │ │ └── then_loc: ∅ @@ -514,6 +527,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (51,7)-(55,3)) ├── flags: ∅ diff --git a/snapshots/case_in_hash_key.txt b/snapshots/case_in_hash_key.txt new file mode 100644 index 0000000000..db6811b8dc --- /dev/null +++ b/snapshots/case_in_hash_key.txt @@ -0,0 +1,131 @@ +@ ProgramNode (location: (1,0)-(6,3)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(6,3)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CaseMatchNode (location: (1,0)-(6,3)) + ├── flags: newline + ├── predicate: + │ @ IntegerNode (location: (1,5)-(1,6)) + │ ├── flags: static_literal, decimal + │ └── value: 1 + ├── conditions: (length: 2) + │ ├── @ InNode (location: (2,0)-(3,18)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ IntegerNode (location: (2,3)-(2,4)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 2 + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (3,2)-(3,18)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (3,2)-(3,18)) + │ │ │ ├── flags: newline + │ │ │ ├── receiver: + │ │ │ │ @ ConstantReadNode (location: (3,2)-(3,3)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :A + │ │ │ ├── call_operator_loc: (3,3)-(3,4) = "." + │ │ │ ├── name: :print + │ │ │ ├── message_loc: (3,4)-(3,9) = "print" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (3,10)-(3,18)) + │ │ │ │ ├── flags: contains_keywords + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ KeywordHashNode (location: (3,10)-(3,18)) + │ │ │ │ ├── flags: symbol_keys + │ │ │ │ └── elements: (length: 1) + │ │ │ │ └── @ AssocNode (location: (3,10)-(3,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (3,10)-(3,18)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (3,10)-(3,17) = "message" + │ │ │ │ │ ├── closing_loc: (3,17)-(3,18) = ":" + │ │ │ │ │ └── unescaped: "message" + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (3,10)-(3,18)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── value: + │ │ │ │ │ @ CallNode (location: (3,10)-(3,18)) + │ │ │ │ │ ├── flags: ignore_visibility + │ │ │ │ │ ├── receiver: ∅ + │ │ │ │ │ ├── call_operator_loc: ∅ + │ │ │ │ │ ├── name: :message + │ │ │ │ │ ├── message_loc: (3,10)-(3,17) = "message" + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── arguments: ∅ + │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ + │ │ │ │ │ └── block: ∅ + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── in_loc: (2,0)-(2,2) = "in" + │ │ └── then_loc: ∅ + │ └── @ InNode (location: (4,0)-(5,18)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ IntegerNode (location: (4,3)-(4,4)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 3 + │ ├── statements: + │ │ @ StatementsNode (location: (5,2)-(5,18)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ CallNode (location: (5,2)-(5,18)) + │ │ ├── flags: newline + │ │ ├── receiver: + │ │ │ @ ConstantReadNode (location: (5,2)-(5,3)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :A + │ │ ├── call_operator_loc: (5,3)-(5,4) = "." + │ │ ├── name: :print + │ │ ├── message_loc: (5,4)-(5,9) = "print" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (5,10)-(5,18)) + │ │ │ ├── flags: contains_keywords + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ KeywordHashNode (location: (5,10)-(5,18)) + │ │ │ ├── flags: symbol_keys + │ │ │ └── elements: (length: 1) + │ │ │ └── @ AssocNode (location: (5,10)-(5,18)) + │ │ │ ├── flags: ∅ + │ │ │ ├── key: + │ │ │ │ @ SymbolNode (location: (5,10)-(5,18)) + │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── value_loc: (5,10)-(5,17) = "message" + │ │ │ │ ├── closing_loc: (5,17)-(5,18) = ":" + │ │ │ │ └── unescaped: "message" + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (5,10)-(5,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── value: + │ │ │ │ @ CallNode (location: (5,10)-(5,18)) + │ │ │ │ ├── flags: ignore_visibility + │ │ │ │ ├── receiver: ∅ + │ │ │ │ ├── call_operator_loc: ∅ + │ │ │ │ ├── name: :message + │ │ │ │ ├── message_loc: (5,10)-(5,17) = "message" + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── arguments: ∅ + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ + │ │ │ │ └── block: ∅ + │ │ │ └── operator_loc: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── in_loc: (4,0)-(4,2) = "in" + │ └── then_loc: ∅ + ├── else_clause: ∅ + ├── case_keyword_loc: (1,0)-(1,4) = "case" + └── end_keyword_loc: (6,0)-(6,3) = "end" diff --git a/snapshots/character_literal.txt b/snapshots/character_literal.txt new file mode 100644 index 0000000000..6a591c8b01 --- /dev/null +++ b/snapshots/character_literal.txt @@ -0,0 +1,38 @@ +@ ProgramNode (location: (2,0)-(2,11)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (2,0)-(2,11)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (2,0)-(2,11)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :p + ├── message_loc: (2,0)-(2,1) = "p" + ├── opening_loc: ∅ + ├── arguments: + │ @ ArgumentsNode (location: (2,2)-(2,11)) + │ ├── flags: ∅ + │ └── arguments: (length: 1) + │ └── @ InterpolatedStringNode (location: (2,2)-(2,11)) + │ ├── flags: ∅ + │ ├── opening_loc: ∅ + │ ├── parts: (length: 2) + │ │ ├── @ StringNode (location: (2,2)-(2,9)) + │ │ │ ├── flags: static_literal, forced_utf8_encoding, frozen + │ │ │ ├── opening_loc: (2,2)-(2,3) = "?" + │ │ │ ├── content_loc: (2,3)-(2,9) = "\\u3042" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "\x{E381}\x82" + │ │ └── @ StringNode (location: (2,9)-(2,11)) + │ │ ├── flags: static_literal, frozen + │ │ ├── opening_loc: (2,9)-(2,10) = "\"" + │ │ ├── content_loc: (2,10)-(2,10) = "" + │ │ ├── closing_loc: (2,10)-(2,11) = "\"" + │ │ └── unescaped: "" + │ └── closing_loc: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: ∅ diff --git a/snapshots/classes.txt b/snapshots/classes.txt index 8dd66ba12c..8633bb0f9c 100644 --- a/snapshots/classes.txt +++ b/snapshots/classes.txt @@ -144,6 +144,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -151,6 +152,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── body: ∅ │ └── end_keyword_loc: (12,0)-(12,3) = "end" @@ -264,6 +266,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (18,12)-(18,13) = "." │ │ ├── name: :bar @@ -271,6 +274,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── body: ∅ │ └── end_keyword_loc: (19,0)-(19,3) = "end" @@ -292,6 +296,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (21,12)-(21,13) = "." │ │ ├── name: :bar @@ -299,6 +304,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── body: ∅ │ └── end_keyword_loc: (21,17)-(21,20) = "end" @@ -352,6 +358,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (30,0)-(30,3) = "end" ├── @ SingletonClassNode (location: (32,0)-(32,23)) @@ -384,6 +391,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (32,20)-(32,23) = "end" └── @ ClassNode (location: (34,0)-(35,3)) @@ -414,6 +422,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: (34,13)-(34,14) = "]" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── body: ∅ ├── end_keyword_loc: (35,0)-(35,3) = "end" diff --git a/snapshots/command_method_call.txt b/snapshots/command_method_call.txt index 87db5a9acf..772484a117 100644 --- a/snapshots/command_method_call.txt +++ b/snapshots/command_method_call.txt @@ -20,6 +20,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,9)) │ ├── flags: newline, ignore_visibility @@ -47,8 +48,10 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ IfNode (location: (5,0)-(5,14)) │ ├── flags: newline @@ -69,6 +72,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ ├── statements: @@ -90,6 +94,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: ∅ │ └── end_keyword_loc: ∅ @@ -112,6 +117,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ ├── statements: @@ -133,6 +139,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── else_clause: ∅ │ └── end_keyword_loc: ∅ @@ -157,6 +164,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── statements: │ @ StatementsNode (location: (9,0)-(9,5)) @@ -177,6 +185,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ UntilNode (location: (11,0)-(11,17)) │ ├── flags: newline @@ -199,6 +208,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── statements: │ @ StatementsNode (location: (11,0)-(11,5)) @@ -219,6 +229,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ RescueModifierNode (location: (13,0)-(13,18)) │ ├── flags: newline @@ -238,6 +249,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (13,6)-(13,12) = "rescue" │ └── rescue_expression: @@ -256,6 +268,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (15,0)-(15,10)) │ ├── flags: newline @@ -269,6 +282,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -293,8 +307,10 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (15,9)-(15,10) = "]" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ AndNode (location: (17,0)-(17,15)) │ ├── flags: newline @@ -314,6 +330,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (17,10)-(17,15)) @@ -331,6 +348,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (17,6)-(17,9) = "and" ├── @ OrNode (location: (19,0)-(19,14)) @@ -351,6 +369,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (19,9)-(19,14)) @@ -368,6 +387,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (19,6)-(19,8) = "or" ├── @ CallNode (location: (21,0)-(21,9)) @@ -388,6 +408,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :! @@ -395,6 +416,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ LocalVariableWriteNode (location: (23,0)-(23,17)) │ ├── flags: newline @@ -423,6 +445,7 @@ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ └── value: 1 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (23,10)-(23,11) = "=" │ └── operator_loc: (23,4)-(23,5) = "=" @@ -451,6 +474,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (25,0)-(25,3) = "def" @@ -477,6 +501,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (29,0)-(29,11)) │ ├── flags: newline @@ -493,6 +518,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (29,5)-(29,6) = "." │ ├── name: :bar @@ -506,6 +532,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (31,0)-(31,14)) │ ├── flags: newline @@ -525,6 +552,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :[] @@ -538,6 +566,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: (31,7)-(31,8) = "]" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (31,8)-(31,9) = "." │ ├── name: :bar @@ -551,6 +580,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 3 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (33,0)-(33,14)) │ ├── flags: newline @@ -573,6 +603,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: (33,7)-(33,8) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (33,8)-(33,9) = "." │ ├── name: :bar @@ -586,6 +617,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 3 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (35,0)-(35,15)) │ ├── flags: newline @@ -602,6 +634,7 @@ │ │ ├── opening_loc: (35,5)-(35,6) = "(" │ │ ├── arguments: ∅ │ │ ├── closing_loc: (35,8)-(35,9) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockArgumentNode (location: (35,6)-(35,8)) │ │ ├── flags: ∅ @@ -622,6 +655,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 3 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ AndNode (location: (37,0)-(37,17)) │ ├── flags: newline @@ -644,6 +678,7 @@ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ └── value: 1 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -651,6 +686,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (37,11)-(37,17)) @@ -671,6 +707,7 @@ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ └── value: 2 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -678,6 +715,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (37,7)-(37,10) = "and" ├── @ OrNode (location: (39,0)-(39,16)) @@ -701,6 +739,7 @@ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ └── value: 1 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -708,6 +747,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (39,10)-(39,16)) @@ -728,6 +768,7 @@ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ └── value: 2 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -735,6 +776,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (39,7)-(39,9) = "or" └── @ CallNode (location: (41,0)-(41,10)) @@ -758,6 +800,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :! @@ -765,6 +808,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :! @@ -772,4 +816,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/command_method_call_2.txt b/snapshots/command_method_call_2.txt new file mode 100644 index 0000000000..ef3e73201c --- /dev/null +++ b/snapshots/command_method_call_2.txt @@ -0,0 +1,103 @@ +@ ProgramNode (location: (1,0)-(3,17)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(3,17)) + ├── flags: ∅ + └── body: (length: 2) + ├── @ CallNode (location: (1,0)-(1,19)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (1,0)-(1,3) = "foo" + │ ├── opening_loc: (1,3)-(1,4) = "(" + │ ├── arguments: + │ │ @ ArgumentsNode (location: (1,4)-(1,18)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ CallNode (location: (1,4)-(1,18)) + │ │ ├── flags: ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :bar + │ │ ├── message_loc: (1,4)-(1,7) = "bar" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (1,8)-(1,11)) + │ │ │ ├── flags: ∅ + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ CallNode (location: (1,8)-(1,11)) + │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :baz + │ │ │ ├── message_loc: (1,8)-(1,11) = "baz" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: + │ │ @ BlockNode (location: (1,12)-(1,18)) + │ │ ├── flags: ∅ + │ │ ├── locals: [] + │ │ ├── parameters: ∅ + │ │ ├── body: ∅ + │ │ ├── opening_loc: (1,12)-(1,14) = "do" + │ │ └── closing_loc: (1,15)-(1,18) = "end" + │ ├── closing_loc: (1,18)-(1,19) = ")" + │ ├── equal_loc: ∅ + │ └── block: ∅ + └── @ CallNode (location: (3,0)-(3,17)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :foo + ├── message_loc: (3,0)-(3,3) = "foo" + ├── opening_loc: (3,3)-(3,4) = "(" + ├── arguments: + │ @ ArgumentsNode (location: (3,4)-(3,16)) + │ ├── flags: ∅ + │ └── arguments: (length: 1) + │ └── @ CallNode (location: (3,4)-(3,16)) + │ ├── flags: ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :bar + │ ├── message_loc: (3,4)-(3,7) = "bar" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (3,8)-(3,16)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 2) + │ │ ├── @ CallNode (location: (3,8)-(3,11)) + │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :baz + │ │ │ ├── message_loc: (3,8)-(3,11) = "baz" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ └── @ CallNode (location: (3,13)-(3,16)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :bat + │ │ ├── message_loc: (3,13)-(3,16) = "bat" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── closing_loc: (3,16)-(3,17) = ")" + ├── equal_loc: ∅ + └── block: ∅ diff --git a/snapshots/command_method_call_3.txt b/snapshots/command_method_call_3.txt new file mode 100644 index 0000000000..e004f875de --- /dev/null +++ b/snapshots/command_method_call_3.txt @@ -0,0 +1,543 @@ +@ ProgramNode (location: (1,0)-(19,25)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(19,25)) + ├── flags: ∅ + └── body: (length: 10) + ├── @ CallNode (location: (1,0)-(1,22)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (1,0)-(1,3) = "foo" + │ ├── opening_loc: (1,3)-(1,4) = "(" + │ ├── arguments: + │ │ @ ArgumentsNode (location: (1,4)-(1,21)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ CallNode (location: (1,4)-(1,21)) + │ │ ├── flags: ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :bar + │ │ ├── message_loc: (1,4)-(1,7) = "bar" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (1,8)-(1,21)) + │ │ │ ├── flags: contains_keywords + │ │ │ └── arguments: (length: 2) + │ │ │ ├── @ IntegerNode (location: (1,8)-(1,9)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ └── @ KeywordHashNode (location: (1,11)-(1,21)) + │ │ │ ├── flags: ∅ + │ │ │ └── elements: (length: 1) + │ │ │ └── @ AssocNode (location: (1,11)-(1,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── key: + │ │ │ │ @ CallNode (location: (1,11)-(1,14)) + │ │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ │ ├── receiver: ∅ + │ │ │ │ ├── call_operator_loc: ∅ + │ │ │ │ ├── name: :key + │ │ │ │ ├── message_loc: (1,11)-(1,14) = "key" + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── arguments: ∅ + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ + │ │ │ │ └── block: ∅ + │ │ │ ├── value: + │ │ │ │ @ StringNode (location: (1,18)-(1,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (1,18)-(1,19) = "'" + │ │ │ │ ├── content_loc: (1,19)-(1,20) = "2" + │ │ │ │ ├── closing_loc: (1,20)-(1,21) = "'" + │ │ │ │ └── unescaped: "2" + │ │ │ └── operator_loc: (1,15)-(1,17) = "=>" + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── closing_loc: (1,21)-(1,22) = ")" + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (3,0)-(3,22)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (3,0)-(3,3) = "foo" + │ ├── opening_loc: (3,3)-(3,4) = "(" + │ ├── arguments: + │ │ @ ArgumentsNode (location: (3,4)-(3,21)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ CallNode (location: (3,4)-(3,21)) + │ │ ├── flags: ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :bar + │ │ ├── message_loc: (3,4)-(3,7) = "bar" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (3,8)-(3,21)) + │ │ │ ├── flags: contains_keywords + │ │ │ └── arguments: (length: 2) + │ │ │ ├── @ IntegerNode (location: (3,8)-(3,9)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ └── @ KeywordHashNode (location: (3,11)-(3,21)) + │ │ │ ├── flags: ∅ + │ │ │ └── elements: (length: 1) + │ │ │ └── @ AssocNode (location: (3,11)-(3,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── key: + │ │ │ │ @ ConstantReadNode (location: (3,11)-(3,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :KEY + │ │ │ ├── value: + │ │ │ │ @ StringNode (location: (3,18)-(3,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (3,18)-(3,19) = "'" + │ │ │ │ ├── content_loc: (3,19)-(3,20) = "2" + │ │ │ │ ├── closing_loc: (3,20)-(3,21) = "'" + │ │ │ │ └── unescaped: "2" + │ │ │ └── operator_loc: (3,15)-(3,17) = "=>" + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── closing_loc: (3,21)-(3,22) = ")" + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (5,0)-(5,23)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (5,0)-(5,3) = "foo" + │ ├── opening_loc: (5,3)-(5,4) = "(" + │ ├── arguments: + │ │ @ ArgumentsNode (location: (5,4)-(5,22)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ CallNode (location: (5,4)-(5,22)) + │ │ ├── flags: ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :bar + │ │ ├── message_loc: (5,4)-(5,7) = "bar" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (5,8)-(5,22)) + │ │ │ ├── flags: contains_keywords + │ │ │ └── arguments: (length: 2) + │ │ │ ├── @ IntegerNode (location: (5,8)-(5,9)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ └── @ KeywordHashNode (location: (5,11)-(5,22)) + │ │ │ ├── flags: symbol_keys + │ │ │ └── elements: (length: 1) + │ │ │ └── @ AssocNode (location: (5,11)-(5,22)) + │ │ │ ├── flags: ∅ + │ │ │ ├── key: + │ │ │ │ @ SymbolNode (location: (5,11)-(5,15)) + │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ ├── opening_loc: (5,11)-(5,12) = ":" + │ │ │ │ ├── value_loc: (5,12)-(5,15) = "key" + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ └── unescaped: "key" + │ │ │ ├── value: + │ │ │ │ @ StringNode (location: (5,19)-(5,22)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (5,19)-(5,20) = "'" + │ │ │ │ ├── content_loc: (5,20)-(5,21) = "2" + │ │ │ │ ├── closing_loc: (5,21)-(5,22) = "'" + │ │ │ │ └── unescaped: "2" + │ │ │ └── operator_loc: (5,16)-(5,18) = "=>" + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── closing_loc: (5,22)-(5,23) = ")" + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (7,0)-(7,32)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (7,0)-(7,3) = "foo" + │ ├── opening_loc: (7,3)-(7,4) = "(" + │ ├── arguments: + │ │ @ ArgumentsNode (location: (7,4)-(7,31)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ CallNode (location: (7,4)-(7,31)) + │ │ ├── flags: ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :bar + │ │ ├── message_loc: (7,4)-(7,7) = "bar" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (7,8)-(7,31)) + │ │ │ ├── flags: contains_keywords + │ │ │ └── arguments: (length: 2) + │ │ │ ├── @ IntegerNode (location: (7,8)-(7,9)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ └── @ KeywordHashNode (location: (7,11)-(7,31)) + │ │ │ ├── flags: ∅ + │ │ │ └── elements: (length: 1) + │ │ │ └── @ AssocNode (location: (7,11)-(7,31)) + │ │ │ ├── flags: ∅ + │ │ │ ├── key: + │ │ │ │ @ HashNode (location: (7,11)-(7,24)) + │ │ │ │ ├── flags: static_literal + │ │ │ │ ├── opening_loc: (7,11)-(7,12) = "{" + │ │ │ │ ├── elements: (length: 1) + │ │ │ │ │ └── @ AssocNode (location: (7,13)-(7,22)) + │ │ │ │ │ ├── flags: static_literal + │ │ │ │ │ ├── key: + │ │ │ │ │ │ @ SymbolNode (location: (7,13)-(7,17)) + │ │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ │ ├── value_loc: (7,13)-(7,16) = "baz" + │ │ │ │ │ │ ├── closing_loc: (7,16)-(7,17) = ":" + │ │ │ │ │ │ └── unescaped: "baz" + │ │ │ │ │ ├── value: + │ │ │ │ │ │ @ SymbolNode (location: (7,18)-(7,22)) + │ │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ │ ├── opening_loc: (7,18)-(7,19) = ":" + │ │ │ │ │ │ ├── value_loc: (7,19)-(7,22) = "bat" + │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ └── unescaped: "bat" + │ │ │ │ │ └── operator_loc: ∅ + │ │ │ │ └── closing_loc: (7,23)-(7,24) = "}" + │ │ │ ├── value: + │ │ │ │ @ StringNode (location: (7,28)-(7,31)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (7,28)-(7,29) = "'" + │ │ │ │ ├── content_loc: (7,29)-(7,30) = "2" + │ │ │ │ ├── closing_loc: (7,30)-(7,31) = "'" + │ │ │ │ └── unescaped: "2" + │ │ │ └── operator_loc: (7,25)-(7,27) = "=>" + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── closing_loc: (7,31)-(7,32) = ")" + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (9,0)-(9,24)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (9,0)-(9,3) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (9,4)-(9,24)) + │ │ ├── flags: contains_keywords + │ │ └── arguments: (length: 1) + │ │ └── @ KeywordHashNode (location: (9,4)-(9,24)) + │ │ ├── flags: ∅ + │ │ └── elements: (length: 1) + │ │ └── @ AssocNode (location: (9,4)-(9,24)) + │ │ ├── flags: ∅ + │ │ ├── key: + │ │ │ @ CallNode (location: (9,4)-(9,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── receiver: + │ │ │ │ @ CallNode (location: (9,4)-(9,7)) + │ │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ │ ├── receiver: ∅ + │ │ │ │ ├── call_operator_loc: ∅ + │ │ │ │ ├── name: :bar + │ │ │ │ ├── message_loc: (9,4)-(9,7) = "bar" + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── arguments: ∅ + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ + │ │ │ │ └── block: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :- + │ │ │ ├── message_loc: (9,8)-(9,9) = "-" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (9,10)-(9,17)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ ArrayNode (location: (9,10)-(9,17)) + │ │ │ │ ├── flags: static_literal + │ │ │ │ ├── elements: (length: 1) + │ │ │ │ │ └── @ SymbolNode (location: (9,13)-(9,16)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (9,13)-(9,16) = "baz" + │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ └── unescaped: "baz" + │ │ │ │ ├── opening_loc: (9,10)-(9,13) = "%i[" + │ │ │ │ └── closing_loc: (9,16)-(9,17) = "]" + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── value: + │ │ │ @ StringNode (location: (9,21)-(9,24)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: (9,21)-(9,22) = "'" + │ │ │ ├── content_loc: (9,22)-(9,23) = "2" + │ │ │ ├── closing_loc: (9,23)-(9,24) = "'" + │ │ │ └── unescaped: "2" + │ │ └── operator_loc: (9,18)-(9,20) = "=>" + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (11,0)-(11,18)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (11,0)-(11,3) = "foo" + │ ├── opening_loc: (11,3)-(11,4) = "(" + │ ├── arguments: + │ │ @ ArgumentsNode (location: (11,4)-(11,17)) + │ │ ├── flags: contains_keywords + │ │ └── arguments: (length: 1) + │ │ └── @ KeywordHashNode (location: (11,4)-(11,17)) + │ │ ├── flags: ∅ + │ │ └── elements: (length: 1) + │ │ └── @ AssocNode (location: (11,4)-(11,17)) + │ │ ├── flags: ∅ + │ │ ├── key: + │ │ │ @ CallNode (location: (11,4)-(11,10)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :bar + │ │ │ ├── message_loc: (11,4)-(11,7) = "bar" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: + │ │ │ @ BlockNode (location: (11,8)-(11,10)) + │ │ │ ├── flags: ∅ + │ │ │ ├── locals: [] + │ │ │ ├── parameters: ∅ + │ │ │ ├── body: ∅ + │ │ │ ├── opening_loc: (11,8)-(11,9) = "{" + │ │ │ └── closing_loc: (11,9)-(11,10) = "}" + │ │ ├── value: + │ │ │ @ StringNode (location: (11,14)-(11,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: (11,14)-(11,15) = "'" + │ │ │ ├── content_loc: (11,15)-(11,16) = "2" + │ │ │ ├── closing_loc: (11,16)-(11,17) = "'" + │ │ │ └── unescaped: "2" + │ │ └── operator_loc: (11,11)-(11,13) = "=>" + │ ├── closing_loc: (11,17)-(11,18) = ")" + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (13,0)-(13,22)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (13,0)-(13,3) = "foo" + │ ├── opening_loc: (13,3)-(13,4) = "(" + │ ├── arguments: + │ │ @ ArgumentsNode (location: (13,4)-(13,21)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ CallNode (location: (13,4)-(13,21)) + │ │ ├── flags: ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :bar + │ │ ├── message_loc: (13,4)-(13,7) = "bar" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (13,8)-(13,21)) + │ │ │ ├── flags: contains_keywords + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ KeywordHashNode (location: (13,8)-(13,21)) + │ │ │ ├── flags: ∅ + │ │ │ └── elements: (length: 1) + │ │ │ └── @ AssocNode (location: (13,8)-(13,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── key: + │ │ │ │ @ CallNode (location: (13,8)-(13,14)) + │ │ │ │ ├── flags: ignore_visibility + │ │ │ │ ├── receiver: ∅ + │ │ │ │ ├── call_operator_loc: ∅ + │ │ │ │ ├── name: :baz + │ │ │ │ ├── message_loc: (13,8)-(13,11) = "baz" + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── arguments: ∅ + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ + │ │ │ │ └── block: + │ │ │ │ @ BlockNode (location: (13,12)-(13,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── locals: [] + │ │ │ │ ├── parameters: ∅ + │ │ │ │ ├── body: ∅ + │ │ │ │ ├── opening_loc: (13,12)-(13,13) = "{" + │ │ │ │ └── closing_loc: (13,13)-(13,14) = "}" + │ │ │ ├── value: + │ │ │ │ @ StringNode (location: (13,18)-(13,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (13,18)-(13,19) = "'" + │ │ │ │ ├── content_loc: (13,19)-(13,20) = "2" + │ │ │ │ ├── closing_loc: (13,20)-(13,21) = "'" + │ │ │ │ └── unescaped: "2" + │ │ │ └── operator_loc: (13,15)-(13,17) = "=>" + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── closing_loc: (13,21)-(13,22) = ")" + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (15,0)-(15,22)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (15,0)-(15,3) = "foo" + │ ├── opening_loc: (15,3)-(15,4) = "(" + │ ├── arguments: + │ │ @ ArgumentsNode (location: (15,4)-(15,21)) + │ │ ├── flags: contains_keywords + │ │ └── arguments: (length: 1) + │ │ └── @ KeywordHashNode (location: (15,4)-(15,21)) + │ │ ├── flags: ∅ + │ │ └── elements: (length: 1) + │ │ └── @ AssocNode (location: (15,4)-(15,21)) + │ │ ├── flags: ∅ + │ │ ├── key: + │ │ │ @ CallNode (location: (15,4)-(15,14)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :bar + │ │ │ ├── message_loc: (15,4)-(15,7) = "bar" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: + │ │ │ @ BlockNode (location: (15,8)-(15,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── locals: [] + │ │ │ ├── parameters: ∅ + │ │ │ ├── body: ∅ + │ │ │ ├── opening_loc: (15,8)-(15,10) = "do" + │ │ │ └── closing_loc: (15,11)-(15,14) = "end" + │ │ ├── value: + │ │ │ @ StringNode (location: (15,18)-(15,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: (15,18)-(15,19) = "'" + │ │ │ ├── content_loc: (15,19)-(15,20) = "2" + │ │ │ ├── closing_loc: (15,20)-(15,21) = "'" + │ │ │ └── unescaped: "2" + │ │ └── operator_loc: (15,15)-(15,17) = "=>" + │ ├── closing_loc: (15,21)-(15,22) = ")" + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (17,0)-(17,21)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (17,0)-(17,3) = "foo" + │ ├── opening_loc: (17,3)-(17,4) = "(" + │ ├── arguments: + │ │ @ ArgumentsNode (location: (17,4)-(17,20)) + │ │ ├── flags: contains_keywords + │ │ └── arguments: (length: 2) + │ │ ├── @ IntegerNode (location: (17,4)-(17,5)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ └── @ KeywordHashNode (location: (17,7)-(17,20)) + │ │ ├── flags: ∅ + │ │ └── elements: (length: 1) + │ │ └── @ AssocNode (location: (17,7)-(17,20)) + │ │ ├── flags: ∅ + │ │ ├── key: + │ │ │ @ CallNode (location: (17,7)-(17,13)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :bar + │ │ │ ├── message_loc: (17,7)-(17,10) = "bar" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: + │ │ │ @ BlockNode (location: (17,11)-(17,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── locals: [] + │ │ │ ├── parameters: ∅ + │ │ │ ├── body: ∅ + │ │ │ ├── opening_loc: (17,11)-(17,12) = "{" + │ │ │ └── closing_loc: (17,12)-(17,13) = "}" + │ │ ├── value: + │ │ │ @ StringNode (location: (17,17)-(17,20)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: (17,17)-(17,18) = "'" + │ │ │ ├── content_loc: (17,18)-(17,19) = "2" + │ │ │ ├── closing_loc: (17,19)-(17,20) = "'" + │ │ │ └── unescaped: "2" + │ │ └── operator_loc: (17,14)-(17,16) = "=>" + │ ├── closing_loc: (17,20)-(17,21) = ")" + │ ├── equal_loc: ∅ + │ └── block: ∅ + └── @ CallNode (location: (19,0)-(19,25)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :foo + ├── message_loc: (19,0)-(19,3) = "foo" + ├── opening_loc: (19,3)-(19,4) = "(" + ├── arguments: + │ @ ArgumentsNode (location: (19,4)-(19,24)) + │ ├── flags: contains_keywords + │ └── arguments: (length: 2) + │ ├── @ IntegerNode (location: (19,4)-(19,5)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 1 + │ └── @ KeywordHashNode (location: (19,7)-(19,24)) + │ ├── flags: ∅ + │ └── elements: (length: 1) + │ └── @ AssocNode (location: (19,7)-(19,24)) + │ ├── flags: ∅ + │ ├── key: + │ │ @ CallNode (location: (19,7)-(19,17)) + │ │ ├── flags: ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :bar + │ │ ├── message_loc: (19,7)-(19,10) = "bar" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: + │ │ @ BlockNode (location: (19,11)-(19,17)) + │ │ ├── flags: ∅ + │ │ ├── locals: [] + │ │ ├── parameters: ∅ + │ │ ├── body: ∅ + │ │ ├── opening_loc: (19,11)-(19,13) = "do" + │ │ └── closing_loc: (19,14)-(19,17) = "end" + │ ├── value: + │ │ @ StringNode (location: (19,21)-(19,24)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: (19,21)-(19,22) = "'" + │ │ ├── content_loc: (19,22)-(19,23) = "2" + │ │ ├── closing_loc: (19,23)-(19,24) = "'" + │ │ └── unescaped: "2" + │ └── operator_loc: (19,18)-(19,20) = "=>" + ├── closing_loc: (19,24)-(19,25) = ")" + ├── equal_loc: ∅ + └── block: ∅ diff --git a/snapshots/comment_single.txt b/snapshots/comment_single.txt index 3de3483075..786532cacb 100644 --- a/snapshots/comment_single.txt +++ b/snapshots/comment_single.txt @@ -14,4 +14,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/comments.txt b/snapshots/comments.txt index 66869bc2a9..8727f8831f 100644 --- a/snapshots/comments.txt +++ b/snapshots/comments.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,1)) │ ├── flags: newline, variable_call, ignore_visibility @@ -24,6 +25,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (5,0)-(5,1)) │ ├── flags: newline, variable_call, ignore_visibility @@ -34,6 +36,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (6,0)-(6,1)) │ ├── flags: newline, variable_call, ignore_visibility @@ -44,6 +47,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (8,0)-(10,4)) │ ├── flags: newline @@ -57,6 +61,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (10,2)-(10,3) = "." │ ├── name: :f @@ -64,6 +69,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (12,0)-(14,2)) │ ├── flags: newline @@ -77,6 +83,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (14,0)-(14,1) = "." │ ├── name: :h @@ -84,6 +91,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (16,0)-(17,2)) │ ├── flags: newline @@ -97,6 +105,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (17,0)-(17,1) = "." │ ├── name: :j @@ -104,6 +113,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (19,0)-(20,4)) │ ├── flags: newline @@ -117,6 +127,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (20,2)-(20,3) = "." │ ├── name: :l @@ -124,6 +135,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (22,0)-(24,5)) ├── flags: newline, safe_navigation @@ -137,6 +149,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (24,2)-(24,4) = "&." ├── name: :n @@ -144,4 +157,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/constants.txt b/snapshots/constants.txt index e1aada8e96..2cf8c8d871 100644 --- a/snapshots/constants.txt +++ b/snapshots/constants.txt @@ -41,6 +41,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── name: :B │ ├── delimiter_loc: (5,1)-(5,3) = "::" @@ -89,6 +90,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (15,0)-(15,8)) │ ├── flags: newline, ignore_visibility @@ -114,8 +116,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (17,0)-(17,9)) │ ├── flags: newline, ignore_visibility @@ -143,9 +147,11 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (17,4)-(17,6) = "**" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (19,0)-(19,8)) │ ├── flags: newline, ignore_visibility @@ -156,6 +162,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockArgumentNode (location: (19,4)-(19,8)) │ ├── flags: ∅ @@ -169,6 +176,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (19,4)-(19,5) = "&" ├── @ CallNode (location: (21,0)-(21,13)) @@ -198,8 +206,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (23,0)-(23,14)) │ ├── flags: newline @@ -230,9 +240,11 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (23,9)-(23,11) = "**" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (25,0)-(25,13)) │ ├── flags: newline @@ -246,6 +258,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockArgumentNode (location: (25,9)-(25,13)) │ ├── flags: ∅ @@ -259,6 +272,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (25,9)-(25,10) = "&" ├── @ CallNode (location: (27,0)-(27,8)) @@ -276,6 +290,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ ConstantPathWriteNode (location: (29,0)-(29,7)) │ ├── flags: newline @@ -341,6 +356,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (39,0)-(39,10)) │ ├── flags: newline @@ -360,6 +376,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (41,0)-(41,4)) │ ├── flags: newline @@ -373,6 +390,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (43,0)-(43,4)) │ ├── flags: newline @@ -386,6 +404,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (45,0)-(45,4)) │ ├── flags: newline @@ -399,6 +418,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (47,0)-(47,5)) │ ├── flags: newline @@ -412,6 +432,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (49,0)-(49,4)) │ ├── flags: newline @@ -425,6 +446,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (51,0)-(51,5)) │ ├── flags: newline @@ -438,6 +460,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (53,0)-(53,6)) │ ├── flags: newline @@ -451,6 +474,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (55,0)-(55,5)) │ ├── flags: newline @@ -464,6 +488,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (57,0)-(57,4)) │ ├── flags: newline @@ -477,6 +502,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (59,0)-(59,5)) │ ├── flags: newline @@ -490,6 +516,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (61,0)-(61,5)) │ ├── flags: newline @@ -503,6 +530,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (63,0)-(63,5)) │ ├── flags: newline @@ -516,6 +544,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ ConstantPathNode (location: (65,0)-(67,1)) │ ├── flags: newline @@ -538,6 +567,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (71,0)-(71,6)) │ ├── flags: newline @@ -551,6 +581,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (73,0)-(73,8)) │ ├── flags: newline @@ -564,6 +595,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ ConstantPathNode (location: (75,0)-(75,8)) │ ├── flags: newline @@ -586,6 +618,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (79,0)-(79,8)) │ ├── flags: newline @@ -599,6 +632,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (81,0)-(81,6)) │ ├── flags: newline @@ -612,6 +646,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (83,0)-(83,10)) │ ├── flags: newline @@ -625,6 +660,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (85,0)-(85,5)) │ ├── flags: newline @@ -638,6 +674,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (87,0)-(87,7)) │ ├── flags: newline @@ -651,6 +688,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (89,0)-(89,8)) │ ├── flags: newline @@ -664,6 +702,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (91,0)-(91,6)) │ ├── flags: newline @@ -677,6 +716,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ ConstantPathNode (location: (93,0)-(93,6)) │ ├── flags: newline @@ -699,6 +739,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (97,0)-(97,8)) │ ├── flags: newline @@ -712,6 +753,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (99,0)-(99,6)) │ ├── flags: newline @@ -725,6 +767,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (101,0)-(101,5)) │ ├── flags: newline @@ -738,6 +781,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (103,0)-(103,5)) │ ├── flags: newline @@ -751,6 +795,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (105,0)-(105,7)) │ ├── flags: newline @@ -764,6 +809,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (107,0)-(107,6)) │ ├── flags: newline @@ -777,6 +823,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (109,0)-(109,6)) │ ├── flags: newline @@ -790,6 +837,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (111,0)-(111,5)) │ ├── flags: newline @@ -803,6 +851,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (113,0)-(113,7)) │ ├── flags: newline @@ -816,6 +865,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (115,0)-(115,9)) │ ├── flags: newline @@ -829,6 +879,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (117,0)-(117,8)) │ ├── flags: newline @@ -842,6 +893,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (119,0)-(119,9)) │ ├── flags: newline @@ -855,6 +907,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (121,0)-(121,7)) │ ├── flags: newline @@ -868,6 +921,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (123,0)-(123,8)) │ ├── flags: newline @@ -881,6 +935,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (125,0)-(125,7)) │ ├── flags: newline @@ -894,6 +949,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (127,0)-(127,7)) │ ├── flags: newline @@ -907,6 +963,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (129,0)-(129,8)) │ ├── flags: newline @@ -920,6 +977,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (131,0)-(131,9)) │ ├── flags: newline @@ -933,6 +991,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (133,0)-(133,8)) │ ├── flags: newline @@ -946,6 +1005,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (135,0)-(135,7)) │ ├── flags: newline @@ -959,6 +1019,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (137,0)-(137,8)) │ ├── flags: newline @@ -972,6 +1033,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (139,0)-(139,8)) │ ├── flags: newline @@ -985,6 +1047,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (141,0)-(141,15)) │ ├── flags: newline @@ -998,6 +1061,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (143,0)-(143,11)) │ ├── flags: newline @@ -1011,6 +1075,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (145,0)-(145,11)) │ ├── flags: newline @@ -1024,6 +1089,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (147,0)-(147,4)) │ ├── flags: newline @@ -1037,6 +1103,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (149,0)-(149,6)) │ ├── flags: newline @@ -1050,6 +1117,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (151,0)-(151,5)) │ ├── flags: newline @@ -1063,6 +1131,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (153,0)-(153,4)) │ ├── flags: newline @@ -1076,6 +1145,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (155,0)-(155,4)) │ ├── flags: newline @@ -1089,6 +1159,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (157,0)-(157,5)) │ ├── flags: newline @@ -1113,8 +1184,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (159,0)-(159,5)) │ ├── flags: newline @@ -1139,8 +1212,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (161,0)-(161,5)) │ ├── flags: newline @@ -1165,8 +1240,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (163,0)-(163,5)) │ ├── flags: newline @@ -1186,6 +1263,7 @@ │ │ ├── flags: ∅ │ │ └── name: :I │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (165,0)-(165,5)) │ ├── flags: newline @@ -1205,6 +1283,7 @@ │ │ ├── flags: ∅ │ │ └── name: :W │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (167,0)-(167,4)) │ ├── flags: newline @@ -1218,6 +1297,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (169,0)-(169,4)) │ ├── flags: newline @@ -1231,6 +1311,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (171,0)-(171,4)) │ ├── flags: newline @@ -1244,6 +1325,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (173,0)-(173,4)) │ ├── flags: newline @@ -1257,6 +1339,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (175,0)-(175,5)) │ ├── flags: newline @@ -1270,6 +1353,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (177,0)-(177,4)) │ ├── flags: newline @@ -1283,6 +1367,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ ConstantPathNode (location: (179,0)-(180,1)) │ ├── flags: newline @@ -1299,6 +1384,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── name: :C │ ├── delimiter_loc: (179,4)-(179,6) = "::" @@ -1318,6 +1404,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── right: │ @ CallNode (location: (184,0)-(184,10)) @@ -1332,5 +1419,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (182,4)-(182,6) = ".." diff --git a/snapshots/dash_heredocs.txt b/snapshots/dash_heredocs.txt index 1ca8b4f73d..402aee8b5c 100644 --- a/snapshots/dash_heredocs.txt +++ b/snapshots/dash_heredocs.txt @@ -35,6 +35,7 @@ │ │ ├── closing_loc: (9,0)-(10,0) = "SECOND\n" │ │ └── unescaped: " b\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ InterpolatedXStringNode (location: (11,0)-(11,8)) │ ├── flags: newline @@ -62,6 +63,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (13,3)-(13,4) = "}" │ │ └── @ StringNode (location: (13,4)-(14,0)) @@ -109,6 +111,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (27,3)-(27,4) = "}" │ │ └── @ StringNode (location: (27,4)-(28,0)) @@ -144,6 +147,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (32,3)-(32,4) = "}" │ │ └── @ StringNode (location: (32,4)-(33,0)) @@ -223,6 +227,7 @@ │ │ │ └── unescaped: "\n" │ │ └── closing_loc: (55,0)-(56,0) = "B\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (57,0)-(57,11)) ├── flags: newline @@ -270,4 +275,5 @@ │ │ └── unescaped: "\n" │ └── closing_loc: (63,0)-(64,0) = "B\n" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/defined.txt b/snapshots/defined.txt index a3807a5fcc..650e800a09 100644 --- a/snapshots/defined.txt +++ b/snapshots/defined.txt @@ -61,6 +61,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (5,17)-(5,20)) @@ -72,6 +73,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (5,13)-(5,16) = "and" │ ├── rparen_loc: (5,20)-(5,21) = ")" diff --git a/snapshots/dos_endings.txt b/snapshots/dos_endings.txt index 69d6b7cd7e..eaa98f310c 100644 --- a/snapshots/dos_endings.txt +++ b/snapshots/dos_endings.txt @@ -17,7 +17,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (1,5)-(2,12)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: ∅ │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (1,5)-(1,9)) @@ -34,6 +34,7 @@ │ │ │ └── unescaped: "there" │ │ └── closing_loc: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ ArrayNode (location: (4,0)-(5,2)) │ ├── flags: newline, static_literal @@ -86,7 +87,7 @@ │ │ ├── flags: ∅ │ │ ├── receiver: │ │ │ @ InterpolatedStringNode (location: (17,8)-(17,14)) - │ │ │ ├── flags: static_literal + │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: (17,8)-(17,14) = "<<~EOF" │ │ │ ├── parts: (length: 2) │ │ │ │ ├── @ StringNode (location: (18,0)-(19,0)) @@ -108,7 +109,9 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (17,19)-(17,20) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (17,2)-(17,3) = "=" diff --git a/snapshots/dstring.txt b/snapshots/dstring.txt index 7913cd010d..516b7b3595 100644 --- a/snapshots/dstring.txt +++ b/snapshots/dstring.txt @@ -37,11 +37,12 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (5,7)-(5,8) = "}" │ └── closing_loc: (5,8)-(5,9) = "\"" ├── @ InterpolatedStringNode (location: (7,0)-(9,2)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: ∅ │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (7,0)-(8,2)) diff --git a/snapshots/emoji_method_calls.txt b/snapshots/emoji_method_calls.txt index f6f1bc4162..7e4c6af8e8 100644 --- a/snapshots/emoji_method_calls.txt +++ b/snapshots/emoji_method_calls.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,3)-(1,4) = "." ├── name: :🌊= @@ -30,4 +31,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: (1,9)-(1,10) = "=" └── block: ∅ diff --git a/snapshots/endless_method_as_default_arg.txt b/snapshots/endless_method_as_default_arg.txt new file mode 100644 index 0000000000..ad7d09b396 --- /dev/null +++ b/snapshots/endless_method_as_default_arg.txt @@ -0,0 +1,323 @@ +@ ProgramNode (location: (1,0)-(11,20)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(11,20)) + ├── flags: ∅ + └── body: (length: 6) + ├── @ DefNode (location: (1,0)-(1,27)) + │ ├── flags: newline + │ ├── name: :foo + │ ├── name_loc: (1,4)-(1,7) = "foo" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,8)-(1,21)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (1,8)-(1,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :a + │ │ │ ├── name_loc: (1,8)-(1,9) = "a" + │ │ │ ├── operator_loc: (1,10)-(1,11) = "=" + │ │ │ └── value: + │ │ │ @ DefNode (location: (1,12)-(1,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :f + │ │ │ ├── name_loc: (1,16)-(1,17) = "f" + │ │ │ ├── receiver: ∅ + │ │ │ ├── parameters: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (1,20)-(1,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (1,20)-(1,21)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── locals: [] + │ │ │ ├── def_keyword_loc: (1,12)-(1,15) = "def" + │ │ │ ├── operator_loc: ∅ + │ │ │ ├── lparen_loc: ∅ + │ │ │ ├── rparen_loc: ∅ + │ │ │ ├── equal_loc: (1,18)-(1,19) = "=" + │ │ │ └── end_keyword_loc: ∅ + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:a] + │ ├── def_keyword_loc: (1,0)-(1,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (1,7)-(1,8) = "(" + │ ├── rparen_loc: (1,21)-(1,22) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (1,24)-(1,27) = "end" + ├── @ DefNode (location: (3,0)-(3,30)) + │ ├── flags: newline + │ ├── name: :foo + │ ├── name_loc: (3,4)-(3,7) = "foo" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (3,8)-(3,24)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (3,8)-(3,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :a + │ │ │ ├── name_loc: (3,8)-(3,9) = "a" + │ │ │ ├── operator_loc: (3,10)-(3,11) = "=" + │ │ │ └── value: + │ │ │ @ DefNode (location: (3,12)-(3,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :f + │ │ │ ├── name_loc: (3,16)-(3,17) = "f" + │ │ │ ├── receiver: ∅ + │ │ │ ├── parameters: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (3,20)-(3,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (3,20)-(3,21)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── locals: [] + │ │ │ ├── def_keyword_loc: (3,12)-(3,15) = "def" + │ │ │ ├── operator_loc: ∅ + │ │ │ ├── lparen_loc: ∅ + │ │ │ ├── rparen_loc: ∅ + │ │ │ ├── equal_loc: (3,18)-(3,19) = "=" + │ │ │ └── end_keyword_loc: ∅ + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (3,23)-(3,24)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :b + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:a, :b] + │ ├── def_keyword_loc: (3,0)-(3,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (3,7)-(3,8) = "(" + │ ├── rparen_loc: (3,24)-(3,25) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (3,27)-(3,30) = "end" + ├── @ DefNode (location: (5,0)-(5,30)) + │ ├── flags: newline + │ ├── name: :foo + │ ├── name_loc: (5,4)-(5,7) = "foo" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (5,8)-(5,24)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (5,8)-(5,9)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :b + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (5,11)-(5,24)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :a + │ │ │ ├── name_loc: (5,11)-(5,12) = "a" + │ │ │ ├── operator_loc: (5,13)-(5,14) = "=" + │ │ │ └── value: + │ │ │ @ DefNode (location: (5,15)-(5,24)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :f + │ │ │ ├── name_loc: (5,19)-(5,20) = "f" + │ │ │ ├── receiver: ∅ + │ │ │ ├── parameters: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (5,23)-(5,24)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (5,23)-(5,24)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── locals: [] + │ │ │ ├── def_keyword_loc: (5,15)-(5,18) = "def" + │ │ │ ├── operator_loc: ∅ + │ │ │ ├── lparen_loc: ∅ + │ │ │ ├── rparen_loc: ∅ + │ │ │ ├── equal_loc: (5,21)-(5,22) = "=" + │ │ │ └── end_keyword_loc: ∅ + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:b, :a] + │ ├── def_keyword_loc: (5,0)-(5,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (5,7)-(5,8) = "(" + │ ├── rparen_loc: (5,24)-(5,25) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (5,27)-(5,30) = "end" + ├── @ DefNode (location: (7,0)-(7,26)) + │ ├── flags: newline + │ ├── name: :foo + │ ├── name_loc: (7,4)-(7,7) = "foo" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (7,8)-(7,20)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 1) + │ │ │ └── @ OptionalKeywordParameterNode (location: (7,8)-(7,20)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :a + │ │ │ ├── name_loc: (7,8)-(7,10) = "a:" + │ │ │ └── value: + │ │ │ @ DefNode (location: (7,11)-(7,20)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :f + │ │ │ ├── name_loc: (7,15)-(7,16) = "f" + │ │ │ ├── receiver: ∅ + │ │ │ ├── parameters: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (7,19)-(7,20)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (7,19)-(7,20)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── locals: [] + │ │ │ ├── def_keyword_loc: (7,11)-(7,14) = "def" + │ │ │ ├── operator_loc: ∅ + │ │ │ ├── lparen_loc: ∅ + │ │ │ ├── rparen_loc: ∅ + │ │ │ ├── equal_loc: (7,17)-(7,18) = "=" + │ │ │ └── end_keyword_loc: ∅ + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:a] + │ ├── def_keyword_loc: (7,0)-(7,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (7,7)-(7,8) = "(" + │ ├── rparen_loc: (7,20)-(7,21) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (7,23)-(7,26) = "end" + ├── @ DefNode (location: (9,0)-(9,29)) + │ ├── flags: newline + │ ├── name: :foo + │ ├── name_loc: (9,4)-(9,7) = "foo" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (9,8)-(9,23)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (9,8)-(9,23)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :a + │ │ │ ├── name_loc: (9,8)-(9,9) = "a" + │ │ │ ├── operator_loc: (9,10)-(9,11) = "=" + │ │ │ └── value: + │ │ │ @ DefNode (location: (9,12)-(9,23)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :f + │ │ │ ├── name_loc: (9,16)-(9,17) = "f" + │ │ │ ├── receiver: ∅ + │ │ │ ├── parameters: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (9,20)-(9,23)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ CallNode (location: (9,20)-(9,23)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── receiver: + │ │ │ │ │ @ IntegerNode (location: (9,20)-(9,21)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ ├── call_operator_loc: ∅ + │ │ │ │ ├── name: :+ + │ │ │ │ ├── message_loc: (9,21)-(9,22) = "+" + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── arguments: + │ │ │ │ │ @ ArgumentsNode (location: (9,22)-(9,23)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── arguments: (length: 1) + │ │ │ │ │ └── @ IntegerNode (location: (9,22)-(9,23)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 2 + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ + │ │ │ │ └── block: ∅ + │ │ │ ├── locals: [] + │ │ │ ├── def_keyword_loc: (9,12)-(9,15) = "def" + │ │ │ ├── operator_loc: ∅ + │ │ │ ├── lparen_loc: ∅ + │ │ │ ├── rparen_loc: ∅ + │ │ │ ├── equal_loc: (9,18)-(9,19) = "=" + │ │ │ └── end_keyword_loc: ∅ + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:a] + │ ├── def_keyword_loc: (9,0)-(9,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (9,7)-(9,8) = "(" + │ ├── rparen_loc: (9,23)-(9,24) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (9,26)-(9,29) = "end" + └── @ LambdaNode (location: (11,0)-(11,20)) + ├── flags: newline + ├── locals: [:a] + ├── operator_loc: (11,0)-(11,2) = "->" + ├── opening_loc: (11,18)-(11,19) = "{" + ├── closing_loc: (11,19)-(11,20) = "}" + ├── parameters: + │ @ BlockParametersNode (location: (11,2)-(11,17)) + │ ├── flags: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (11,3)-(11,16)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (11,3)-(11,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :a + │ │ │ ├── name_loc: (11,3)-(11,4) = "a" + │ │ │ ├── operator_loc: (11,5)-(11,6) = "=" + │ │ │ └── value: + │ │ │ @ DefNode (location: (11,7)-(11,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :f + │ │ │ ├── name_loc: (11,11)-(11,12) = "f" + │ │ │ ├── receiver: ∅ + │ │ │ ├── parameters: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (11,15)-(11,16)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (11,15)-(11,16)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── locals: [] + │ │ │ ├── def_keyword_loc: (11,7)-(11,10) = "def" + │ │ │ ├── operator_loc: ∅ + │ │ │ ├── lparen_loc: ∅ + │ │ │ ├── rparen_loc: ∅ + │ │ │ ├── equal_loc: (11,13)-(11,14) = "=" + │ │ │ └── end_keyword_loc: ∅ + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── locals: (length: 0) + │ ├── opening_loc: (11,2)-(11,3) = "(" + │ └── closing_loc: (11,16)-(11,17) = ")" + └── body: ∅ diff --git a/snapshots/endless_methods.txt b/snapshots/endless_methods.txt index 29f701ed17..938ec25a56 100644 --- a/snapshots/endless_methods.txt +++ b/snapshots/endless_methods.txt @@ -1,10 +1,10 @@ -@ ProgramNode (location: (1,0)-(5,22)) +@ ProgramNode (location: (1,0)-(7,15)) ├── flags: ∅ -├── locals: [] +├── locals: [:x] └── statements: - @ StatementsNode (location: (1,0)-(5,22)) + @ StatementsNode (location: (1,0)-(7,15)) ├── flags: ∅ - └── body: (length: 3) + └── body: (length: 4) ├── @ DefNode (location: (1,0)-(1,11)) │ ├── flags: newline │ ├── name: :foo @@ -53,6 +53,7 @@ │ │ │ ├── closing_loc: (3,13)-(3,14) = "\"" │ │ │ └── unescaped: "" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (3,0)-(3,3) = "def" @@ -61,55 +62,98 @@ │ ├── rparen_loc: ∅ │ ├── equal_loc: (3,8)-(3,9) = "=" │ └── end_keyword_loc: ∅ - └── @ DefNode (location: (5,0)-(5,22)) + ├── @ DefNode (location: (5,0)-(5,22)) + │ ├── flags: newline + │ ├── name: :method + │ ├── name_loc: (5,4)-(5,10) = "method" + │ ├── receiver: ∅ + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (5,13)-(5,22)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ CallNode (location: (5,13)-(5,22)) + │ │ ├── flags: ∅ + │ │ ├── receiver: + │ │ │ @ CallNode (location: (5,13)-(5,18)) + │ │ │ ├── flags: ∅ + │ │ │ ├── receiver: + │ │ │ │ @ IntegerNode (location: (5,13)-(5,14)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :+ + │ │ │ ├── message_loc: (5,15)-(5,16) = "+" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (5,17)-(5,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (5,17)-(5,18)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 2 + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :+ + │ │ ├── message_loc: (5,19)-(5,20) = "+" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (5,21)-(5,22)) + │ │ │ ├── flags: ∅ + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ IntegerNode (location: (5,21)-(5,22)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 3 + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── locals: [] + │ ├── def_keyword_loc: (5,0)-(5,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: (5,11)-(5,12) = "=" + │ └── end_keyword_loc: ∅ + └── @ LocalVariableWriteNode (location: (7,0)-(7,15)) ├── flags: newline - ├── name: :method - ├── name_loc: (5,4)-(5,10) = "method" - ├── receiver: ∅ - ├── parameters: ∅ - ├── body: - │ @ StatementsNode (location: (5,13)-(5,22)) + ├── name: :x + ├── depth: 0 + ├── name_loc: (7,0)-(7,1) = "x" + ├── value: + │ @ DefNode (location: (7,4)-(7,15)) │ ├── flags: ∅ - │ └── body: (length: 1) - │ └── @ CallNode (location: (5,13)-(5,22)) - │ ├── flags: ∅ - │ ├── receiver: - │ │ @ CallNode (location: (5,13)-(5,18)) - │ │ ├── flags: ∅ - │ │ ├── receiver: - │ │ │ @ IntegerNode (location: (5,13)-(5,14)) - │ │ │ ├── flags: static_literal, decimal - │ │ │ └── value: 1 - │ │ ├── call_operator_loc: ∅ - │ │ ├── name: :+ - │ │ ├── message_loc: (5,15)-(5,16) = "+" - │ │ ├── opening_loc: ∅ - │ │ ├── arguments: - │ │ │ @ ArgumentsNode (location: (5,17)-(5,18)) - │ │ │ ├── flags: ∅ - │ │ │ └── arguments: (length: 1) - │ │ │ └── @ IntegerNode (location: (5,17)-(5,18)) - │ │ │ ├── flags: static_literal, decimal - │ │ │ └── value: 2 - │ │ ├── closing_loc: ∅ - │ │ └── block: ∅ - │ ├── call_operator_loc: ∅ - │ ├── name: :+ - │ ├── message_loc: (5,19)-(5,20) = "+" - │ ├── opening_loc: ∅ - │ ├── arguments: - │ │ @ ArgumentsNode (location: (5,21)-(5,22)) - │ │ ├── flags: ∅ - │ │ └── arguments: (length: 1) - │ │ └── @ IntegerNode (location: (5,21)-(5,22)) - │ │ ├── flags: static_literal, decimal - │ │ └── value: 3 - │ ├── closing_loc: ∅ - │ └── block: ∅ - ├── locals: [] - ├── def_keyword_loc: (5,0)-(5,3) = "def" - ├── operator_loc: ∅ - ├── lparen_loc: ∅ - ├── rparen_loc: ∅ - ├── equal_loc: (5,11)-(5,12) = "=" - └── end_keyword_loc: ∅ + │ ├── name: :f + │ ├── name_loc: (7,8)-(7,9) = "f" + │ ├── receiver: ∅ + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (7,12)-(7,15)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ CallNode (location: (7,12)-(7,15)) + │ │ ├── flags: ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :p + │ │ ├── message_loc: (7,12)-(7,13) = "p" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (7,14)-(7,15)) + │ │ │ ├── flags: ∅ + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ IntegerNode (location: (7,14)-(7,15)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── locals: [] + │ ├── def_keyword_loc: (7,4)-(7,7) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: (7,10)-(7,11) = "=" + │ └── end_keyword_loc: ∅ + └── operator_loc: (7,2)-(7,3) = "=" diff --git a/snapshots/hashes.txt b/snapshots/hashes.txt index 8462c28994..0890f13667 100644 --- a/snapshots/hashes.txt +++ b/snapshots/hashes.txt @@ -31,6 +31,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── value: │ │ │ │ @ CallNode (location: (6,7)-(6,8)) @@ -42,6 +43,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (6,4)-(6,6) = "=>" │ │ └── @ AssocNode (location: (6,10)-(6,16)) @@ -56,6 +58,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── value: │ │ │ @ CallNode (location: (6,15)-(6,16)) @@ -67,6 +70,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (6,12)-(6,14) = "=>" │ └── closing_loc: (6,17)-(6,18) = "}" @@ -86,6 +90,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── value: │ │ │ │ @ CallNode (location: (8,7)-(8,8)) @@ -97,6 +102,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (8,4)-(8,6) = "=>" │ │ └── @ AssocSplatNode (location: (8,10)-(8,13)) @@ -111,6 +117,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (8,10)-(8,12) = "**" │ └── closing_loc: (8,14)-(8,15) = "}" @@ -137,6 +144,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: ∅ │ │ └── @ AssocNode (location: (12,6)-(12,10)) @@ -158,6 +166,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: ∅ │ └── closing_loc: (16,4)-(16,5) = "}" @@ -184,6 +193,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: ∅ │ │ ├── @ AssocNode (location: (18,8)-(18,12)) @@ -205,6 +215,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: ∅ │ │ ├── @ AssocSplatNode (location: (18,14)-(18,17)) @@ -219,6 +230,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (18,14)-(18,16) = "**" │ │ └── @ AssocNode (location: (18,19)-(18,23)) @@ -240,6 +252,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: ∅ │ └── closing_loc: (18,24)-(18,25) = "}" @@ -269,6 +282,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :! @@ -276,6 +290,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: ∅ │ └── closing_loc: (20,11)-(20,12) = "}" @@ -298,6 +313,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (23,4)-(26,3)) │ ├── flags: ∅ @@ -379,6 +395,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ └── operator_loc: ∅ │ │ │ └── @ AssocNode (location: (25,16)-(25,18)) diff --git a/snapshots/heredoc_percent_q_newline_delimiter.txt b/snapshots/heredoc_percent_q_newline_delimiter.txt new file mode 100644 index 0000000000..75c436b670 --- /dev/null +++ b/snapshots/heredoc_percent_q_newline_delimiter.txt @@ -0,0 +1,114 @@ +@ ProgramNode (location: (1,0)-(22,0)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(22,0)) + ├── flags: ∅ + └── body: (length: 7) + ├── @ InterpolatedStringNode (location: (1,0)-(3,0)) + │ ├── flags: newline, static_literal, mutable + │ ├── opening_loc: (1,0)-(2,0) = "%Q\n" + │ ├── parts: (length: 1) + │ │ └── @ EmbeddedStatementsNode (location: (2,0)-(2,6)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: (2,0)-(2,2) = "\#{" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (2,2)-(2,5)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ StringNode (location: (2,2)-(2,5)) + │ │ │ ├── flags: static_literal, frozen + │ │ │ ├── opening_loc: (2,2)-(2,5) = "<> @@ -1883,6 +1899,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (163,12)-(163,14)) │ │ │ ├── flags: ∅ @@ -1892,6 +1909,7 @@ │ │ │ ├── opening_loc: (163,12)-(163,13) = "{" │ │ │ └── closing_loc: (163,13)-(163,14) = "}" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:a] │ ├── def_keyword_loc: (162,0)-(162,3) = "def" @@ -1998,6 +2016,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :-@ @@ -2005,6 +2024,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_rest: ∅ │ │ └── block: ∅ @@ -2046,6 +2066,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :+@ @@ -2053,6 +2074,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_rest: ∅ │ │ └── block: ∅ @@ -2094,6 +2116,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :! @@ -2101,6 +2124,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_rest: ∅ │ │ └── block: ∅ @@ -2181,6 +2205,7 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (180,6)-(180,9)) │ │ │ └── flags: ∅ │ │ ├── closing_loc: (180,9)-(180,10) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (179,0)-(179,3) = "def" diff --git a/snapshots/modules.txt b/snapshots/modules.txt index 8bd25a7340..3eb4974319 100644 --- a/snapshots/modules.txt +++ b/snapshots/modules.txt @@ -55,6 +55,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (3,12)-(3,13) = "}" │ │ └── @ StringNode (location: (3,13)-(3,17)) @@ -81,6 +82,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── name: :M │ │ ├── delimiter_loc: (5,8)-(5,10) = "::" @@ -163,6 +165,7 @@ │ │ │ ├── opening_loc: (14,8)-(14,9) = "[" │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: (14,9)-(14,10) = "]" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── name: :B │ │ ├── delimiter_loc: (14,10)-(14,12) = "::" @@ -196,6 +199,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: (17,10)-(17,11) = "]" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── name: :B │ ├── delimiter_loc: (17,11)-(17,13) = "::" diff --git a/snapshots/next.txt b/snapshots/next.txt index f38323e4e7..edcb9c1d6d 100644 --- a/snapshots/next.txt +++ b/snapshots/next.txt @@ -1,10 +1,10 @@ -@ ProgramNode (location: (1,0)-(24,15)) +@ ProgramNode (location: (1,0)-(28,23)) ├── flags: ∅ ├── locals: [] └── statements: - @ StatementsNode (location: (1,0)-(24,15)) + @ StatementsNode (location: (1,0)-(28,23)) ├── flags: ∅ - └── body: (length: 10) + └── body: (length: 12) ├── @ CallNode (location: (1,0)-(1,12)) │ ├── flags: newline, ignore_visibility │ ├── receiver: ∅ @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,4)-(1,12)) │ ├── flags: ∅ @@ -38,6 +39,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,4)-(3,26)) │ ├── flags: ∅ @@ -98,6 +100,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,4)-(5,14)) │ ├── flags: ∅ @@ -128,6 +131,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,4)-(8,3)) │ ├── flags: ∅ @@ -164,6 +168,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (10,4)-(10,20)) │ ├── flags: ∅ @@ -200,6 +205,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (12,4)-(12,22)) │ ├── flags: ∅ @@ -241,6 +247,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (14,4)-(17,3)) │ ├── flags: ∅ @@ -282,6 +289,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (19,4)-(20,3)) │ ├── flags: ∅ @@ -309,6 +317,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (22,4)-(22,14)) │ ├── flags: ∅ @@ -332,41 +341,136 @@ │ │ └── keyword_loc: (22,6)-(22,10) = "next" │ ├── opening_loc: (22,4)-(22,5) = "{" │ └── closing_loc: (22,13)-(22,14) = "}" - └── @ CallNode (location: (24,0)-(24,15)) + ├── @ CallNode (location: (24,0)-(24,15)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (24,0)-(24,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (24,4)-(24,15)) + │ ├── flags: ∅ + │ ├── locals: [] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (24,6)-(24,13)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ NextNode (location: (24,6)-(24,13)) + │ │ ├── flags: newline + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (24,10)-(24,13)) + │ │ │ ├── flags: ∅ + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ ParenthesesNode (location: (24,10)-(24,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (24,11)-(24,12)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (24,11)-(24,12)) + │ │ │ │ ├── flags: newline, static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── opening_loc: (24,10)-(24,11) = "(" + │ │ │ └── closing_loc: (24,12)-(24,13) = ")" + │ │ └── keyword_loc: (24,6)-(24,10) = "next" + │ ├── opening_loc: (24,4)-(24,5) = "{" + │ └── closing_loc: (24,14)-(24,15) = "}" + ├── @ CallNode (location: (26,0)-(26,16)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :tap + │ ├── message_loc: (26,0)-(26,3) = "tap" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: + │ @ BlockNode (location: (26,4)-(26,16)) + │ ├── flags: ∅ + │ ├── locals: [] + │ ├── parameters: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (26,6)-(26,14)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ ParenthesesNode (location: (26,6)-(26,14)) + │ │ ├── flags: newline + │ │ ├── body: + │ │ │ @ StatementsNode (location: (26,7)-(26,13)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NextNode (location: (26,7)-(26,13)) + │ │ │ ├── flags: newline + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (26,12)-(26,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (26,12)-(26,13)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ └── keyword_loc: (26,7)-(26,11) = "next" + │ │ ├── opening_loc: (26,6)-(26,7) = "(" + │ │ └── closing_loc: (26,13)-(26,14) = ")" + │ ├── opening_loc: (26,4)-(26,5) = "{" + │ └── closing_loc: (26,15)-(26,16) = "}" + └── @ CallNode (location: (28,0)-(28,23)) ├── flags: newline, ignore_visibility ├── receiver: ∅ ├── call_operator_loc: ∅ ├── name: :tap - ├── message_loc: (24,0)-(24,3) = "tap" + ├── message_loc: (28,0)-(28,3) = "tap" ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: - @ BlockNode (location: (24,4)-(24,15)) + @ BlockNode (location: (28,4)-(28,23)) ├── flags: ∅ ├── locals: [] ├── parameters: ∅ ├── body: - │ @ StatementsNode (location: (24,6)-(24,13)) + │ @ StatementsNode (location: (28,6)-(28,21)) │ ├── flags: ∅ │ └── body: (length: 1) - │ └── @ NextNode (location: (24,6)-(24,13)) + │ └── @ AndNode (location: (28,6)-(28,21)) │ ├── flags: newline - │ ├── arguments: - │ │ @ ArgumentsNode (location: (24,10)-(24,13)) + │ ├── left: + │ │ @ CallNode (location: (28,6)-(28,9)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (28,6)-(28,9) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ ├── right: + │ │ @ ParenthesesNode (location: (28,13)-(28,21)) │ │ ├── flags: ∅ - │ │ └── arguments: (length: 1) - │ │ └── @ ParenthesesNode (location: (24,10)-(24,13)) - │ │ ├── flags: ∅ - │ │ ├── body: - │ │ │ @ StatementsNode (location: (24,11)-(24,12)) - │ │ │ ├── flags: ∅ - │ │ │ └── body: (length: 1) - │ │ │ └── @ IntegerNode (location: (24,11)-(24,12)) - │ │ │ ├── flags: newline, static_literal, decimal - │ │ │ └── value: 1 - │ │ ├── opening_loc: (24,10)-(24,11) = "(" - │ │ └── closing_loc: (24,12)-(24,13) = ")" - │ └── keyword_loc: (24,6)-(24,10) = "next" - ├── opening_loc: (24,4)-(24,5) = "{" - └── closing_loc: (24,14)-(24,15) = "}" + │ │ ├── body: + │ │ │ @ StatementsNode (location: (28,14)-(28,20)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NextNode (location: (28,14)-(28,20)) + │ │ │ ├── flags: newline + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (28,19)-(28,20)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (28,19)-(28,20)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ └── keyword_loc: (28,14)-(28,18) = "next" + │ │ ├── opening_loc: (28,13)-(28,14) = "(" + │ │ └── closing_loc: (28,20)-(28,21) = ")" + │ └── operator_loc: (28,10)-(28,12) = "&&" + ├── opening_loc: (28,4)-(28,5) = "{" + └── closing_loc: (28,22)-(28,23) = "}" diff --git a/snapshots/non_alphanumeric_methods.txt b/snapshots/non_alphanumeric_methods.txt index 2d29d365e4..240a6e7816 100644 --- a/snapshots/non_alphanumeric_methods.txt +++ b/snapshots/non_alphanumeric_methods.txt @@ -265,6 +265,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── parameters: ∅ │ ├── body: ∅ diff --git a/snapshots/not.txt b/snapshots/not.txt index e164b18813..0ec160a71e 100644 --- a/snapshots/not.txt +++ b/snapshots/not.txt @@ -20,6 +20,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -27,6 +28,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (1,12)-(1,19)) @@ -41,6 +43,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -48,6 +51,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (1,8)-(1,11) = "and" ├── @ CallNode (location: (3,0)-(3,16)) @@ -65,6 +69,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (3,12)-(3,15)) @@ -76,6 +81,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (3,8)-(3,11) = "and" │ ├── call_operator_loc: ∅ @@ -84,6 +90,7 @@ │ ├── opening_loc: (3,3)-(3,4) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (3,15)-(3,16) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (5,0)-(5,7)) │ ├── flags: newline @@ -97,6 +104,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :! @@ -104,6 +112,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ AndNode (location: (7,0)-(8,5)) │ ├── flags: newline @@ -120,6 +129,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -127,6 +137,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (7,12)-(8,5)) @@ -141,6 +152,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -148,6 +160,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (7,8)-(7,11) = "and" ├── @ AndNode (location: (11,0)-(13,5)) @@ -165,6 +178,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -172,6 +186,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (12,4)-(13,5)) @@ -186,6 +201,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -193,6 +209,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (11,8)-(11,11) = "and" ├── @ AndNode (location: (16,0)-(20,5)) @@ -210,6 +227,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -217,6 +235,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (17,2)-(20,5)) @@ -231,6 +250,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :! @@ -238,6 +258,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (16,8)-(16,11) = "and" ├── @ CallNode (location: (22,0)-(25,1)) @@ -252,6 +273,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :! @@ -259,6 +281,7 @@ │ ├── opening_loc: (22,3)-(22,4) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (25,0)-(25,1) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (27,0)-(33,3)) │ ├── flags: newline @@ -272,6 +295,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :! @@ -279,6 +303,7 @@ │ ├── opening_loc: (27,3)-(27,4) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (33,2)-(33,3) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (35,0)-(35,14)) │ ├── flags: newline @@ -295,6 +320,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (35,11)-(35,14)) @@ -306,6 +332,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (35,8)-(35,10) = ".." │ ├── call_operator_loc: ∅ @@ -314,6 +341,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (37,0)-(37,16)) ├── flags: newline @@ -336,6 +364,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (37,12)-(37,15)) @@ -347,6 +376,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (37,9)-(37,11) = ".." │ ├── opening_loc: (37,4)-(37,5) = "(" @@ -357,4 +387,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/patterns.txt b/snapshots/patterns.txt index fc0f6e7cef..20c9b1f994 100644 --- a/snapshots/patterns.txt +++ b/snapshots/patterns.txt @@ -1,10 +1,10 @@ -@ ProgramNode (location: (1,0)-(220,14)) +@ ProgramNode (location: (1,0)-(224,14)) ├── flags: ∅ ├── locals: [:bar, :baz, :qux, :b, :a, :foo, :x, :_a] └── statements: - @ StatementsNode (location: (1,0)-(220,14)) + @ StatementsNode (location: (1,0)-(224,14)) ├── flags: ∅ - └── body: (length: 187) + └── body: (length: 190) ├── @ MatchRequiredNode (location: (1,0)-(1,10)) │ ├── flags: newline │ ├── value: @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ LocalVariableTargetNode (location: (1,7)-(1,10)) @@ -36,6 +37,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ IntegerNode (location: (2,7)-(2,8)) @@ -54,6 +56,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ FloatNode (location: (3,7)-(3,10)) @@ -72,6 +75,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ImaginaryNode (location: (4,7)-(4,9)) @@ -93,6 +97,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RationalNode (location: (5,7)-(5,9)) @@ -112,6 +117,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SymbolNode (location: (6,7)-(6,11)) @@ -133,6 +139,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SymbolNode (location: (7,7)-(7,14)) @@ -154,6 +161,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SymbolNode (location: (8,7)-(8,13)) @@ -175,6 +183,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RegularExpressionNode (location: (9,7)-(9,12)) @@ -196,6 +205,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ XStringNode (location: (10,7)-(10,12)) @@ -217,6 +227,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ XStringNode (location: (11,7)-(11,14)) @@ -238,6 +249,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayNode (location: (12,7)-(12,14)) @@ -264,6 +276,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayNode (location: (13,7)-(13,14)) @@ -290,6 +303,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayNode (location: (14,7)-(14,14)) @@ -316,6 +330,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayNode (location: (15,7)-(15,14)) @@ -342,6 +357,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ StringNode (location: (16,7)-(16,14)) @@ -363,6 +379,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ StringNode (location: (17,7)-(17,14)) @@ -384,6 +401,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ StringNode (location: (18,7)-(18,12)) @@ -405,6 +423,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ NilNode (location: (19,7)-(19,10)) @@ -422,6 +441,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SelfNode (location: (20,7)-(20,11)) @@ -439,6 +459,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ TrueNode (location: (21,7)-(21,11)) @@ -456,6 +477,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ FalseNode (location: (22,7)-(22,12)) @@ -473,6 +495,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SourceFileNode (location: (23,7)-(23,15)) @@ -491,6 +514,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SourceLineNode (location: (24,7)-(24,15)) @@ -508,6 +532,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SourceEncodingNode (location: (25,7)-(25,19)) @@ -525,6 +550,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ LambdaNode (location: (26,7)-(26,17)) @@ -555,6 +581,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (28,7)-(28,13)) @@ -581,6 +608,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (29,7)-(29,17)) @@ -607,6 +635,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (30,7)-(30,15)) @@ -639,6 +668,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (31,7)-(31,15)) @@ -667,6 +697,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (32,7)-(32,19)) @@ -699,6 +730,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (33,7)-(33,25)) @@ -731,6 +763,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (34,7)-(34,23)) @@ -763,6 +796,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (35,7)-(35,21)) @@ -795,6 +829,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (36,7)-(36,21)) @@ -827,6 +862,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (37,7)-(37,25)) @@ -859,6 +895,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (38,7)-(38,25)) @@ -901,6 +938,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (39,7)-(39,25)) @@ -943,6 +981,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (40,7)-(40,25)) @@ -985,6 +1024,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (41,7)-(41,25)) @@ -1027,6 +1067,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (42,7)-(42,25)) @@ -1059,6 +1100,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (43,7)-(43,25)) @@ -1091,6 +1133,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (44,7)-(44,21)) @@ -1123,6 +1166,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (45,7)-(45,17)) @@ -1147,6 +1191,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (46,7)-(46,19)) @@ -1171,6 +1216,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (47,7)-(47,19)) @@ -1195,6 +1241,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (48,7)-(48,21)) @@ -1219,6 +1266,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (49,7)-(49,27)) @@ -1245,6 +1293,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (50,7)-(50,27)) @@ -1269,6 +1318,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (51,7)-(51,35)) @@ -1293,6 +1343,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RangeNode (location: (52,7)-(52,31)) @@ -1353,6 +1404,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ PinnedVariableNode (location: (54,16)-(54,20)) @@ -1376,6 +1428,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ PinnedVariableNode (location: (55,7)-(55,12)) @@ -1398,6 +1451,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ PinnedVariableNode (location: (56,7)-(56,13)) @@ -1420,6 +1474,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ PinnedVariableNode (location: (57,7)-(57,12)) @@ -1442,6 +1497,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ PinnedExpressionNode (location: (59,7)-(59,11)) @@ -1466,6 +1522,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ PinnedExpressionNode (location: (60,7)-(60,13)) @@ -1489,6 +1546,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ PinnedExpressionNode (location: (61,7)-(61,23)) @@ -1518,6 +1576,7 @@ │ │ │ │ ├── closing_loc: (61,21)-(61,22) = "\"" │ │ │ │ └── unescaped: "baz" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── operator_loc: (61,7)-(61,8) = "^" │ │ ├── lparen_loc: (61,8)-(61,9) = "(" @@ -1535,6 +1594,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ConstantReadNode (location: (63,7)-(63,10)) @@ -1553,6 +1613,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ConstantPathNode (location: (64,7)-(64,20)) @@ -1583,6 +1644,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ConstantPathNode (location: (65,7)-(65,12)) @@ -1604,6 +1666,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ConstantPathNode (location: (66,7)-(66,22)) @@ -1637,6 +1700,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (68,7)-(68,12)) @@ -1663,6 +1727,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (69,7)-(69,13)) @@ -1692,6 +1757,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (70,7)-(70,19)) @@ -1727,6 +1793,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (71,7)-(71,15)) @@ -1757,6 +1824,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (72,7)-(72,21)) @@ -1795,6 +1863,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (73,7)-(73,21)) @@ -1833,6 +1902,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ FindPatternNode (location: (74,7)-(74,27)) @@ -1879,6 +1949,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (76,7)-(76,12)) @@ -1905,6 +1976,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (77,7)-(77,13)) @@ -1934,6 +2006,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (78,7)-(78,19)) @@ -1969,6 +2042,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (79,7)-(79,17)) @@ -2006,6 +2080,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (80,7)-(80,15)) @@ -2036,6 +2111,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (81,7)-(81,21)) @@ -2074,6 +2150,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (82,7)-(82,21)) @@ -2112,6 +2189,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ FindPatternNode (location: (83,7)-(83,27)) @@ -2158,6 +2236,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (85,7)-(85,11)) @@ -2189,6 +2268,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (86,7)-(86,21)) @@ -2228,6 +2308,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (87,7)-(87,21)) @@ -2267,6 +2348,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (88,7)-(88,21)) @@ -2306,6 +2388,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ FindPatternNode (location: (89,7)-(89,22)) @@ -2349,6 +2432,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (90,7)-(90,11)) @@ -2378,6 +2462,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (92,7)-(92,9)) @@ -2401,6 +2486,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (93,7)-(93,17)) @@ -2456,6 +2542,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (95,7)-(95,13)) @@ -2487,6 +2574,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (96,7)-(96,23)) @@ -2526,6 +2614,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (97,7)-(97,23)) @@ -2565,6 +2654,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (98,7)-(98,23)) @@ -2604,6 +2694,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ FindPatternNode (location: (99,7)-(99,24)) @@ -2647,6 +2738,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ LocalVariableTargetNode (location: (101,7)-(101,10)) @@ -2666,6 +2758,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ IntegerNode (location: (102,7)-(102,8)) @@ -2684,6 +2777,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ FloatNode (location: (103,7)-(103,10)) @@ -2702,6 +2796,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ImaginaryNode (location: (104,7)-(104,9)) @@ -2723,6 +2818,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RationalNode (location: (105,7)-(105,9)) @@ -2742,6 +2838,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SymbolNode (location: (106,7)-(106,11)) @@ -2763,6 +2860,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SymbolNode (location: (107,7)-(107,14)) @@ -2784,6 +2882,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SymbolNode (location: (108,7)-(108,13)) @@ -2805,6 +2904,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ RegularExpressionNode (location: (109,7)-(109,12)) @@ -2826,6 +2926,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ XStringNode (location: (110,7)-(110,12)) @@ -2847,6 +2948,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ XStringNode (location: (111,7)-(111,14)) @@ -2868,6 +2970,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayNode (location: (112,7)-(112,14)) @@ -2894,6 +2997,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayNode (location: (113,7)-(113,14)) @@ -2920,6 +3024,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayNode (location: (114,7)-(114,14)) @@ -2946,6 +3051,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayNode (location: (115,7)-(115,14)) @@ -2972,6 +3078,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ StringNode (location: (116,7)-(116,14)) @@ -2993,6 +3100,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ StringNode (location: (117,7)-(117,14)) @@ -3014,6 +3122,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ StringNode (location: (118,7)-(118,12)) @@ -3035,6 +3144,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ NilNode (location: (119,7)-(119,10)) @@ -3052,6 +3162,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SelfNode (location: (120,7)-(120,11)) @@ -3069,6 +3180,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ TrueNode (location: (121,7)-(121,11)) @@ -3086,6 +3198,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ FalseNode (location: (122,7)-(122,12)) @@ -3103,6 +3216,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SourceFileNode (location: (123,7)-(123,15)) @@ -3121,6 +3235,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SourceLineNode (location: (124,7)-(124,15)) @@ -3138,6 +3253,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ SourceEncodingNode (location: (125,7)-(125,19)) @@ -3155,6 +3271,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ LambdaNode (location: (126,7)-(126,17)) @@ -3185,6 +3302,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (127,7)-(127,11)) @@ -3214,6 +3332,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (129,10)-(129,21)) @@ -3241,6 +3360,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (130,10)-(130,19)) @@ -3267,6 +3387,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (131,10)-(131,21)) @@ -3293,6 +3414,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (132,10)-(132,20)) @@ -3322,6 +3444,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (133,10)-(133,20)) @@ -3349,6 +3472,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (134,10)-(134,22)) @@ -3378,6 +3502,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (135,10)-(135,25)) @@ -3407,6 +3532,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (136,10)-(136,24)) @@ -3436,6 +3562,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (137,10)-(137,23)) @@ -3465,6 +3592,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (138,10)-(138,23)) @@ -3494,6 +3622,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (139,10)-(139,25)) @@ -3523,6 +3652,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (140,10)-(140,25)) @@ -3557,6 +3687,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (141,10)-(141,25)) @@ -3591,6 +3722,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (142,10)-(142,25)) @@ -3625,6 +3757,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (143,10)-(143,25)) @@ -3659,6 +3792,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (144,10)-(144,25)) @@ -3688,6 +3822,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (145,10)-(145,25)) @@ -3717,6 +3852,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (146,10)-(146,23)) @@ -3746,6 +3882,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (147,10)-(147,21)) @@ -3771,6 +3908,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (148,10)-(148,22)) @@ -3796,6 +3934,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (149,10)-(149,22)) @@ -3821,6 +3960,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (150,10)-(150,23)) @@ -3846,6 +3986,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (151,10)-(151,26)) @@ -3872,6 +4013,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (152,10)-(152,26)) @@ -3897,6 +4039,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (153,10)-(153,30)) @@ -3922,6 +4065,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (154,10)-(154,28)) @@ -3960,6 +4104,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (156,10)-(156,28)) @@ -4002,6 +4147,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (157,10)-(157,26)) @@ -4043,6 +4189,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (158,10)-(158,28)) @@ -4084,6 +4231,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (159,10)-(159,27)) @@ -4128,6 +4276,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (160,10)-(160,27)) @@ -4170,6 +4319,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (161,10)-(161,29)) @@ -4214,6 +4364,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (162,10)-(162,32)) @@ -4258,6 +4409,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (163,10)-(163,31)) @@ -4302,6 +4454,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (164,10)-(164,30)) @@ -4346,6 +4499,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (165,10)-(165,30)) @@ -4390,6 +4544,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (166,10)-(166,32)) @@ -4434,6 +4589,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (167,10)-(167,32)) @@ -4483,6 +4639,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (168,10)-(168,32)) @@ -4532,6 +4689,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (169,10)-(169,32)) @@ -4581,6 +4739,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (170,10)-(170,32)) @@ -4630,6 +4789,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (171,10)-(171,32)) @@ -4674,6 +4834,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (172,10)-(172,32)) @@ -4718,6 +4879,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (173,10)-(173,30)) @@ -4762,6 +4924,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (174,10)-(174,28)) @@ -4802,6 +4965,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (175,10)-(175,29)) @@ -4842,6 +5006,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (176,10)-(176,29)) @@ -4882,6 +5047,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (177,10)-(177,30)) @@ -4922,6 +5088,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (178,10)-(178,33)) @@ -4963,6 +5130,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (179,10)-(179,33)) @@ -5003,6 +5171,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (180,10)-(180,37)) @@ -5043,6 +5212,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (181,10)-(181,35)) @@ -5100,6 +5270,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── pattern: │ │ │ @ ArrayPatternNode (location: (183,8)-(183,10)) @@ -5127,6 +5298,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ ArrayPatternNode (location: (186,5)-(188,1)) @@ -5154,6 +5326,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ HashPatternNode (location: (190,7)-(194,1)) @@ -5215,6 +5388,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ CapturePatternNode (location: (196,7)-(196,17)) @@ -5243,6 +5417,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ CapturePatternNode (location: (197,7)-(197,17)) @@ -5300,6 +5475,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (200,4)-(202,3)) │ ├── flags: ∅ @@ -5409,6 +5585,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (206,7)-(206,19)) │ ├── flags: ∅ @@ -5465,6 +5642,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CaseMatchNode (location: (213,0)-(213,25)) │ ├── flags: newline @@ -5641,6 +5819,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (217,8)-(217,11) = "and" ├── @ OrNode (location: (218,0)-(218,12)) @@ -5679,6 +5858,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (218,8)-(218,10) = "or" ├── @ AndNode (location: (219,0)-(219,15)) @@ -5725,51 +5905,172 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (219,10)-(219,13) = "and" - └── @ OrNode (location: (220,0)-(220,14)) + ├── @ OrNode (location: (220,0)-(220,14)) + │ ├── flags: newline + │ ├── left: + │ │ @ ParenthesesNode (location: (220,0)-(220,9)) + │ │ ├── flags: ∅ + │ │ ├── body: + │ │ │ @ StatementsNode (location: (220,1)-(220,8)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ MatchPredicateNode (location: (220,1)-(220,8)) + │ │ │ ├── flags: newline + │ │ │ ├── value: + │ │ │ │ @ LocalVariableReadNode (location: (220,1)-(220,2)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :a + │ │ │ │ └── depth: 0 + │ │ │ ├── pattern: + │ │ │ │ @ ArrayPatternNode (location: (220,6)-(220,8)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── constant: ∅ + │ │ │ │ ├── requireds: (length: 1) + │ │ │ │ │ └── @ LocalVariableTargetNode (location: (220,6)-(220,7)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :b + │ │ │ │ │ └── depth: 0 + │ │ │ │ ├── rest: + │ │ │ │ │ @ ImplicitRestNode (location: (220,7)-(220,8)) + │ │ │ │ │ └── flags: ∅ + │ │ │ │ ├── posts: (length: 0) + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ └── closing_loc: ∅ + │ │ │ └── operator_loc: (220,3)-(220,5) = "in" + │ │ ├── opening_loc: (220,0)-(220,1) = "(" + │ │ └── closing_loc: (220,8)-(220,9) = ")" + │ ├── right: + │ │ @ CallNode (location: (220,13)-(220,14)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :c + │ │ ├── message_loc: (220,13)-(220,14) = "c" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ └── operator_loc: (220,10)-(220,12) = "or" + ├── @ MatchRequiredNode (location: (222,0)-(222,14)) + │ ├── flags: newline + │ ├── value: + │ │ @ LocalVariableReadNode (location: (222,0)-(222,1)) + │ │ ├── flags: ∅ + │ │ ├── name: :x + │ │ └── depth: 0 + │ ├── pattern: + │ │ @ PinnedExpressionNode (location: (222,5)-(222,14)) + │ │ ├── flags: ∅ + │ │ ├── expression: + │ │ │ @ ArrayNode (location: (222,7)-(222,13)) + │ │ │ ├── flags: contains_splat + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ SplatNode (location: (222,8)-(222,12)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (222,8)-(222,9) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ CallNode (location: (222,9)-(222,12)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── receiver: + │ │ │ │ │ @ LocalVariableReadNode (location: (222,9)-(222,10)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :a + │ │ │ │ │ └── depth: 0 + │ │ │ │ ├── call_operator_loc: (222,10)-(222,11) = "." + │ │ │ │ ├── name: :x + │ │ │ │ ├── message_loc: (222,11)-(222,12) = "x" + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── arguments: ∅ + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ + │ │ │ │ └── block: ∅ + │ │ │ ├── opening_loc: (222,7)-(222,8) = "[" + │ │ │ └── closing_loc: (222,12)-(222,13) = "]" + │ │ ├── operator_loc: (222,5)-(222,6) = "^" + │ │ ├── lparen_loc: (222,6)-(222,7) = "(" + │ │ └── rparen_loc: (222,13)-(222,14) = ")" + │ └── operator_loc: (222,2)-(222,4) = "=>" + ├── @ MatchRequiredNode (location: (223,0)-(223,15)) + │ ├── flags: newline + │ ├── value: + │ │ @ LocalVariableReadNode (location: (223,0)-(223,1)) + │ │ ├── flags: ∅ + │ │ ├── name: :x + │ │ └── depth: 0 + │ ├── pattern: + │ │ @ PinnedExpressionNode (location: (223,5)-(223,15)) + │ │ ├── flags: ∅ + │ │ ├── expression: + │ │ │ @ ArrayNode (location: (223,7)-(223,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ KeywordHashNode (location: (223,8)-(223,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── elements: (length: 1) + │ │ │ │ └── @ AssocSplatNode (location: (223,8)-(223,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── value: + │ │ │ │ │ @ CallNode (location: (223,10)-(223,13)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── receiver: + │ │ │ │ │ │ @ LocalVariableReadNode (location: (223,10)-(223,11)) + │ │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ │ ├── name: :a + │ │ │ │ │ │ └── depth: 0 + │ │ │ │ │ ├── call_operator_loc: (223,11)-(223,12) = "." + │ │ │ │ │ ├── name: :x + │ │ │ │ │ ├── message_loc: (223,12)-(223,13) = "x" + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── arguments: ∅ + │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ + │ │ │ │ │ └── block: ∅ + │ │ │ │ └── operator_loc: (223,8)-(223,10) = "**" + │ │ │ ├── opening_loc: (223,7)-(223,8) = "[" + │ │ │ └── closing_loc: (223,13)-(223,14) = "]" + │ │ ├── operator_loc: (223,5)-(223,6) = "^" + │ │ ├── lparen_loc: (223,6)-(223,7) = "(" + │ │ └── rparen_loc: (223,14)-(223,15) = ")" + │ └── operator_loc: (223,2)-(223,4) = "=>" + └── @ MatchRequiredNode (location: (224,0)-(224,14)) ├── flags: newline - ├── left: - │ @ ParenthesesNode (location: (220,0)-(220,9)) + ├── value: + │ @ LocalVariableReadNode (location: (224,0)-(224,1)) + │ ├── flags: ∅ + │ ├── name: :x + │ └── depth: 0 + ├── pattern: + │ @ PinnedExpressionNode (location: (224,5)-(224,14)) │ ├── flags: ∅ - │ ├── body: - │ │ @ StatementsNode (location: (220,1)-(220,8)) + │ ├── expression: + │ │ @ HashNode (location: (224,7)-(224,13)) │ │ ├── flags: ∅ - │ │ └── body: (length: 1) - │ │ └── @ MatchPredicateNode (location: (220,1)-(220,8)) - │ │ ├── flags: newline - │ │ ├── value: - │ │ │ @ LocalVariableReadNode (location: (220,1)-(220,2)) - │ │ │ ├── flags: ∅ - │ │ │ ├── name: :a - │ │ │ └── depth: 0 - │ │ ├── pattern: - │ │ │ @ ArrayPatternNode (location: (220,6)-(220,8)) - │ │ │ ├── flags: ∅ - │ │ │ ├── constant: ∅ - │ │ │ ├── requireds: (length: 1) - │ │ │ │ └── @ LocalVariableTargetNode (location: (220,6)-(220,7)) - │ │ │ │ ├── flags: ∅ - │ │ │ │ ├── name: :b - │ │ │ │ └── depth: 0 - │ │ │ ├── rest: - │ │ │ │ @ ImplicitRestNode (location: (220,7)-(220,8)) - │ │ │ │ └── flags: ∅ - │ │ │ ├── posts: (length: 0) - │ │ │ ├── opening_loc: ∅ - │ │ │ └── closing_loc: ∅ - │ │ └── operator_loc: (220,3)-(220,5) = "in" - │ ├── opening_loc: (220,0)-(220,1) = "(" - │ └── closing_loc: (220,8)-(220,9) = ")" - ├── right: - │ @ CallNode (location: (220,13)-(220,14)) - │ ├── flags: variable_call, ignore_visibility - │ ├── receiver: ∅ - │ ├── call_operator_loc: ∅ - │ ├── name: :c - │ ├── message_loc: (220,13)-(220,14) = "c" - │ ├── opening_loc: ∅ - │ ├── arguments: ∅ - │ ├── closing_loc: ∅ - │ └── block: ∅ - └── operator_loc: (220,10)-(220,12) = "or" + │ │ ├── opening_loc: (224,7)-(224,8) = "{" + │ │ ├── elements: (length: 1) + │ │ │ └── @ AssocNode (location: (224,9)-(224,11)) + │ │ │ ├── flags: ∅ + │ │ │ ├── key: + │ │ │ │ @ SymbolNode (location: (224,9)-(224,11)) + │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── value_loc: (224,9)-(224,10) = "a" + │ │ │ │ ├── closing_loc: (224,10)-(224,11) = ":" + │ │ │ │ └── unescaped: "a" + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (224,9)-(224,11)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableReadNode (location: (224,9)-(224,11)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :a + │ │ │ │ └── depth: 0 + │ │ │ └── operator_loc: ∅ + │ │ └── closing_loc: (224,12)-(224,13) = "}" + │ ├── operator_loc: (224,5)-(224,6) = "^" + │ ├── lparen_loc: (224,6)-(224,7) = "(" + │ └── rparen_loc: (224,13)-(224,14) = ")" + └── operator_loc: (224,2)-(224,4) = "=>" diff --git a/snapshots/procs.txt b/snapshots/procs.txt index 6d554889bf..a52eb78484 100644 --- a/snapshots/procs.txt +++ b/snapshots/procs.txt @@ -123,6 +123,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ LambdaNode (location: (15,0)-(15,15)) │ ├── flags: newline @@ -144,6 +145,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ LambdaNode (location: (17,0)-(17,29)) │ ├── flags: newline @@ -408,6 +410,7 @@ │ │ ├── name: :b │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ LambdaNode (location: (27,0)-(27,19)) ├── flags: newline diff --git a/snapshots/ranges.txt b/snapshots/ranges.txt index 59af913fa4..5808698003 100644 --- a/snapshots/ranges.txt +++ b/snapshots/ranges.txt @@ -76,6 +76,7 @@ │ │ ├── opening_loc: (5,4)-(5,5) = "(" │ │ └── closing_loc: (5,11)-(5,12) = ")" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ RangeNode (location: (7,0)-(7,5)) │ ├── flags: newline, static_literal, exclude_end @@ -100,6 +101,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -118,6 +120,7 @@ │ │ │ └── value: 2 │ │ └── operator_loc: (9,4)-(9,7) = "..." │ ├── closing_loc: (9,8)-(9,9) = "]" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ HashNode (location: (11,0)-(11,15)) │ ├── flags: newline @@ -146,6 +149,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (11,7)-(11,10) = "..." │ │ └── operator_loc: ∅ @@ -204,6 +208,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (17,7)-(17,9) = ".." │ │ └── operator_loc: ∅ @@ -279,6 +284,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (27,0)-(27,8)) │ ├── flags: newline @@ -303,6 +309,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (29,0)-(29,9)) │ ├── flags: newline @@ -327,6 +334,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (31,0)-(31,9)) │ ├── flags: newline @@ -351,6 +359,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (33,0)-(33,8)) │ ├── flags: newline @@ -375,6 +384,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (35,0)-(35,8)) │ ├── flags: newline @@ -399,6 +409,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (37,0)-(37,7)) │ ├── flags: newline @@ -423,6 +434,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (39,0)-(39,7)) │ ├── flags: newline @@ -447,6 +459,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (41,0)-(41,8)) │ ├── flags: newline @@ -471,6 +484,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (43,0)-(43,8)) │ ├── flags: newline @@ -495,6 +509,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (45,0)-(45,8)) │ ├── flags: newline @@ -519,6 +534,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (47,0)-(47,8)) │ ├── flags: newline @@ -543,6 +559,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ RangeNode (location: (49,0)-(49,7)) │ ├── flags: newline @@ -563,6 +580,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (49,1)-(49,3) = ".." └── @ RangeNode (location: (51,0)-(51,7)) @@ -584,5 +602,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (51,1)-(51,3) = ".." diff --git a/snapshots/regex.txt b/snapshots/regex.txt index e8835648ee..b26c1dd78b 100644 --- a/snapshots/regex.txt +++ b/snapshots/regex.txt @@ -23,6 +23,7 @@ │ │ ├── closing_loc: (1,8)-(1,9) = "/" │ │ └── unescaped: "bar" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ RegularExpressionNode (location: (3,0)-(3,8)) │ ├── flags: newline, static_literal, ignore_case, forced_us_ascii_encoding @@ -80,6 +81,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (9,10)-(9,11) = "}" │ │ └── @ StringNode (location: (9,11)-(9,15)) @@ -121,8 +123,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── targets: (length: 1) │ │ │ └── @ LocalVariableTargetNode (location: (11,5)-(11,8)) @@ -189,6 +193,7 @@ │ │ ├── closing_loc: (26,15)-(26,16) = "\"" │ │ └── unescaped: "hi" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ RegularExpressionNode (location: (28,0)-(28,9)) │ ├── flags: newline, static_literal, forced_us_ascii_encoding @@ -222,6 +227,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (30,10)-(30,11) = "}" │ └── closing_loc: (30,11)-(30,13) = "/o" @@ -252,6 +258,7 @@ │ │ │ ├── closing_loc: (33,9)-(33,10) = "\"" │ │ │ └── unescaped: "" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── targets: (length: 1) │ └── @ LocalVariableTargetNode (location: (32,0)-(33,4)) @@ -289,6 +296,7 @@ │ │ │ ├── closing_loc: (35,23)-(35,24) = "\"" │ │ │ └── unescaped: "" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── targets: (length: 1) │ └── @ LocalVariableTargetNode (location: (35,4)-(35,7)) @@ -323,6 +331,7 @@ │ │ ├── closing_loc: (37,15)-(37,16) = "\"" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ LocalVariableWriteNode (location: (39,0)-(39,5)) │ ├── flags: newline @@ -343,6 +352,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (40,4)-(40,24)) │ ├── flags: ∅ @@ -381,8 +391,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── targets: (length: 1) │ │ └── @ LocalVariableTargetNode (location: (40,10)-(40,11)) @@ -418,6 +430,7 @@ │ │ │ ├── closing_loc: (42,15)-(42,16) = "\"" │ │ │ └── unescaped: "" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── targets: (length: 1) │ └── @ LocalVariableTargetNode (location: (42,4)-(42,7)) @@ -448,6 +461,7 @@ │ │ ├── closing_loc: (43,15)-(43,16) = "\"" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (45,0)-(45,16)) │ ├── flags: newline @@ -473,6 +487,7 @@ │ │ ├── closing_loc: (45,15)-(45,16) = "\"" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ DefNode (location: (46,0)-(46,32)) │ ├── flags: newline @@ -524,6 +539,7 @@ │ │ │ │ ├── closing_loc: (46,31)-(46,32) = "\"" │ │ │ │ └── unescaped: "" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── targets: (length: 1) │ │ └── @ LocalVariableTargetNode (location: (46,20)-(46,23)) diff --git a/snapshots/regex_char_width.txt b/snapshots/regex_char_width.txt index 664e4e8850..d08fe8dda7 100644 --- a/snapshots/regex_char_width.txt +++ b/snapshots/regex_char_width.txt @@ -32,6 +32,7 @@ │ │ │ ├── closing_loc: (2,35)-(2,36) = "'" │ │ │ └── unescaped: "\x{E285}\xA7a\x{E285}\xA9b" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── targets: (length: 2) │ ├── @ LocalVariableTargetNode (location: (2,7)-(2,8)) diff --git a/snapshots/regex_escape_encoding.txt b/snapshots/regex_escape_encoding.txt index 0f2dcc2c54..ee073c6c58 100644 --- a/snapshots/regex_escape_encoding.txt +++ b/snapshots/regex_escape_encoding.txt @@ -40,4 +40,5 @@ │ ├── closing_loc: (3,20)-(3,21) = "/" │ └── unescaped: "hello \\u{fc}" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/rescue.txt b/snapshots/rescue.txt index d664e6a9ef..0ee20ee218 100644 --- a/snapshots/rescue.txt +++ b/snapshots/rescue.txt @@ -1,10 +1,10 @@ -@ ProgramNode (location: (1,0)-(35,18)) +@ ProgramNode (location: (1,0)-(39,3)) ├── flags: ∅ ├── locals: [:a, :z] └── statements: - @ StatementsNode (location: (1,0)-(35,18)) + @ StatementsNode (location: (1,0)-(39,3)) ├── flags: ∅ - └── body: (length: 14) + └── body: (length: 15) ├── @ RescueModifierNode (location: (1,0)-(1,14)) │ ├── flags: newline │ ├── expression: @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (1,4)-(1,10) = "rescue" │ └── rescue_expression: @@ -34,6 +35,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (3,4)-(3,10) = "rescue" │ └── rescue_expression: @@ -48,6 +50,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (6,4)-(6,24)) │ ├── flags: ∅ @@ -79,6 +82,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (8,4)-(8,23)) │ ├── flags: ∅ @@ -124,6 +128,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (12,4)-(12,10) = "rescue" │ └── rescue_expression: @@ -149,6 +154,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (14,4)-(14,10) = "rescue" │ └── rescue_expression: @@ -195,6 +201,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (16,10)-(16,19)) @@ -214,6 +221,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── operator_loc: ∅ │ │ ├── reference: ∅ @@ -232,6 +240,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (18,4)-(20,3)) │ ├── flags: ∅ @@ -282,8 +291,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (19,7)-(19,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (19,9)-(19,15) = "rescue" │ │ └── rescue_expression: @@ -316,8 +327,10 @@ │ │ │ │ ├── closing_loc: (19,39)-(19,40) = "\"" │ │ │ │ └── unescaped: "baz" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (18,4)-(18,6) = "do" │ └── closing_loc: (20,0)-(20,3) = "end" @@ -343,6 +356,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── keyword_loc: (22,11)-(22,17) = "rescue" │ │ │ └── rescue_expression: @@ -363,6 +377,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: ∅ │ └── end_keyword_loc: (24,0)-(24,3) = "end" @@ -394,6 +409,7 @@ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ └── value: 42 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (26,34)-(26,40) = "rescue" │ │ └── rescue_expression: @@ -456,9 +472,11 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ └── operator_loc: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (30,0)-(30,6)) @@ -496,6 +514,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ ├── statements: @@ -511,6 +530,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── subsequent: ∅ │ │ └── end_keyword_loc: ∅ @@ -525,62 +545,94 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ - └── @ LocalVariableWriteNode (location: (35,0)-(35,18)) + ├── @ LocalVariableWriteNode (location: (35,0)-(35,18)) + │ ├── flags: newline + │ ├── name: :z + │ ├── depth: 0 + │ ├── name_loc: (35,0)-(35,1) = "z" + │ ├── value: + │ │ @ RescueModifierNode (location: (35,4)-(35,18)) + │ │ ├── flags: ∅ + │ │ ├── expression: + │ │ │ @ CallNode (location: (35,4)-(35,7)) + │ │ │ ├── flags: ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :x + │ │ │ ├── message_loc: (35,4)-(35,5) = "x" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (35,6)-(35,7)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ CallNode (location: (35,6)-(35,7)) + │ │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ │ ├── receiver: ∅ + │ │ │ │ ├── call_operator_loc: ∅ + │ │ │ │ ├── name: :y + │ │ │ │ ├── message_loc: (35,6)-(35,7) = "y" + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── arguments: ∅ + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ + │ │ │ │ └── block: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── keyword_loc: (35,8)-(35,14) = "rescue" + │ │ └── rescue_expression: + │ │ @ CallNode (location: (35,15)-(35,18)) + │ │ ├── flags: ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :c + │ │ ├── message_loc: (35,15)-(35,16) = "c" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (35,17)-(35,18)) + │ │ │ ├── flags: ∅ + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ CallNode (location: (35,17)-(35,18)) + │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :d + │ │ │ ├── message_loc: (35,17)-(35,18) = "d" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ + │ │ └── block: ∅ + │ └── operator_loc: (35,2)-(35,3) = "=" + └── @ BeginNode (location: (37,0)-(39,3)) ├── flags: newline - ├── name: :z - ├── depth: 0 - ├── name_loc: (35,0)-(35,1) = "z" - ├── value: - │ @ RescueModifierNode (location: (35,4)-(35,18)) + ├── begin_keyword_loc: (37,0)-(37,5) = "begin" + ├── statements: ∅ + ├── rescue_clause: + │ @ RescueNode (location: (38,0)-(38,13)) │ ├── flags: ∅ - │ ├── expression: - │ │ @ CallNode (location: (35,4)-(35,7)) - │ │ ├── flags: ignore_visibility - │ │ ├── receiver: ∅ - │ │ ├── call_operator_loc: ∅ - │ │ ├── name: :x - │ │ ├── message_loc: (35,4)-(35,5) = "x" - │ │ ├── opening_loc: ∅ - │ │ ├── arguments: - │ │ │ @ ArgumentsNode (location: (35,6)-(35,7)) + │ ├── keyword_loc: (38,0)-(38,6) = "rescue" + │ ├── exceptions: (length: 0) + │ ├── operator_loc: (38,7)-(38,9) = "=>" + │ ├── reference: + │ │ @ IndexTargetNode (location: (38,10)-(38,13)) + │ │ ├── flags: attribute_write + │ │ ├── receiver: + │ │ │ @ ConstantReadNode (location: (38,10)-(38,11)) │ │ │ ├── flags: ∅ - │ │ │ └── arguments: (length: 1) - │ │ │ └── @ CallNode (location: (35,6)-(35,7)) - │ │ │ ├── flags: variable_call, ignore_visibility - │ │ │ ├── receiver: ∅ - │ │ │ ├── call_operator_loc: ∅ - │ │ │ ├── name: :y - │ │ │ ├── message_loc: (35,6)-(35,7) = "y" - │ │ │ ├── opening_loc: ∅ - │ │ │ ├── arguments: ∅ - │ │ │ ├── closing_loc: ∅ - │ │ │ └── block: ∅ - │ │ ├── closing_loc: ∅ + │ │ │ └── name: :A + │ │ ├── opening_loc: (38,11)-(38,12) = "[" + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: (38,12)-(38,13) = "]" │ │ └── block: ∅ - │ ├── keyword_loc: (35,8)-(35,14) = "rescue" - │ └── rescue_expression: - │ @ CallNode (location: (35,15)-(35,18)) - │ ├── flags: ignore_visibility - │ ├── receiver: ∅ - │ ├── call_operator_loc: ∅ - │ ├── name: :c - │ ├── message_loc: (35,15)-(35,16) = "c" - │ ├── opening_loc: ∅ - │ ├── arguments: - │ │ @ ArgumentsNode (location: (35,17)-(35,18)) - │ │ ├── flags: ∅ - │ │ └── arguments: (length: 1) - │ │ └── @ CallNode (location: (35,17)-(35,18)) - │ │ ├── flags: variable_call, ignore_visibility - │ │ ├── receiver: ∅ - │ │ ├── call_operator_loc: ∅ - │ │ ├── name: :d - │ │ ├── message_loc: (35,17)-(35,18) = "d" - │ │ ├── opening_loc: ∅ - │ │ ├── arguments: ∅ - │ │ ├── closing_loc: ∅ - │ │ └── block: ∅ - │ ├── closing_loc: ∅ - │ └── block: ∅ - └── operator_loc: (35,2)-(35,3) = "=" + │ ├── then_keyword_loc: ∅ + │ ├── statements: ∅ + │ └── subsequent: ∅ + ├── else_clause: ∅ + ├── ensure_clause: ∅ + └── end_keyword_loc: (39,0)-(39,3) = "end" diff --git a/snapshots/rescue_modifier.txt b/snapshots/rescue_modifier.txt index 0a27a3bb49..c6d6e67ef2 100644 --- a/snapshots/rescue_modifier.txt +++ b/snapshots/rescue_modifier.txt @@ -18,6 +18,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ ├── statements: @@ -36,6 +37,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (1,2)-(1,8) = "rescue" │ │ └── rescue_expression: @@ -48,6 +50,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: ∅ │ └── end_keyword_loc: ∅ @@ -64,6 +67,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ ├── statements: @@ -88,6 +92,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── keyword_loc: (3,6)-(3,12) = "rescue" │ │ │ └── rescue_expression: @@ -100,6 +105,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (3,2)-(3,3) = "=" │ ├── subsequent: ∅ @@ -117,6 +123,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ ├── statements: @@ -150,6 +157,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (5,7)-(5,13) = "rescue" │ │ └── rescue_expression: @@ -162,6 +170,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: ∅ │ └── end_keyword_loc: ∅ @@ -178,6 +187,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: ∅ ├── statements: @@ -206,6 +216,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (7,10)-(7,16) = "rescue" │ │ └── rescue_expression: @@ -218,6 +229,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (7,0)-(7,3) = "def" diff --git a/snapshots/return.txt b/snapshots/return.txt index ff297438b3..25d43e00e1 100644 --- a/snapshots/return.txt +++ b/snapshots/return.txt @@ -1,10 +1,10 @@ -@ ProgramNode (location: (1,0)-(23,9)) +@ ProgramNode (location: (1,0)-(27,17)) ├── flags: ∅ ├── locals: [] └── statements: - @ StatementsNode (location: (1,0)-(23,9)) + @ StatementsNode (location: (1,0)-(27,17)) ├── flags: ∅ - └── body: (length: 10) + └── body: (length: 12) ├── @ ReturnNode (location: (1,0)-(1,6)) │ ├── flags: newline │ ├── keyword_loc: (1,0)-(1,6) = "return" @@ -159,21 +159,73 @@ │ ├── body: ∅ │ ├── opening_loc: (21,6)-(21,7) = "(" │ └── closing_loc: (21,7)-(21,8) = ")" - └── @ ReturnNode (location: (23,0)-(23,9)) + ├── @ ReturnNode (location: (23,0)-(23,9)) + │ ├── flags: newline + │ ├── keyword_loc: (23,0)-(23,6) = "return" + │ └── arguments: + │ @ ArgumentsNode (location: (23,6)-(23,9)) + │ ├── flags: ∅ + │ └── arguments: (length: 1) + │ └── @ ParenthesesNode (location: (23,6)-(23,9)) + │ ├── flags: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (23,7)-(23,8)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ IntegerNode (location: (23,7)-(23,8)) + │ │ ├── flags: newline, static_literal, decimal + │ │ └── value: 1 + │ ├── opening_loc: (23,6)-(23,7) = "(" + │ └── closing_loc: (23,8)-(23,9) = ")" + ├── @ ParenthesesNode (location: (25,0)-(25,10)) + │ ├── flags: newline + │ ├── body: + │ │ @ StatementsNode (location: (25,1)-(25,9)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ ReturnNode (location: (25,1)-(25,9)) + │ │ ├── flags: newline + │ │ ├── keyword_loc: (25,1)-(25,7) = "return" + │ │ └── arguments: + │ │ @ ArgumentsNode (location: (25,8)-(25,9)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ IntegerNode (location: (25,8)-(25,9)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 1 + │ ├── opening_loc: (25,0)-(25,1) = "(" + │ └── closing_loc: (25,9)-(25,10) = ")" + └── @ AndNode (location: (27,0)-(27,17)) ├── flags: newline - ├── keyword_loc: (23,0)-(23,6) = "return" - └── arguments: - @ ArgumentsNode (location: (23,6)-(23,9)) - ├── flags: ∅ - └── arguments: (length: 1) - └── @ ParenthesesNode (location: (23,6)-(23,9)) - ├── flags: ∅ - ├── body: - │ @ StatementsNode (location: (23,7)-(23,8)) - │ ├── flags: ∅ - │ └── body: (length: 1) - │ └── @ IntegerNode (location: (23,7)-(23,8)) - │ ├── flags: newline, static_literal, decimal - │ └── value: 1 - ├── opening_loc: (23,6)-(23,7) = "(" - └── closing_loc: (23,8)-(23,9) = ")" + ├── left: + │ @ CallNode (location: (27,0)-(27,3)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (27,0)-(27,3) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + ├── right: + │ @ ParenthesesNode (location: (27,7)-(27,17)) + │ ├── flags: ∅ + │ ├── body: + │ │ @ StatementsNode (location: (27,8)-(27,16)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ ReturnNode (location: (27,8)-(27,16)) + │ │ ├── flags: newline + │ │ ├── keyword_loc: (27,8)-(27,14) = "return" + │ │ └── arguments: + │ │ @ ArgumentsNode (location: (27,15)-(27,16)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ IntegerNode (location: (27,15)-(27,16)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 1 + │ ├── opening_loc: (27,7)-(27,8) = "(" + │ └── closing_loc: (27,16)-(27,17) = ")" + └── operator_loc: (27,4)-(27,6) = "&&" diff --git a/snapshots/seattlerb/TestRubyParserShared.txt b/snapshots/seattlerb/TestRubyParserShared.txt index 7a488a20aa..548b112dde 100644 --- a/snapshots/seattlerb/TestRubyParserShared.txt +++ b/snapshots/seattlerb/TestRubyParserShared.txt @@ -177,6 +177,7 @@ │ │ │ │ ├── name: :b │ │ │ │ └── depth: 0 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── locals: [:a, :b] │ │ ├── def_keyword_loc: (52,2)-(52,5) = "def" @@ -287,6 +288,7 @@ │ │ │ │ ├── name: :b │ │ │ │ └── depth: 0 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── locals: [:a, :b] │ │ ├── def_keyword_loc: (67,2)-(67,5) = "def" @@ -395,4 +397,5 @@ │ ├── closing_loc: ∅ │ └── unescaped: "line3" ├── closing_loc: (92,0)-(92,1) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/and_multi.txt b/snapshots/seattlerb/and_multi.txt index f98ad67e10..a32921fa07 100644 --- a/snapshots/seattlerb/and_multi.txt +++ b/snapshots/seattlerb/and_multi.txt @@ -25,6 +25,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (1,5)-(1,8) = "and" ├── right: diff --git a/snapshots/seattlerb/array_lits_trailing_calls.txt b/snapshots/seattlerb/array_lits_trailing_calls.txt index 2de5a054a6..08c95ac88b 100644 --- a/snapshots/seattlerb/array_lits_trailing_calls.txt +++ b/snapshots/seattlerb/array_lits_trailing_calls.txt @@ -19,6 +19,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (3,0)-(3,4)) ├── flags: newline @@ -34,4 +35,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/assoc__bare.txt b/snapshots/seattlerb/assoc__bare.txt index 530360ef66..72d8f387a5 100644 --- a/snapshots/seattlerb/assoc__bare.txt +++ b/snapshots/seattlerb/assoc__bare.txt @@ -31,6 +31,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: ∅ └── closing_loc: (1,5)-(1,6) = "}" diff --git a/snapshots/seattlerb/assoc_label.txt b/snapshots/seattlerb/assoc_label.txt index 91b94bbc1c..ae9fc3a318 100644 --- a/snapshots/seattlerb/assoc_label.txt +++ b/snapshots/seattlerb/assoc_label.txt @@ -34,4 +34,5 @@ │ │ └── value: 1 │ └── operator_loc: ∅ ├── closing_loc: (1,5)-(1,6) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/attr_asgn_colon_id.txt b/snapshots/seattlerb/attr_asgn_colon_id.txt index 67802fc8a4..9e2c641649 100644 --- a/snapshots/seattlerb/attr_asgn_colon_id.txt +++ b/snapshots/seattlerb/attr_asgn_colon_id.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: (1,5)-(1,6) = "=" └── block: ∅ diff --git a/snapshots/seattlerb/attrasgn_array_arg.txt b/snapshots/seattlerb/attrasgn_array_arg.txt index 43853b4ef9..e5224e9353 100644 --- a/snapshots/seattlerb/attrasgn_array_arg.txt +++ b/snapshots/seattlerb/attrasgn_array_arg.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[]= @@ -41,4 +42,5 @@ │ ├── flags: static_literal, decimal │ └── value: 3 ├── closing_loc: (1,8)-(1,9) = "]" + ├── equal_loc: (1,10)-(1,11) = "=" └── block: ∅ diff --git a/snapshots/seattlerb/attrasgn_array_lhs.txt b/snapshots/seattlerb/attrasgn_array_lhs.txt index 5729407edc..1cc64d3e07 100644 --- a/snapshots/seattlerb/attrasgn_array_lhs.txt +++ b/snapshots/seattlerb/attrasgn_array_lhs.txt @@ -45,6 +45,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (1,21)-(1,23)) @@ -56,6 +57,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (1,18)-(1,20) = ".." │ └── @ ArrayNode (location: (1,27)-(1,42)) @@ -82,4 +84,5 @@ │ ├── opening_loc: (1,27)-(1,28) = "[" │ └── closing_loc: (1,41)-(1,42) = "]" ├── closing_loc: (1,23)-(1,24) = "]" + ├── equal_loc: (1,25)-(1,26) = "=" └── block: ∅ diff --git a/snapshots/seattlerb/attrasgn_primary_dot_constant.txt b/snapshots/seattlerb/attrasgn_primary_dot_constant.txt index 2c06df2609..299bfe79d8 100644 --- a/snapshots/seattlerb/attrasgn_primary_dot_constant.txt +++ b/snapshots/seattlerb/attrasgn_primary_dot_constant.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,1)-(1,2) = "." ├── name: :B= @@ -30,4 +31,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: (1,4)-(1,5) = "=" └── block: ∅ diff --git a/snapshots/seattlerb/backticks_interpolation_line.txt b/snapshots/seattlerb/backticks_interpolation_line.txt index 8c6a163c48..d18aef6139 100644 --- a/snapshots/seattlerb/backticks_interpolation_line.txt +++ b/snapshots/seattlerb/backticks_interpolation_line.txt @@ -36,8 +36,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,6)-(1,7) = "}" │ └── closing_loc: (1,7)-(1,8) = "`" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/bang_eq.txt b/snapshots/seattlerb/bang_eq.txt index 6bbd4a6ea2..5a534501f3 100644 --- a/snapshots/seattlerb/bang_eq.txt +++ b/snapshots/seattlerb/bang_eq.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/bdot2.txt b/snapshots/seattlerb/bdot2.txt index b1c05c0fc4..fb363fc4d9 100644 --- a/snapshots/seattlerb/bdot2.txt +++ b/snapshots/seattlerb/bdot2.txt @@ -26,6 +26,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (2,2)-(2,4) = ".." └── @ CallNode (location: (3,2)-(3,3)) @@ -37,4 +38,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/bdot3.txt b/snapshots/seattlerb/bdot3.txt index 0b35268f19..08df7f22f0 100644 --- a/snapshots/seattlerb/bdot3.txt +++ b/snapshots/seattlerb/bdot3.txt @@ -26,6 +26,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (2,2)-(2,5) = "..." └── @ CallNode (location: (3,2)-(3,3)) @@ -37,4 +38,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/block_arg_kwsplat.txt b/snapshots/seattlerb/block_arg_kwsplat.txt index 20756c8378..671338da94 100644 --- a/snapshots/seattlerb/block_arg_kwsplat.txt +++ b/snapshots/seattlerb/block_arg_kwsplat.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,11)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_arg_opt_arg_block.txt b/snapshots/seattlerb/block_arg_opt_arg_block.txt index dd89df907d..f04012b531 100644 --- a/snapshots/seattlerb/block_arg_opt_arg_block.txt +++ b/snapshots/seattlerb/block_arg_opt_arg_block.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,21)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_arg_opt_splat.txt b/snapshots/seattlerb/block_arg_opt_splat.txt index cefc1a8515..0d4308afc5 100644 --- a/snapshots/seattlerb/block_arg_opt_splat.txt +++ b/snapshots/seattlerb/block_arg_opt_splat.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,20)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_arg_opt_splat_arg_block_omfg.txt b/snapshots/seattlerb/block_arg_opt_splat_arg_block_omfg.txt index bf66e376fd..a8c6ba341e 100644 --- a/snapshots/seattlerb/block_arg_opt_splat_arg_block_omfg.txt +++ b/snapshots/seattlerb/block_arg_opt_splat_arg_block_omfg.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,25)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_arg_optional.txt b/snapshots/seattlerb/block_arg_optional.txt index 5fecfc31ab..99f2449a0c 100644 --- a/snapshots/seattlerb/block_arg_optional.txt +++ b/snapshots/seattlerb/block_arg_optional.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,13)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_arg_scope.txt b/snapshots/seattlerb/block_arg_scope.txt index e90d6445b2..ccdb3c6aa2 100644 --- a/snapshots/seattlerb/block_arg_scope.txt +++ b/snapshots/seattlerb/block_arg_scope.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,12)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_arg_scope2.txt b/snapshots/seattlerb/block_arg_scope2.txt index c9f7242d8a..a3874e6311 100644 --- a/snapshots/seattlerb/block_arg_scope2.txt +++ b/snapshots/seattlerb/block_arg_scope2.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,14)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_arg_splat_arg.txt b/snapshots/seattlerb/block_arg_splat_arg.txt index 6ae1b1dade..4865dc04b2 100644 --- a/snapshots/seattlerb/block_arg_splat_arg.txt +++ b/snapshots/seattlerb/block_arg_splat_arg.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,16)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_args_kwargs.txt b/snapshots/seattlerb/block_args_kwargs.txt index 45876c6dc1..3b1ea21611 100644 --- a/snapshots/seattlerb/block_args_kwargs.txt +++ b/snapshots/seattlerb/block_args_kwargs.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,23)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_args_no_kwargs.txt b/snapshots/seattlerb/block_args_no_kwargs.txt index 298bc26ce0..e1e997d8cf 100644 --- a/snapshots/seattlerb/block_args_no_kwargs.txt +++ b/snapshots/seattlerb/block_args_no_kwargs.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,13)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_args_opt1.txt b/snapshots/seattlerb/block_args_opt1.txt index d23bd5edce..151f34188a 100644 --- a/snapshots/seattlerb/block_args_opt1.txt +++ b/snapshots/seattlerb/block_args_opt1.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,24)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_args_opt2.txt b/snapshots/seattlerb/block_args_opt2.txt index 7170768b1c..b8bc9bc343 100644 --- a/snapshots/seattlerb/block_args_opt2.txt +++ b/snapshots/seattlerb/block_args_opt2.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,18)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_args_opt2_2.txt b/snapshots/seattlerb/block_args_opt2_2.txt index 34d04dbe54..5c36d15e1b 100644 --- a/snapshots/seattlerb/block_args_opt2_2.txt +++ b/snapshots/seattlerb/block_args_opt2_2.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,35)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_args_opt3.txt b/snapshots/seattlerb/block_args_opt3.txt index 508d062ce2..229e05b02f 100644 --- a/snapshots/seattlerb/block_args_opt3.txt +++ b/snapshots/seattlerb/block_args_opt3.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,42)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_call_defn_call_block_call.txt b/snapshots/seattlerb/block_call_defn_call_block_call.txt index 4e6ad90afd..93d74188bc 100644 --- a/snapshots/seattlerb/block_call_defn_call_block_call.txt +++ b/snapshots/seattlerb/block_call_defn_call_block_call.txt @@ -47,6 +47,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── locals: [:c] │ │ ├── def_keyword_loc: (1,2)-(1,5) = "def" @@ -56,6 +57,7 @@ │ │ ├── equal_loc: ∅ │ │ └── end_keyword_loc: (3,1)-(3,4) = "end" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (4,1)-(4,11)) ├── flags: newline @@ -69,6 +71,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (4,2)-(4,3) = "." ├── name: :f @@ -76,6 +79,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (4,5)-(4,11)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_call_dot_op2_brace_block.txt b/snapshots/seattlerb/block_call_dot_op2_brace_block.txt index 5f05b1f6ff..ff837f9de2 100644 --- a/snapshots/seattlerb/block_call_dot_op2_brace_block.txt +++ b/snapshots/seattlerb/block_call_dot_op2_brace_block.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,1)-(1,2) = "." │ ├── name: :b @@ -38,8 +39,10 @@ │ │ ├── opening_loc: (1,5)-(1,6) = "(" │ │ ├── arguments: ∅ │ │ ├── closing_loc: (1,6)-(1,7) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,8)-(1,16)) │ ├── flags: ∅ @@ -58,6 +61,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,8)-(1,10) = "do" │ └── closing_loc: (1,13)-(1,16) = "end" @@ -67,6 +71,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,19)-(1,31)) ├── flags: ∅ @@ -103,6 +108,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (1,19)-(1,21) = "do" └── closing_loc: (1,28)-(1,31) = "end" diff --git a/snapshots/seattlerb/block_call_dot_op2_cmd_args_do_block.txt b/snapshots/seattlerb/block_call_dot_op2_cmd_args_do_block.txt index ca141580b7..f55ce46120 100644 --- a/snapshots/seattlerb/block_call_dot_op2_cmd_args_do_block.txt +++ b/snapshots/seattlerb/block_call_dot_op2_cmd_args_do_block.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,1)-(1,2) = "." │ ├── name: :b @@ -38,8 +39,10 @@ │ │ ├── opening_loc: (1,5)-(1,6) = "(" │ │ ├── arguments: ∅ │ │ ├── closing_loc: (1,6)-(1,7) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,8)-(1,16)) │ ├── flags: ∅ @@ -58,6 +61,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,8)-(1,10) = "do" │ └── closing_loc: (1,13)-(1,16) = "end" @@ -78,8 +82,10 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,21)-(1,33)) ├── flags: ∅ @@ -116,6 +122,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (1,21)-(1,23) = "do" └── closing_loc: (1,30)-(1,33) = "end" diff --git a/snapshots/seattlerb/block_call_operation_colon.txt b/snapshots/seattlerb/block_call_operation_colon.txt index cecd421263..6c1740536f 100644 --- a/snapshots/seattlerb/block_call_operation_colon.txt +++ b/snapshots/seattlerb/block_call_operation_colon.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,1)-(1,2) = "." │ ├── name: :b @@ -38,8 +39,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,6)-(1,12)) │ ├── flags: ∅ @@ -54,4 +57,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/block_call_operation_dot.txt b/snapshots/seattlerb/block_call_operation_dot.txt index 5c661fb49a..09f19632ad 100644 --- a/snapshots/seattlerb/block_call_operation_dot.txt +++ b/snapshots/seattlerb/block_call_operation_dot.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,1)-(1,2) = "." │ ├── name: :b @@ -38,8 +39,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,6)-(1,12)) │ ├── flags: ∅ @@ -54,4 +57,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/block_call_paren_call_block_call.txt b/snapshots/seattlerb/block_call_paren_call_block_call.txt index 93c4b05f9b..3fb5905a4c 100644 --- a/snapshots/seattlerb/block_call_paren_call_block_call.txt +++ b/snapshots/seattlerb/block_call_paren_call_block_call.txt @@ -31,10 +31,12 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (1,2)-(1,3) = "(" │ │ └── closing_loc: (1,4)-(1,5) = ")" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (2,0)-(2,10)) ├── flags: newline @@ -48,6 +50,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (2,1)-(2,2) = "." ├── name: :d @@ -55,6 +58,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (2,4)-(2,10)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_command_operation_colon.txt b/snapshots/seattlerb/block_command_operation_colon.txt index c71fbe2f4a..c40d5108ac 100644 --- a/snapshots/seattlerb/block_command_operation_colon.txt +++ b/snapshots/seattlerb/block_command_operation_colon.txt @@ -26,6 +26,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "b" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,5)-(1,11)) │ ├── flags: ∅ @@ -49,4 +50,5 @@ │ ├── closing_loc: ∅ │ └── unescaped: "d" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/block_command_operation_dot.txt b/snapshots/seattlerb/block_command_operation_dot.txt index 68d98c99b4..cd04ccd4ef 100644 --- a/snapshots/seattlerb/block_command_operation_dot.txt +++ b/snapshots/seattlerb/block_command_operation_dot.txt @@ -26,6 +26,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "b" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,5)-(1,11)) │ ├── flags: ∅ @@ -49,4 +50,5 @@ │ ├── closing_loc: ∅ │ └── unescaped: "d" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/block_decomp_anon_splat_arg.txt b/snapshots/seattlerb/block_decomp_anon_splat_arg.txt index 5628cacc97..4b3b985e52 100644 --- a/snapshots/seattlerb/block_decomp_anon_splat_arg.txt +++ b/snapshots/seattlerb/block_decomp_anon_splat_arg.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,14)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_decomp_arg_splat.txt b/snapshots/seattlerb/block_decomp_arg_splat.txt index b13e13d167..55a55081a9 100644 --- a/snapshots/seattlerb/block_decomp_arg_splat.txt +++ b/snapshots/seattlerb/block_decomp_arg_splat.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,14)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_decomp_arg_splat_arg.txt b/snapshots/seattlerb/block_decomp_arg_splat_arg.txt index ba0a6202ce..abf6412b1c 100644 --- a/snapshots/seattlerb/block_decomp_arg_splat_arg.txt +++ b/snapshots/seattlerb/block_decomp_arg_splat_arg.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,18)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_decomp_splat.txt b/snapshots/seattlerb/block_decomp_splat.txt index fd8ad4bda1..1ebce5f29a 100644 --- a/snapshots/seattlerb/block_decomp_splat.txt +++ b/snapshots/seattlerb/block_decomp_splat.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,12)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_kw.txt b/snapshots/seattlerb/block_kw.txt index d76998ecb6..b68e4409b7 100644 --- a/snapshots/seattlerb/block_kw.txt +++ b/snapshots/seattlerb/block_kw.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,5)-(1,15)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_kw__required.txt b/snapshots/seattlerb/block_kw__required.txt index f04987d854..b7e56e6907 100644 --- a/snapshots/seattlerb/block_kw__required.txt +++ b/snapshots/seattlerb/block_kw__required.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,5)-(1,16)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_kwarg_lvar.txt b/snapshots/seattlerb/block_kwarg_lvar.txt index 861348f2a2..74e1034aad 100644 --- a/snapshots/seattlerb/block_kwarg_lvar.txt +++ b/snapshots/seattlerb/block_kwarg_lvar.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,3)-(1,20)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_kwarg_lvar_multiple.txt b/snapshots/seattlerb/block_kwarg_lvar_multiple.txt index f1c1fef8a3..b3649eae6d 100644 --- a/snapshots/seattlerb/block_kwarg_lvar_multiple.txt +++ b/snapshots/seattlerb/block_kwarg_lvar_multiple.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,3)-(1,33)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_opt_arg.txt b/snapshots/seattlerb/block_opt_arg.txt index 39be11ac92..f1df1ff429 100644 --- a/snapshots/seattlerb/block_opt_arg.txt +++ b/snapshots/seattlerb/block_opt_arg.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,14)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_opt_splat.txt b/snapshots/seattlerb/block_opt_splat.txt index 3898212dc0..9cb8ab91e5 100644 --- a/snapshots/seattlerb/block_opt_splat.txt +++ b/snapshots/seattlerb/block_opt_splat.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,17)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_opt_splat_arg_block_omfg.txt b/snapshots/seattlerb/block_opt_splat_arg_block_omfg.txt index ed4857ad25..b79bebf6d6 100644 --- a/snapshots/seattlerb/block_opt_splat_arg_block_omfg.txt +++ b/snapshots/seattlerb/block_opt_splat_arg_block_omfg.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,22)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_optarg.txt b/snapshots/seattlerb/block_optarg.txt index 2172571eb1..76ff4779d6 100644 --- a/snapshots/seattlerb/block_optarg.txt +++ b/snapshots/seattlerb/block_optarg.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,14)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_paren_splat.txt b/snapshots/seattlerb/block_paren_splat.txt index b6c2da679b..fafe9fd1b2 100644 --- a/snapshots/seattlerb/block_paren_splat.txt +++ b/snapshots/seattlerb/block_paren_splat.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,15)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_reg_optarg.txt b/snapshots/seattlerb/block_reg_optarg.txt index 0173b92e8f..82a4d1c87d 100644 --- a/snapshots/seattlerb/block_reg_optarg.txt +++ b/snapshots/seattlerb/block_reg_optarg.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,17)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_return.txt b/snapshots/seattlerb/block_return.txt index 0eee33c844..d0528da318 100644 --- a/snapshots/seattlerb/block_return.txt +++ b/snapshots/seattlerb/block_return.txt @@ -32,8 +32,10 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,15)-(1,27)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_scope.txt b/snapshots/seattlerb/block_scope.txt index ef659bb38e..24e701d566 100644 --- a/snapshots/seattlerb/block_scope.txt +++ b/snapshots/seattlerb/block_scope.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,10)) ├── flags: ∅ diff --git a/snapshots/seattlerb/block_splat_reg.txt b/snapshots/seattlerb/block_splat_reg.txt index b5eb009c52..453132bb12 100644 --- a/snapshots/seattlerb/block_splat_reg.txt +++ b/snapshots/seattlerb/block_splat_reg.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,13)) ├── flags: ∅ diff --git a/snapshots/seattlerb/bug169.txt b/snapshots/seattlerb/bug169.txt index c55df4257d..66862b9211 100644 --- a/snapshots/seattlerb/bug169.txt +++ b/snapshots/seattlerb/bug169.txt @@ -22,6 +22,7 @@ │ ├── opening_loc: (1,2)-(1,3) = "(" │ └── closing_loc: (1,3)-(1,4) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,5)-(1,7)) ├── flags: ∅ diff --git a/snapshots/seattlerb/bug179.txt b/snapshots/seattlerb/bug179.txt index 4392d5ec27..99c541c247 100644 --- a/snapshots/seattlerb/bug179.txt +++ b/snapshots/seattlerb/bug179.txt @@ -29,4 +29,5 @@ │ │ └── flags: static_literal │ └── operator_loc: (1,4)-(1,6) = ".." ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/bug191.txt b/snapshots/seattlerb/bug191.txt index 27b7f97f45..ec99bd73e2 100644 --- a/snapshots/seattlerb/bug191.txt +++ b/snapshots/seattlerb/bug191.txt @@ -18,6 +18,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (1,2)-(1,3) = "?" │ ├── statements: @@ -47,6 +48,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: ∅ │ └── end_keyword_loc: ∅ @@ -63,6 +65,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: (3,2)-(3,3) = "?" ├── statements: @@ -92,6 +95,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: ∅ └── end_keyword_loc: ∅ diff --git a/snapshots/seattlerb/bug236.txt b/snapshots/seattlerb/bug236.txt index 792020dc78..fc93297fe1 100644 --- a/snapshots/seattlerb/bug236.txt +++ b/snapshots/seattlerb/bug236.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,1)-(1,7)) │ ├── flags: ∅ @@ -51,6 +52,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (3,1)-(3,6)) ├── flags: ∅ diff --git a/snapshots/seattlerb/bug290.txt b/snapshots/seattlerb/bug290.txt index 85d75c0d16..2460ec80bb 100644 --- a/snapshots/seattlerb/bug290.txt +++ b/snapshots/seattlerb/bug290.txt @@ -21,6 +21,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: ∅ ├── else_clause: ∅ diff --git a/snapshots/seattlerb/bug_187.txt b/snapshots/seattlerb/bug_187.txt index 6a5786e34a..489556c6f5 100644 --- a/snapshots/seattlerb/bug_187.txt +++ b/snapshots/seattlerb/bug_187.txt @@ -38,6 +38,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (2,1)-(2,2) = "." │ │ ├── name: :b @@ -45,6 +46,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (2,4)-(2,10)) │ │ ├── flags: ∅ @@ -61,4 +63,5 @@ │ ├── equal_loc: ∅ │ └── end_keyword_loc: (3,0)-(3,3) = "end" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/bug_249.txt b/snapshots/seattlerb/bug_249.txt index 06daa80e41..2cd226915e 100644 --- a/snapshots/seattlerb/bug_249.txt +++ b/snapshots/seattlerb/bug_249.txt @@ -37,6 +37,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: │ │ │ │ @ BlockNode (location: (1,17)-(4,4)) │ │ │ │ ├── flags: ∅ @@ -70,6 +71,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ KeywordHashNode (location: (4,11)-(4,28)) │ ├── flags: symbol_keys @@ -92,4 +94,5 @@ │ │ └── unescaped: "endpoint" │ └── operator_loc: (4,15)-(4,17) = "=>" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/bug_args__19.txt b/snapshots/seattlerb/bug_args__19.txt index 5b1d897718..55eb1b8787 100644 --- a/snapshots/seattlerb/bug_args__19.txt +++ b/snapshots/seattlerb/bug_args__19.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,16)) ├── flags: ∅ @@ -60,6 +61,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (1,2)-(1,3) = "{" └── closing_loc: (1,15)-(1,16) = "}" diff --git a/snapshots/seattlerb/bug_args_masgn.txt b/snapshots/seattlerb/bug_args_masgn.txt index 6456d82ecc..9914cbb1dc 100644 --- a/snapshots/seattlerb/bug_args_masgn.txt +++ b/snapshots/seattlerb/bug_args_masgn.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,17)) ├── flags: ∅ diff --git a/snapshots/seattlerb/bug_args_masgn2.txt b/snapshots/seattlerb/bug_args_masgn2.txt index bd9fc61161..ecb608247a 100644 --- a/snapshots/seattlerb/bug_args_masgn2.txt +++ b/snapshots/seattlerb/bug_args_masgn2.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,22)) ├── flags: ∅ diff --git a/snapshots/seattlerb/bug_args_masgn_outer_parens__19.txt b/snapshots/seattlerb/bug_args_masgn_outer_parens__19.txt index ad62bd4daa..8801adffa9 100644 --- a/snapshots/seattlerb/bug_args_masgn_outer_parens__19.txt +++ b/snapshots/seattlerb/bug_args_masgn_outer_parens__19.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,19)) ├── flags: ∅ diff --git a/snapshots/seattlerb/bug_call_arglist_parens.txt b/snapshots/seattlerb/bug_call_arglist_parens.txt index 6954854bae..28a3eafb84 100644 --- a/snapshots/seattlerb/bug_call_arglist_parens.txt +++ b/snapshots/seattlerb/bug_call_arglist_parens.txt @@ -41,6 +41,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (1,6)-(1,9) = "def" @@ -85,6 +86,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (6,6)-(6,9) = "def" @@ -119,4 +121,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/bug_comma.txt b/snapshots/seattlerb/bug_comma.txt index d370ea0ac0..4ffe4b972d 100644 --- a/snapshots/seattlerb/bug_comma.txt +++ b/snapshots/seattlerb/bug_comma.txt @@ -35,8 +35,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: (1,16)-(1,20) = "then" ├── statements: ∅ diff --git a/snapshots/seattlerb/bug_hash_args.txt b/snapshots/seattlerb/bug_hash_args.txt index cd90f0ebc6..f3002ef7f6 100644 --- a/snapshots/seattlerb/bug_hash_args.txt +++ b/snapshots/seattlerb/bug_hash_args.txt @@ -39,4 +39,5 @@ │ │ └── flags: static_literal │ └── operator_loc: ∅ ├── closing_loc: (1,18)-(1,19) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/bug_hash_args_trailing_comma.txt b/snapshots/seattlerb/bug_hash_args_trailing_comma.txt index 8c06cabf1c..2eccde82c0 100644 --- a/snapshots/seattlerb/bug_hash_args_trailing_comma.txt +++ b/snapshots/seattlerb/bug_hash_args_trailing_comma.txt @@ -39,4 +39,5 @@ │ │ └── flags: static_literal │ └── operator_loc: ∅ ├── closing_loc: (1,19)-(1,20) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/bug_masgn_right.txt b/snapshots/seattlerb/bug_masgn_right.txt index e5b635d802..b3c9924bd3 100644 --- a/snapshots/seattlerb/bug_masgn_right.txt +++ b/snapshots/seattlerb/bug_masgn_right.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,17)) ├── flags: ∅ diff --git a/snapshots/seattlerb/bug_not_parens.txt b/snapshots/seattlerb/bug_not_parens.txt index 163fb79564..39550d72b3 100644 --- a/snapshots/seattlerb/bug_not_parens.txt +++ b/snapshots/seattlerb/bug_not_parens.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :! @@ -24,4 +25,5 @@ ├── opening_loc: (1,3)-(1,4) = "(" ├── arguments: ∅ ├── closing_loc: (1,5)-(1,6) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/bug_op_asgn_rescue.txt b/snapshots/seattlerb/bug_op_asgn_rescue.txt index 9da753aece..b12d5e9a43 100644 --- a/snapshots/seattlerb/bug_op_asgn_rescue.txt +++ b/snapshots/seattlerb/bug_op_asgn_rescue.txt @@ -22,6 +22,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (1,8)-(1,14) = "rescue" │ └── rescue_expression: diff --git a/snapshots/seattlerb/call_and.txt b/snapshots/seattlerb/call_and.txt index 640f355c4a..c74913c47e 100644 --- a/snapshots/seattlerb/call_and.txt +++ b/snapshots/seattlerb/call_and.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_arg_assoc.txt b/snapshots/seattlerb/call_arg_assoc.txt index b8ec907031..3c780c6e19 100644 --- a/snapshots/seattlerb/call_arg_assoc.txt +++ b/snapshots/seattlerb/call_arg_assoc.txt @@ -34,4 +34,5 @@ │ │ └── value: 3 │ └── operator_loc: (1,6)-(1,8) = "=>" ├── closing_loc: (1,9)-(1,10) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_arg_assoc_kwsplat.txt b/snapshots/seattlerb/call_arg_assoc_kwsplat.txt index 11142b2721..e80ab7a106 100644 --- a/snapshots/seattlerb/call_arg_assoc_kwsplat.txt +++ b/snapshots/seattlerb/call_arg_assoc_kwsplat.txt @@ -44,4 +44,5 @@ │ │ └── value: 3 │ └── operator_loc: (1,12)-(1,14) = "**" ├── closing_loc: (1,15)-(1,16) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_arg_kwsplat.txt b/snapshots/seattlerb/call_arg_kwsplat.txt index 853f7103e3..097188f8cf 100644 --- a/snapshots/seattlerb/call_arg_kwsplat.txt +++ b/snapshots/seattlerb/call_arg_kwsplat.txt @@ -25,6 +25,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ KeywordHashNode (location: (1,5)-(1,8)) │ ├── flags: ∅ @@ -37,4 +38,5 @@ │ │ └── value: 1 │ └── operator_loc: (1,5)-(1,7) = "**" ├── closing_loc: (1,8)-(1,9) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_args_assoc_quoted.txt b/snapshots/seattlerb/call_args_assoc_quoted.txt index 615bee5b4a..adb1413554 100644 --- a/snapshots/seattlerb/call_args_assoc_quoted.txt +++ b/snapshots/seattlerb/call_args_assoc_quoted.txt @@ -42,6 +42,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ └── closing_loc: (1,6)-(1,7) = "}" │ │ │ └── closing_loc: (1,7)-(1,9) = "\":" @@ -51,6 +52,7 @@ │ │ │ └── value: 42 │ │ └── operator_loc: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,8)) │ ├── flags: newline, ignore_visibility @@ -81,6 +83,7 @@ │ │ │ └── value: 42 │ │ └── operator_loc: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (5,0)-(5,8)) ├── flags: newline, ignore_visibility @@ -111,4 +114,5 @@ │ │ └── value: 42 │ └── operator_loc: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_args_assoc_trailing_comma.txt b/snapshots/seattlerb/call_args_assoc_trailing_comma.txt index 00bc620f54..615ccb92c2 100644 --- a/snapshots/seattlerb/call_args_assoc_trailing_comma.txt +++ b/snapshots/seattlerb/call_args_assoc_trailing_comma.txt @@ -34,4 +34,5 @@ │ │ └── value: 3 │ └── operator_loc: (1,6)-(1,8) = "=>" ├── closing_loc: (1,10)-(1,11) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_args_command.txt b/snapshots/seattlerb/call_args_command.txt index 6fe112f224..33608409f3 100644 --- a/snapshots/seattlerb/call_args_command.txt +++ b/snapshots/seattlerb/call_args_command.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,1)-(1,2) = "." ├── name: :b @@ -38,6 +39,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,5)-(1,6) = "." │ ├── name: :d @@ -51,6 +53,8 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_array_arg.txt b/snapshots/seattlerb/call_array_arg.txt index cec613bc58..71f0c2f80e 100644 --- a/snapshots/seattlerb/call_array_arg.txt +++ b/snapshots/seattlerb/call_array_arg.txt @@ -37,4 +37,5 @@ │ ├── opening_loc: (1,5)-(1,6) = "[" │ └── closing_loc: (1,12)-(1,13) = "]" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_array_block_call.txt b/snapshots/seattlerb/call_array_block_call.txt index 4a044924e9..7461b0529a 100644 --- a/snapshots/seattlerb/call_array_block_call.txt +++ b/snapshots/seattlerb/call_array_block_call.txt @@ -30,6 +30,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (1,11)-(1,17)) │ │ ├── flags: ∅ @@ -41,4 +42,5 @@ │ ├── opening_loc: (1,2)-(1,3) = "[" │ └── closing_loc: (1,18)-(1,19) = "]" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_array_lambda_block_call.txt b/snapshots/seattlerb/call_array_lambda_block_call.txt index dca64e5f7b..a2575f5780 100644 --- a/snapshots/seattlerb/call_array_lambda_block_call.txt +++ b/snapshots/seattlerb/call_array_lambda_block_call.txt @@ -36,6 +36,7 @@ │ ├── opening_loc: (1,2)-(1,3) = "[" │ └── closing_loc: (1,10)-(1,11) = "]" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,12)-(2,3)) ├── flags: ∅ diff --git a/snapshots/seattlerb/call_array_lit_inline_hash.txt b/snapshots/seattlerb/call_array_lit_inline_hash.txt index f83c7a55e5..3b38a1c0af 100644 --- a/snapshots/seattlerb/call_array_lit_inline_hash.txt +++ b/snapshots/seattlerb/call_array_lit_inline_hash.txt @@ -45,4 +45,5 @@ │ ├── opening_loc: (1,2)-(1,3) = "[" │ └── closing_loc: (1,14)-(1,15) = "]" ├── closing_loc: (1,15)-(1,16) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_assoc.txt b/snapshots/seattlerb/call_assoc.txt index a4e4512a08..464b532574 100644 --- a/snapshots/seattlerb/call_assoc.txt +++ b/snapshots/seattlerb/call_assoc.txt @@ -31,4 +31,5 @@ │ │ └── value: 3 │ └── operator_loc: (1,3)-(1,5) = "=>" ├── closing_loc: (1,6)-(1,7) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_assoc_new.txt b/snapshots/seattlerb/call_assoc_new.txt index 6cbc942a6b..2b252e5d5e 100644 --- a/snapshots/seattlerb/call_assoc_new.txt +++ b/snapshots/seattlerb/call_assoc_new.txt @@ -34,4 +34,5 @@ │ │ └── value: 3 │ └── operator_loc: ∅ ├── closing_loc: (1,5)-(1,6) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_assoc_new_if_multiline.txt b/snapshots/seattlerb/call_assoc_new_if_multiline.txt index a258b734a3..078dba18e9 100644 --- a/snapshots/seattlerb/call_assoc_new_if_multiline.txt +++ b/snapshots/seattlerb/call_assoc_new_if_multiline.txt @@ -62,4 +62,5 @@ │ │ └── end_keyword_loc: (5,0)-(5,3) = "end" │ └── operator_loc: ∅ ├── closing_loc: (5,3)-(5,4) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_assoc_trailing_comma.txt b/snapshots/seattlerb/call_assoc_trailing_comma.txt index a240775d69..1e4c77855a 100644 --- a/snapshots/seattlerb/call_assoc_trailing_comma.txt +++ b/snapshots/seattlerb/call_assoc_trailing_comma.txt @@ -31,4 +31,5 @@ │ │ └── value: 2 │ └── operator_loc: (1,3)-(1,5) = "=>" ├── closing_loc: (1,7)-(1,8) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_bang_command_call.txt b/snapshots/seattlerb/call_bang_command_call.txt index e226d65278..a133c530cf 100644 --- a/snapshots/seattlerb/call_bang_command_call.txt +++ b/snapshots/seattlerb/call_bang_command_call.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,3)-(1,4) = "." │ ├── name: :b @@ -33,6 +34,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :! @@ -40,4 +42,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_bang_squiggle.txt b/snapshots/seattlerb/call_bang_squiggle.txt index 5c10841f73..95d08a81c9 100644 --- a/snapshots/seattlerb/call_bang_squiggle.txt +++ b/snapshots/seattlerb/call_bang_squiggle.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_begin_call_block_call.txt b/snapshots/seattlerb/call_begin_call_block_call.txt index 240a3aaa76..c9397059af 100644 --- a/snapshots/seattlerb/call_begin_call_block_call.txt +++ b/snapshots/seattlerb/call_begin_call_block_call.txt @@ -35,6 +35,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (2,1)-(2,2) = "." │ │ ├── name: :c @@ -42,6 +43,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (2,4)-(2,10)) │ │ ├── flags: ∅ @@ -55,4 +57,5 @@ │ ├── ensure_clause: ∅ │ └── end_keyword_loc: (3,0)-(3,3) = "end" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_block_arg_named.txt b/snapshots/seattlerb/call_block_arg_named.txt index db6fc7a059..9c93a4c040 100644 --- a/snapshots/seattlerb/call_block_arg_named.txt +++ b/snapshots/seattlerb/call_block_arg_named.txt @@ -1,11 +1,11 @@ -@ ProgramNode (location: (1,0)-(1,6)) +@ ProgramNode (location: (1,0)-(1,7)) ├── flags: ∅ ├── locals: [] └── statements: - @ StatementsNode (location: (1,0)-(1,6)) + @ StatementsNode (location: (1,0)-(1,7)) ├── flags: ∅ └── body: (length: 1) - └── @ CallNode (location: (1,0)-(1,6)) + └── @ CallNode (location: (1,0)-(1,7)) ├── flags: newline, ignore_visibility ├── receiver: ∅ ├── call_operator_loc: ∅ @@ -14,6 +14,7 @@ ├── opening_loc: (1,1)-(1,2) = "(" ├── arguments: ∅ ├── closing_loc: (1,6)-(1,7) = ")" + ├── equal_loc: ∅ └── block: @ BlockArgumentNode (location: (1,2)-(1,6)) ├── flags: ∅ @@ -27,5 +28,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (1,2)-(1,3) = "&" diff --git a/snapshots/seattlerb/call_carat.txt b/snapshots/seattlerb/call_carat.txt index 88ed832aca..c074ae8403 100644 --- a/snapshots/seattlerb/call_carat.txt +++ b/snapshots/seattlerb/call_carat.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_colon2.txt b/snapshots/seattlerb/call_colon2.txt index 85e39cd363..dcca399fbf 100644 --- a/snapshots/seattlerb/call_colon2.txt +++ b/snapshots/seattlerb/call_colon2.txt @@ -17,4 +17,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_colon_parens.txt b/snapshots/seattlerb/call_colon_parens.txt index 19141c3413..f2902d10e8 100644 --- a/snapshots/seattlerb/call_colon_parens.txt +++ b/snapshots/seattlerb/call_colon_parens.txt @@ -17,4 +17,5 @@ ├── opening_loc: (1,3)-(1,4) = "(" ├── arguments: ∅ ├── closing_loc: (1,4)-(1,5) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_div.txt b/snapshots/seattlerb/call_div.txt index 55a410977c..6ffb409e3e 100644 --- a/snapshots/seattlerb/call_div.txt +++ b/snapshots/seattlerb/call_div.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_dot_parens.txt b/snapshots/seattlerb/call_dot_parens.txt index 29b592a960..42652196ff 100644 --- a/snapshots/seattlerb/call_dot_parens.txt +++ b/snapshots/seattlerb/call_dot_parens.txt @@ -17,4 +17,5 @@ ├── opening_loc: (1,2)-(1,3) = "(" ├── arguments: ∅ ├── closing_loc: (1,3)-(1,4) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_env.txt b/snapshots/seattlerb/call_env.txt index 933621594f..413df446b7 100644 --- a/snapshots/seattlerb/call_env.txt +++ b/snapshots/seattlerb/call_env.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,1)-(1,2) = "." ├── name: :happy @@ -24,4 +25,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_eq3.txt b/snapshots/seattlerb/call_eq3.txt index 52e4b00c5c..7c9cb05eb8 100644 --- a/snapshots/seattlerb/call_eq3.txt +++ b/snapshots/seattlerb/call_eq3.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_gt.txt b/snapshots/seattlerb/call_gt.txt index 22371dd8ca..c80c2ab0b2 100644 --- a/snapshots/seattlerb/call_gt.txt +++ b/snapshots/seattlerb/call_gt.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_kwsplat.txt b/snapshots/seattlerb/call_kwsplat.txt index 17773e7693..7b53cfc361 100644 --- a/snapshots/seattlerb/call_kwsplat.txt +++ b/snapshots/seattlerb/call_kwsplat.txt @@ -27,4 +27,5 @@ │ │ └── value: 1 │ └── operator_loc: (1,2)-(1,4) = "**" ├── closing_loc: (1,5)-(1,6) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_leading_dots.txt b/snapshots/seattlerb/call_leading_dots.txt index 5562afcd70..7fbeee4337 100644 --- a/snapshots/seattlerb/call_leading_dots.txt +++ b/snapshots/seattlerb/call_leading_dots.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (2,0)-(2,1) = "." │ ├── name: :b @@ -27,6 +28,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (3,0)-(3,1) = "." ├── name: :c @@ -34,4 +36,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_leading_dots_comment.txt b/snapshots/seattlerb/call_leading_dots_comment.txt index f285e42cbf..497096733a 100644 --- a/snapshots/seattlerb/call_leading_dots_comment.txt +++ b/snapshots/seattlerb/call_leading_dots_comment.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (2,0)-(2,1) = "." │ ├── name: :b @@ -27,6 +28,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (4,0)-(4,1) = "." ├── name: :d @@ -34,4 +36,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_lt.txt b/snapshots/seattlerb/call_lt.txt index bec3deddd0..41a88ac3d7 100644 --- a/snapshots/seattlerb/call_lt.txt +++ b/snapshots/seattlerb/call_lt.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_lte.txt b/snapshots/seattlerb/call_lte.txt index a71e03ee12..0333ceb774 100644 --- a/snapshots/seattlerb/call_lte.txt +++ b/snapshots/seattlerb/call_lte.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_not.txt b/snapshots/seattlerb/call_not.txt index e9df80fb9f..af4a1cab34 100644 --- a/snapshots/seattlerb/call_not.txt +++ b/snapshots/seattlerb/call_not.txt @@ -17,4 +17,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_pipe.txt b/snapshots/seattlerb/call_pipe.txt index 8cf68211a9..66aec7af3f 100644 --- a/snapshots/seattlerb/call_pipe.txt +++ b/snapshots/seattlerb/call_pipe.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_rshift.txt b/snapshots/seattlerb/call_rshift.txt index 28948a044f..1c539107b5 100644 --- a/snapshots/seattlerb/call_rshift.txt +++ b/snapshots/seattlerb/call_rshift.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_self_brackets.txt b/snapshots/seattlerb/call_self_brackets.txt index e4f5e2c413..59a70e6db5 100644 --- a/snapshots/seattlerb/call_self_brackets.txt +++ b/snapshots/seattlerb/call_self_brackets.txt @@ -22,4 +22,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: (1,6)-(1,7) = "]" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_spaceship.txt b/snapshots/seattlerb/call_spaceship.txt index 4ea67f2e00..9087b69321 100644 --- a/snapshots/seattlerb/call_spaceship.txt +++ b/snapshots/seattlerb/call_spaceship.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_stabby_do_end_with_block.txt b/snapshots/seattlerb/call_stabby_do_end_with_block.txt index 0e83d334ca..8bea34eae6 100644 --- a/snapshots/seattlerb/call_stabby_do_end_with_block.txt +++ b/snapshots/seattlerb/call_stabby_do_end_with_block.txt @@ -31,6 +31,7 @@ │ ├── flags: newline, static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,14)-(1,22)) ├── flags: ∅ diff --git a/snapshots/seattlerb/call_stabby_with_braces_block.txt b/snapshots/seattlerb/call_stabby_with_braces_block.txt index 705f8b8d02..4d604748d6 100644 --- a/snapshots/seattlerb/call_stabby_with_braces_block.txt +++ b/snapshots/seattlerb/call_stabby_with_braces_block.txt @@ -31,6 +31,7 @@ │ ├── flags: newline, static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,11)-(1,19)) ├── flags: ∅ diff --git a/snapshots/seattlerb/call_star.txt b/snapshots/seattlerb/call_star.txt index 06bee81f30..f757447606 100644 --- a/snapshots/seattlerb/call_star.txt +++ b/snapshots/seattlerb/call_star.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_star2.txt b/snapshots/seattlerb/call_star2.txt index bd367d2e75..731cea7731 100644 --- a/snapshots/seattlerb/call_star2.txt +++ b/snapshots/seattlerb/call_star2.txt @@ -23,4 +23,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_trailing_comma.txt b/snapshots/seattlerb/call_trailing_comma.txt index 01cb77a25a..bc91c9d966 100644 --- a/snapshots/seattlerb/call_trailing_comma.txt +++ b/snapshots/seattlerb/call_trailing_comma.txt @@ -20,4 +20,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: (1,4)-(1,5) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_trailing_dots.txt b/snapshots/seattlerb/call_trailing_dots.txt index 73ffd855ad..dda8ca355e 100644 --- a/snapshots/seattlerb/call_trailing_dots.txt +++ b/snapshots/seattlerb/call_trailing_dots.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,1)-(1,2) = "." │ ├── name: :b @@ -27,6 +28,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (2,1)-(2,2) = "." ├── name: :c @@ -34,4 +36,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/call_unary_bang.txt b/snapshots/seattlerb/call_unary_bang.txt index b08f070693..3d95afeace 100644 --- a/snapshots/seattlerb/call_unary_bang.txt +++ b/snapshots/seattlerb/call_unary_bang.txt @@ -17,4 +17,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/case_in.txt b/snapshots/seattlerb/case_in.txt index 929cca0d38..80a29db396 100644 --- a/snapshots/seattlerb/case_in.txt +++ b/snapshots/seattlerb/case_in.txt @@ -917,6 +917,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── operator_loc: (90,4)-(90,5) = "^" │ │ │ │ ├── lparen_loc: (90,5)-(90,6) = "(" diff --git a/snapshots/seattlerb/defn_arg_forward_args.txt b/snapshots/seattlerb/defn_arg_forward_args.txt index ababd94b11..76ffa41db5 100644 --- a/snapshots/seattlerb/defn_arg_forward_args.txt +++ b/snapshots/seattlerb/defn_arg_forward_args.txt @@ -47,6 +47,7 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,20)-(1,23)) │ │ └── flags: ∅ │ ├── closing_loc: (1,23)-(1,24) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:x] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defn_args_forward_args.txt b/snapshots/seattlerb/defn_args_forward_args.txt index d689049433..5cba1311d7 100644 --- a/snapshots/seattlerb/defn_args_forward_args.txt +++ b/snapshots/seattlerb/defn_args_forward_args.txt @@ -59,6 +59,7 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,32)-(1,35)) │ │ └── flags: ∅ │ ├── closing_loc: (1,35)-(1,36) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:x, :y, :z] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defn_endless_command.txt b/snapshots/seattlerb/defn_endless_command.txt index 12149a821c..1aa2e2c12a 100644 --- a/snapshots/seattlerb/defn_endless_command.txt +++ b/snapshots/seattlerb/defn_endless_command.txt @@ -30,6 +30,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 42 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defn_endless_command_rescue.txt b/snapshots/seattlerb/defn_endless_command_rescue.txt index 99194a5ce9..4046cbcb3e 100644 --- a/snapshots/seattlerb/defn_endless_command_rescue.txt +++ b/snapshots/seattlerb/defn_endless_command_rescue.txt @@ -33,6 +33,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 42 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (1,34)-(1,40) = "rescue" │ └── rescue_expression: diff --git a/snapshots/seattlerb/defn_forward_args.txt b/snapshots/seattlerb/defn_forward_args.txt index 58a97028c6..b912c58721 100644 --- a/snapshots/seattlerb/defn_forward_args.txt +++ b/snapshots/seattlerb/defn_forward_args.txt @@ -40,6 +40,7 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,14)-(1,17)) │ │ └── flags: ∅ │ ├── closing_loc: (1,17)-(1,18) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defn_forward_args__no_parens.txt b/snapshots/seattlerb/defn_forward_args__no_parens.txt index 5d8e09f6c0..af9aa9c11e 100644 --- a/snapshots/seattlerb/defn_forward_args__no_parens.txt +++ b/snapshots/seattlerb/defn_forward_args__no_parens.txt @@ -40,6 +40,7 @@ │ │ └── @ ForwardingArgumentsNode (location: (2,4)-(2,7)) │ │ └── flags: ∅ │ ├── closing_loc: (2,7)-(2,8) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defn_kwarg_env.txt b/snapshots/seattlerb/defn_kwarg_env.txt index 0df82b5dc2..281e779877 100644 --- a/snapshots/seattlerb/defn_kwarg_env.txt +++ b/snapshots/seattlerb/defn_kwarg_env.txt @@ -52,6 +52,7 @@ │ │ │ └── depth: 0 │ │ └── operator_loc: (1,31)-(1,33) = "**" │ ├── closing_loc: (1,40)-(1,41) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:testing] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defn_oneliner.txt b/snapshots/seattlerb/defn_oneliner.txt index 81ca22f010..387955d934 100644 --- a/snapshots/seattlerb/defn_oneliner.txt +++ b/snapshots/seattlerb/defn_oneliner.txt @@ -43,6 +43,7 @@ │ │ ├── name: :cmd │ │ └── depth: 0 │ ├── closing_loc: (1,26)-(1,27) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:cmd] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defn_oneliner_noargs.txt b/snapshots/seattlerb/defn_oneliner_noargs.txt index 5928f64179..42d716cdcc 100644 --- a/snapshots/seattlerb/defn_oneliner_noargs.txt +++ b/snapshots/seattlerb/defn_oneliner_noargs.txt @@ -24,6 +24,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defn_oneliner_noargs_parentheses.txt b/snapshots/seattlerb/defn_oneliner_noargs_parentheses.txt index d0cd777039..b3fa26c683 100644 --- a/snapshots/seattlerb/defn_oneliner_noargs_parentheses.txt +++ b/snapshots/seattlerb/defn_oneliner_noargs_parentheses.txt @@ -24,6 +24,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defn_oneliner_rescue.txt b/snapshots/seattlerb/defn_oneliner_rescue.txt index 4c4e9aef2a..4d22657cfe 100644 --- a/snapshots/seattlerb/defn_oneliner_rescue.txt +++ b/snapshots/seattlerb/defn_oneliner_rescue.txt @@ -47,6 +47,7 @@ │ │ │ │ ├── name: :cmd │ │ │ │ └── depth: 0 │ │ │ ├── closing_loc: (2,12)-(2,13) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (3,0)-(4,5)) @@ -114,6 +115,7 @@ │ │ │ │ ├── name: :cmd │ │ │ │ └── depth: 0 │ │ │ ├── closing_loc: (9,12)-(9,13) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (9,14)-(9,20) = "rescue" │ │ └── rescue_expression: @@ -167,6 +169,7 @@ │ │ │ ├── name: :cmd │ │ │ └── depth: 0 │ │ ├── closing_loc: (13,26)-(13,27) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (13,28)-(13,34) = "rescue" │ └── rescue_expression: diff --git a/snapshots/seattlerb/defs_as_arg_with_do_block_inside.txt b/snapshots/seattlerb/defs_as_arg_with_do_block_inside.txt index f9479eb11b..994cd742bc 100644 --- a/snapshots/seattlerb/defs_as_arg_with_do_block_inside.txt +++ b/snapshots/seattlerb/defs_as_arg_with_do_block_inside.txt @@ -40,6 +40,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (1,15)-(1,16) = "." │ │ ├── name: :y @@ -47,6 +48,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (1,18)-(1,25)) │ │ ├── flags: ∅ @@ -63,4 +65,5 @@ │ ├── equal_loc: ∅ │ └── end_keyword_loc: (1,27)-(1,30) = "end" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/defs_endless_command.txt b/snapshots/seattlerb/defs_endless_command.txt index f34d667901..d8db9cd1b9 100644 --- a/snapshots/seattlerb/defs_endless_command.txt +++ b/snapshots/seattlerb/defs_endless_command.txt @@ -19,6 +19,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── parameters: ∅ ├── body: @@ -40,6 +41,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 42 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defs_endless_command_rescue.txt b/snapshots/seattlerb/defs_endless_command_rescue.txt index fe85936940..862623427d 100644 --- a/snapshots/seattlerb/defs_endless_command_rescue.txt +++ b/snapshots/seattlerb/defs_endless_command_rescue.txt @@ -19,6 +19,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── parameters: ∅ ├── body: @@ -43,6 +44,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 42 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (1,36)-(1,42) = "rescue" │ └── rescue_expression: diff --git a/snapshots/seattlerb/defs_oneliner.txt b/snapshots/seattlerb/defs_oneliner.txt index c99b810844..23033d429b 100644 --- a/snapshots/seattlerb/defs_oneliner.txt +++ b/snapshots/seattlerb/defs_oneliner.txt @@ -45,6 +45,7 @@ │ │ ├── name: :cmd │ │ └── depth: 0 │ ├── closing_loc: (1,31)-(1,32) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:cmd] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/seattlerb/defs_oneliner_rescue.txt b/snapshots/seattlerb/defs_oneliner_rescue.txt index e620fbd178..40bde573c4 100644 --- a/snapshots/seattlerb/defs_oneliner_rescue.txt +++ b/snapshots/seattlerb/defs_oneliner_rescue.txt @@ -49,6 +49,7 @@ │ │ │ │ ├── name: :cmd │ │ │ │ └── depth: 0 │ │ │ ├── closing_loc: (2,12)-(2,13) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (3,0)-(4,5)) @@ -118,6 +119,7 @@ │ │ │ │ ├── name: :cmd │ │ │ │ └── depth: 0 │ │ │ ├── closing_loc: (9,12)-(9,13) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (9,14)-(9,20) = "rescue" │ │ └── rescue_expression: @@ -173,6 +175,7 @@ │ │ │ ├── name: :cmd │ │ │ └── depth: 0 │ │ ├── closing_loc: (13,31)-(13,32) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (13,33)-(13,39) = "rescue" │ └── rescue_expression: diff --git a/snapshots/seattlerb/difficult0_.txt b/snapshots/seattlerb/difficult0_.txt index 233440b101..0c7ebb3d30 100644 --- a/snapshots/seattlerb/difficult0_.txt +++ b/snapshots/seattlerb/difficult0_.txt @@ -37,7 +37,7 @@ │ │ │ ├── flags: ∅ │ │ │ └── arguments: (length: 1) │ │ │ └── @ InterpolatedStringNode (location: (1,9)-(4,4)) - │ │ │ ├── flags: static_literal + │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: (1,9)-(1,10) = "'" │ │ │ ├── parts: (length: 2) │ │ │ │ ├── @ StringNode (location: (1,10)-(2,0)) @@ -54,6 +54,7 @@ │ │ │ │ └── unescaped: " c" │ │ │ └── closing_loc: (4,3)-(4,4) = "'" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :+ @@ -70,6 +71,8 @@ │ │ ├── closing_loc: (4,7)-(4,8) = "'" │ │ └── unescaped: "d" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/difficult1_line_numbers.txt b/snapshots/seattlerb/difficult1_line_numbers.txt index c34579e6ac..0d293c5ba3 100644 --- a/snapshots/seattlerb/difficult1_line_numbers.txt +++ b/snapshots/seattlerb/difficult1_line_numbers.txt @@ -31,6 +31,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── @ CallNode (location: (3,2)-(3,7)) │ │ ├── flags: newline @@ -44,6 +45,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (3,3)-(3,4) = "." │ │ ├── name: :b @@ -57,6 +59,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── @ CallNode (location: (4,2)-(4,10)) │ │ ├── flags: newline @@ -70,6 +73,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (4,3)-(4,4) = "." │ │ ├── name: :d @@ -86,6 +90,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 4 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── @ CallNode (location: (5,2)-(5,7)) │ │ ├── flags: newline @@ -99,6 +104,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (5,3)-(5,4) = "." │ │ ├── name: :f @@ -112,6 +118,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 5 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── @ CallNode (location: (6,2)-(6,10)) │ │ ├── flags: newline @@ -125,6 +132,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (6,3)-(6,4) = "." │ │ ├── name: :h @@ -141,6 +149,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 7 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── @ CallNode (location: (7,2)-(7,6)) │ │ ├── flags: newline, ignore_visibility @@ -157,6 +166,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: (7,5)-(7,6) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── @ CallNode (location: (8,2)-(8,8)) │ │ ├── flags: newline @@ -170,6 +180,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (8,3)-(8,4) = "." │ │ ├── name: :b @@ -183,6 +194,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: (8,7)-(8,8) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── @ CallNode (location: (9,2)-(9,11)) │ │ ├── flags: newline @@ -196,6 +208,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (9,3)-(9,4) = "." │ │ ├── name: :d @@ -212,6 +225,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 4 │ │ ├── closing_loc: (9,10)-(9,11) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── @ CallNode (location: (10,2)-(10,8)) │ │ ├── flags: newline @@ -225,6 +239,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (10,3)-(10,4) = "." │ │ ├── name: :f @@ -238,6 +253,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 5 │ │ ├── closing_loc: (10,7)-(10,8) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ CallNode (location: (11,2)-(11,11)) │ ├── flags: newline @@ -251,6 +267,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (11,3)-(11,4) = "." │ ├── name: :h @@ -267,6 +284,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 7 │ ├── closing_loc: (11,10)-(11,11) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── subsequent: ∅ └── end_keyword_loc: (12,0)-(12,3) = "end" diff --git a/snapshots/seattlerb/difficult1_line_numbers2.txt b/snapshots/seattlerb/difficult1_line_numbers2.txt index ae710f997f..83d97619d1 100644 --- a/snapshots/seattlerb/difficult1_line_numbers2.txt +++ b/snapshots/seattlerb/difficult1_line_numbers2.txt @@ -34,6 +34,7 @@ │ │ │ │ ├── closing_loc: (2,6)-(2,7) = "\"" │ │ │ │ └── unescaped: "a" │ │ │ ├── closing_loc: (2,7)-(2,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── @ LocalVariableWriteNode (location: (3,2)-(3,7)) │ │ │ ├── flags: newline @@ -61,6 +62,7 @@ │ │ │ │ ├── name: :b │ │ │ │ └── depth: 0 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ LocalVariableWriteNode (location: (5,2)-(5,6)) │ │ ├── flags: newline @@ -83,4 +85,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/difficult2_.txt b/snapshots/seattlerb/difficult2_.txt index 2a7e8e49d0..721cd3a5c0 100644 --- a/snapshots/seattlerb/difficult2_.txt +++ b/snapshots/seattlerb/difficult2_.txt @@ -35,6 +35,7 @@ │ │ │ ├── closing_loc: (1,7)-(1,8) = "'" │ │ │ └── unescaped: "" │ │ ├── closing_loc: (1,8)-(1,9) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: │ │ @ ElseNode (location: (1,10)-(1,13)) @@ -78,4 +79,5 @@ │ │ └── value: 3 │ └── operator_loc: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/difficult3_.txt b/snapshots/seattlerb/difficult3_.txt index 313cfa4cf2..d79dad8d9f 100644 --- a/snapshots/seattlerb/difficult3_.txt +++ b/snapshots/seattlerb/difficult3_.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,18)) ├── flags: ∅ diff --git a/snapshots/seattlerb/difficult3_2.txt b/snapshots/seattlerb/difficult3_2.txt index e1eed78c79..3bd8803c45 100644 --- a/snapshots/seattlerb/difficult3_2.txt +++ b/snapshots/seattlerb/difficult3_2.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,13)) ├── flags: ∅ diff --git a/snapshots/seattlerb/difficult3_3.txt b/snapshots/seattlerb/difficult3_3.txt index 5dcd71d651..e193e6d4fd 100644 --- a/snapshots/seattlerb/difficult3_3.txt +++ b/snapshots/seattlerb/difficult3_3.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,17)) ├── flags: ∅ diff --git a/snapshots/seattlerb/difficult3_4.txt b/snapshots/seattlerb/difficult3_4.txt index b733c42265..070378d75b 100644 --- a/snapshots/seattlerb/difficult3_4.txt +++ b/snapshots/seattlerb/difficult3_4.txt @@ -24,6 +24,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (1,4)-(1,5) = "?" │ ├── statements: diff --git a/snapshots/seattlerb/difficult3_5.txt b/snapshots/seattlerb/difficult3_5.txt index b8bbbdc03e..619e3eacff 100644 --- a/snapshots/seattlerb/difficult3_5.txt +++ b/snapshots/seattlerb/difficult3_5.txt @@ -42,6 +42,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,11)-(1,17)) │ ├── flags: ∅ @@ -51,4 +52,5 @@ │ ├── opening_loc: (1,11)-(1,13) = "do" │ └── closing_loc: (1,14)-(1,17) = "end" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/difficult3__10.txt b/snapshots/seattlerb/difficult3__10.txt index a5ce0762f1..c02f1985de 100644 --- a/snapshots/seattlerb/difficult3__10.txt +++ b/snapshots/seattlerb/difficult3__10.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,18)) ├── flags: ∅ diff --git a/snapshots/seattlerb/difficult3__11.txt b/snapshots/seattlerb/difficult3__11.txt index c1017885d8..fdd84d7862 100644 --- a/snapshots/seattlerb/difficult3__11.txt +++ b/snapshots/seattlerb/difficult3__11.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,14)) ├── flags: ∅ diff --git a/snapshots/seattlerb/difficult3__12.txt b/snapshots/seattlerb/difficult3__12.txt index bbcfad48b4..70af34502b 100644 --- a/snapshots/seattlerb/difficult3__12.txt +++ b/snapshots/seattlerb/difficult3__12.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,17)) ├── flags: ∅ diff --git a/snapshots/seattlerb/difficult3__6.txt b/snapshots/seattlerb/difficult3__6.txt index 95d1ac39b5..952539317f 100644 --- a/snapshots/seattlerb/difficult3__6.txt +++ b/snapshots/seattlerb/difficult3__6.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,21)) ├── flags: ∅ diff --git a/snapshots/seattlerb/difficult3__7.txt b/snapshots/seattlerb/difficult3__7.txt index 4640cfdb53..69f59c0982 100644 --- a/snapshots/seattlerb/difficult3__7.txt +++ b/snapshots/seattlerb/difficult3__7.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,17)) ├── flags: ∅ diff --git a/snapshots/seattlerb/difficult3__8.txt b/snapshots/seattlerb/difficult3__8.txt index e19cbfc279..1289c37b0e 100644 --- a/snapshots/seattlerb/difficult3__8.txt +++ b/snapshots/seattlerb/difficult3__8.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,20)) ├── flags: ∅ diff --git a/snapshots/seattlerb/difficult3__9.txt b/snapshots/seattlerb/difficult3__9.txt index 2259351b41..e6b0879bdb 100644 --- a/snapshots/seattlerb/difficult3__9.txt +++ b/snapshots/seattlerb/difficult3__9.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,15)) ├── flags: ∅ diff --git a/snapshots/seattlerb/difficult4__leading_dots.txt b/snapshots/seattlerb/difficult4__leading_dots.txt index 4201ed00aa..aaf0dafd0f 100644 --- a/snapshots/seattlerb/difficult4__leading_dots.txt +++ b/snapshots/seattlerb/difficult4__leading_dots.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (2,0)-(2,1) = "." ├── name: :b @@ -24,4 +25,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/difficult6_.txt b/snapshots/seattlerb/difficult6_.txt index fc273bda46..f061f034d2 100644 --- a/snapshots/seattlerb/difficult6_.txt +++ b/snapshots/seattlerb/difficult6_.txt @@ -67,4 +67,5 @@ │ ├── opening_loc: (1,17)-(1,18) = "[" │ └── closing_loc: (1,22)-(1,23) = "]" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/difficult6__7.txt b/snapshots/seattlerb/difficult6__7.txt index 509da6914f..027409dab4 100644 --- a/snapshots/seattlerb/difficult6__7.txt +++ b/snapshots/seattlerb/difficult6__7.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,1)-(1,2) = "." ├── name: :b @@ -38,6 +39,7 @@ │ ├── opening_loc: (1,4)-(1,5) = "(" │ └── closing_loc: (1,6)-(1,7) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,8)-(1,11)) ├── flags: ∅ @@ -56,6 +58,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (1,8)-(1,9) = "{" └── closing_loc: (1,10)-(1,11) = "}" diff --git a/snapshots/seattlerb/difficult6__8.txt b/snapshots/seattlerb/difficult6__8.txt index c6fece62cb..b16b36b60e 100644 --- a/snapshots/seattlerb/difficult6__8.txt +++ b/snapshots/seattlerb/difficult6__8.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,1)-(1,3) = "::" ├── name: :b @@ -38,6 +39,7 @@ │ ├── opening_loc: (1,5)-(1,6) = "(" │ └── closing_loc: (1,7)-(1,8) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,9)-(1,12)) ├── flags: ∅ @@ -56,6 +58,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (1,9)-(1,10) = "{" └── closing_loc: (1,11)-(1,12) = "}" diff --git a/snapshots/seattlerb/difficult7_.txt b/snapshots/seattlerb/difficult7_.txt index 2cf03ce57e..bd19aedcb7 100644 --- a/snapshots/seattlerb/difficult7_.txt +++ b/snapshots/seattlerb/difficult7_.txt @@ -28,6 +28,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (2,18)-(2,33)) │ │ │ ├── flags: ∅ @@ -50,6 +51,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── then_keyword_loc: (2,22)-(2,23) = "?" │ │ │ │ ├── statements: @@ -65,6 +67,7 @@ │ │ │ │ │ ├── opening_loc: (2,25)-(2,26) = "(" │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: (2,26)-(2,27) = ")" + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── subsequent: │ │ │ │ │ @ ElseNode (location: (2,28)-(2,31)) @@ -83,6 +86,7 @@ │ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ │ └── block: ∅ │ │ │ │ │ └── end_keyword_loc: ∅ │ │ │ │ └── end_keyword_loc: ∅ diff --git a/snapshots/seattlerb/do_bug.txt b/snapshots/seattlerb/do_bug.txt index 8d1a0b786c..591bbfc0f3 100644 --- a/snapshots/seattlerb/do_bug.txt +++ b/snapshots/seattlerb/do_bug.txt @@ -20,6 +20,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (2,0)-(4,3)) ├── flags: newline @@ -33,6 +34,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (2,1)-(2,2) = "." ├── name: :b @@ -40,6 +42,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (2,4)-(4,3)) ├── flags: ∅ diff --git a/snapshots/seattlerb/dot2_nil__26.txt b/snapshots/seattlerb/dot2_nil__26.txt index fc5122055f..eb81e7a6a1 100644 --- a/snapshots/seattlerb/dot2_nil__26.txt +++ b/snapshots/seattlerb/dot2_nil__26.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── right: ∅ └── operator_loc: (1,1)-(1,3) = ".." diff --git a/snapshots/seattlerb/dot3_nil__26.txt b/snapshots/seattlerb/dot3_nil__26.txt index c2277975db..3149e48d2b 100644 --- a/snapshots/seattlerb/dot3_nil__26.txt +++ b/snapshots/seattlerb/dot3_nil__26.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── right: ∅ └── operator_loc: (1,1)-(1,4) = "..." diff --git a/snapshots/seattlerb/dstr_evstr.txt b/snapshots/seattlerb/dstr_evstr.txt index 143d8ff584..c3b5b23628 100644 --- a/snapshots/seattlerb/dstr_evstr.txt +++ b/snapshots/seattlerb/dstr_evstr.txt @@ -39,6 +39,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── closing_loc: (1,10)-(1,11) = "}" └── closing_loc: (1,11)-(1,12) = "\"" diff --git a/snapshots/seattlerb/dstr_evstr_empty_end.txt b/snapshots/seattlerb/dstr_evstr_empty_end.txt index 8e3ade63c9..de61550358 100644 --- a/snapshots/seattlerb/dstr_evstr_empty_end.txt +++ b/snapshots/seattlerb/dstr_evstr_empty_end.txt @@ -25,6 +25,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── closing_loc: (1,9)-(1,10) = "}" └── closing_loc: (1,10)-(1,11) = "\"" diff --git a/snapshots/seattlerb/dstr_lex_state.txt b/snapshots/seattlerb/dstr_lex_state.txt index 2bdeab0834..36afd84bd5 100644 --- a/snapshots/seattlerb/dstr_lex_state.txt +++ b/snapshots/seattlerb/dstr_lex_state.txt @@ -34,6 +34,7 @@ │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "a" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── closing_loc: (1,6)-(1,7) = "}" └── closing_loc: (1,7)-(1,8) = "\"" diff --git a/snapshots/seattlerb/dstr_str.txt b/snapshots/seattlerb/dstr_str.txt index 7b3e0e36ad..9e26a7ebc4 100644 --- a/snapshots/seattlerb/dstr_str.txt +++ b/snapshots/seattlerb/dstr_str.txt @@ -6,7 +6,7 @@ ├── flags: ∅ └── body: (length: 1) └── @ InterpolatedStringNode (location: (1,0)-(1,10)) - ├── flags: newline, static_literal, mutable + ├── flags: newline, mutable ├── opening_loc: (1,0)-(1,1) = "\"" ├── parts: (length: 2) │ ├── @ EmbeddedStatementsNode (location: (1,1)-(1,7)) diff --git a/snapshots/seattlerb/eq_begin_why_wont_people_use_their_spacebar.txt b/snapshots/seattlerb/eq_begin_why_wont_people_use_their_spacebar.txt index 5f6a3fe62e..fcb4da7534 100644 --- a/snapshots/seattlerb/eq_begin_why_wont_people_use_their_spacebar.txt +++ b/snapshots/seattlerb/eq_begin_why_wont_people_use_their_spacebar.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[]= @@ -35,6 +36,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ BeginNode (location: (1,5)-(3,8)) │ ├── flags: ∅ @@ -51,4 +53,5 @@ │ ├── ensure_clause: ∅ │ └── end_keyword_loc: (3,5)-(3,8) = "end" ├── closing_loc: (1,3)-(1,4) = "]" + ├── equal_loc: (1,4)-(1,5) = "=" └── block: ∅ diff --git a/snapshots/seattlerb/evstr_evstr.txt b/snapshots/seattlerb/evstr_evstr.txt index c8dba1c3e5..fc692727d1 100644 --- a/snapshots/seattlerb/evstr_evstr.txt +++ b/snapshots/seattlerb/evstr_evstr.txt @@ -25,6 +25,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,4)-(1,5) = "}" │ └── @ EmbeddedStatementsNode (location: (1,5)-(1,9)) @@ -43,6 +44,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── closing_loc: (1,8)-(1,9) = "}" └── closing_loc: (1,9)-(1,10) = "\"" diff --git a/snapshots/seattlerb/evstr_str.txt b/snapshots/seattlerb/evstr_str.txt index 69a992b19a..1f279216e1 100644 --- a/snapshots/seattlerb/evstr_str.txt +++ b/snapshots/seattlerb/evstr_str.txt @@ -25,6 +25,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,4)-(1,5) = "}" │ └── @ StringNode (location: (1,5)-(1,7)) diff --git a/snapshots/seattlerb/expr_not_bang.txt b/snapshots/seattlerb/expr_not_bang.txt index 868ef85648..f347268565 100644 --- a/snapshots/seattlerb/expr_not_bang.txt +++ b/snapshots/seattlerb/expr_not_bang.txt @@ -28,8 +28,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :! @@ -37,4 +39,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/flip2_env_lvar.txt b/snapshots/seattlerb/flip2_env_lvar.txt index def6ffaf3a..fc26c8a1da 100644 --- a/snapshots/seattlerb/flip2_env_lvar.txt +++ b/snapshots/seattlerb/flip2_env_lvar.txt @@ -21,6 +21,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (1,6)-(1,7)) @@ -32,6 +33,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (1,4)-(1,6) = ".." ├── then_keyword_loc: (1,8)-(1,12) = "then" diff --git a/snapshots/seattlerb/heredoc_nested.txt b/snapshots/seattlerb/heredoc_nested.txt index 4820ef6d4d..64a7d9ddca 100644 --- a/snapshots/seattlerb/heredoc_nested.txt +++ b/snapshots/seattlerb/heredoc_nested.txt @@ -6,10 +6,10 @@ ├── flags: ∅ └── body: (length: 1) └── @ ArrayNode (location: (1,0)-(7,2)) - ├── flags: newline, static_literal + ├── flags: newline ├── elements: (length: 2) │ ├── @ InterpolatedStringNode (location: (1,1)-(1,4)) - │ │ ├── flags: static_literal, mutable + │ │ ├── flags: mutable │ │ ├── opening_loc: (1,1)-(1,4) = "< @@ -30,4 +31,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/safe_call_rhs_newline.txt b/snapshots/seattlerb/safe_call_rhs_newline.txt index 50d03b7044..37e32fab4a 100644 --- a/snapshots/seattlerb/safe_call_rhs_newline.txt +++ b/snapshots/seattlerb/safe_call_rhs_newline.txt @@ -23,6 +23,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,5)-(1,7) = "&." │ ├── name: :b @@ -30,5 +31,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (1,2)-(1,3) = "=" diff --git a/snapshots/seattlerb/safe_calls.txt b/snapshots/seattlerb/safe_calls.txt index 5d853af648..4004aa882d 100644 --- a/snapshots/seattlerb/safe_calls.txt +++ b/snapshots/seattlerb/safe_calls.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,1)-(1,3) = "&." │ ├── name: :b @@ -27,6 +28,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,4)-(1,6) = "&." ├── name: :c @@ -40,4 +42,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: (1,9)-(1,10) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/safe_op_asgn.txt b/snapshots/seattlerb/safe_op_asgn.txt index 31ad5a813d..8abb5bf82b 100644 --- a/snapshots/seattlerb/safe_op_asgn.txt +++ b/snapshots/seattlerb/safe_op_asgn.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,1)-(1,3) = "&." ├── message_loc: (1,3)-(1,4) = "b" @@ -40,4 +41,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/safe_op_asgn2.txt b/snapshots/seattlerb/safe_op_asgn2.txt index 81d42aac63..2e5a80ad15 100644 --- a/snapshots/seattlerb/safe_op_asgn2.txt +++ b/snapshots/seattlerb/safe_op_asgn2.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,1)-(1,3) = "&." ├── message_loc: (1,3)-(1,4) = "b" @@ -33,4 +34,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/slashy_newlines_within_string.txt b/snapshots/seattlerb/slashy_newlines_within_string.txt index 061e67ca6a..5cc044993e 100644 --- a/snapshots/seattlerb/slashy_newlines_within_string.txt +++ b/snapshots/seattlerb/slashy_newlines_within_string.txt @@ -23,6 +23,7 @@ │ │ ├── closing_loc: (4,7)-(4,8) = "\"" │ │ └── unescaped: "hello my dear friend" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (6,0)-(6,5)) ├── flags: newline @@ -36,6 +37,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :+ @@ -54,6 +56,8 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/stabby_block_iter_call.txt b/snapshots/seattlerb/stabby_block_iter_call.txt index 9769563607..232727ee9d 100644 --- a/snapshots/seattlerb/stabby_block_iter_call.txt +++ b/snapshots/seattlerb/stabby_block_iter_call.txt @@ -45,6 +45,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (2,1)-(2,2) = "." │ ├── name: :b @@ -52,6 +53,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (2,4)-(3,3)) │ ├── flags: ∅ @@ -61,4 +63,5 @@ │ ├── opening_loc: (2,4)-(2,6) = "do" │ └── closing_loc: (3,0)-(3,3) = "end" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/stabby_block_iter_call_no_target_with_arg.txt b/snapshots/seattlerb/stabby_block_iter_call_no_target_with_arg.txt index 5d60be6e86..a75e64faf0 100644 --- a/snapshots/seattlerb/stabby_block_iter_call_no_target_with_arg.txt +++ b/snapshots/seattlerb/stabby_block_iter_call_no_target_with_arg.txt @@ -48,6 +48,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: (2,3)-(2,4) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (2,5)-(3,3)) │ ├── flags: ∅ @@ -57,4 +58,5 @@ │ ├── opening_loc: (2,5)-(2,7) = "do" │ └── closing_loc: (3,0)-(3,3) = "end" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/str_backslashes.txt b/snapshots/seattlerb/str_backslashes.txt index e73793beb8..48a119c73a 100644 --- a/snapshots/seattlerb/str_backslashes.txt +++ b/snapshots/seattlerb/str_backslashes.txt @@ -23,4 +23,5 @@ │ ├── closing_loc: (1,203)-(1,204) = "'" │ └── unescaped: "\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/str_double_double_escaped_newline.txt b/snapshots/seattlerb/str_double_double_escaped_newline.txt index fa7444d7e7..5187bfb43c 100644 --- a/snapshots/seattlerb/str_double_double_escaped_newline.txt +++ b/snapshots/seattlerb/str_double_double_escaped_newline.txt @@ -23,6 +23,7 @@ │ │ ├── closing_loc: (1,6)-(1,7) = "\"" │ │ └── unescaped: "\\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (1,8)-(1,9)) ├── flags: newline, variable_call, ignore_visibility @@ -33,4 +34,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/str_double_escaped_newline.txt b/snapshots/seattlerb/str_double_escaped_newline.txt index c91c913919..4c61b94ef8 100644 --- a/snapshots/seattlerb/str_double_escaped_newline.txt +++ b/snapshots/seattlerb/str_double_escaped_newline.txt @@ -23,6 +23,7 @@ │ │ ├── closing_loc: (1,5)-(1,6) = "\"" │ │ └── unescaped: "\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (1,7)-(1,8)) ├── flags: newline, variable_call, ignore_visibility @@ -33,4 +34,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/str_double_newline.txt b/snapshots/seattlerb/str_double_newline.txt index 7809a9aaff..83283ddca6 100644 --- a/snapshots/seattlerb/str_double_newline.txt +++ b/snapshots/seattlerb/str_double_newline.txt @@ -23,6 +23,7 @@ │ │ ├── closing_loc: (2,0)-(2,1) = "\"" │ │ └── unescaped: "\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (2,2)-(2,3)) ├── flags: newline, variable_call, ignore_visibility @@ -33,4 +34,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/str_evstr.txt b/snapshots/seattlerb/str_evstr.txt index 98b65f00f8..05bedf388b 100644 --- a/snapshots/seattlerb/str_evstr.txt +++ b/snapshots/seattlerb/str_evstr.txt @@ -31,6 +31,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── closing_loc: (1,6)-(1,7) = "}" └── closing_loc: (1,7)-(1,8) = "\"" diff --git a/snapshots/seattlerb/str_evstr_escape.txt b/snapshots/seattlerb/str_evstr_escape.txt index f6559cc822..0f4e8c8e31 100644 --- a/snapshots/seattlerb/str_evstr_escape.txt +++ b/snapshots/seattlerb/str_evstr_escape.txt @@ -31,6 +31,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,6)-(1,7) = "}" │ └── @ StringNode (location: (1,7)-(1,15)) diff --git a/snapshots/seattlerb/str_heredoc_interp.txt b/snapshots/seattlerb/str_heredoc_interp.txt index 1261eec6c3..e6f09298c6 100644 --- a/snapshots/seattlerb/str_heredoc_interp.txt +++ b/snapshots/seattlerb/str_heredoc_interp.txt @@ -25,6 +25,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (2,3)-(2,4) = "}" │ └── @ StringNode (location: (2,4)-(4,0)) diff --git a/snapshots/seattlerb/str_interp_ternary_or_label.txt b/snapshots/seattlerb/str_interp_ternary_or_label.txt index 8161109337..72a3cf7898 100644 --- a/snapshots/seattlerb/str_interp_ternary_or_label.txt +++ b/snapshots/seattlerb/str_interp_ternary_or_label.txt @@ -32,6 +32,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: (1,4)-(1,5) = "." │ │ │ ├── name: :b? @@ -39,6 +40,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: (1,8)-(1,9) = "?" │ │ ├── statements: @@ -74,8 +76,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :+ @@ -92,6 +96,7 @@ │ │ │ │ ├── closing_loc: (1,16)-(1,17) = "\"" │ │ │ │ └── unescaped: "" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── subsequent: │ │ │ @ ElseNode (location: (1,17)-(1,21)) diff --git a/snapshots/seattlerb/str_lit_concat_bad_encodings.txt b/snapshots/seattlerb/str_lit_concat_bad_encodings.txt index 4a80bc3305..35aac7b4e9 100644 --- a/snapshots/seattlerb/str_lit_concat_bad_encodings.txt +++ b/snapshots/seattlerb/str_lit_concat_bad_encodings.txt @@ -6,7 +6,7 @@ ├── flags: ∅ └── body: (length: 1) └── @ InterpolatedStringNode (location: (1,0)-(2,66)) - ├── flags: newline, static_literal + ├── flags: newline ├── opening_loc: ∅ ├── parts: (length: 2) │ ├── @ StringNode (location: (1,0)-(1,62)) diff --git a/snapshots/seattlerb/str_pct_Q_nested.txt b/snapshots/seattlerb/str_pct_Q_nested.txt index 76a0f5a5cf..00c3239b59 100644 --- a/snapshots/seattlerb/str_pct_Q_nested.txt +++ b/snapshots/seattlerb/str_pct_Q_nested.txt @@ -31,6 +31,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,17)-(1,18) = "}" │ └── @ StringNode (location: (1,18)-(1,25)) diff --git a/snapshots/seattlerb/str_single_double_escaped_newline.txt b/snapshots/seattlerb/str_single_double_escaped_newline.txt index 2187edc92d..8ac56ccc00 100644 --- a/snapshots/seattlerb/str_single_double_escaped_newline.txt +++ b/snapshots/seattlerb/str_single_double_escaped_newline.txt @@ -23,6 +23,7 @@ │ │ ├── closing_loc: (1,6)-(1,7) = "'" │ │ └── unescaped: "\\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (1,8)-(1,9)) ├── flags: newline, variable_call, ignore_visibility @@ -33,4 +34,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/str_single_escaped_newline.txt b/snapshots/seattlerb/str_single_escaped_newline.txt index 36028e09d0..a0f1bd6649 100644 --- a/snapshots/seattlerb/str_single_escaped_newline.txt +++ b/snapshots/seattlerb/str_single_escaped_newline.txt @@ -23,6 +23,7 @@ │ │ ├── closing_loc: (1,5)-(1,6) = "'" │ │ └── unescaped: "\\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (1,7)-(1,8)) ├── flags: newline, variable_call, ignore_visibility @@ -33,4 +34,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/str_single_newline.txt b/snapshots/seattlerb/str_single_newline.txt index b53d1ed81a..7c0f8b02f0 100644 --- a/snapshots/seattlerb/str_single_newline.txt +++ b/snapshots/seattlerb/str_single_newline.txt @@ -23,6 +23,7 @@ │ │ ├── closing_loc: (2,0)-(2,1) = "'" │ │ └── unescaped: "\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (2,2)-(2,3)) ├── flags: newline, variable_call, ignore_visibility @@ -33,4 +34,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/str_str.txt b/snapshots/seattlerb/str_str.txt index 37a57d2fd6..fa8d6fa5f1 100644 --- a/snapshots/seattlerb/str_str.txt +++ b/snapshots/seattlerb/str_str.txt @@ -6,7 +6,7 @@ ├── flags: ∅ └── body: (length: 1) └── @ InterpolatedStringNode (location: (1,0)-(1,10)) - ├── flags: newline, static_literal, mutable + ├── flags: newline ├── opening_loc: (1,0)-(1,1) = "\"" ├── parts: (length: 2) │ ├── @ StringNode (location: (1,1)-(1,3)) diff --git a/snapshots/seattlerb/str_str_str.txt b/snapshots/seattlerb/str_str_str.txt index ed74c1a954..a4d3f41208 100644 --- a/snapshots/seattlerb/str_str_str.txt +++ b/snapshots/seattlerb/str_str_str.txt @@ -6,7 +6,7 @@ ├── flags: ∅ └── body: (length: 1) └── @ InterpolatedStringNode (location: (1,0)-(1,12)) - ├── flags: newline, static_literal, mutable + ├── flags: newline ├── opening_loc: (1,0)-(1,1) = "\"" ├── parts: (length: 3) │ ├── @ StringNode (location: (1,1)-(1,3)) diff --git a/snapshots/seattlerb/symbol_list.txt b/snapshots/seattlerb/symbol_list.txt index 6ee21564bb..aa4f3663b5 100644 --- a/snapshots/seattlerb/symbol_list.txt +++ b/snapshots/seattlerb/symbol_list.txt @@ -28,6 +28,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (1,6)-(1,7) = "}" │ │ └── closing_loc: ∅ @@ -51,6 +52,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,11)-(1,12) = "}" │ └── closing_loc: ∅ diff --git a/snapshots/seattlerb/thingy.txt b/snapshots/seattlerb/thingy.txt index edbcd8e25b..abe6266076 100644 --- a/snapshots/seattlerb/thingy.txt +++ b/snapshots/seattlerb/thingy.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,1)-(1,2) = "." │ ├── name: :call @@ -30,6 +31,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 42 │ ├── closing_loc: (1,5)-(1,6) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (3,0)-(3,7)) ├── flags: newline @@ -43,6 +45,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (3,1)-(3,3) = "::" ├── name: :call @@ -56,4 +59,5 @@ │ ├── flags: static_literal, decimal │ └── value: 42 ├── closing_loc: (3,6)-(3,7) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/unary_minus.txt b/snapshots/seattlerb/unary_minus.txt index d10ff3a89e..9e05d56c76 100644 --- a/snapshots/seattlerb/unary_minus.txt +++ b/snapshots/seattlerb/unary_minus.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :-@ @@ -24,4 +25,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/unary_plus.txt b/snapshots/seattlerb/unary_plus.txt index 11cb2ebabd..5305fe5d4e 100644 --- a/snapshots/seattlerb/unary_plus.txt +++ b/snapshots/seattlerb/unary_plus.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :+@ @@ -24,4 +25,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/unary_plus_on_literal.txt b/snapshots/seattlerb/unary_plus_on_literal.txt index 3431fd6cfe..d7c1e1d6d9 100644 --- a/snapshots/seattlerb/unary_plus_on_literal.txt +++ b/snapshots/seattlerb/unary_plus_on_literal.txt @@ -20,4 +20,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/unary_tilde.txt b/snapshots/seattlerb/unary_tilde.txt index 52a4fa8630..a039b5dc30 100644 --- a/snapshots/seattlerb/unary_tilde.txt +++ b/snapshots/seattlerb/unary_tilde.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :~ @@ -24,4 +25,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/utf8_bom.txt b/snapshots/seattlerb/utf8_bom.txt index c26bb1741b..2977bbb5cb 100644 --- a/snapshots/seattlerb/utf8_bom.txt +++ b/snapshots/seattlerb/utf8_bom.txt @@ -20,4 +20,5 @@ │ ├── flags: static_literal, decimal │ └── value: 0 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/seattlerb/when_splat.txt b/snapshots/seattlerb/when_splat.txt index 6df6e77397..eab233c4fc 100644 --- a/snapshots/seattlerb/when_splat.txt +++ b/snapshots/seattlerb/when_splat.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ WhenNode (location: (1,8)-(1,20)) @@ -36,6 +37,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (1,16)-(1,20) = "then" │ └── statements: ∅ diff --git a/snapshots/single_method_call_with_bang.txt b/snapshots/single_method_call_with_bang.txt index 8baca8888d..946e4a3b6b 100644 --- a/snapshots/single_method_call_with_bang.txt +++ b/snapshots/single_method_call_with_bang.txt @@ -14,4 +14,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/spanning_heredoc.txt b/snapshots/spanning_heredoc.txt index f880f64434..fc11ac7876 100644 --- a/snapshots/spanning_heredoc.txt +++ b/snapshots/spanning_heredoc.txt @@ -57,8 +57,10 @@ │ │ │ ├── closing_loc: (7,5)-(7,6) = "\"" │ │ │ └── unescaped: "" │ │ ├── closing_loc: (7,6)-(7,7) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (10,0)-(13,2)) │ ├── flags: newline, ignore_visibility @@ -78,7 +80,7 @@ │ │ │ ├── closing_loc: (12,0)-(13,0) = "A\n" │ │ │ └── unescaped: "c\n" │ │ └── @ InterpolatedStringNode (location: (10,9)-(13,2)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (10,9)-(10,10) = "\"" │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (10,10)-(10,12)) @@ -95,6 +97,7 @@ │ │ │ └── unescaped: "d" │ │ └── closing_loc: (13,1)-(13,2) = "\"" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (16,0)-(19,2)) │ ├── flags: newline, ignore_visibility @@ -114,7 +117,7 @@ │ │ │ ├── closing_loc: (18,0)-(19,0) = "A\n" │ │ │ └── unescaped: "e\n" │ │ └── @ InterpolatedStringNode (location: (16,9)-(19,2)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (16,9)-(16,12) = "%q[" │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (16,12)-(16,14)) @@ -131,6 +134,7 @@ │ │ │ └── unescaped: "f" │ │ └── closing_loc: (19,1)-(19,2) = "]" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (22,0)-(25,2)) │ ├── flags: newline, ignore_visibility @@ -150,7 +154,7 @@ │ │ │ ├── closing_loc: (24,0)-(25,0) = "A\n" │ │ │ └── unescaped: "g\n" │ │ └── @ InterpolatedStringNode (location: (22,9)-(25,2)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (22,9)-(22,12) = "%Q[" │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (22,12)-(22,14)) @@ -167,6 +171,7 @@ │ │ │ └── unescaped: "h" │ │ └── closing_loc: (25,1)-(25,2) = "]" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (28,0)-(31,2)) │ ├── flags: newline, ignore_visibility @@ -187,22 +192,28 @@ │ │ │ └── unescaped: "i\n" │ │ └── @ ArrayNode (location: (28,9)-(31,2)) │ │ ├── flags: ∅ - │ │ ├── elements: (length: 2) - │ │ │ ├── @ StringNode (location: (28,12)-(28,14)) - │ │ │ │ ├── flags: ∅ - │ │ │ │ ├── opening_loc: ∅ - │ │ │ │ ├── content_loc: (28,12)-(28,14) = "j\\" - │ │ │ │ ├── closing_loc: ∅ - │ │ │ │ └── unescaped: "j\n" - │ │ │ └── @ StringNode (location: (31,0)-(31,1)) + │ │ ├── elements: (length: 1) + │ │ │ └── @ InterpolatedStringNode (location: (28,12)-(31,1)) │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: ∅ - │ │ │ ├── content_loc: (31,0)-(31,1) = "j" - │ │ │ ├── closing_loc: ∅ - │ │ │ └── unescaped: "j" + │ │ │ ├── parts: (length: 2) + │ │ │ │ ├── @ StringNode (location: (28,12)-(28,14)) + │ │ │ │ │ ├── flags: static_literal, frozen + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── content_loc: (28,12)-(28,14) = "j\\" + │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ └── unescaped: "j\n" + │ │ │ │ └── @ StringNode (location: (31,0)-(31,1)) + │ │ │ │ ├── flags: static_literal, frozen + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── content_loc: (31,0)-(31,1) = "j" + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ └── unescaped: "j" + │ │ │ └── closing_loc: ∅ │ │ ├── opening_loc: (28,9)-(28,12) = "%w[" │ │ └── closing_loc: (31,1)-(31,2) = "]" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (35,0)-(38,2)) │ ├── flags: newline, ignore_visibility @@ -222,10 +233,10 @@ │ │ │ ├── closing_loc: (37,0)-(38,0) = "A\n" │ │ │ └── unescaped: "k\n" │ │ └── @ ArrayNode (location: (35,9)-(38,2)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── elements: (length: 1) │ │ │ └── @ InterpolatedStringNode (location: (35,12)-(38,1)) - │ │ │ ├── flags: static_literal + │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: ∅ │ │ │ ├── parts: (length: 2) │ │ │ │ ├── @ StringNode (location: (35,12)-(35,14)) @@ -244,6 +255,7 @@ │ │ ├── opening_loc: (35,9)-(35,12) = "%W[" │ │ └── closing_loc: (38,1)-(38,2) = "]" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (41,0)-(44,2)) │ ├── flags: newline, ignore_visibility @@ -264,22 +276,28 @@ │ │ │ └── unescaped: "m\n" │ │ └── @ ArrayNode (location: (41,9)-(44,2)) │ │ ├── flags: static_literal - │ │ ├── elements: (length: 2) - │ │ │ ├── @ SymbolNode (location: (41,12)-(41,14)) - │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding - │ │ │ │ ├── opening_loc: ∅ - │ │ │ │ ├── value_loc: (41,12)-(41,14) = "n\\" - │ │ │ │ ├── closing_loc: ∅ - │ │ │ │ └── unescaped: "n\n" - │ │ │ └── @ SymbolNode (location: (44,0)-(44,1)) - │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ ├── elements: (length: 1) + │ │ │ └── @ InterpolatedSymbolNode (location: (41,12)-(41,14)) + │ │ │ ├── flags: static_literal │ │ │ ├── opening_loc: ∅ - │ │ │ ├── value_loc: (44,0)-(44,1) = "n" - │ │ │ ├── closing_loc: ∅ - │ │ │ └── unescaped: "n" + │ │ │ ├── parts: (length: 2) + │ │ │ │ ├── @ StringNode (location: (41,12)-(41,14)) + │ │ │ │ │ ├── flags: static_literal, frozen + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── content_loc: (41,12)-(41,14) = "n\\" + │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ └── unescaped: "n\n" + │ │ │ │ └── @ StringNode (location: (41,12)-(41,14)) + │ │ │ │ ├── flags: static_literal, frozen + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── content_loc: (41,12)-(41,14) = "n\\" + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ └── unescaped: "n" + │ │ │ └── closing_loc: ∅ │ │ ├── opening_loc: (41,9)-(41,12) = "%i[" │ │ └── closing_loc: (44,1)-(44,2) = "]" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (48,0)-(51,2)) │ ├── flags: newline, ignore_visibility @@ -321,6 +339,7 @@ │ │ ├── opening_loc: (48,9)-(48,12) = "%I[" │ │ └── closing_loc: (51,1)-(51,2) = "]" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ StringNode (location: (53,0)-(53,3)) │ ├── flags: newline @@ -366,6 +385,7 @@ │ │ │ ├── closing_loc: (55,12)-(55,13) = "'" │ │ │ └── unescaped: "" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── targets: (length: 1) │ └── @ LocalVariableTargetNode (location: (53,5)-(55,7)) diff --git a/snapshots/spanning_heredoc_newlines.txt b/snapshots/spanning_heredoc_newlines.txt index ce57ca9662..976d5d28dc 100644 --- a/snapshots/spanning_heredoc_newlines.txt +++ b/snapshots/spanning_heredoc_newlines.txt @@ -29,6 +29,7 @@ │ │ ├── closing_loc: (3,0)-(4,0) = "\n" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (5,0)-(8,0)) │ ├── flags: newline @@ -54,6 +55,7 @@ │ │ ├── closing_loc: (7,0)-(8,0) = "\n" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (9,0)-(12,0)) │ ├── flags: newline @@ -79,6 +81,7 @@ │ │ ├── closing_loc: (11,0)-(12,0) = "\n" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (13,0)-(16,0)) │ ├── flags: newline @@ -104,6 +107,7 @@ │ │ ├── closing_loc: (15,0)-(16,0) = "\n" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (17,0)-(20,0)) │ ├── flags: newline @@ -129,6 +133,7 @@ │ │ ├── closing_loc: (19,0)-(20,0) = "\n" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (21,0)-(24,0)) ├── flags: newline @@ -154,4 +159,5 @@ │ ├── closing_loc: (23,0)-(24,0) = "\n" │ └── unescaped: "" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/string_concatination_frozen_false.txt b/snapshots/string_concatination_frozen_false.txt new file mode 100644 index 0000000000..f1361edbce --- /dev/null +++ b/snapshots/string_concatination_frozen_false.txt @@ -0,0 +1,71 @@ +@ ProgramNode (location: (3,0)-(5,23)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (3,0)-(5,23)) + ├── flags: ∅ + └── body: (length: 2) + ├── @ InterpolatedStringNode (location: (3,0)-(3,11)) + │ ├── flags: newline, mutable + │ ├── opening_loc: ∅ + │ ├── parts: (length: 2) + │ │ ├── @ StringNode (location: (3,0)-(3,5)) + │ │ │ ├── flags: static_literal, frozen + │ │ │ ├── opening_loc: (3,0)-(3,1) = "'" + │ │ │ ├── content_loc: (3,1)-(3,4) = "foo" + │ │ │ ├── closing_loc: (3,4)-(3,5) = "'" + │ │ │ └── unescaped: "foo" + │ │ └── @ StringNode (location: (3,6)-(3,11)) + │ │ ├── flags: static_literal, frozen + │ │ ├── opening_loc: (3,6)-(3,7) = "'" + │ │ ├── content_loc: (3,7)-(3,10) = "bar" + │ │ ├── closing_loc: (3,10)-(3,11) = "'" + │ │ └── unescaped: "bar" + │ └── closing_loc: ∅ + └── @ InterpolatedStringNode (location: (5,0)-(5,23)) + ├── flags: newline + ├── opening_loc: ∅ + ├── parts: (length: 3) + │ ├── @ StringNode (location: (5,0)-(5,5)) + │ │ ├── flags: static_literal, frozen + │ │ ├── opening_loc: (5,0)-(5,1) = "'" + │ │ ├── content_loc: (5,1)-(5,4) = "foo" + │ │ ├── closing_loc: (5,4)-(5,5) = "'" + │ │ └── unescaped: "foo" + │ ├── @ StringNode (location: (5,6)-(5,11)) + │ │ ├── flags: static_literal, frozen + │ │ ├── opening_loc: (5,6)-(5,7) = "'" + │ │ ├── content_loc: (5,7)-(5,10) = "bar" + │ │ ├── closing_loc: (5,10)-(5,11) = "'" + │ │ └── unescaped: "bar" + │ └── @ InterpolatedStringNode (location: (5,12)-(5,23)) + │ ├── flags: ∅ + │ ├── opening_loc: (5,12)-(5,13) = "\"" + │ ├── parts: (length: 2) + │ │ ├── @ StringNode (location: (5,13)-(5,16)) + │ │ │ ├── flags: static_literal, frozen + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (5,13)-(5,16) = "baz" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "baz" + │ │ └── @ EmbeddedStatementsNode (location: (5,16)-(5,22)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: (5,16)-(5,18) = "\#{" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (5,18)-(5,21)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (5,18)-(5,21)) + │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :bat + │ │ │ ├── message_loc: (5,18)-(5,21) = "bat" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ └── closing_loc: (5,21)-(5,22) = "}" + │ └── closing_loc: (5,22)-(5,23) = "\"" + └── closing_loc: ∅ diff --git a/snapshots/string_concatination_frozen_true.txt b/snapshots/string_concatination_frozen_true.txt new file mode 100644 index 0000000000..9d1f44666f --- /dev/null +++ b/snapshots/string_concatination_frozen_true.txt @@ -0,0 +1,71 @@ +@ ProgramNode (location: (3,0)-(5,23)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (3,0)-(5,23)) + ├── flags: ∅ + └── body: (length: 2) + ├── @ InterpolatedStringNode (location: (3,0)-(3,11)) + │ ├── flags: newline, static_literal, frozen + │ ├── opening_loc: ∅ + │ ├── parts: (length: 2) + │ │ ├── @ StringNode (location: (3,0)-(3,5)) + │ │ │ ├── flags: static_literal, frozen + │ │ │ ├── opening_loc: (3,0)-(3,1) = "'" + │ │ │ ├── content_loc: (3,1)-(3,4) = "foo" + │ │ │ ├── closing_loc: (3,4)-(3,5) = "'" + │ │ │ └── unescaped: "foo" + │ │ └── @ StringNode (location: (3,6)-(3,11)) + │ │ ├── flags: static_literal, frozen + │ │ ├── opening_loc: (3,6)-(3,7) = "'" + │ │ ├── content_loc: (3,7)-(3,10) = "bar" + │ │ ├── closing_loc: (3,10)-(3,11) = "'" + │ │ └── unescaped: "bar" + │ └── closing_loc: ∅ + └── @ InterpolatedStringNode (location: (5,0)-(5,23)) + ├── flags: newline + ├── opening_loc: ∅ + ├── parts: (length: 3) + │ ├── @ StringNode (location: (5,0)-(5,5)) + │ │ ├── flags: static_literal, frozen + │ │ ├── opening_loc: (5,0)-(5,1) = "'" + │ │ ├── content_loc: (5,1)-(5,4) = "foo" + │ │ ├── closing_loc: (5,4)-(5,5) = "'" + │ │ └── unescaped: "foo" + │ ├── @ StringNode (location: (5,6)-(5,11)) + │ │ ├── flags: static_literal, frozen + │ │ ├── opening_loc: (5,6)-(5,7) = "'" + │ │ ├── content_loc: (5,7)-(5,10) = "bar" + │ │ ├── closing_loc: (5,10)-(5,11) = "'" + │ │ └── unescaped: "bar" + │ └── @ InterpolatedStringNode (location: (5,12)-(5,23)) + │ ├── flags: ∅ + │ ├── opening_loc: (5,12)-(5,13) = "\"" + │ ├── parts: (length: 2) + │ │ ├── @ StringNode (location: (5,13)-(5,16)) + │ │ │ ├── flags: static_literal, frozen + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (5,13)-(5,16) = "baz" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "baz" + │ │ └── @ EmbeddedStatementsNode (location: (5,16)-(5,22)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: (5,16)-(5,18) = "\#{" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (5,18)-(5,21)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (5,18)-(5,21)) + │ │ │ ├── flags: variable_call, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :bat + │ │ │ ├── message_loc: (5,18)-(5,21) = "bat" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: ∅ + │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ + │ │ │ └── block: ∅ + │ │ └── closing_loc: (5,21)-(5,22) = "}" + │ └── closing_loc: (5,22)-(5,23) = "\"" + └── closing_loc: ∅ diff --git a/snapshots/strings.txt b/snapshots/strings.txt index 6bf5006305..f2727f22fa 100644 --- a/snapshots/strings.txt +++ b/snapshots/strings.txt @@ -1,10 +1,10 @@ -@ ProgramNode (location: (1,0)-(153,15)) +@ ProgramNode (location: (1,0)-(185,15)) ├── flags: ∅ ├── locals: [] └── statements: - @ StatementsNode (location: (1,0)-(153,15)) + @ StatementsNode (location: (1,0)-(185,15)) ├── flags: ∅ - └── body: (length: 65) + └── body: (length: 71) ├── @ StringNode (location: (1,0)-(1,6)) │ ├── flags: newline │ ├── opening_loc: (1,0)-(1,2) = "%%" @@ -138,6 +138,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (35,11)-(35,12) = "}" │ │ └── @ StringNode (location: (35,12)-(35,16)) @@ -177,6 +178,7 @@ │ │ ├── closing_loc: (41,4)-(41,5) = "\"" │ │ └── unescaped: "bar" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ StringNode (location: (43,0)-(46,1)) │ ├── flags: newline @@ -252,6 +254,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (64,10)-(64,11) = "}" │ │ └── @ StringNode (location: (64,11)-(64,15)) @@ -393,6 +396,7 @@ │ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ │ └── block: ∅ │ │ │ │ │ └── closing_loc: (79,8)-(79,9) = "}" │ │ │ │ └── @ StringNode (location: (79,9)-(80,3)) @@ -428,6 +432,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (81,9)-(81,10) = "}" │ │ └── closing_loc: ∅ @@ -529,284 +534,437 @@ │ │ └── unescaped: "d" │ ├── opening_loc: (96,0)-(96,3) = "%w[" │ └── closing_loc: (100,0)-(100,1) = "]" - ├── @ ArrayNode (location: (102,0)-(102,18)) + ├── @ ArrayNode (location: (102,0)-(105,1)) + │ ├── flags: newline + │ ├── elements: (length: 3) + │ │ ├── @ StringNode (location: (103,2)-(103,10)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (103,2)-(103,10) = "foo\\nbar" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "foo\\nbar" + │ │ ├── @ StringNode (location: (103,11)-(104,0)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (103,11)-(104,0) = "baz\\n\\n\\\n" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "baz\\n\\n\n" + │ │ └── @ StringNode (location: (104,2)-(104,15)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: ∅ + │ │ ├── content_loc: (104,2)-(104,15) = "bat\\n\\\\\\n\\foo" + │ │ ├── closing_loc: ∅ + │ │ └── unescaped: "bat\\n\\\\n\\foo" + │ ├── opening_loc: (102,0)-(102,3) = "%w[" + │ └── closing_loc: (105,0)-(105,1) = "]" + ├── @ ArrayNode (location: (107,0)-(110,1)) + │ ├── flags: newline + │ ├── elements: (length: 3) + │ │ ├── @ StringNode (location: (108,2)-(108,10)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (108,2)-(108,10) = "foo\\nbar" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "foo\nbar" + │ │ ├── @ StringNode (location: (108,11)-(109,0)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (108,11)-(109,0) = "baz\\n\\n\\\n" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "baz\n\n\n" + │ │ └── @ StringNode (location: (109,2)-(109,15)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: ∅ + │ │ ├── content_loc: (109,2)-(109,15) = "bat\\n\\\\\\n\\foo" + │ │ ├── closing_loc: ∅ + │ │ └── unescaped: "bat\n\\\n\foo" + │ ├── opening_loc: (107,0)-(107,3) = "%W[" + │ └── closing_loc: (110,0)-(110,1) = "]" + ├── @ ArrayNode (location: (112,0)-(119,1)) + │ ├── flags: newline + │ ├── elements: (length: 7) + │ │ ├── @ StringNode (location: (112,3)-(113,0)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (112,3)-(113,0) = "foo\\\n" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "foo\n" + │ │ ├── @ StringNode (location: (113,2)-(113,5)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (113,2)-(113,5) = "bar" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "bar" + │ │ ├── @ StringNode (location: (114,2)-(114,7)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (114,2)-(114,7) = "baz\\\\" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "baz\\" + │ │ ├── @ StringNode (location: (115,2)-(115,5)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (115,2)-(115,5) = "bat" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "bat" + │ │ ├── @ StringNode (location: (116,2)-(116,5)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (116,2)-(116,5) = "1\\n" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "1\\n" + │ │ ├── @ StringNode (location: (117,2)-(117,3)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (117,2)-(117,3) = "2" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "2" + │ │ └── @ StringNode (location: (118,2)-(118,6)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: ∅ + │ │ ├── content_loc: (118,2)-(118,6) = "3\\\\n" + │ │ ├── closing_loc: ∅ + │ │ └── unescaped: "3\\n" + │ ├── opening_loc: (112,0)-(112,3) = "%w[" + │ └── closing_loc: (119,0)-(119,1) = "]" + ├── @ ArrayNode (location: (121,0)-(128,1)) + │ ├── flags: newline + │ ├── elements: (length: 7) + │ │ ├── @ StringNode (location: (121,3)-(122,0)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (121,3)-(122,0) = "foo\\\n" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "foo\n" + │ │ ├── @ StringNode (location: (122,2)-(122,5)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (122,2)-(122,5) = "bar" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "bar" + │ │ ├── @ StringNode (location: (123,2)-(123,7)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (123,2)-(123,7) = "baz\\\\" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "baz\\" + │ │ ├── @ StringNode (location: (124,2)-(124,5)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (124,2)-(124,5) = "bat" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "bat" + │ │ ├── @ StringNode (location: (125,2)-(125,5)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (125,2)-(125,5) = "1\\n" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "1\n" + │ │ ├── @ StringNode (location: (126,2)-(126,3)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (126,2)-(126,3) = "2" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "2" + │ │ └── @ StringNode (location: (127,2)-(127,6)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: ∅ + │ │ ├── content_loc: (127,2)-(127,6) = "3\\\\n" + │ │ ├── closing_loc: ∅ + │ │ └── unescaped: "3\\n" + │ ├── opening_loc: (121,0)-(121,3) = "%W[" + │ └── closing_loc: (128,0)-(128,1) = "]" + ├── @ ArrayNode (location: (130,0)-(130,18)) │ ├── flags: newline │ ├── elements: (length: 1) - │ │ └── @ StringNode (location: (102,3)-(102,17)) + │ │ └── @ StringNode (location: (130,3)-(130,17)) │ │ ├── flags: ∅ │ │ ├── opening_loc: ∅ - │ │ ├── content_loc: (102,3)-(102,17) = "f\\u{006f 006f}" + │ │ ├── content_loc: (130,3)-(130,17) = "f\\u{006f 006f}" │ │ ├── closing_loc: ∅ │ │ └── unescaped: "foo" - │ ├── opening_loc: (102,0)-(102,3) = "%W[" - │ └── closing_loc: (102,17)-(102,18) = "]" - ├── @ ArrayNode (location: (104,0)-(104,14)) + │ ├── opening_loc: (130,0)-(130,3) = "%W[" + │ └── closing_loc: (130,17)-(130,18) = "]" + ├── @ ArrayNode (location: (132,0)-(132,14)) │ ├── flags: newline │ ├── elements: (length: 3) - │ │ ├── @ StringNode (location: (104,3)-(104,4)) + │ │ ├── @ StringNode (location: (132,3)-(132,4)) │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: ∅ - │ │ │ ├── content_loc: (104,3)-(104,4) = "a" + │ │ │ ├── content_loc: (132,3)-(132,4) = "a" │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "a" - │ │ ├── @ InterpolatedStringNode (location: (104,5)-(104,11)) + │ │ ├── @ InterpolatedStringNode (location: (132,5)-(132,11)) │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: ∅ │ │ │ ├── parts: (length: 3) - │ │ │ │ ├── @ StringNode (location: (104,5)-(104,6)) + │ │ │ │ ├── @ StringNode (location: (132,5)-(132,6)) │ │ │ │ │ ├── flags: static_literal, frozen │ │ │ │ │ ├── opening_loc: ∅ - │ │ │ │ │ ├── content_loc: (104,5)-(104,6) = "b" + │ │ │ │ │ ├── content_loc: (132,5)-(132,6) = "b" │ │ │ │ │ ├── closing_loc: ∅ │ │ │ │ │ └── unescaped: "b" - │ │ │ │ ├── @ EmbeddedStatementsNode (location: (104,6)-(104,10)) + │ │ │ │ ├── @ EmbeddedStatementsNode (location: (132,6)-(132,10)) │ │ │ │ │ ├── flags: ∅ - │ │ │ │ │ ├── opening_loc: (104,6)-(104,8) = "\#{" + │ │ │ │ │ ├── opening_loc: (132,6)-(132,8) = "\#{" │ │ │ │ │ ├── statements: - │ │ │ │ │ │ @ StatementsNode (location: (104,8)-(104,9)) + │ │ │ │ │ │ @ StatementsNode (location: (132,8)-(132,9)) │ │ │ │ │ │ ├── flags: ∅ │ │ │ │ │ │ └── body: (length: 1) - │ │ │ │ │ │ └── @ CallNode (location: (104,8)-(104,9)) + │ │ │ │ │ │ └── @ CallNode (location: (132,8)-(132,9)) │ │ │ │ │ │ ├── flags: variable_call, ignore_visibility │ │ │ │ │ │ ├── receiver: ∅ │ │ │ │ │ │ ├── call_operator_loc: ∅ │ │ │ │ │ │ ├── name: :c - │ │ │ │ │ │ ├── message_loc: (104,8)-(104,9) = "c" + │ │ │ │ │ │ ├── message_loc: (132,8)-(132,9) = "c" │ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ │ └── block: ∅ - │ │ │ │ │ └── closing_loc: (104,9)-(104,10) = "}" - │ │ │ │ └── @ StringNode (location: (104,10)-(104,11)) + │ │ │ │ │ └── closing_loc: (132,9)-(132,10) = "}" + │ │ │ │ └── @ StringNode (location: (132,10)-(132,11)) │ │ │ │ ├── flags: static_literal, frozen │ │ │ │ ├── opening_loc: ∅ - │ │ │ │ ├── content_loc: (104,10)-(104,11) = "d" + │ │ │ │ ├── content_loc: (132,10)-(132,11) = "d" │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "d" │ │ │ └── closing_loc: ∅ - │ │ └── @ StringNode (location: (104,12)-(104,13)) + │ │ └── @ StringNode (location: (132,12)-(132,13)) │ │ ├── flags: ∅ │ │ ├── opening_loc: ∅ - │ │ ├── content_loc: (104,12)-(104,13) = "e" + │ │ ├── content_loc: (132,12)-(132,13) = "e" │ │ ├── closing_loc: ∅ │ │ └── unescaped: "e" - │ ├── opening_loc: (104,0)-(104,3) = "%W[" - │ └── closing_loc: (104,13)-(104,14) = "]" - ├── @ ArrayNode (location: (106,0)-(106,9)) + │ ├── opening_loc: (132,0)-(132,3) = "%W[" + │ └── closing_loc: (132,13)-(132,14) = "]" + ├── @ ArrayNode (location: (134,0)-(134,9)) │ ├── flags: newline │ ├── elements: (length: 3) - │ │ ├── @ StringNode (location: (106,3)-(106,4)) + │ │ ├── @ StringNode (location: (134,3)-(134,4)) │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: ∅ - │ │ │ ├── content_loc: (106,3)-(106,4) = "a" + │ │ │ ├── content_loc: (134,3)-(134,4) = "a" │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "a" - │ │ ├── @ StringNode (location: (106,5)-(106,6)) + │ │ ├── @ StringNode (location: (134,5)-(134,6)) │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: ∅ - │ │ │ ├── content_loc: (106,5)-(106,6) = "b" + │ │ │ ├── content_loc: (134,5)-(134,6) = "b" │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "b" - │ │ └── @ StringNode (location: (106,7)-(106,8)) + │ │ └── @ StringNode (location: (134,7)-(134,8)) │ │ ├── flags: ∅ │ │ ├── opening_loc: ∅ - │ │ ├── content_loc: (106,7)-(106,8) = "c" + │ │ ├── content_loc: (134,7)-(134,8) = "c" │ │ ├── closing_loc: ∅ │ │ └── unescaped: "c" - │ ├── opening_loc: (106,0)-(106,3) = "%W[" - │ └── closing_loc: (106,8)-(106,9) = "]" - ├── @ ArrayNode (location: (108,0)-(112,1)) + │ ├── opening_loc: (134,0)-(134,3) = "%W[" + │ └── closing_loc: (134,8)-(134,9) = "]" + ├── @ ArrayNode (location: (136,0)-(140,1)) │ ├── flags: newline │ ├── elements: (length: 3) - │ │ ├── @ StringNode (location: (109,2)-(109,3)) + │ │ ├── @ StringNode (location: (137,2)-(137,3)) │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: ∅ - │ │ │ ├── content_loc: (109,2)-(109,3) = "a" + │ │ │ ├── content_loc: (137,2)-(137,3) = "a" │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "a" - │ │ ├── @ StringNode (location: (110,2)-(110,3)) + │ │ ├── @ StringNode (location: (138,2)-(138,3)) │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: ∅ - │ │ │ ├── content_loc: (110,2)-(110,3) = "b" + │ │ │ ├── content_loc: (138,2)-(138,3) = "b" │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "b" - │ │ └── @ StringNode (location: (111,2)-(111,3)) + │ │ └── @ StringNode (location: (139,2)-(139,3)) │ │ ├── flags: ∅ │ │ ├── opening_loc: ∅ - │ │ ├── content_loc: (111,2)-(111,3) = "c" + │ │ ├── content_loc: (139,2)-(139,3) = "c" │ │ ├── closing_loc: ∅ │ │ └── unescaped: "c" - │ ├── opening_loc: (108,0)-(108,3) = "%w[" - │ └── closing_loc: (112,0)-(112,1) = "]" - ├── @ StringNode (location: (114,0)-(114,15)) + │ ├── opening_loc: (136,0)-(136,3) = "%w[" + │ └── closing_loc: (140,0)-(140,1) = "]" + ├── @ StringNode (location: (142,0)-(142,15)) │ ├── flags: newline - │ ├── opening_loc: (114,0)-(114,1) = "'" - │ ├── content_loc: (114,1)-(114,14) = "\\' foo \\' bar" - │ ├── closing_loc: (114,14)-(114,15) = "'" + │ ├── opening_loc: (142,0)-(142,1) = "'" + │ ├── content_loc: (142,1)-(142,14) = "\\' foo \\' bar" + │ ├── closing_loc: (142,14)-(142,15) = "'" │ └── unescaped: "' foo ' bar" - ├── @ StringNode (location: (116,0)-(116,15)) + ├── @ StringNode (location: (144,0)-(144,15)) │ ├── flags: newline - │ ├── opening_loc: (116,0)-(116,1) = "'" - │ ├── content_loc: (116,1)-(116,14) = "\\\\ foo \\\\ bar" - │ ├── closing_loc: (116,14)-(116,15) = "'" + │ ├── opening_loc: (144,0)-(144,1) = "'" + │ ├── content_loc: (144,1)-(144,14) = "\\\\ foo \\\\ bar" + │ ├── closing_loc: (144,14)-(144,15) = "'" │ └── unescaped: "\\ foo \\ bar" - ├── @ StringNode (location: (118,0)-(121,1)) + ├── @ StringNode (location: (146,0)-(149,1)) │ ├── flags: newline - │ ├── opening_loc: (118,0)-(118,1) = "'" - │ ├── content_loc: (118,1)-(121,0) = "foo\\\nbar\\\\\nbaz\n" - │ ├── closing_loc: (121,0)-(121,1) = "'" + │ ├── opening_loc: (146,0)-(146,1) = "'" + │ ├── content_loc: (146,1)-(149,0) = "foo\\\nbar\\\\\nbaz\n" + │ ├── closing_loc: (149,0)-(149,1) = "'" │ └── unescaped: "foo\\\nbar\\\nbaz\n" - ├── @ InterpolatedStringNode (location: (123,0)-(123,7)) + ├── @ InterpolatedStringNode (location: (151,0)-(151,7)) │ ├── flags: newline - │ ├── opening_loc: (123,0)-(123,1) = "\"" + │ ├── opening_loc: (151,0)-(151,1) = "\"" │ ├── parts: (length: 1) - │ │ └── @ EmbeddedVariableNode (location: (123,1)-(123,6)) + │ │ └── @ EmbeddedVariableNode (location: (151,1)-(151,6)) │ │ ├── flags: ∅ - │ │ ├── operator_loc: (123,1)-(123,2) = "#" + │ │ ├── operator_loc: (151,1)-(151,2) = "#" │ │ └── variable: - │ │ @ GlobalVariableReadNode (location: (123,2)-(123,6)) + │ │ @ GlobalVariableReadNode (location: (151,2)-(151,6)) │ │ ├── flags: ∅ │ │ └── name: :$foo - │ └── closing_loc: (123,6)-(123,7) = "\"" - ├── @ InterpolatedStringNode (location: (125,0)-(125,7)) + │ └── closing_loc: (151,6)-(151,7) = "\"" + ├── @ InterpolatedStringNode (location: (153,0)-(153,7)) │ ├── flags: newline - │ ├── opening_loc: (125,0)-(125,1) = "\"" + │ ├── opening_loc: (153,0)-(153,1) = "\"" │ ├── parts: (length: 1) - │ │ └── @ EmbeddedVariableNode (location: (125,1)-(125,6)) + │ │ └── @ EmbeddedVariableNode (location: (153,1)-(153,6)) │ │ ├── flags: ∅ - │ │ ├── operator_loc: (125,1)-(125,2) = "#" + │ │ ├── operator_loc: (153,1)-(153,2) = "#" │ │ └── variable: - │ │ @ InstanceVariableReadNode (location: (125,2)-(125,6)) + │ │ @ InstanceVariableReadNode (location: (153,2)-(153,6)) │ │ ├── flags: ∅ │ │ └── name: :@foo - │ └── closing_loc: (125,6)-(125,7) = "\"" - ├── @ StringNode (location: (127,0)-(127,15)) + │ └── closing_loc: (153,6)-(153,7) = "\"" + ├── @ StringNode (location: (155,0)-(155,15)) │ ├── flags: newline - │ ├── opening_loc: (127,0)-(127,1) = "\"" - │ ├── content_loc: (127,1)-(127,14) = "\\x7 \\x23 \\x61" - │ ├── closing_loc: (127,14)-(127,15) = "\"" + │ ├── opening_loc: (155,0)-(155,1) = "\"" + │ ├── content_loc: (155,1)-(155,14) = "\\x7 \\x23 \\x61" + │ ├── closing_loc: (155,14)-(155,15) = "\"" │ └── unescaped: "\a # a" - ├── @ StringNode (location: (129,0)-(129,13)) + ├── @ StringNode (location: (157,0)-(157,13)) │ ├── flags: newline - │ ├── opening_loc: (129,0)-(129,1) = "\"" - │ ├── content_loc: (129,1)-(129,12) = "\\7 \\43 \\141" - │ ├── closing_loc: (129,12)-(129,13) = "\"" + │ ├── opening_loc: (157,0)-(157,1) = "\"" + │ ├── content_loc: (157,1)-(157,12) = "\\7 \\43 \\141" + │ ├── closing_loc: (157,12)-(157,13) = "\"" │ └── unescaped: "\a # a" - ├── @ StringNode (location: (131,0)-(131,17)) + ├── @ StringNode (location: (159,0)-(159,17)) │ ├── flags: newline, forced_utf8_encoding - │ ├── opening_loc: (131,0)-(131,1) = "\"" - │ ├── content_loc: (131,1)-(131,16) = "ち\\xE3\\x81\\xFF" - │ ├── closing_loc: (131,16)-(131,17) = "\"" + │ ├── opening_loc: (159,0)-(159,1) = "\"" + │ ├── content_loc: (159,1)-(159,16) = "ち\\xE3\\x81\\xFF" + │ ├── closing_loc: (159,16)-(159,17) = "\"" │ └── unescaped: "ち\xE3\x81\xFF" - ├── @ StringNode (location: (133,0)-(133,6)) + ├── @ StringNode (location: (161,0)-(161,6)) │ ├── flags: newline, forced_utf8_encoding - │ ├── opening_loc: (133,0)-(133,1) = "\"" - │ ├── content_loc: (133,1)-(133,5) = "\\777" - │ ├── closing_loc: (133,5)-(133,6) = "\"" + │ ├── opening_loc: (161,0)-(161,1) = "\"" + │ ├── content_loc: (161,1)-(161,5) = "\\777" + │ ├── closing_loc: (161,5)-(161,6) = "\"" │ └── unescaped: "\xFF" - ├── @ StringNode (location: (135,0)-(135,6)) + ├── @ StringNode (location: (163,0)-(163,6)) │ ├── flags: newline - │ ├── opening_loc: (135,0)-(135,2) = "%[" - │ ├── content_loc: (135,2)-(135,5) = "abc" - │ ├── closing_loc: (135,5)-(135,6) = "]" + │ ├── opening_loc: (163,0)-(163,2) = "%[" + │ ├── content_loc: (163,2)-(163,5) = "abc" + │ ├── closing_loc: (163,5)-(163,6) = "]" │ └── unescaped: "abc" - ├── @ StringNode (location: (137,0)-(137,6)) + ├── @ StringNode (location: (165,0)-(165,6)) │ ├── flags: newline - │ ├── opening_loc: (137,0)-(137,2) = "%(" - │ ├── content_loc: (137,2)-(137,5) = "abc" - │ ├── closing_loc: (137,5)-(137,6) = ")" + │ ├── opening_loc: (165,0)-(165,2) = "%(" + │ ├── content_loc: (165,2)-(165,5) = "abc" + │ ├── closing_loc: (165,5)-(165,6) = ")" │ └── unescaped: "abc" - ├── @ StringNode (location: (139,0)-(139,6)) + ├── @ StringNode (location: (167,0)-(167,6)) │ ├── flags: newline - │ ├── opening_loc: (139,0)-(139,2) = "%@" - │ ├── content_loc: (139,2)-(139,5) = "abc" - │ ├── closing_loc: (139,5)-(139,6) = "@" + │ ├── opening_loc: (167,0)-(167,2) = "%@" + │ ├── content_loc: (167,2)-(167,5) = "abc" + │ ├── closing_loc: (167,5)-(167,6) = "@" │ └── unescaped: "abc" - ├── @ StringNode (location: (141,0)-(141,6)) + ├── @ StringNode (location: (169,0)-(169,6)) │ ├── flags: newline - │ ├── opening_loc: (141,0)-(141,2) = "%$" - │ ├── content_loc: (141,2)-(141,5) = "abc" - │ ├── closing_loc: (141,5)-(141,6) = "$" + │ ├── opening_loc: (169,0)-(169,2) = "%$" + │ ├── content_loc: (169,2)-(169,5) = "abc" + │ ├── closing_loc: (169,5)-(169,6) = "$" │ └── unescaped: "abc" - ├── @ StringNode (location: (143,0)-(143,2)) + ├── @ StringNode (location: (171,0)-(171,2)) │ ├── flags: newline - │ ├── opening_loc: (143,0)-(143,1) = "?" - │ ├── content_loc: (143,1)-(143,2) = "a" + │ ├── opening_loc: (171,0)-(171,1) = "?" + │ ├── content_loc: (171,1)-(171,2) = "a" │ ├── closing_loc: ∅ │ └── unescaped: "a" - ├── @ InterpolatedStringNode (location: (145,0)-(145,6)) - │ ├── flags: newline, static_literal + ├── @ InterpolatedStringNode (location: (173,0)-(173,6)) + │ ├── flags: newline │ ├── opening_loc: ∅ │ ├── parts: (length: 2) - │ │ ├── @ StringNode (location: (145,0)-(145,2)) + │ │ ├── @ StringNode (location: (173,0)-(173,2)) │ │ │ ├── flags: static_literal, frozen - │ │ │ ├── opening_loc: (145,0)-(145,1) = "?" - │ │ │ ├── content_loc: (145,1)-(145,2) = "a" + │ │ │ ├── opening_loc: (173,0)-(173,1) = "?" + │ │ │ ├── content_loc: (173,1)-(173,2) = "a" │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "a" - │ │ └── @ StringNode (location: (145,3)-(145,6)) + │ │ └── @ StringNode (location: (173,3)-(173,6)) │ │ ├── flags: static_literal, frozen - │ │ ├── opening_loc: (145,3)-(145,4) = "\"" - │ │ ├── content_loc: (145,4)-(145,5) = "a" - │ │ ├── closing_loc: (145,5)-(145,6) = "\"" + │ │ ├── opening_loc: (173,3)-(173,4) = "\"" + │ │ ├── content_loc: (173,4)-(173,5) = "a" + │ │ ├── closing_loc: (173,5)-(173,6) = "\"" │ │ └── unescaped: "a" │ └── closing_loc: ∅ - ├── @ StringNode (location: (147,0)-(147,7)) + ├── @ StringNode (location: (175,0)-(175,7)) │ ├── flags: newline - │ ├── opening_loc: (147,0)-(147,3) = "%Q{" - │ ├── content_loc: (147,3)-(147,6) = "abc" - │ ├── closing_loc: (147,6)-(147,7) = "}" + │ ├── opening_loc: (175,0)-(175,3) = "%Q{" + │ ├── content_loc: (175,3)-(175,6) = "abc" + │ ├── closing_loc: (175,6)-(175,7) = "}" │ └── unescaped: "abc" - ├── @ StringNode (location: (149,0)-(149,5)) - │ ├── flags: newline - │ ├── opening_loc: (149,0)-(149,2) = "%^" - │ ├── content_loc: (149,2)-(149,4) = "\#$" - │ ├── closing_loc: (149,4)-(149,5) = "^" + ├── @ StringNode (location: (177,0)-(177,7)) + │ ├── flags: newline + │ ├── opening_loc: (177,0)-(177,3) = "%Q(" + │ ├── content_loc: (177,3)-(177,6) = "\\«" + │ ├── closing_loc: (177,6)-(177,7) = ")" + │ └── unescaped: "«" + ├── @ StringNode (location: (179,0)-(179,7)) + │ ├── flags: newline + │ ├── opening_loc: (179,0)-(179,3) = "%q(" + │ ├── content_loc: (179,3)-(179,6) = "\\«" + │ ├── closing_loc: (179,6)-(179,7) = ")" + │ └── unescaped: "\\«" + ├── @ StringNode (location: (181,0)-(181,5)) + │ ├── flags: newline + │ ├── opening_loc: (181,0)-(181,2) = "%^" + │ ├── content_loc: (181,2)-(181,4) = "\#$" + │ ├── closing_loc: (181,4)-(181,5) = "^" │ └── unescaped: "\#$" - ├── @ StringNode (location: (151,0)-(151,4)) + ├── @ StringNode (location: (183,0)-(183,4)) │ ├── flags: newline - │ ├── opening_loc: (151,0)-(151,2) = "%@" - │ ├── content_loc: (151,2)-(151,3) = "#" - │ ├── closing_loc: (151,3)-(151,4) = "@" + │ ├── opening_loc: (183,0)-(183,2) = "%@" + │ ├── content_loc: (183,2)-(183,3) = "#" + │ ├── closing_loc: (183,3)-(183,4) = "@" │ └── unescaped: "#" - └── @ InterpolatedStringNode (location: (153,0)-(153,15)) + └── @ InterpolatedStringNode (location: (185,0)-(185,15)) ├── flags: newline - ├── opening_loc: (153,0)-(153,1) = "\"" + ├── opening_loc: (185,0)-(185,1) = "\"" ├── parts: (length: 2) - │ ├── @ EmbeddedStatementsNode (location: (153,1)-(153,12)) + │ ├── @ EmbeddedStatementsNode (location: (185,1)-(185,12)) │ │ ├── flags: ∅ - │ │ ├── opening_loc: (153,1)-(153,3) = "\#{" + │ │ ├── opening_loc: (185,1)-(185,3) = "\#{" │ │ ├── statements: - │ │ │ @ StatementsNode (location: (153,3)-(153,11)) + │ │ │ @ StatementsNode (location: (185,3)-(185,11)) │ │ │ ├── flags: ∅ │ │ │ └── body: (length: 1) - │ │ │ └── @ InterpolatedStringNode (location: (153,3)-(153,11)) + │ │ │ └── @ InterpolatedStringNode (location: (185,3)-(185,11)) │ │ │ ├── flags: ∅ - │ │ │ ├── opening_loc: (153,3)-(153,4) = "\"" + │ │ │ ├── opening_loc: (185,3)-(185,4) = "\"" │ │ │ ├── parts: (length: 2) - │ │ │ │ ├── @ EmbeddedStatementsNode (location: (153,4)-(153,8)) + │ │ │ │ ├── @ EmbeddedStatementsNode (location: (185,4)-(185,8)) │ │ │ │ │ ├── flags: ∅ - │ │ │ │ │ ├── opening_loc: (153,4)-(153,6) = "\#{" + │ │ │ │ │ ├── opening_loc: (185,4)-(185,6) = "\#{" │ │ │ │ │ ├── statements: - │ │ │ │ │ │ @ StatementsNode (location: (153,6)-(153,7)) + │ │ │ │ │ │ @ StatementsNode (location: (185,6)-(185,7)) │ │ │ │ │ │ ├── flags: ∅ │ │ │ │ │ │ └── body: (length: 1) - │ │ │ │ │ │ └── @ ConstantReadNode (location: (153,6)-(153,7)) + │ │ │ │ │ │ └── @ ConstantReadNode (location: (185,6)-(185,7)) │ │ │ │ │ │ ├── flags: ∅ │ │ │ │ │ │ └── name: :B - │ │ │ │ │ └── closing_loc: (153,7)-(153,8) = "}" - │ │ │ │ └── @ StringNode (location: (153,8)-(153,10)) + │ │ │ │ │ └── closing_loc: (185,7)-(185,8) = "}" + │ │ │ │ └── @ StringNode (location: (185,8)-(185,10)) │ │ │ │ ├── flags: static_literal, frozen │ │ │ │ ├── opening_loc: ∅ - │ │ │ │ ├── content_loc: (153,8)-(153,10) = " C" + │ │ │ │ ├── content_loc: (185,8)-(185,10) = " C" │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: " C" - │ │ │ └── closing_loc: (153,10)-(153,11) = "\"" - │ │ └── closing_loc: (153,11)-(153,12) = "}" - │ └── @ StringNode (location: (153,12)-(153,14)) + │ │ │ └── closing_loc: (185,10)-(185,11) = "\"" + │ │ └── closing_loc: (185,11)-(185,12) = "}" + │ └── @ StringNode (location: (185,12)-(185,14)) │ ├── flags: static_literal, frozen │ ├── opening_loc: ∅ - │ ├── content_loc: (153,12)-(153,14) = " D" + │ ├── content_loc: (185,12)-(185,14) = " D" │ ├── closing_loc: ∅ │ └── unescaped: " D" - └── closing_loc: (153,14)-(153,15) = "\"" + └── closing_loc: (185,14)-(185,15) = "\"" diff --git a/snapshots/symbols.txt b/snapshots/symbols.txt index 5d988e7313..05b960b1a0 100644 --- a/snapshots/symbols.txt +++ b/snapshots/symbols.txt @@ -31,6 +31,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (3,7)-(3,8) = "}" │ └── closing_loc: (3,8)-(3,9) = "\"" diff --git a/snapshots/ternary_operator.txt b/snapshots/ternary_operator.txt index 4d6a7423f9..c7a38ffd83 100644 --- a/snapshots/ternary_operator.txt +++ b/snapshots/ternary_operator.txt @@ -18,6 +18,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (1,2)-(1,3) = "?" │ ├── statements: @@ -33,6 +34,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: │ │ @ ElseNode (location: (1,6)-(1,9)) @@ -51,6 +53,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: ∅ │ └── end_keyword_loc: ∅ @@ -67,6 +70,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (3,2)-(3,3) = "?" │ ├── statements: @@ -86,6 +90,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rparen_loc: ∅ │ │ └── keyword_loc: (3,4)-(3,12) = "defined?" @@ -110,6 +115,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── rparen_loc: ∅ │ │ │ └── keyword_loc: (3,17)-(3,25) = "defined?" @@ -128,6 +134,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (5,6)-(5,7) = "?" │ ├── statements: @@ -161,6 +168,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (7,6)-(7,7) = "?" │ ├── statements: @@ -194,6 +202,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (9,6)-(9,7) = "?" │ ├── statements: @@ -227,6 +236,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (11,2)-(11,3) = "?" │ ├── statements: @@ -260,6 +270,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (13,2)-(13,3) = "?" │ ├── statements: @@ -275,6 +286,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: │ │ @ ElseNode (location: (13,8)-(13,14)) @@ -293,6 +305,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: ∅ │ └── end_keyword_loc: ∅ @@ -309,6 +322,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: (15,4)-(15,5) = "?" ├── statements: diff --git a/snapshots/tilde_heredocs.txt b/snapshots/tilde_heredocs.txt index dc6321ce1a..ad41ff0797 100644 --- a/snapshots/tilde_heredocs.txt +++ b/snapshots/tilde_heredocs.txt @@ -46,7 +46,7 @@ │ ├── closing_loc: (9,0)-(10,0) = "EOF\n" │ └── unescaped: "a\n" ├── @ InterpolatedStringNode (location: (11,0)-(11,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (11,0)-(11,6) = "<<~EOF" │ ├── parts: (length: 3) │ │ ├── @ StringNode (location: (12,0)-(13,0)) @@ -175,7 +175,7 @@ │ │ └── unescaped: "\n" │ └── closing_loc: (33,0)-(34,0) = "EOF\n" ├── @ InterpolatedStringNode (location: (35,0)-(35,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (35,0)-(35,6) = "<<~EOF" │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (36,0)-(37,0)) @@ -192,7 +192,7 @@ │ │ └── unescaped: "b\n" │ └── closing_loc: (38,0)-(39,0) = "EOF\n" ├── @ InterpolatedStringNode (location: (40,0)-(40,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (40,0)-(40,6) = "<<~EOF" │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (41,0)-(42,0)) @@ -209,7 +209,7 @@ │ │ └── unescaped: " b\n" │ └── closing_loc: (43,0)-(44,0) = "EOF\n" ├── @ InterpolatedStringNode (location: (45,0)-(45,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (45,0)-(45,6) = "<<~EOF" │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (46,0)-(47,0)) @@ -232,7 +232,7 @@ │ ├── closing_loc: (52,0)-(53,0) = "EOF\n" │ └── unescaped: "a \#{1}\n" ├── @ InterpolatedStringNode (location: (54,0)-(54,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (54,0)-(54,6) = "<<~EOF" │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (55,0)-(56,0)) @@ -249,7 +249,7 @@ │ │ └── unescaped: " b\n" │ └── closing_loc: (57,0)-(58,0) = "EOF\n" ├── @ InterpolatedStringNode (location: (59,0)-(59,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (59,0)-(59,6) = "<<~EOF" │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (60,0)-(61,0)) @@ -266,7 +266,7 @@ │ │ └── unescaped: "b\n" │ └── closing_loc: (62,0)-(63,0) = "EOF\n" ├── @ InterpolatedStringNode (location: (64,0)-(64,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (64,0)-(64,6) = "<<~EOF" │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (65,0)-(66,0)) @@ -283,7 +283,7 @@ │ │ └── unescaped: "b\n" │ └── closing_loc: (67,0)-(68,0) = "EOF\n" ├── @ InterpolatedStringNode (location: (69,0)-(69,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (69,0)-(69,6) = "<<~EOF" │ ├── parts: (length: 3) │ │ ├── @ StringNode (location: (70,0)-(71,0)) @@ -306,7 +306,7 @@ │ │ └── unescaped: "b\n" │ └── closing_loc: (73,0)-(74,0) = "EOF\n" ├── @ InterpolatedStringNode (location: (75,0)-(75,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (75,0)-(75,6) = "<<~EOF" │ ├── parts: (length: 3) │ │ ├── @ StringNode (location: (76,0)-(77,0)) @@ -329,7 +329,7 @@ │ │ └── unescaped: "b\n" │ └── closing_loc: (79,0)-(80,0) = "EOF\n" ├── @ InterpolatedStringNode (location: (81,0)-(81,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (81,0)-(81,6) = "<<~EOF" │ ├── parts: (length: 5) │ │ ├── @ StringNode (location: (82,0)-(83,0)) diff --git a/snapshots/unary_method_calls.txt b/snapshots/unary_method_calls.txt new file mode 100644 index 0000000000..4f793866c5 --- /dev/null +++ b/snapshots/unary_method_calls.txt @@ -0,0 +1,35 @@ +@ ProgramNode (location: (1,0)-(2,5)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(2,5)) + ├── flags: ∅ + └── body: (length: 2) + ├── @ CallNode (location: (1,0)-(1,5)) + │ ├── flags: newline + │ ├── receiver: + │ │ @ IntegerNode (location: (1,0)-(1,2)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 42 + │ ├── call_operator_loc: (1,2)-(1,3) = "." + │ ├── name: :~ + │ ├── message_loc: (1,3)-(1,5) = "~@" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ + │ └── block: ∅ + └── @ CallNode (location: (2,0)-(2,5)) + ├── flags: newline + ├── receiver: + │ @ IntegerNode (location: (2,0)-(2,2)) + │ ├── flags: static_literal, decimal + │ └── value: 42 + ├── call_operator_loc: (2,2)-(2,3) = "." + ├── name: :! + ├── message_loc: (2,3)-(2,5) = "!@" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + ├── equal_loc: ∅ + └── block: ∅ diff --git a/snapshots/unless.txt b/snapshots/unless.txt index 9e62b0c0a9..62b659193d 100644 --- a/snapshots/unless.txt +++ b/snapshots/unless.txt @@ -73,6 +73,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (8,4)-(8,25)) │ ├── flags: ∅ @@ -110,6 +111,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (10,4)-(10,24)) │ ├── flags: ∅ @@ -168,6 +170,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: ∅ ├── statements: @@ -198,6 +201,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "b" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── else_clause: ∅ └── end_keyword_loc: ∅ diff --git a/snapshots/unparser/corpus/literal/assignment.txt b/snapshots/unparser/corpus/literal/assignment.txt index 4e4ed86e7b..501492a43d 100644 --- a/snapshots/unparser/corpus/literal/assignment.txt +++ b/snapshots/unparser/corpus/literal/assignment.txt @@ -652,6 +652,7 @@ │ │ ├── opening_loc: (25,9)-(25,10) = "(" │ │ ├── arguments: ∅ │ │ ├── closing_loc: (25,10)-(25,11) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (25,4)-(25,5) = "=" ├── @ CallNode (location: (26,0)-(26,9)) @@ -667,6 +668,7 @@ │ ├── opening_loc: (26,7)-(26,8) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (26,8)-(26,9) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (27,0)-(27,13)) │ ├── flags: newline @@ -690,6 +692,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: (27,12)-(27,13) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (28,0)-(28,11)) │ ├── flags: newline @@ -709,6 +712,7 @@ │ │ └── @ TrueNode (location: (28,7)-(28,11)) │ │ └── flags: static_literal │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (29,0)-(29,19)) │ ├── flags: newline, attribute_write @@ -738,6 +742,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (29,14)-(29,19)) │ │ ├── flags: variable_call, ignore_visibility @@ -748,8 +753,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (29,10)-(29,11) = "]" + │ ├── equal_loc: (29,12)-(29,13) = "=" │ └── block: ∅ ├── @ CallNode (location: (30,0)-(30,17)) │ ├── flags: newline, attribute_write @@ -786,8 +793,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (30,8)-(30,9) = "]" + │ ├── equal_loc: (30,10)-(30,11) = "=" │ └── block: ∅ ├── @ CallNode (location: (31,0)-(31,9)) │ ├── flags: newline, attribute_write @@ -808,6 +817,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: (31,4)-(31,5) = "]" + │ ├── equal_loc: (31,6)-(31,7) = "=" │ └── block: ∅ ├── @ CallNode (location: (32,0)-(32,17)) │ ├── flags: newline, attribute_write @@ -841,8 +851,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (32,8)-(32,9) = "]" + │ ├── equal_loc: (32,10)-(32,11) = "=" │ └── block: ∅ ├── @ CallNode (location: (33,0)-(33,18)) │ ├── flags: newline, attribute_write @@ -868,6 +880,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (33,13)-(33,18)) │ │ ├── flags: variable_call, ignore_visibility @@ -878,8 +891,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (33,9)-(33,10) = "]" + │ ├── equal_loc: (33,11)-(33,12) = "=" │ └── block: ∅ ├── @ LocalVariableWriteNode (location: (34,0)-(34,7)) │ ├── flags: newline @@ -916,6 +931,7 @@ │ │ ├── closing_loc: (35,6)-(35,7) = ")" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: (35,3)-(35,4) = "=" │ └── block: ∅ ├── @ CallNode (location: (36,0)-(36,12)) │ ├── flags: newline, attribute_write @@ -947,8 +963,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (36,5)-(36,6) = "]" + │ ├── equal_loc: (36,7)-(36,8) = "=" │ └── block: ∅ ├── @ IndexOrWriteNode (location: (37,0)-(37,14)) │ ├── flags: newline @@ -982,6 +1000,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ InstanceVariableOrWriteNode (location: (38,0)-(38,10)) │ ├── flags: newline @@ -1062,6 +1081,7 @@ │ │ │ └── unescaped: "\n" │ │ └── closing_loc: (44,0)-(45,0) = "HEREDOC\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: (42,3)-(42,4) = "=" │ └── block: ∅ ├── @ CallNode (location: (45,0)-(45,16)) │ ├── flags: newline, attribute_write @@ -1101,6 +1121,7 @@ │ │ │ └── unescaped: "\n" │ │ └── closing_loc: (47,0)-(48,0) = "HEREDOC\n" │ ├── closing_loc: (45,2)-(45,3) = "]" + │ ├── equal_loc: (45,4)-(45,5) = "=" │ └── block: ∅ ├── @ IndexOrWriteNode (location: (48,0)-(48,21)) │ ├── flags: newline @@ -1150,6 +1171,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ InstanceVariableOrWriteNode (location: (51,0)-(51,17)) ├── flags: newline diff --git a/snapshots/unparser/corpus/literal/block.txt b/snapshots/unparser/corpus/literal/block.txt index 38fc6f48d9..8eb3db2db6 100644 --- a/snapshots/unparser/corpus/literal/block.txt +++ b/snapshots/unparser/corpus/literal/block.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,4)-(2,1)) │ ├── flags: ∅ @@ -31,6 +32,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,4)-(4,1)) │ ├── flags: ∅ @@ -66,6 +68,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,4)-(6,1)) │ ├── flags: ∅ @@ -103,6 +106,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,4)-(8,1)) │ ├── flags: ∅ @@ -143,6 +147,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (9,4)-(10,1)) │ ├── flags: ∅ @@ -187,6 +192,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: (11,5)-(11,6) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (11,7)-(13,1)) │ ├── flags: ∅ @@ -209,6 +215,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (14,4)-(16,1)) │ ├── flags: ∅ @@ -254,6 +261,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (17,4)-(19,1)) │ ├── flags: ∅ @@ -299,6 +307,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (20,4)-(22,1)) │ ├── flags: ∅ @@ -317,6 +326,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (20,4)-(20,5) = "{" │ └── closing_loc: (22,0)-(22,1) = "}" @@ -332,6 +342,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (23,3)-(23,4) = "." │ ├── name: :bar @@ -339,6 +350,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (23,8)-(25,1)) │ ├── flags: ∅ @@ -388,6 +400,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (23,8)-(23,9) = "{" │ └── closing_loc: (25,0)-(25,1) = "}" @@ -403,6 +416,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (26,3)-(26,4) = "." │ ├── name: :bar @@ -410,6 +424,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (26,8)-(27,1)) │ ├── flags: ∅ @@ -453,6 +468,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (28,3)-(28,4) = "." │ ├── name: :bar @@ -460,6 +476,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (28,8)-(29,1)) │ ├── flags: ∅ @@ -501,6 +518,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (30,3)-(30,4) = "." │ ├── name: :bar @@ -508,6 +526,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (30,8)-(31,1)) │ ├── flags: ∅ @@ -540,6 +559,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (32,3)-(32,4) = "." │ ├── name: :bar @@ -547,6 +567,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (32,8)-(34,1)) │ ├── flags: ∅ @@ -585,6 +606,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (32,8)-(32,9) = "{" │ └── closing_loc: (34,0)-(34,1) = "}" @@ -600,6 +622,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (35,3)-(35,4) = "." │ ├── name: :bar @@ -607,6 +630,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (35,8)-(37,1)) │ ├── flags: ∅ @@ -651,6 +675,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (35,8)-(35,9) = "{" │ └── closing_loc: (37,0)-(37,1) = "}" @@ -666,6 +691,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (38,3)-(38,4) = "." │ ├── name: :bar @@ -673,6 +699,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (38,8)-(40,1)) │ ├── flags: ∅ @@ -724,6 +751,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (38,8)-(38,9) = "{" │ └── closing_loc: (40,0)-(40,1) = "}" @@ -739,6 +767,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (41,3)-(41,4) = "." │ ├── name: :bar @@ -746,6 +775,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (41,8)-(43,1)) │ ├── flags: ∅ @@ -800,6 +830,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (41,8)-(41,9) = "{" │ └── closing_loc: (43,0)-(43,1) = "}" @@ -815,6 +846,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (44,3)-(44,4) = "." │ ├── name: :bar @@ -822,6 +854,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (44,8)-(46,1)) │ ├── flags: ∅ @@ -868,6 +901,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (44,8)-(44,9) = "{" │ └── closing_loc: (46,0)-(46,1) = "}" @@ -886,6 +920,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (47,3)-(47,4) = "." │ │ ├── name: :bar @@ -893,6 +928,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (47,8)-(48,1)) │ │ ├── flags: ∅ @@ -907,6 +943,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (49,0)-(51,3)) │ ├── flags: newline, ignore_visibility @@ -917,6 +954,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (49,2)-(51,3)) │ ├── flags: ∅ @@ -958,6 +996,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (52,2)-(56,3)) │ ├── flags: ∅ @@ -980,6 +1019,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (54,0)-(55,5)) @@ -1019,6 +1059,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (57,2)-(61,3)) │ ├── flags: ∅ @@ -1041,6 +1082,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (59,0)-(60,5)) @@ -1063,6 +1105,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── operator_loc: ∅ │ │ │ ├── reference: ∅ @@ -1080,6 +1123,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── subsequent: ∅ │ │ ├── else_clause: ∅ @@ -1096,6 +1140,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (62,2)-(66,3)) │ ├── flags: ∅ @@ -1118,6 +1163,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (64,0)-(65,5)) @@ -1140,6 +1186,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── operator_loc: (64,23)-(64,25) = "=>" │ │ │ ├── reference: @@ -1161,6 +1208,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── subsequent: ∅ │ │ ├── else_clause: ∅ @@ -1177,6 +1225,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (67,2)-(71,3)) │ ├── flags: ∅ @@ -1199,6 +1248,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (69,0)-(70,5)) @@ -1218,6 +1268,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── operator_loc: ∅ │ │ │ ├── reference: ∅ @@ -1235,6 +1286,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── subsequent: ∅ │ │ ├── else_clause: ∅ @@ -1251,6 +1303,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (72,2)-(75,3)) │ ├── flags: ∅ @@ -1273,6 +1326,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (74,0)-(74,16)) @@ -1301,6 +1355,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (76,2)-(81,3)) │ ├── flags: ∅ @@ -1323,6 +1378,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (78,0)-(78,6)) @@ -1351,6 +1407,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── end_keyword_loc: (81,0)-(81,3) = "end" │ │ ├── ensure_clause: ∅ @@ -1366,6 +1423,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (82,2)-(86,3)) │ ├── flags: ∅ @@ -1388,6 +1446,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (84,0)-(85,5)) @@ -1407,6 +1466,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── operator_loc: (84,12)-(84,14) = "=>" │ │ │ ├── reference: @@ -1428,6 +1488,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── subsequent: ∅ │ │ ├── else_clause: ∅ @@ -1444,6 +1505,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (87,2)-(89,3)) │ ├── flags: ∅ @@ -1474,6 +1536,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (90,2)-(93,3)) │ ├── flags: ∅ @@ -1513,6 +1576,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (94,4)-(96,1)) ├── flags: ∅ @@ -1545,6 +1609,7 @@ │ │ ├── name: :_2 │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (94,4)-(94,5) = "{" └── closing_loc: (96,0)-(96,1) = "}" diff --git a/snapshots/unparser/corpus/literal/case.txt b/snapshots/unparser/corpus/literal/case.txt index 5e831cc6c3..f78a03a72e 100644 --- a/snapshots/unparser/corpus/literal/case.txt +++ b/snapshots/unparser/corpus/literal/case.txt @@ -22,6 +22,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── then_keyword_loc: ∅ │ │ │ └── statements: @@ -37,6 +38,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ WhenNode (location: (4,0)-(5,5)) │ │ ├── flags: ∅ @@ -51,6 +53,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: @@ -66,6 +69,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── else_clause: ∅ │ ├── case_keyword_loc: (1,0)-(1,4) = "case" @@ -82,6 +86,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 2) │ │ ├── @ WhenNode (location: (8,0)-(8,8)) @@ -97,6 +102,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── then_keyword_loc: ∅ │ │ │ └── statements: ∅ @@ -113,6 +119,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: @@ -128,6 +135,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── else_clause: ∅ │ ├── case_keyword_loc: (7,0)-(7,4) = "case" @@ -144,6 +152,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 2) │ │ ├── @ WhenNode (location: (13,0)-(14,5)) @@ -159,6 +168,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── then_keyword_loc: ∅ │ │ │ └── statements: @@ -174,6 +184,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ WhenNode (location: (15,0)-(16,5)) │ │ ├── flags: ∅ @@ -188,6 +199,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: @@ -203,6 +215,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── else_clause: ∅ │ ├── case_keyword_loc: (12,0)-(12,4) = "case" @@ -219,6 +232,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ WhenNode (location: (19,0)-(20,8)) @@ -234,6 +248,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── @ CallNode (location: (19,10)-(19,13)) │ │ │ ├── flags: variable_call, ignore_visibility @@ -244,6 +259,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: @@ -271,6 +287,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ WhenNode (location: (23,0)-(24,8)) @@ -290,6 +307,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: @@ -317,6 +335,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ WhenNode (location: (27,0)-(28,5)) @@ -332,6 +351,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: @@ -347,6 +367,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── else_clause: │ │ @ ElseNode (location: (29,0)-(31,3)) @@ -377,6 +398,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ WhenNode (location: (33,0)-(33,15)) @@ -399,6 +421,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :| @@ -417,8 +440,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: ∅ @@ -437,6 +462,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ WhenNode (location: (36,0)-(36,15)) @@ -459,6 +485,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (36,9)-(36,10) = "." │ │ ├── name: :baz= @@ -472,6 +499,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: (36,13)-(36,14) = "=" │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ └── statements: ∅ diff --git a/snapshots/unparser/corpus/literal/class.txt b/snapshots/unparser/corpus/literal/class.txt index add60ce305..1a52256221 100644 --- a/snapshots/unparser/corpus/literal/class.txt +++ b/snapshots/unparser/corpus/literal/class.txt @@ -33,6 +33,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── body: ∅ │ └── end_keyword_loc: (5,0)-(5,3) = "end" @@ -51,6 +52,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── body: │ │ @ StatementsNode (location: (8,2)-(8,3)) @@ -65,6 +67,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (9,0)-(9,3) = "end" ├── @ ClassNode (location: (11,0)-(12,3)) @@ -214,8 +217,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (27,15)-(27,16) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ DefNode (location: (29,2)-(31,5)) │ │ ├── flags: newline diff --git a/snapshots/unparser/corpus/literal/def.txt b/snapshots/unparser/corpus/literal/def.txt index 9a6fa40050..5fc7a7af23 100644 --- a/snapshots/unparser/corpus/literal/def.txt +++ b/snapshots/unparser/corpus/literal/def.txt @@ -28,6 +28,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (3,0)-(4,3)) @@ -50,6 +51,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── subsequent: ∅ │ │ ├── else_clause: @@ -69,6 +71,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── end_keyword_loc: (7,0)-(7,6) = "ensure" │ │ ├── ensure_clause: @@ -88,6 +91,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── end_keyword_loc: (9,0)-(9,3) = "end" │ │ └── end_keyword_loc: (9,0)-(9,3) = "end" @@ -124,6 +128,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── keyword_loc: (12,4)-(12,10) = "rescue" │ │ │ └── rescue_expression: @@ -136,6 +141,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (13,0)-(14,3)) @@ -158,6 +164,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── subsequent: ∅ │ │ ├── else_clause: @@ -177,6 +184,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── end_keyword_loc: (17,0)-(17,6) = "ensure" │ │ ├── ensure_clause: @@ -196,6 +204,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── end_keyword_loc: (19,0)-(19,3) = "end" │ │ └── end_keyword_loc: (19,0)-(19,3) = "end" @@ -270,6 +279,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (27,0)-(27,3) = "def" @@ -301,6 +311,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (33,0)-(34,5)) @@ -323,6 +334,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── subsequent: ∅ │ │ ├── else_clause: ∅ @@ -343,6 +355,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── end_keyword_loc: (37,0)-(37,3) = "end" │ │ └── end_keyword_loc: (37,0)-(37,3) = "end" @@ -376,6 +389,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: ∅ │ │ ├── else_clause: ∅ @@ -396,6 +410,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── end_keyword_loc: (43,0)-(43,3) = "end" │ │ └── end_keyword_loc: (43,0)-(43,3) = "end" @@ -429,6 +444,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (47,0)-(48,5)) @@ -451,6 +467,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── subsequent: ∅ │ │ ├── else_clause: ∅ @@ -604,6 +621,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ └── @ NilNode (location: (63,20)-(63,23)) │ │ │ │ └── flags: newline, static_literal @@ -759,6 +777,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_rest: ∅ │ │ └── block: ∅ @@ -797,6 +816,7 @@ │ │ │ ├── opening_loc: (80,16)-(80,17) = "(" │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: (80,17)-(80,18) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_rest: ∅ │ │ └── block: ∅ @@ -841,6 +861,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (83,0)-(83,3) = "def" @@ -963,6 +984,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:baz, :bor] │ ├── def_keyword_loc: (95,0)-(95,3) = "def" @@ -1017,6 +1039,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:baz, :bor, :block] │ ├── def_keyword_loc: (99,0)-(99,3) = "def" @@ -1104,6 +1127,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:block] │ ├── def_keyword_loc: (107,0)-(107,3) = "def" @@ -1169,6 +1193,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (117,2)-(117,5)) │ │ ├── flags: newline, variable_call, ignore_visibility @@ -1179,6 +1204,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (115,0)-(115,3) = "def" diff --git a/snapshots/unparser/corpus/literal/defs.txt b/snapshots/unparser/corpus/literal/defs.txt index 33c24f3b24..79c5ccc158 100644 --- a/snapshots/unparser/corpus/literal/defs.txt +++ b/snapshots/unparser/corpus/literal/defs.txt @@ -42,6 +42,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (4,0)-(4,3) = "def" @@ -71,6 +72,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (10,2)-(10,5)) │ │ ├── flags: newline, variable_call, ignore_visibility @@ -81,6 +83,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (8,0)-(8,3) = "def" @@ -111,6 +114,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (13,0)-(13,3) = "def" @@ -136,6 +140,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (17,9)-(18,1)) │ │ │ ├── flags: ∅ @@ -178,6 +183,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (17,0)-(17,3) = "def" @@ -209,6 +215,7 @@ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ └── value: 1 │ │ │ ├── closing_loc: (22,10)-(22,11) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (22,4)-(22,5) = "(" │ │ └── closing_loc: (22,11)-(22,12) = ")" @@ -226,6 +233,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (22,0)-(22,3) = "def" @@ -260,6 +268,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (26,4)-(26,5) = "(" │ │ └── closing_loc: (26,17)-(26,18) = ")" @@ -277,6 +286,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (26,0)-(26,3) = "def" @@ -318,6 +328,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (30,0)-(30,3) = "def" @@ -348,6 +359,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (34,0)-(34,3) = "def" @@ -370,6 +382,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── parameters: ∅ ├── body: @@ -385,6 +398,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (38,0)-(38,3) = "def" diff --git a/snapshots/unparser/corpus/literal/dstr.txt b/snapshots/unparser/corpus/literal/dstr.txt index 64cb3ff1b2..9b76f1594b 100644 --- a/snapshots/unparser/corpus/literal/dstr.txt +++ b/snapshots/unparser/corpus/literal/dstr.txt @@ -76,6 +76,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: ∅ │ └── end_keyword_loc: (11,0)-(11,3) = "end" @@ -303,6 +304,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ └── closing_loc: (32,7)-(32,8) = "}" │ │ │ └── @ StringNode (location: (32,8)-(33,0)) @@ -313,6 +315,7 @@ │ │ │ └── unescaped: "\n" │ │ └── closing_loc: (33,0)-(34,0) = "HEREDOC\n" │ ├── closing_loc: (31,14)-(31,15) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (34,0)-(37,1)) ├── flags: newline, ignore_visibility @@ -351,6 +354,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (35,7)-(35,8) = "}" │ │ └── @ StringNode (location: (35,8)-(36,0)) @@ -361,6 +365,7 @@ │ │ └── unescaped: "\n" │ └── closing_loc: (36,0)-(37,0) = "HEREDOC\n" ├── closing_loc: (34,14)-(34,15) = ")" + ├── equal_loc: ∅ └── block: @ BlockNode (location: (34,16)-(37,1)) ├── flags: ∅ diff --git a/snapshots/unparser/corpus/literal/flipflop.txt b/snapshots/unparser/corpus/literal/flipflop.txt index 418aa242cb..520646ed25 100644 --- a/snapshots/unparser/corpus/literal/flipflop.txt +++ b/snapshots/unparser/corpus/literal/flipflop.txt @@ -36,6 +36,7 @@ │ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ │ └── block: ∅ │ │ │ │ │ ├── call_operator_loc: ∅ │ │ │ │ │ ├── name: :== @@ -49,6 +50,7 @@ │ │ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ │ │ └── value: 4 │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── opening_loc: (1,4)-(1,5) = "(" │ │ │ │ └── closing_loc: (1,11)-(1,12) = ")" @@ -71,6 +73,7 @@ │ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ │ └── block: ∅ │ │ │ │ │ ├── call_operator_loc: ∅ │ │ │ │ │ ├── name: :== @@ -84,6 +87,7 @@ │ │ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ │ │ └── value: 4 │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── opening_loc: (1,14)-(1,15) = "(" │ │ │ │ └── closing_loc: (1,21)-(1,22) = ")" @@ -104,6 +108,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: ∅ │ └── end_keyword_loc: (3,0)-(3,3) = "end" @@ -138,6 +143,7 @@ │ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ │ └── block: ∅ │ │ │ │ │ ├── call_operator_loc: ∅ │ │ │ │ │ ├── name: :== @@ -151,6 +157,7 @@ │ │ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ │ │ └── value: 4 │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── opening_loc: (4,4)-(4,5) = "(" │ │ │ │ └── closing_loc: (4,11)-(4,12) = ")" @@ -173,6 +180,7 @@ │ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ │ └── block: ∅ │ │ │ │ │ ├── call_operator_loc: ∅ │ │ │ │ │ ├── name: :== @@ -186,6 +194,7 @@ │ │ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ │ │ └── value: 4 │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── opening_loc: (4,15)-(4,16) = "(" │ │ │ │ └── closing_loc: (4,22)-(4,23) = ")" @@ -206,6 +215,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: ∅ │ └── end_keyword_loc: (6,0)-(6,3) = "end" @@ -226,6 +236,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (7,3)-(7,5) = ".." │ ├── then_keyword_loc: ∅ @@ -248,6 +259,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: ∅ │ └── operator_loc: (9,6)-(9,8) = ".." diff --git a/snapshots/unparser/corpus/literal/for.txt b/snapshots/unparser/corpus/literal/for.txt index a1722a8a09..4be6cbad2d 100644 --- a/snapshots/unparser/corpus/literal/for.txt +++ b/snapshots/unparser/corpus/literal/for.txt @@ -33,6 +33,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── statements: │ │ │ @ StatementsNode (location: (2,2)-(2,5)) @@ -47,12 +48,14 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── for_keyword_loc: (1,4)-(1,7) = "for" │ │ ├── in_keyword_loc: (1,10)-(1,12) = "in" │ │ ├── do_keyword_loc: (1,17)-(1,19) = "do" │ │ └── end_keyword_loc: (3,0)-(3,3) = "end" │ ├── closing_loc: (3,3)-(3,4) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ ForNode (location: (4,0)-(6,3)) │ ├── flags: newline @@ -71,6 +74,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── statements: │ │ @ StatementsNode (location: (5,2)-(5,5)) @@ -85,6 +89,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── for_keyword_loc: (4,0)-(4,3) = "for" │ ├── in_keyword_loc: (4,6)-(4,8) = "in" @@ -122,6 +127,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── statements: │ │ @ StatementsNode (location: (8,2)-(8,5)) @@ -136,6 +142,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── for_keyword_loc: (7,0)-(7,3) = "for" │ ├── in_keyword_loc: (7,12)-(7,14) = "in" @@ -169,6 +176,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── statements: │ @ StatementsNode (location: (11,2)-(11,5)) @@ -183,6 +191,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── for_keyword_loc: (10,0)-(10,3) = "for" ├── in_keyword_loc: (10,11)-(10,13) = "in" diff --git a/snapshots/unparser/corpus/literal/hookexe.txt b/snapshots/unparser/corpus/literal/hookexe.txt index bbcb8fee1b..95f55b8cfe 100644 --- a/snapshots/unparser/corpus/literal/hookexe.txt +++ b/snapshots/unparser/corpus/literal/hookexe.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (1,0)-(1,5) = "BEGIN" │ ├── opening_loc: (1,6)-(1,7) = "{" @@ -33,6 +34,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ PostExecutionNode (location: (5,0)-(7,1)) ├── flags: newline @@ -49,6 +51,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── keyword_loc: (5,0)-(5,3) = "END" ├── opening_loc: (5,4)-(5,5) = "{" diff --git a/snapshots/unparser/corpus/literal/if.txt b/snapshots/unparser/corpus/literal/if.txt index 10240962c5..a1603c48e4 100644 --- a/snapshots/unparser/corpus/literal/if.txt +++ b/snapshots/unparser/corpus/literal/if.txt @@ -29,6 +29,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: ∅ │ └── end_keyword_loc: (3,0)-(3,3) = "end" @@ -123,6 +124,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ ├── statements: ∅ @@ -168,6 +170,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (22,6)-(22,7) = "=" │ │ ├── subsequent: ∅ @@ -214,6 +217,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (26,6)-(26,7) = "=" │ │ ├── else_clause: ∅ @@ -233,6 +237,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ ├── statements: @@ -254,6 +259,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (29,6)-(29,7) = "=" │ ├── else_clause: ∅ @@ -271,6 +277,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (31,7)-(33,1)) │ ├── flags: ∅ diff --git a/snapshots/unparser/corpus/literal/kwbegin.txt b/snapshots/unparser/corpus/literal/kwbegin.txt index 44028c93b7..2fc436e836 100644 --- a/snapshots/unparser/corpus/literal/kwbegin.txt +++ b/snapshots/unparser/corpus/literal/kwbegin.txt @@ -51,6 +51,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -72,6 +73,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (15,0)-(16,3)) @@ -94,6 +96,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -115,6 +118,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (21,2)-(21,3)) │ │ ├── flags: newline, variable_call, ignore_visibility @@ -125,6 +129,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (22,0)-(23,3)) @@ -147,6 +152,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -212,6 +218,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (36,0)-(39,3)) @@ -237,6 +244,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: │ │ @ RescueNode (location: (38,0)-(39,3)) @@ -262,6 +270,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -282,6 +291,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (42,0)-(42,3) = "end" │ └── end_keyword_loc: (42,0)-(42,3) = "end" @@ -312,6 +322,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── rescue_clause: │ │ │ @ RescueNode (location: (48,2)-(48,8)) @@ -347,6 +358,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── @ CallNode (location: (52,2)-(52,5)) │ │ │ ├── flags: newline, variable_call, ignore_visibility @@ -357,6 +369,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -387,6 +400,7 @@ │ │ │ │ ├── flags: ∅ │ │ │ │ └── name: :Exception │ │ │ ├── closing_loc: (56,17)-(56,18) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (56,19)-(56,25) = "rescue" │ │ └── rescue_expression: @@ -405,6 +419,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (56,30)-(56,31) = "=" │ ├── rescue_clause: @@ -546,6 +561,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ diff --git a/snapshots/unparser/corpus/literal/lambda.txt b/snapshots/unparser/corpus/literal/lambda.txt index 863678f17b..4df90087bc 100644 --- a/snapshots/unparser/corpus/literal/lambda.txt +++ b/snapshots/unparser/corpus/literal/lambda.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,7)-(2,1)) │ ├── flags: ∅ @@ -31,6 +32,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,7)-(5,1)) │ ├── flags: ∅ diff --git a/snapshots/unparser/corpus/literal/literal.txt b/snapshots/unparser/corpus/literal/literal.txt index 430a8a0679..386002b557 100644 --- a/snapshots/unparser/corpus/literal/literal.txt +++ b/snapshots/unparser/corpus/literal/literal.txt @@ -153,6 +153,7 @@ │ │ │ │ └── unescaped: "\n" │ │ │ └── closing_loc: (8,0)-(9,0) = "HEREDOC\n" │ │ ├── closing_loc: (6,12)-(6,13) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (6,13)-(6,14) = "." │ ├── name: :a @@ -160,6 +161,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (9,0)-(9,8)) │ ├── flags: newline @@ -182,6 +184,7 @@ │ │ │ ├── closing_loc: (9,4)-(9,5) = ")" │ │ │ └── unescaped: "" │ │ ├── closing_loc: (9,5)-(9,6) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (9,6)-(9,7) = "." │ ├── name: :a @@ -189,6 +192,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ HashNode (location: (10,0)-(10,30)) │ ├── flags: newline @@ -239,6 +243,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (10,23)-(10,25) = "**" │ └── closing_loc: (10,29)-(10,30) = "}" @@ -275,6 +280,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (13,16)-(13,18) = "**" │ └── closing_loc: (13,22)-(13,23) = "}" @@ -331,6 +337,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ IntegerNode (location: (17,0)-(17,1)) │ ├── flags: newline, static_literal, decimal @@ -388,7 +395,7 @@ │ ├── numerator: 1 │ └── denominator: 1 ├── @ InterpolatedStringNode (location: (28,0)-(28,11)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: ∅ │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (28,0)-(28,5)) @@ -430,6 +437,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (29,13)-(29,14) = "}" │ └── closing_loc: (29,14)-(29,15) = "\"" @@ -740,6 +748,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (58,10)-(58,11) = "}" │ │ └── @ StringNode (location: (58,11)-(58,14)) @@ -795,6 +804,7 @@ │ │ │ │ ├── flags: static_literal │ │ │ │ └── value: 0.0 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (60,0)-(60,1) = "(" │ │ └── closing_loc: (60,10)-(60,11) = ")" @@ -834,6 +844,7 @@ │ │ │ │ ├── flags: static_literal │ │ │ │ └── value: 0.0 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (61,3)-(61,4) = "(" │ │ └── closing_loc: (61,13)-(61,14) = ")" @@ -865,6 +876,7 @@ │ │ │ │ ├── flags: static_literal │ │ │ │ └── value: 0.0 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (62,0)-(62,1) = "(" │ │ └── closing_loc: (62,10)-(62,11) = ")" @@ -910,6 +922,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (66,0)-(66,1) = "[" │ └── closing_loc: (66,10)-(66,11) = "]" @@ -1080,6 +1093,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── opening_loc: (76,5)-(76,6) = "(" │ │ │ │ └── closing_loc: (76,18)-(76,19) = ")" @@ -1228,6 +1242,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (83,4)-(86,1)) │ ├── flags: ∅ @@ -1298,6 +1313,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (90,5)-(90,6) = "}" │ └── @ StringNode (location: (90,6)-(91,1)) diff --git a/snapshots/unparser/corpus/literal/module.txt b/snapshots/unparser/corpus/literal/module.txt index 9ad15d2dcd..cd68b2708c 100644 --- a/snapshots/unparser/corpus/literal/module.txt +++ b/snapshots/unparser/corpus/literal/module.txt @@ -91,8 +91,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: (11,15)-(11,16) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ DefNode (location: (13,2)-(15,5)) │ ├── flags: newline diff --git a/snapshots/unparser/corpus/literal/opasgn.txt b/snapshots/unparser/corpus/literal/opasgn.txt index 3df6248d4b..38eca36c28 100644 --- a/snapshots/unparser/corpus/literal/opasgn.txt +++ b/snapshots/unparser/corpus/literal/opasgn.txt @@ -74,6 +74,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── name: :a │ └── depth: 0 @@ -114,6 +115,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (9,0)-(9,17)) │ ├── flags: newline, attribute_write @@ -155,6 +157,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (9,16)-(9,17)) │ │ ├── flags: variable_call, ignore_visibility @@ -165,8 +168,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (9,12)-(9,13) = "]" + │ ├── equal_loc: (9,14)-(9,15) = "=" │ └── block: ∅ ├── @ CallOperatorWriteNode (location: (10,0)-(10,8)) │ ├── flags: newline @@ -275,6 +280,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallOrWriteNode (location: (16,0)-(16,9)) │ ├── flags: newline @@ -314,6 +320,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (17,3)-(17,4) = "]" │ ├── block: ∅ @@ -345,6 +352,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (18,3)-(18,4) = "]" │ ├── block: ∅ @@ -376,6 +384,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (19,3)-(19,4) = "]" │ ├── block: ∅ @@ -407,6 +416,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (20,3)-(20,4) = "]" │ ├── block: ∅ @@ -438,6 +448,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (21,3)-(21,4) = "]" │ ├── block: ∅ @@ -469,6 +480,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (22,3)-(22,4) = "]" │ ├── block: ∅ @@ -483,6 +495,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ IndexOrWriteNode (location: (23,0)-(23,10)) │ ├── flags: newline @@ -506,6 +519,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (23,3)-(23,4) = "]" │ ├── block: ∅ @@ -526,6 +540,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (24,3)-(24,4) = "." ├── message_loc: (24,4)-(24,5) = "A" diff --git a/snapshots/unparser/corpus/literal/pattern.txt b/snapshots/unparser/corpus/literal/pattern.txt index 200837c450..57506dbd0d 100644 --- a/snapshots/unparser/corpus/literal/pattern.txt +++ b/snapshots/unparser/corpus/literal/pattern.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 15) │ │ ├── @ InNode (location: (2,0)-(3,6)) @@ -90,6 +91,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── in_loc: (4,0)-(4,2) = "in" │ │ │ └── then_loc: (4,12)-(4,16) = "then" @@ -450,6 +452,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (35,0)-(35,17)) @@ -501,6 +504,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (38,0)-(38,4)) diff --git a/snapshots/unparser/corpus/literal/pragma.txt b/snapshots/unparser/corpus/literal/pragma.txt index 2a82f0c860..2ee0f17d0c 100644 --- a/snapshots/unparser/corpus/literal/pragma.txt +++ b/snapshots/unparser/corpus/literal/pragma.txt @@ -21,4 +21,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/unparser/corpus/literal/rescue.txt b/snapshots/unparser/corpus/literal/rescue.txt index 78801c1d90..1d73e02a5d 100644 --- a/snapshots/unparser/corpus/literal/rescue.txt +++ b/snapshots/unparser/corpus/literal/rescue.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (1,4)-(1,10) = "rescue" │ └── rescue_expression: @@ -29,6 +30,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ RescueModifierNode (location: (2,0)-(2,21)) │ ├── flags: newline @@ -42,6 +44,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (2,4)-(2,10) = "rescue" │ └── rescue_expression: @@ -61,6 +64,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ LocalVariableWriteNode (location: (3,0)-(3,27)) ├── flags: newline @@ -86,6 +90,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (3,9)-(3,15) = "rescue" │ │ └── rescue_expression: @@ -105,6 +110,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (3,4)-(3,5) = "(" │ └── closing_loc: (3,26)-(3,27) = ")" diff --git a/snapshots/unparser/corpus/literal/send.txt b/snapshots/unparser/corpus/literal/send.txt index de5c6e9f46..82dc2cc7f7 100644 --- a/snapshots/unparser/corpus/literal/send.txt +++ b/snapshots/unparser/corpus/literal/send.txt @@ -54,6 +54,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (2,10)-(2,11) = "(" │ │ │ └── closing_loc: (2,21)-(2,22) = ")" @@ -96,6 +97,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── end_keyword_loc: (8,0)-(8,3) = "end" │ └── name: :A @@ -121,6 +123,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (11,0)-(12,7)) │ ├── flags: newline @@ -142,6 +145,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (13,0)-(15,7)) │ ├── flags: newline @@ -169,6 +173,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (16,0)-(19,7)) │ ├── flags: newline @@ -218,6 +223,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── then_keyword_loc: ∅ │ │ │ └── statements: ∅ @@ -230,6 +236,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (20,0)-(22,7)) │ ├── flags: newline @@ -246,6 +253,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── conditions: (length: 1) │ │ │ └── @ WhenNode (location: (21,0)-(21,8)) @@ -261,6 +269,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── then_keyword_loc: ∅ │ │ │ └── statements: ∅ @@ -273,6 +282,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (23,0)-(24,7)) │ ├── flags: newline @@ -293,6 +303,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (25,0)-(26,7)) │ ├── flags: newline @@ -319,6 +330,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (27,0)-(28,7)) │ ├── flags: newline @@ -343,6 +355,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (29,0)-(30,7)) │ ├── flags: newline @@ -362,6 +375,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── statements: ∅ │ ├── call_operator_loc: (30,3)-(30,4) = "." @@ -370,6 +384,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (31,0)-(32,7)) │ ├── flags: newline @@ -389,6 +404,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── statements: ∅ │ ├── call_operator_loc: (32,3)-(32,4) = "." @@ -397,6 +413,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (33,0)-(34,5)) │ ├── flags: newline @@ -410,6 +427,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (33,5)-(34,1)) │ │ ├── flags: ∅ @@ -424,6 +442,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (35,0)-(36,7)) │ ├── flags: newline @@ -441,6 +460,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ ├── statements: ∅ @@ -452,6 +472,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (37,0)-(37,19)) │ ├── flags: newline @@ -486,6 +507,7 @@ │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "foo" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (37,0)-(37,1) = "(" │ │ └── closing_loc: (37,14)-(37,15) = ")" @@ -495,6 +517,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (38,0)-(38,10)) │ ├── flags: newline @@ -524,6 +547,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (39,0)-(39,18)) │ ├── flags: newline @@ -546,6 +570,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :=~ @@ -562,6 +587,7 @@ │ │ │ │ ├── closing_loc: (39,12)-(39,13) = "/" │ │ │ │ └── unescaped: "bar" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (39,0)-(39,1) = "(" │ │ └── closing_loc: (39,13)-(39,14) = ")" @@ -571,6 +597,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (40,0)-(40,13)) │ ├── flags: newline @@ -596,6 +623,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "foo" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (41,0)-(41,12)) │ ├── flags: newline @@ -623,8 +651,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ RangeNode (location: (42,0)-(42,8)) │ ├── flags: newline @@ -645,6 +675,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (42,1)-(42,3) = ".." ├── @ CallNode (location: (43,0)-(43,5)) @@ -659,6 +690,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (44,0)-(44,5)) │ ├── flags: newline, ignore_visibility @@ -669,6 +701,7 @@ │ ├── opening_loc: (44,3)-(44,4) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (44,4)-(44,5) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (45,0)-(45,4)) │ ├── flags: newline, safe_navigation @@ -682,6 +715,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (45,1)-(45,3) = "&." │ ├── name: :b @@ -689,6 +723,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (46,0)-(46,5)) │ ├── flags: newline @@ -702,6 +737,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (46,1)-(46,2) = "." │ ├── name: :foo @@ -709,6 +745,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (47,0)-(47,3)) │ ├── flags: newline, variable_call, ignore_visibility @@ -719,6 +756,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (48,0)-(48,18)) │ ├── flags: newline @@ -732,6 +770,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :<< @@ -759,6 +798,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :* @@ -777,12 +817,15 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (48,7)-(48,8) = "(" │ │ └── closing_loc: (48,17)-(48,18) = ")" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (49,0)-(49,12)) │ ├── flags: newline @@ -796,6 +839,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :=~ @@ -812,8 +856,9 @@ │ │ ├── closing_loc: (49,11)-(49,12) = "/" │ │ └── unescaped: "bar" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ - ├── @ CallNode (location: (50,0)-(50,17)) + ├── @ CallNode (location: (50,0)-(50,18)) │ ├── flags: newline, ignore_visibility │ ├── receiver: ∅ │ ├── call_operator_loc: ∅ @@ -822,6 +867,7 @@ │ ├── opening_loc: (50,3)-(50,4) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (50,17)-(50,18) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockArgumentNode (location: (50,4)-(50,17)) │ ├── flags: ∅ @@ -844,6 +890,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── right: │ │ │ │ @ CallNode (location: (50,13)-(50,16)) @@ -855,12 +902,13 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (50,10)-(50,12) = "||" │ │ ├── opening_loc: (50,5)-(50,6) = "(" │ │ └── closing_loc: (50,16)-(50,17) = ")" │ └── operator_loc: (50,4)-(50,5) = "&" - ├── @ CallNode (location: (51,0)-(51,10)) + ├── @ CallNode (location: (51,0)-(51,11)) │ ├── flags: newline, ignore_visibility │ ├── receiver: ∅ │ ├── call_operator_loc: ∅ @@ -869,6 +917,7 @@ │ ├── opening_loc: (51,3)-(51,4) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (51,10)-(51,11) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockArgumentNode (location: (51,4)-(51,10)) │ ├── flags: ∅ @@ -882,9 +931,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (51,4)-(51,5) = "&" - ├── @ CallNode (location: (52,0)-(52,17)) + ├── @ CallNode (location: (52,0)-(52,18)) │ ├── flags: newline, ignore_visibility │ ├── receiver: ∅ │ ├── call_operator_loc: ∅ @@ -908,8 +958,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (52,17)-(52,18) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockArgumentNode (location: (52,11)-(52,17)) │ ├── flags: ∅ @@ -923,6 +975,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (52,11)-(52,12) = "&" ├── @ CallNode (location: (53,0)-(53,15)) @@ -949,8 +1002,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (53,14)-(53,15) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (54,0)-(54,9)) │ ├── flags: newline, ignore_visibility @@ -970,6 +1025,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: (54,8)-(54,9) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (55,0)-(55,8)) │ ├── flags: newline, ignore_visibility @@ -991,8 +1047,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (55,7)-(55,8) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (56,0)-(56,15)) │ ├── flags: newline, ignore_visibility @@ -1014,6 +1072,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ SplatNode (location: (56,9)-(56,14)) │ │ ├── flags: ∅ @@ -1028,8 +1087,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (56,14)-(56,15) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (57,0)-(57,17)) │ ├── flags: newline, ignore_visibility @@ -1054,6 +1115,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: ∅ │ │ ├── name: :=~ @@ -1070,8 +1132,10 @@ │ │ │ ├── closing_loc: (57,15)-(57,16) = "/" │ │ │ └── unescaped: "bar" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (57,16)-(57,17) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (58,0)-(58,13)) │ ├── flags: newline @@ -1085,6 +1149,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (58,3)-(58,4) = "." │ ├── name: :bar @@ -1092,6 +1157,7 @@ │ ├── opening_loc: (58,7)-(58,8) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (58,12)-(58,13) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockArgumentNode (location: (58,8)-(58,12)) │ ├── flags: ∅ @@ -1105,6 +1171,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (58,8)-(58,9) = "&" ├── @ CallNode (location: (59,0)-(59,26)) @@ -1119,6 +1186,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (59,3)-(59,4) = "." │ ├── name: :bar @@ -1141,6 +1209,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── @ CallNode (location: (59,15)-(59,18)) │ │ │ ├── flags: variable_call, ignore_visibility @@ -1151,6 +1220,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ SplatNode (location: (59,20)-(59,25)) │ │ ├── flags: ∅ @@ -1165,8 +1235,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (59,25)-(59,26) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (60,0)-(60,14)) │ ├── flags: newline @@ -1180,6 +1252,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (60,3)-(60,4) = "." │ ├── name: :bar @@ -1202,8 +1275,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (60,13)-(60,14) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (61,0)-(61,19)) │ ├── flags: newline @@ -1217,6 +1292,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (61,3)-(61,4) = "." │ ├── name: :bar @@ -1239,6 +1315,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (61,15)-(61,18)) │ │ ├── flags: variable_call, ignore_visibility @@ -1249,8 +1326,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (61,18)-(61,19) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (62,0)-(62,19)) │ ├── flags: newline @@ -1264,6 +1343,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (62,3)-(62,4) = "." │ ├── name: :bar @@ -1280,6 +1360,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "baz" │ ├── closing_loc: (62,18)-(62,19) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockArgumentNode (location: (62,14)-(62,18)) │ ├── flags: ∅ @@ -1293,6 +1374,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (62,14)-(62,15) = "&" ├── @ CallNode (location: (63,0)-(63,17)) @@ -1307,6 +1389,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (63,3)-(63,4) = "." │ ├── name: :bar @@ -1338,9 +1421,11 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: ∅ │ ├── closing_loc: (63,16)-(63,17) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (64,0)-(64,26)) │ ├── flags: newline @@ -1354,6 +1439,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (64,3)-(64,4) = "." │ ├── name: :bar @@ -1372,6 +1458,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ KeywordHashNode (location: (64,13)-(64,25)) │ │ ├── flags: ∅ @@ -1395,9 +1482,11 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (64,19)-(64,21) = "=>" │ ├── closing_loc: (64,25)-(64,26) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (65,0)-(65,19)) │ ├── flags: newline @@ -1411,6 +1500,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (65,3)-(65,4) = "." │ ├── name: :bar @@ -1429,6 +1519,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ SplatNode (location: (65,13)-(65,18)) │ │ ├── flags: ∅ @@ -1443,8 +1534,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (65,18)-(65,19) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (66,0)-(66,27)) │ ├── flags: newline @@ -1458,6 +1551,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (66,3)-(66,4) = "." │ ├── name: :bar @@ -1476,6 +1570,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ SplatNode (location: (66,13)-(66,18)) │ │ ├── flags: ∅ @@ -1490,8 +1585,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (66,26)-(66,27) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockArgumentNode (location: (66,20)-(66,26)) │ ├── flags: ∅ @@ -1505,6 +1602,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (66,20)-(66,21) = "&" ├── @ CallNode (location: (67,0)-(67,16)) @@ -1519,6 +1617,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (67,3)-(67,4) = "." │ ├── name: :bar @@ -1537,6 +1636,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ HashNode (location: (67,13)-(67,15)) │ │ ├── flags: static_literal @@ -1544,6 +1644,7 @@ │ │ ├── elements: (length: 0) │ │ └── closing_loc: (67,14)-(67,15) = "}" │ ├── closing_loc: (67,15)-(67,16) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (68,0)-(68,26)) │ ├── flags: newline @@ -1557,6 +1658,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (68,3)-(68,4) = "." │ ├── name: :bar @@ -1589,6 +1691,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ └── operator_loc: ∅ │ │ │ └── closing_loc: (68,19)-(68,20) = "}" @@ -1601,8 +1704,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (68,25)-(68,26) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (69,0)-(69,12)) │ ├── flags: newline, attribute_write @@ -1616,6 +1721,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (69,3)-(69,4) = "." │ ├── name: :bar= @@ -1632,6 +1738,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "baz" │ ├── closing_loc: ∅ + │ ├── equal_loc: (69,7)-(69,8) = "=" │ └── block: ∅ ├── @ CallNode (location: (70,0)-(70,9)) │ ├── flags: newline, ignore_visibility @@ -1666,9 +1773,11 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: ∅ │ ├── closing_loc: (70,8)-(70,9) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (71,0)-(71,11)) │ ├── flags: newline @@ -1682,6 +1791,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (71,3)-(71,4) = "." │ ├── name: :& @@ -1713,9 +1823,11 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: ∅ │ ├── closing_loc: (71,10)-(71,11) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (72,0)-(72,10)) │ ├── flags: newline @@ -1729,6 +1841,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (72,3)-(72,4) = "." │ ├── name: :& @@ -1753,9 +1866,11 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (72,6)-(72,8) = "**" │ ├── closing_loc: (72,9)-(72,10) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (73,0)-(73,9)) │ ├── flags: newline @@ -1769,6 +1884,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -1791,8 +1907,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (73,8)-(73,9) = "]" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (74,0)-(74,9)) │ ├── flags: newline @@ -1806,6 +1924,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -1822,6 +1941,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 2 │ ├── closing_loc: (74,8)-(74,9) = "]" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (75,0)-(75,5)) │ ├── flags: newline @@ -1835,6 +1955,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :[] @@ -1842,6 +1963,7 @@ │ ├── opening_loc: (75,3)-(75,4) = "[" │ ├── arguments: ∅ │ ├── closing_loc: (75,4)-(75,5) = "]" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (76,0)-(76,8)) │ ├── flags: newline, ignore_visibility @@ -1854,6 +1976,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (77,0)-(77,13)) │ ├── flags: newline, attribute_write, ignore_visibility @@ -1875,6 +1998,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "bar" │ ├── closing_loc: ∅ + │ ├── equal_loc: (77,8)-(77,9) = "=" │ └── block: ∅ ├── @ CallNode (location: (78,0)-(78,17)) │ ├── flags: newline @@ -1897,6 +2021,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :+ @@ -1915,8 +2040,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (78,0)-(78,1) = "(" │ │ └── closing_loc: (78,6)-(78,7) = ")" @@ -1946,6 +2073,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :- @@ -1964,12 +2092,15 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (78,10)-(78,11) = "(" │ │ └── closing_loc: (78,16)-(78,17) = ")" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (79,0)-(79,19)) │ ├── flags: newline @@ -1992,6 +2123,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :+ @@ -2010,8 +2142,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (79,0)-(79,1) = "(" │ │ └── closing_loc: (79,6)-(79,7) = ")" @@ -2035,6 +2169,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (79,11)-(79,12) = "." │ │ ├── name: :- @@ -2053,6 +2188,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── @ CallNode (location: (79,17)-(79,18)) │ │ │ ├── flags: variable_call, ignore_visibility @@ -2063,10 +2199,13 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: (79,18)-(79,19) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (80,0)-(80,17)) │ ├── flags: newline @@ -2089,6 +2228,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :+ @@ -2107,8 +2247,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (80,0)-(80,1) = "(" │ │ └── closing_loc: (80,6)-(80,7) = ")" @@ -2132,6 +2274,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (80,11)-(80,12) = "." │ │ ├── name: :- @@ -2154,10 +2297,13 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: (80,16)-(80,17) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (81,0)-(81,8)) │ ├── flags: newline, ignore_visibility @@ -2185,9 +2331,11 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (81,2)-(81,4) = "**" │ ├── closing_loc: (81,7)-(81,8) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (82,0)-(82,6)) │ ├── flags: newline, safe_navigation @@ -2201,6 +2349,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (82,3)-(82,5) = "&." │ ├── name: :! @@ -2208,6 +2357,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (83,0)-(83,8)) │ ├── flags: newline @@ -2221,6 +2371,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (83,3)-(83,4) = "." │ ├── name: :~ @@ -2239,8 +2390,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (83,7)-(83,8) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (84,0)-(84,7)) ├── flags: newline, safe_navigation @@ -2254,6 +2407,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (84,1)-(84,3) = "&." ├── name: :+ @@ -2272,6 +2426,8 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: (84,6)-(84,7) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/unparser/corpus/literal/since/27.txt b/snapshots/unparser/corpus/literal/since/27.txt index e4cda312f8..3edae724eb 100644 --- a/snapshots/unparser/corpus/literal/since/27.txt +++ b/snapshots/unparser/corpus/literal/since/27.txt @@ -39,6 +39,7 @@ │ │ ├── name: :_2 │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ ParenthesesNode (location: (4,0)-(4,5)) ├── flags: newline diff --git a/snapshots/unparser/corpus/literal/since/31.txt b/snapshots/unparser/corpus/literal/since/31.txt index 81bcd9662b..639c52d603 100644 --- a/snapshots/unparser/corpus/literal/since/31.txt +++ b/snapshots/unparser/corpus/literal/since/31.txt @@ -26,10 +26,10 @@ │ │ ├── name_loc: ∅ │ │ └── operator_loc: (1,8)-(1,9) = "&" │ ├── body: - │ │ @ StatementsNode (location: (2,2)-(2,7)) + │ │ @ StatementsNode (location: (2,2)-(2,8)) │ │ ├── flags: ∅ │ │ └── body: (length: 1) - │ │ └── @ CallNode (location: (2,2)-(2,7)) + │ │ └── @ CallNode (location: (2,2)-(2,8)) │ │ ├── flags: newline, ignore_visibility │ │ ├── receiver: ∅ │ │ ├── call_operator_loc: ∅ @@ -38,6 +38,7 @@ │ │ ├── opening_loc: (2,5)-(2,6) = "(" │ │ ├── arguments: ∅ │ │ ├── closing_loc: (2,7)-(2,8) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockArgumentNode (location: (2,6)-(2,7)) │ │ ├── flags: ∅ @@ -74,10 +75,10 @@ │ ├── name_loc: ∅ │ └── operator_loc: (5,11)-(5,12) = "&" ├── body: - │ @ StatementsNode (location: (6,2)-(6,7)) + │ @ StatementsNode (location: (6,2)-(6,8)) │ ├── flags: ∅ │ └── body: (length: 1) - │ └── @ CallNode (location: (6,2)-(6,7)) + │ └── @ CallNode (location: (6,2)-(6,8)) │ ├── flags: newline, ignore_visibility │ ├── receiver: ∅ │ ├── call_operator_loc: ∅ @@ -86,6 +87,7 @@ │ ├── opening_loc: (6,5)-(6,6) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (6,7)-(6,8) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockArgumentNode (location: (6,6)-(6,7)) │ ├── flags: ∅ diff --git a/snapshots/unparser/corpus/literal/since/32.txt b/snapshots/unparser/corpus/literal/since/32.txt index 2b126a0cc5..335ae12c1e 100644 --- a/snapshots/unparser/corpus/literal/since/32.txt +++ b/snapshots/unparser/corpus/literal/since/32.txt @@ -55,6 +55,7 @@ │ │ │ ├── value: ∅ │ │ │ └── operator_loc: (2,16)-(2,18) = "**" │ │ ├── closing_loc: (2,18)-(2,19) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:argument] │ ├── def_keyword_loc: (1,0)-(1,3) = "def" @@ -110,6 +111,7 @@ │ │ │ ├── operator_loc: (6,16)-(6,17) = "*" │ │ │ └── expression: ∅ │ │ ├── closing_loc: (6,17)-(6,18) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:argument] │ ├── def_keyword_loc: (5,0)-(5,3) = "def" diff --git a/snapshots/unparser/corpus/literal/super.txt b/snapshots/unparser/corpus/literal/super.txt index a6311116ca..a3855c140e 100644 --- a/snapshots/unparser/corpus/literal/super.txt +++ b/snapshots/unparser/corpus/literal/super.txt @@ -32,6 +32,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rparen_loc: (3,7)-(3,8) = ")" │ └── block: ∅ @@ -52,6 +53,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (4,9)-(4,10)) │ │ ├── flags: variable_call, ignore_visibility @@ -62,6 +64,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rparen_loc: (4,10)-(4,11) = ")" │ └── block: ∅ @@ -84,6 +87,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (5,6)-(5,7) = "&" ├── @ SuperNode (location: (6,0)-(6,16)) @@ -103,6 +107,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rparen_loc: (6,15)-(6,16) = ")" │ └── block: @@ -118,6 +123,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (6,9)-(6,10) = "&" ├── @ SuperNode (location: (7,0)-(9,2)) @@ -137,6 +143,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (7,8)-(9,1)) │ │ ├── flags: ∅ @@ -155,6 +162,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (7,8)-(7,9) = "{" │ │ └── closing_loc: (9,0)-(9,1) = "}" @@ -180,6 +188,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (10,6)-(10,7) = "{" │ └── closing_loc: (12,0)-(12,1) = "}" @@ -200,6 +209,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rparen_loc: (13,7)-(13,8) = ")" │ └── block: @@ -220,6 +230,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (13,9)-(13,10) = "{" │ └── closing_loc: (15,0)-(15,1) = "}" @@ -247,6 +258,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (16,8)-(16,9) = "{" │ └── closing_loc: (18,0)-(18,1) = "}" @@ -267,6 +279,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ CallNode (location: (19,9)-(19,10)) │ ├── flags: variable_call, ignore_visibility @@ -277,6 +290,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rparen_loc: (19,10)-(19,11) = ")" └── block: @@ -297,6 +311,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (19,12)-(19,13) = "{" └── closing_loc: (21,0)-(21,1) = "}" diff --git a/snapshots/unparser/corpus/literal/unary.txt b/snapshots/unparser/corpus/literal/unary.txt index ec2115e411..d64e24adad 100644 --- a/snapshots/unparser/corpus/literal/unary.txt +++ b/snapshots/unparser/corpus/literal/unary.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (2,0)-(2,5)) │ ├── flags: newline @@ -39,6 +40,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (2,1)-(2,2) = "(" │ │ └── closing_loc: (2,4)-(2,5) = ")" @@ -48,6 +50,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,16)) │ ├── flags: newline @@ -79,6 +82,7 @@ │ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ │ └── block: ∅ │ │ │ │ │ ├── right: │ │ │ │ │ │ @ CallNode (location: (3,11)-(3,14)) @@ -90,6 +94,7 @@ │ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ │ └── block: ∅ │ │ │ │ │ └── operator_loc: (3,8)-(3,10) = "||" │ │ │ │ ├── opening_loc: (3,3)-(3,4) = "(" @@ -100,6 +105,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (3,1)-(3,2) = "(" │ │ └── closing_loc: (3,15)-(3,16) = ")" @@ -109,6 +115,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (4,0)-(4,9)) │ ├── flags: newline @@ -134,6 +141,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (4,1)-(4,2) = "(" │ │ │ └── closing_loc: (4,4)-(4,5) = ")" @@ -143,6 +151,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :! @@ -150,6 +159,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (5,0)-(5,2)) │ ├── flags: newline @@ -163,6 +173,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :~ @@ -170,6 +181,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (6,0)-(6,2)) │ ├── flags: newline @@ -183,6 +195,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :-@ @@ -190,6 +203,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (7,0)-(7,2)) │ ├── flags: newline @@ -203,6 +217,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :+@ @@ -210,6 +225,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (8,0)-(8,9)) │ ├── flags: newline @@ -235,6 +251,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── call_operator_loc: ∅ │ │ │ │ ├── name: :-@ @@ -242,6 +259,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (8,1)-(8,2) = "(" │ │ │ └── closing_loc: (8,4)-(8,5) = ")" @@ -251,6 +269,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :-@ @@ -258,6 +277,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (9,0)-(9,9)) ├── flags: newline @@ -283,6 +303,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :+@ @@ -290,6 +311,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (9,1)-(9,2) = "(" │ │ └── closing_loc: (9,4)-(9,5) = ")" @@ -299,6 +321,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :+@ @@ -306,4 +329,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/unparser/corpus/literal/variables.txt b/snapshots/unparser/corpus/literal/variables.txt index 3861af1a46..f2c2e32ebd 100644 --- a/snapshots/unparser/corpus/literal/variables.txt +++ b/snapshots/unparser/corpus/literal/variables.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ InstanceVariableReadNode (location: (2,0)-(2,2)) │ ├── flags: newline diff --git a/snapshots/unparser/corpus/literal/while.txt b/snapshots/unparser/corpus/literal/while.txt index 642a5c182e..f11ba958a6 100644 --- a/snapshots/unparser/corpus/literal/while.txt +++ b/snapshots/unparser/corpus/literal/while.txt @@ -26,6 +26,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (2,6)-(6,3)) │ │ ├── flags: ∅ @@ -68,6 +69,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── statements: │ │ │ @ StatementsNode (location: (4,6)-(4,15)) @@ -128,8 +130,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── statements: │ │ @ StatementsNode (location: (10,2)-(10,11)) @@ -150,6 +154,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (10,6)-(10,7) = "=" │ ├── locals: [:foo] @@ -200,6 +205,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (14,6)-(14,7) = "=" │ ├── end_keyword_loc: (15,0)-(15,3) = "end" @@ -245,6 +251,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (18,6)-(18,7) = "=" │ ├── end_keyword_loc: (19,0)-(19,3) = "end" @@ -276,6 +283,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── statements: │ │ @ StatementsNode (location: (23,4)-(23,13)) @@ -296,6 +304,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (23,8)-(23,9) = "=" │ ├── end_keyword_loc: (25,0)-(25,3) = "end" @@ -321,6 +330,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (28,7)-(32,3)) │ │ ├── flags: ∅ @@ -363,6 +373,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── statements: │ │ │ @ StatementsNode (location: (30,6)-(30,15)) @@ -383,6 +394,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (30,10)-(30,11) = "=" │ │ ├── opening_loc: (28,7)-(28,8) = "{" @@ -410,6 +422,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (36,7)-(40,3)) │ │ ├── flags: ∅ @@ -466,6 +479,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (38,10)-(38,11) = "=" │ │ ├── opening_loc: (36,7)-(36,8) = "{" @@ -499,6 +513,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── statements: │ │ │ @ StatementsNode (location: (42,5)-(44,3)) @@ -520,6 +535,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── rescue_clause: ∅ │ │ │ ├── else_clause: ∅ @@ -543,6 +559,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── statements: │ @ StatementsNode (location: (45,0)-(47,3)) @@ -564,6 +581,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -584,6 +602,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── statements: │ @ StatementsNode (location: (48,0)-(51,3)) @@ -605,6 +624,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (50,2)-(50,5)) │ │ ├── flags: newline, variable_call, ignore_visibility @@ -615,6 +635,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -635,6 +656,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── statements: │ @ StatementsNode (location: (52,0)-(55,3)) @@ -656,6 +678,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (54,2)-(54,5)) │ │ ├── flags: newline, variable_call, ignore_visibility @@ -666,6 +689,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -716,6 +740,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (61,11)-(62,1)) │ │ │ ├── flags: ∅ @@ -781,6 +806,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (70,11)-(71,1)) │ │ ├── flags: ∅ diff --git a/snapshots/unparser/corpus/semantic/and.txt b/snapshots/unparser/corpus/semantic/and.txt index ad2b639777..9206b1bf33 100644 --- a/snapshots/unparser/corpus/semantic/and.txt +++ b/snapshots/unparser/corpus/semantic/and.txt @@ -20,6 +20,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (1,4)-(1,5)) @@ -31,6 +32,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (1,1)-(1,4) = "..." │ ├── right: @@ -46,6 +48,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (1,13)-(1,14)) @@ -57,6 +60,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (1,10)-(1,13) = "..." │ └── operator_loc: (1,6)-(1,8) = "or" @@ -75,6 +79,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (2,4)-(2,5)) @@ -86,6 +91,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (2,1)-(2,4) = "..." │ ├── right: @@ -101,6 +107,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (2,14)-(2,15)) @@ -112,6 +119,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (2,11)-(2,14) = "..." │ └── operator_loc: (2,6)-(2,9) = "and" @@ -134,6 +142,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── right: │ │ │ │ @ CallNode (location: (4,7)-(4,8)) @@ -145,6 +154,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (4,4)-(4,7) = "..." │ │ ├── right: @@ -160,6 +170,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── right: │ │ │ │ @ CallNode (location: (4,16)-(4,17)) @@ -171,6 +182,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (4,13)-(4,16) = "..." │ │ └── operator_loc: (4,9)-(4,11) = "or" @@ -197,6 +209,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (7,7)-(7,8)) @@ -208,6 +221,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (7,4)-(7,7) = "..." │ ├── right: @@ -223,6 +237,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (7,17)-(7,18)) @@ -234,6 +249,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (7,14)-(7,17) = "..." │ └── operator_loc: (7,9)-(7,12) = "and" diff --git a/snapshots/unparser/corpus/semantic/block.txt b/snapshots/unparser/corpus/semantic/block.txt index b6ea10f25f..5de8246b64 100644 --- a/snapshots/unparser/corpus/semantic/block.txt +++ b/snapshots/unparser/corpus/semantic/block.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,4)-(2,3)) │ ├── flags: ∅ @@ -31,6 +32,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (4,4)-(6,3)) │ ├── flags: ∅ @@ -65,6 +67,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (8,4)-(11,3)) │ ├── flags: ∅ @@ -96,6 +99,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (13,4)-(14,3)) │ ├── flags: ∅ @@ -140,6 +144,7 @@ │ │ ├── closing_loc: (18,0)-(19,0) = "DOC\n" │ │ └── unescaped: " b\n" │ ├── closing_loc: (16,10)-(16,11) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (16,12)-(20,3)) │ ├── flags: ∅ @@ -191,6 +196,7 @@ │ ├── closing_loc: (24,0)-(25,0) = "DOC\n" │ └── unescaped: " b\n" ├── closing_loc: (22,10)-(22,11) = ")" + ├── equal_loc: ∅ └── block: @ BlockNode (location: (22,12)-(26,3)) ├── flags: ∅ @@ -209,6 +215,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (22,12)-(22,14) = "do" └── closing_loc: (26,0)-(26,3) = "end" diff --git a/snapshots/unparser/corpus/semantic/def.txt b/snapshots/unparser/corpus/semantic/def.txt index f05ce02bca..f1e0a913f1 100644 --- a/snapshots/unparser/corpus/semantic/def.txt +++ b/snapshots/unparser/corpus/semantic/def.txt @@ -33,6 +33,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: ∅ │ │ │ ├── name: :- @@ -51,8 +52,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (2,2)-(2,3) = "(" │ │ └── closing_loc: (2,8)-(2,9) = ")" @@ -85,6 +88,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (6,4)-(6,10) = "rescue" │ └── rescue_expression: diff --git a/snapshots/unparser/corpus/semantic/dstr.txt b/snapshots/unparser/corpus/semantic/dstr.txt index b1bfbefc8b..5271788e01 100644 --- a/snapshots/unparser/corpus/semantic/dstr.txt +++ b/snapshots/unparser/corpus/semantic/dstr.txt @@ -114,7 +114,7 @@ │ │ └── unescaped: "b\n" │ └── closing_loc: (35,0)-(36,0) = "DOC\n" ├── @ InterpolatedStringNode (location: (37,0)-(37,6)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (37,0)-(37,6) = "<<~DOC" │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (38,0)-(39,0)) @@ -495,7 +495,7 @@ │ │ └── closing_loc: (120,4)-(120,5) = "\"" │ └── closing_loc: ∅ ├── @ InterpolatedStringNode (location: (122,0)-(122,8)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: ∅ │ ├── parts: (length: 3) │ │ ├── @ StringNode (location: (122,0)-(122,2)) diff --git a/snapshots/unparser/corpus/semantic/kwbegin.txt b/snapshots/unparser/corpus/semantic/kwbegin.txt index dc5f529efb..432531b577 100644 --- a/snapshots/unparser/corpus/semantic/kwbegin.txt +++ b/snapshots/unparser/corpus/semantic/kwbegin.txt @@ -60,6 +60,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: ∅ │ ├── else_clause: ∅ @@ -81,6 +82,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (16,0)-(17,3)) @@ -103,6 +105,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -124,6 +127,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (22,2)-(22,3)) │ │ ├── flags: newline, variable_call, ignore_visibility @@ -134,6 +138,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (23,0)-(24,3)) @@ -156,6 +161,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -227,6 +233,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: │ @ RescueNode (location: (36,0)-(39,3)) @@ -252,6 +259,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: │ @ RescueNode (location: (38,0)-(39,3)) @@ -277,6 +285,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: ∅ ├── else_clause: ∅ @@ -297,6 +306,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (42,0)-(42,3) = "end" └── end_keyword_loc: (42,0)-(42,3) = "end" diff --git a/snapshots/unparser/corpus/semantic/literal.txt b/snapshots/unparser/corpus/semantic/literal.txt index 0d21b59d49..b296cee92d 100644 --- a/snapshots/unparser/corpus/semantic/literal.txt +++ b/snapshots/unparser/corpus/semantic/literal.txt @@ -105,8 +105,11 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: (14,9)-(14,10) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/unparser/corpus/semantic/opasgn.txt b/snapshots/unparser/corpus/semantic/opasgn.txt index 870942f97e..a14bef38b5 100644 --- a/snapshots/unparser/corpus/semantic/opasgn.txt +++ b/snapshots/unparser/corpus/semantic/opasgn.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── opening_loc: (1,1)-(1,2) = "[" diff --git a/snapshots/unparser/corpus/semantic/send.txt b/snapshots/unparser/corpus/semantic/send.txt index f403d3d2b6..fd54e0e9c3 100644 --- a/snapshots/unparser/corpus/semantic/send.txt +++ b/snapshots/unparser/corpus/semantic/send.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (2,0)-(2,6)) │ ├── flags: newline, ignore_visibility @@ -30,6 +31,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: (2,5)-(2,6) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (4,0)-(4,15)) │ ├── flags: newline @@ -49,6 +51,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── call_operator_loc: (4,1)-(4,2) = "." │ │ │ ├── name: :=== @@ -67,8 +70,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (4,7)-(4,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (4,8)-(4,9) = "." │ │ ├── name: :c @@ -76,6 +81,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :== @@ -94,8 +100,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (6,0)-(6,15)) ├── flags: newline @@ -109,6 +117,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :== @@ -133,6 +142,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── call_operator_loc: (6,6)-(6,7) = "." │ │ ├── name: :c @@ -140,6 +150,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (6,8)-(6,9) = "." │ ├── name: :=== @@ -158,8 +169,11 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (6,14)-(6,15) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/unparser/corpus/semantic/while.txt b/snapshots/unparser/corpus/semantic/while.txt index de3a3335db..36f7b07c8d 100644 --- a/snapshots/unparser/corpus/semantic/while.txt +++ b/snapshots/unparser/corpus/semantic/while.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (1,11)-(1,13)) │ │ ├── flags: ∅ @@ -41,6 +42,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ UntilNode (location: (3,0)-(5,3)) │ ├── flags: newline @@ -57,6 +59,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (3,9)-(3,11)) │ │ ├── flags: ∅ @@ -78,6 +81,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ WhileNode (location: (7,0)-(7,19)) │ ├── flags: newline @@ -108,6 +112,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (7,4)-(7,5) = "=" ├── @ UntilNode (location: (9,0)-(9,18)) @@ -128,6 +133,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── right: │ │ │ @ CallNode (location: (9,13)-(9,18)) @@ -139,6 +145,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (9,15)-(9,18)) │ │ │ ├── flags: ∅ @@ -161,6 +168,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ WhileNode (location: (11,0)-(13,3)) │ ├── flags: newline @@ -183,6 +191,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (11,8)-(11,9) = "=" │ └── statements: @@ -217,6 +226,7 @@ │ │ │ ├── closing_loc: (16,0)-(17,0) = "FOO\n" │ │ │ └── unescaped: "" │ │ ├── closing_loc: (15,16)-(15,17) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (15,18)-(18,3)) │ │ ├── flags: ∅ @@ -235,6 +245,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (15,18)-(15,20) = "do" │ │ └── closing_loc: (18,0)-(18,3) = "end" @@ -273,6 +284,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (21,6)-(21,7) = "=" │ └── @ WhileNode (location: (22,2)-(24,5)) @@ -304,6 +316,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (23,8)-(23,9) = "=" ├── end_keyword_loc: (25,0)-(25,3) = "end" diff --git a/snapshots/until.txt b/snapshots/until.txt index e89a17450a..55b3beafa8 100644 --- a/snapshots/until.txt +++ b/snapshots/until.txt @@ -44,6 +44,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,4)-(5,24)) │ ├── flags: ∅ @@ -80,6 +81,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,4)-(7,23)) │ ├── flags: ∅ @@ -138,6 +140,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── statements: │ @ StatementsNode (location: (11,0)-(11,10)) @@ -167,6 +170,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "b" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ WhileNode (location: (13,0)-(13,20)) ├── flags: newline @@ -186,6 +190,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ LocalVariableTargetNode (location: (13,17)-(13,20)) @@ -206,4 +211,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/variables.txt b/snapshots/variables.txt index f36ef08075..d25338e88d 100644 --- a/snapshots/variables.txt +++ b/snapshots/variables.txt @@ -85,6 +85,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ LocalVariableWriteNode (location: (19,0)-(19,7)) │ ├── flags: newline @@ -397,6 +398,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── @ CallNode (location: (45,4)-(45,5)) │ │ │ ├── flags: newline, variable_call, ignore_visibility @@ -407,6 +409,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ CallNode (location: (45,7)-(45,8)) │ │ ├── flags: newline, variable_call, ignore_visibility @@ -417,6 +420,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (45,0)-(45,1) = "(" │ └── closing_loc: (45,8)-(45,9) = ")" diff --git a/snapshots/while.txt b/snapshots/while.txt index 7d6d53c520..67d45e4d66 100644 --- a/snapshots/while.txt +++ b/snapshots/while.txt @@ -44,6 +44,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,4)-(5,24)) │ ├── flags: ∅ @@ -80,6 +81,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,4)-(7,23)) │ ├── flags: ∅ @@ -138,6 +140,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── statements: │ @ StatementsNode (location: (11,0)-(11,10)) @@ -167,6 +170,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "b" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (13,0)-(13,58)) │ ├── flags: newline, ignore_visibility @@ -177,6 +181,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (13,4)-(13,58)) │ ├── flags: ∅ @@ -219,6 +224,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: │ │ │ │ │ @ BlockNode (location: (13,33)-(13,39)) │ │ │ │ │ ├── flags: ∅ @@ -259,6 +265,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (15,4)-(15,55)) │ ├── flags: ∅ @@ -303,6 +310,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: │ │ │ │ │ @ BlockNode (location: (15,30)-(15,36)) │ │ │ │ │ ├── flags: ∅ @@ -333,6 +341,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (17,4)-(17,56)) │ ├── flags: ∅ @@ -369,6 +378,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: │ │ │ │ @ BlockNode (location: (17,31)-(17,37)) │ │ │ │ ├── flags: ∅ @@ -397,6 +407,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (19,4)-(19,60)) │ ├── flags: ∅ @@ -439,6 +450,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: │ │ │ │ │ @ BlockNode (location: (19,35)-(19,41)) │ │ │ │ │ ├── flags: ∅ @@ -484,6 +496,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (21,20)-(21,26)) │ │ │ ├── flags: ∅ @@ -518,6 +531,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── pattern: │ │ @ LocalVariableTargetNode (location: (23,17)-(23,20)) @@ -538,4 +552,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/ambiuous_quoted_label_in_ternary_operator.txt b/snapshots/whitequark/ambiuous_quoted_label_in_ternary_operator.txt index 7c2f8a2d96..1bfcb0b3b5 100644 --- a/snapshots/whitequark/ambiuous_quoted_label_in_ternary_operator.txt +++ b/snapshots/whitequark/ambiuous_quoted_label_in_ternary_operator.txt @@ -18,6 +18,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: (1,2)-(1,3) = "?" ├── statements: @@ -36,6 +37,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :& @@ -52,6 +54,7 @@ │ │ ├── closing_loc: (1,9)-(1,10) = "'" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── subsequent: │ @ ElseNode (location: (1,10)-(1,15)) diff --git a/snapshots/whitequark/and.txt b/snapshots/whitequark/and.txt index 3f548d55eb..e528ac9bc3 100644 --- a/snapshots/whitequark/and.txt +++ b/snapshots/whitequark/and.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (1,7)-(1,10)) @@ -28,6 +29,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (1,4)-(1,6) = "&&" └── @ AndNode (location: (3,0)-(3,11)) @@ -42,6 +44,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── right: │ @ CallNode (location: (3,8)-(3,11)) @@ -53,5 +56,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (3,4)-(3,7) = "and" diff --git a/snapshots/whitequark/and_asgn.txt b/snapshots/whitequark/and_asgn.txt index f07cfd749d..a268cafb87 100644 --- a/snapshots/whitequark/and_asgn.txt +++ b/snapshots/whitequark/and_asgn.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,3)-(1,4) = "." │ ├── message_loc: (1,4)-(1,5) = "a" @@ -39,6 +40,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── opening_loc: (3,3)-(3,4) = "[" diff --git a/snapshots/whitequark/and_or_masgn.txt b/snapshots/whitequark/and_or_masgn.txt index 208120c02e..9357fb4a87 100644 --- a/snapshots/whitequark/and_or_masgn.txt +++ b/snapshots/whitequark/and_or_masgn.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ ParenthesesNode (location: (1,7)-(1,19)) @@ -51,6 +52,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (1,7)-(1,8) = "(" │ │ └── closing_loc: (1,18)-(1,19) = ")" @@ -67,6 +69,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── right: │ @ ParenthesesNode (location: (3,7)-(3,19)) @@ -101,6 +104,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (3,7)-(3,8) = "(" │ └── closing_loc: (3,18)-(3,19) = ")" diff --git a/snapshots/whitequark/anonymous_blockarg.txt b/snapshots/whitequark/anonymous_blockarg.txt index 7ae9500bb7..3d180d6910 100644 --- a/snapshots/whitequark/anonymous_blockarg.txt +++ b/snapshots/whitequark/anonymous_blockarg.txt @@ -26,10 +26,10 @@ │ ├── name_loc: ∅ │ └── operator_loc: (1,8)-(1,9) = "&" ├── body: - │ @ StatementsNode (location: (1,12)-(1,17)) + │ @ StatementsNode (location: (1,12)-(1,18)) │ ├── flags: ∅ │ └── body: (length: 1) - │ └── @ CallNode (location: (1,12)-(1,17)) + │ └── @ CallNode (location: (1,12)-(1,18)) │ ├── flags: newline, ignore_visibility │ ├── receiver: ∅ │ ├── call_operator_loc: ∅ @@ -38,6 +38,7 @@ │ ├── opening_loc: (1,15)-(1,16) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (1,17)-(1,18) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockArgumentNode (location: (1,16)-(1,17)) │ ├── flags: ∅ diff --git a/snapshots/whitequark/arg_label.txt b/snapshots/whitequark/arg_label.txt index 97c1b45671..42c10dafa2 100644 --- a/snapshots/whitequark/arg_label.txt +++ b/snapshots/whitequark/arg_label.txt @@ -33,6 +33,7 @@ │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "b" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (1,0)-(1,3) = "def" @@ -69,6 +70,7 @@ │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "b" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (4,0)-(4,3) = "def" @@ -86,6 +88,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (6,2)-(6,12)) ├── flags: ∅ @@ -119,6 +122,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "b" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (6,2)-(6,3) = "{" └── closing_loc: (6,11)-(6,12) = "}" diff --git a/snapshots/whitequark/arg_scope.txt b/snapshots/whitequark/arg_scope.txt index 7838aad5fd..c5f0371b89 100644 --- a/snapshots/whitequark/arg_scope.txt +++ b/snapshots/whitequark/arg_scope.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,6)-(1,13)) ├── flags: ∅ diff --git a/snapshots/whitequark/args_args_assocs.txt b/snapshots/whitequark/args_args_assocs.txt index bc9615273e..241dc55763 100644 --- a/snapshots/whitequark/args_args_assocs.txt +++ b/snapshots/whitequark/args_args_assocs.txt @@ -1,8 +1,8 @@ -@ ProgramNode (location: (1,0)-(3,24)) +@ ProgramNode (location: (1,0)-(3,25)) ├── flags: ∅ ├── locals: [] └── statements: - @ StatementsNode (location: (1,0)-(3,24)) + @ StatementsNode (location: (1,0)-(3,25)) ├── flags: ∅ └── body: (length: 2) ├── @ CallNode (location: (1,0)-(1,19)) @@ -25,6 +25,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ KeywordHashNode (location: (1,9)-(1,18)) │ │ ├── flags: symbol_keys @@ -44,8 +45,9 @@ │ │ │ └── value: 1 │ │ └── operator_loc: (1,14)-(1,16) = "=>" │ ├── closing_loc: (1,18)-(1,19) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ - └── @ CallNode (location: (3,0)-(3,24)) + └── @ CallNode (location: (3,0)-(3,25)) ├── flags: newline, ignore_visibility ├── receiver: ∅ ├── call_operator_loc: ∅ @@ -65,6 +67,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ KeywordHashNode (location: (3,9)-(3,18)) │ ├── flags: symbol_keys @@ -84,6 +87,7 @@ │ │ └── value: 1 │ └── operator_loc: (3,14)-(3,16) = "=>" ├── closing_loc: (3,24)-(3,25) = ")" + ├── equal_loc: ∅ └── block: @ BlockArgumentNode (location: (3,20)-(3,24)) ├── flags: ∅ @@ -97,5 +101,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (3,20)-(3,21) = "&" diff --git a/snapshots/whitequark/args_args_assocs_comma.txt b/snapshots/whitequark/args_args_assocs_comma.txt index cb98bdd1a0..ddf24a00b8 100644 --- a/snapshots/whitequark/args_args_assocs_comma.txt +++ b/snapshots/whitequark/args_args_assocs_comma.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[] @@ -35,6 +36,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ KeywordHashNode (location: (1,9)-(1,18)) │ ├── flags: symbol_keys @@ -54,4 +56,5 @@ │ │ └── value: 1 │ └── operator_loc: (1,14)-(1,16) = "=>" ├── closing_loc: (1,19)-(1,20) = "]" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/args_args_comma.txt b/snapshots/whitequark/args_args_comma.txt index 1452565827..1afdbf6bb3 100644 --- a/snapshots/whitequark/args_args_comma.txt +++ b/snapshots/whitequark/args_args_comma.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[] @@ -35,6 +36,8 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: (1,8)-(1,9) = "]" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/args_args_star.txt b/snapshots/whitequark/args_args_star.txt index 32f8b6bafb..5845b84b6b 100644 --- a/snapshots/whitequark/args_args_star.txt +++ b/snapshots/whitequark/args_args_star.txt @@ -1,8 +1,8 @@ -@ ProgramNode (location: (1,0)-(3,19)) +@ ProgramNode (location: (1,0)-(3,20)) ├── flags: ∅ ├── locals: [] └── statements: - @ StatementsNode (location: (1,0)-(3,19)) + @ StatementsNode (location: (1,0)-(3,20)) ├── flags: ∅ └── body: (length: 2) ├── @ CallNode (location: (1,0)-(1,14)) @@ -25,6 +25,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ SplatNode (location: (1,9)-(1,13)) │ │ ├── flags: ∅ @@ -39,10 +40,12 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (1,13)-(1,14) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ - └── @ CallNode (location: (3,0)-(3,19)) + └── @ CallNode (location: (3,0)-(3,20)) ├── flags: newline, ignore_visibility ├── receiver: ∅ ├── call_operator_loc: ∅ @@ -62,6 +65,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ SplatNode (location: (3,9)-(3,13)) │ ├── flags: ∅ @@ -76,8 +80,10 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: (3,19)-(3,20) = ")" + ├── equal_loc: ∅ └── block: @ BlockArgumentNode (location: (3,15)-(3,19)) ├── flags: ∅ @@ -91,5 +97,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (3,15)-(3,16) = "&" diff --git a/snapshots/whitequark/args_assocs_comma.txt b/snapshots/whitequark/args_assocs_comma.txt index 2d00798a37..86ab339f0e 100644 --- a/snapshots/whitequark/args_assocs_comma.txt +++ b/snapshots/whitequark/args_assocs_comma.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[] @@ -44,4 +45,5 @@ │ │ └── value: 1 │ └── operator_loc: (1,9)-(1,11) = "=>" ├── closing_loc: (1,14)-(1,15) = "]" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/args_block_pass.txt b/snapshots/whitequark/args_block_pass.txt index 495d8efd4f..f1765fb79c 100644 --- a/snapshots/whitequark/args_block_pass.txt +++ b/snapshots/whitequark/args_block_pass.txt @@ -1,11 +1,11 @@ -@ ProgramNode (location: (1,0)-(1,8)) +@ ProgramNode (location: (1,0)-(1,9)) ├── flags: ∅ ├── locals: [] └── statements: - @ StatementsNode (location: (1,0)-(1,8)) + @ StatementsNode (location: (1,0)-(1,9)) ├── flags: ∅ └── body: (length: 1) - └── @ CallNode (location: (1,0)-(1,8)) + └── @ CallNode (location: (1,0)-(1,9)) ├── flags: newline, ignore_visibility ├── receiver: ∅ ├── call_operator_loc: ∅ @@ -14,6 +14,7 @@ ├── opening_loc: (1,3)-(1,4) = "(" ├── arguments: ∅ ├── closing_loc: (1,8)-(1,9) = ")" + ├── equal_loc: ∅ └── block: @ BlockArgumentNode (location: (1,4)-(1,8)) ├── flags: ∅ @@ -27,5 +28,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (1,4)-(1,5) = "&" diff --git a/snapshots/whitequark/args_cmd.txt b/snapshots/whitequark/args_cmd.txt index 1cfdf1bb10..9bc295c30b 100644 --- a/snapshots/whitequark/args_cmd.txt +++ b/snapshots/whitequark/args_cmd.txt @@ -36,8 +36,11 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: (1,9)-(1,10) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/args_star.txt b/snapshots/whitequark/args_star.txt index 488b113dff..45eb557816 100644 --- a/snapshots/whitequark/args_star.txt +++ b/snapshots/whitequark/args_star.txt @@ -1,8 +1,8 @@ -@ ProgramNode (location: (1,0)-(3,14)) +@ ProgramNode (location: (1,0)-(3,15)) ├── flags: ∅ ├── locals: [] └── statements: - @ StatementsNode (location: (1,0)-(3,14)) + @ StatementsNode (location: (1,0)-(3,15)) ├── flags: ∅ └── body: (length: 2) ├── @ CallNode (location: (1,0)-(1,9)) @@ -29,10 +29,12 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (1,8)-(1,9) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ - └── @ CallNode (location: (3,0)-(3,14)) + └── @ CallNode (location: (3,0)-(3,15)) ├── flags: newline, ignore_visibility ├── receiver: ∅ ├── call_operator_loc: ∅ @@ -56,8 +58,10 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: (3,14)-(3,15) = ")" + ├── equal_loc: ∅ └── block: @ BlockArgumentNode (location: (3,10)-(3,14)) ├── flags: ∅ @@ -71,5 +75,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (3,10)-(3,11) = "&" diff --git a/snapshots/whitequark/array_splat.txt b/snapshots/whitequark/array_splat.txt index bfd74572ca..ae94a8eda3 100644 --- a/snapshots/whitequark/array_splat.txt +++ b/snapshots/whitequark/array_splat.txt @@ -21,6 +21,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,0)-(1,1) = "[" │ └── closing_loc: (1,5)-(1,6) = "]" @@ -43,6 +44,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ IntegerNode (location: (3,10)-(3,11)) │ │ ├── flags: static_literal, decimal @@ -68,6 +70,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (5,0)-(5,1) = "[" └── closing_loc: (5,8)-(5,9) = "]" diff --git a/snapshots/whitequark/array_symbols_interp.txt b/snapshots/whitequark/array_symbols_interp.txt index f250ef041f..0fa0416870 100644 --- a/snapshots/whitequark/array_symbols_interp.txt +++ b/snapshots/whitequark/array_symbols_interp.txt @@ -34,6 +34,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (1,12)-(1,13) = "}" │ │ └── closing_loc: ∅ @@ -68,6 +69,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (3,11)-(3,12) = "}" │ └── closing_loc: ∅ diff --git a/snapshots/whitequark/array_words_interp.txt b/snapshots/whitequark/array_words_interp.txt index dd104a1921..2acf9d2943 100644 --- a/snapshots/whitequark/array_words_interp.txt +++ b/snapshots/whitequark/array_words_interp.txt @@ -34,6 +34,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (1,12)-(1,13) = "}" │ │ └── closing_loc: ∅ @@ -68,6 +69,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (3,12)-(3,13) = "}" │ │ ├── @ StringNode (location: (3,13)-(3,16)) diff --git a/snapshots/whitequark/asgn_cmd.txt b/snapshots/whitequark/asgn_cmd.txt index c212864ded..f2b2cfd767 100644 --- a/snapshots/whitequark/asgn_cmd.txt +++ b/snapshots/whitequark/asgn_cmd.txt @@ -33,6 +33,7 @@ │ │ │ │ ├── name: :foo │ │ │ │ └── depth: 0 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (1,10)-(1,11) = "=" │ └── operator_loc: (1,4)-(1,5) = "=" @@ -58,5 +59,6 @@ │ │ ├── name: :foo │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (3,4)-(3,5) = "=" diff --git a/snapshots/whitequark/asgn_mrhs.txt b/snapshots/whitequark/asgn_mrhs.txt index 972eaf7fa5..b8395d1b2d 100644 --- a/snapshots/whitequark/asgn_mrhs.txt +++ b/snapshots/whitequark/asgn_mrhs.txt @@ -27,6 +27,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: ∅ │ │ └── closing_loc: ∅ @@ -49,6 +50,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── @ IntegerNode (location: (3,11)-(3,12)) │ │ │ ├── flags: static_literal, decimal @@ -74,6 +76,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ SplatNode (location: (5,11)-(5,15)) │ │ ├── flags: ∅ @@ -88,6 +91,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: ∅ │ └── closing_loc: ∅ diff --git a/snapshots/whitequark/bang.txt b/snapshots/whitequark/bang.txt index 165a5d3149..f9ad821fb3 100644 --- a/snapshots/whitequark/bang.txt +++ b/snapshots/whitequark/bang.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :! @@ -24,4 +25,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/bang_cmd.txt b/snapshots/whitequark/bang_cmd.txt index d4487ad6ca..f78e47f5e4 100644 --- a/snapshots/whitequark/bang_cmd.txt +++ b/snapshots/whitequark/bang_cmd.txt @@ -28,8 +28,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :! @@ -37,4 +39,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/begin_cmdarg.txt b/snapshots/whitequark/begin_cmdarg.txt index 8287191fab..964f7955f9 100644 --- a/snapshots/whitequark/begin_cmdarg.txt +++ b/snapshots/whitequark/begin_cmdarg.txt @@ -35,6 +35,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (1,16)-(1,24)) │ │ ├── flags: ∅ @@ -54,4 +55,5 @@ │ ├── ensure_clause: ∅ │ └── end_keyword_loc: (1,25)-(1,28) = "end" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/beginless_erange_after_newline.txt b/snapshots/whitequark/beginless_erange_after_newline.txt index fe05701982..d88aadd4a6 100644 --- a/snapshots/whitequark/beginless_erange_after_newline.txt +++ b/snapshots/whitequark/beginless_erange_after_newline.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ RangeNode (location: (2,0)-(2,6)) ├── flags: newline, static_literal, exclude_end diff --git a/snapshots/whitequark/beginless_irange_after_newline.txt b/snapshots/whitequark/beginless_irange_after_newline.txt index ae5c09808a..b067a7b369 100644 --- a/snapshots/whitequark/beginless_irange_after_newline.txt +++ b/snapshots/whitequark/beginless_irange_after_newline.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ RangeNode (location: (2,0)-(2,5)) ├── flags: newline, static_literal diff --git a/snapshots/whitequark/block_arg_combinations.txt b/snapshots/whitequark/block_arg_combinations.txt index 733f1ad6b5..224e33dd01 100644 --- a/snapshots/whitequark/block_arg_combinations.txt +++ b/snapshots/whitequark/block_arg_combinations.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,1)-(1,5)) │ ├── flags: ∅ @@ -31,6 +32,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,1)-(3,8)) │ ├── flags: ∅ @@ -54,6 +56,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,1)-(5,9)) │ ├── flags: ∅ @@ -91,6 +94,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,1)-(7,12)) │ ├── flags: ∅ @@ -133,6 +137,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (9,1)-(9,16)) │ ├── flags: ∅ @@ -178,6 +183,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (11,1)-(11,13)) │ ├── flags: ∅ @@ -220,6 +226,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (13,1)-(13,9)) │ ├── flags: ∅ @@ -257,6 +264,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (15,1)-(15,8)) │ ├── flags: ∅ @@ -294,6 +302,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (17,1)-(19,3)) │ ├── flags: ∅ @@ -320,6 +329,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (21,1)-(21,9)) │ ├── flags: ∅ @@ -346,6 +356,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (23,1)-(23,12)) │ ├── flags: ∅ @@ -386,6 +397,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (25,1)-(25,15)) │ ├── flags: ∅ @@ -431,6 +443,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (27,1)-(27,19)) │ ├── flags: ∅ @@ -479,6 +492,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (29,1)-(29,16)) │ ├── flags: ∅ @@ -524,6 +538,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (31,1)-(31,12)) │ ├── flags: ∅ @@ -564,6 +579,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (33,1)-(33,11)) │ ├── flags: ∅ @@ -604,6 +620,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (35,1)-(35,11)) │ ├── flags: ∅ @@ -642,6 +659,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (37,1)-(37,17)) │ ├── flags: ∅ @@ -691,6 +709,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (39,1)-(39,24)) │ ├── flags: ∅ @@ -748,6 +767,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (41,1)-(41,27)) │ ├── flags: ∅ @@ -811,6 +831,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (43,1)-(43,20)) │ ├── flags: ∅ @@ -863,6 +884,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (45,1)-(45,9)) │ ├── flags: ∅ @@ -900,6 +922,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (47,1)-(47,8)) │ ├── flags: ∅ @@ -935,6 +958,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (49,1)-(49,14)) │ ├── flags: ∅ @@ -981,6 +1005,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (51,1)-(51,18)) │ ├── flags: ∅ @@ -1032,6 +1057,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (53,1)-(53,21)) │ ├── flags: ∅ @@ -1086,6 +1112,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (55,1)-(55,17)) │ ├── flags: ∅ @@ -1135,6 +1162,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (57,1)-(57,7)) ├── flags: ∅ diff --git a/snapshots/whitequark/block_kwarg.txt b/snapshots/whitequark/block_kwarg.txt index 65e827fb5b..8ab737f4b6 100644 --- a/snapshots/whitequark/block_kwarg.txt +++ b/snapshots/whitequark/block_kwarg.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,1)-(1,11)) ├── flags: ∅ diff --git a/snapshots/whitequark/block_kwarg_combinations.txt b/snapshots/whitequark/block_kwarg_combinations.txt index ec1659a941..6af2600515 100644 --- a/snapshots/whitequark/block_kwarg_combinations.txt +++ b/snapshots/whitequark/block_kwarg_combinations.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,1)-(1,16)) │ ├── flags: ∅ @@ -56,6 +57,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,1)-(3,17)) │ ├── flags: ∅ @@ -101,6 +103,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (5,1)-(5,32)) ├── flags: ∅ diff --git a/snapshots/whitequark/blockargs.txt b/snapshots/whitequark/blockargs.txt index 53ef39ac0f..6cd5c6590b 100644 --- a/snapshots/whitequark/blockargs.txt +++ b/snapshots/whitequark/blockargs.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,1)-(1,5)) │ ├── flags: ∅ @@ -31,6 +32,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,1)-(3,8)) │ ├── flags: ∅ @@ -54,6 +56,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,1)-(5,9)) │ ├── flags: ∅ @@ -91,6 +94,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,1)-(7,16)) │ ├── flags: ∅ @@ -133,6 +137,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (9,1)-(9,12)) │ ├── flags: ∅ @@ -175,6 +180,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (11,1)-(11,16)) │ ├── flags: ∅ @@ -220,6 +226,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (13,1)-(13,13)) │ ├── flags: ∅ @@ -262,6 +269,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (15,1)-(15,9)) │ ├── flags: ∅ @@ -299,6 +307,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (17,1)-(17,8)) │ ├── flags: ∅ @@ -336,6 +345,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (19,1)-(21,3)) │ ├── flags: ∅ @@ -362,6 +372,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (23,1)-(23,9)) │ ├── flags: ∅ @@ -388,6 +399,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (25,1)-(25,12)) │ ├── flags: ∅ @@ -428,6 +440,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (27,1)-(27,15)) │ ├── flags: ∅ @@ -473,6 +486,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (29,1)-(29,19)) │ ├── flags: ∅ @@ -521,6 +535,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (31,1)-(31,16)) │ ├── flags: ∅ @@ -566,6 +581,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (33,1)-(33,12)) │ ├── flags: ∅ @@ -606,6 +622,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (35,1)-(35,11)) │ ├── flags: ∅ @@ -646,6 +663,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (37,1)-(37,12)) │ ├── flags: ∅ @@ -686,6 +704,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (39,1)-(39,11)) │ ├── flags: ∅ @@ -724,6 +743,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (41,1)-(41,17)) │ ├── flags: ∅ @@ -773,6 +793,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (43,1)-(43,24)) │ ├── flags: ∅ @@ -830,6 +851,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (45,1)-(45,27)) │ ├── flags: ∅ @@ -893,6 +915,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (47,1)-(47,20)) │ ├── flags: ∅ @@ -945,6 +968,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (49,1)-(49,9)) │ ├── flags: ∅ @@ -982,6 +1006,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (51,1)-(51,8)) │ ├── flags: ∅ @@ -1017,6 +1042,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (53,1)-(53,8)) │ ├── flags: ∅ @@ -1052,6 +1078,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (55,1)-(55,8)) │ ├── flags: ∅ @@ -1087,6 +1114,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (57,1)-(57,17)) │ ├── flags: ∅ @@ -1132,6 +1160,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (59,1)-(59,32)) │ ├── flags: ∅ @@ -1190,6 +1219,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (61,1)-(61,11)) │ ├── flags: ∅ @@ -1226,6 +1256,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (63,1)-(63,14)) │ ├── flags: ∅ @@ -1272,6 +1303,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (65,1)-(65,18)) │ ├── flags: ∅ @@ -1323,6 +1355,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (67,1)-(67,21)) │ ├── flags: ∅ @@ -1377,6 +1410,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (69,1)-(69,17)) │ ├── flags: ∅ @@ -1426,6 +1460,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (71,1)-(71,7)) ├── flags: ∅ diff --git a/snapshots/whitequark/bug_447.txt b/snapshots/whitequark/bug_447.txt index 6c8644d462..99353f85a0 100644 --- a/snapshots/whitequark/bug_447.txt +++ b/snapshots/whitequark/bug_447.txt @@ -22,6 +22,7 @@ │ │ ├── opening_loc: (1,2)-(1,3) = "[" │ │ └── closing_loc: (1,3)-(1,4) = "]" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,5)-(1,11)) │ ├── flags: ∅ @@ -50,6 +51,7 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (3,8)-(3,14)) ├── flags: ∅ diff --git a/snapshots/whitequark/bug_452.txt b/snapshots/whitequark/bug_452.txt index f55b54b89a..e1f59ea2a4 100644 --- a/snapshots/whitequark/bug_452.txt +++ b/snapshots/whitequark/bug_452.txt @@ -36,8 +36,10 @@ │ │ ├── opening_loc: (1,19)-(1,20) = "(" │ │ ├── arguments: ∅ │ │ ├── closing_loc: (1,20)-(1,21) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (1,23)-(1,37)) ├── flags: newline @@ -51,6 +53,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,25)-(1,26) = "." ├── name: :num @@ -58,6 +61,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,30)-(1,37)) ├── flags: ∅ diff --git a/snapshots/whitequark/bug_466.txt b/snapshots/whitequark/bug_466.txt index 8556ff6d24..fe67e320d4 100644 --- a/snapshots/whitequark/bug_466.txt +++ b/snapshots/whitequark/bug_466.txt @@ -54,6 +54,7 @@ │ │ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ │ │ └── value: 1 │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── opening_loc: (1,7)-(1,8) = "(" │ │ │ │ └── closing_loc: (1,11)-(1,12) = ")" @@ -63,10 +64,12 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,17)-(1,18) = "}" │ └── closing_loc: (1,18)-(1,19) = "\"" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,20)-(1,27)) ├── flags: ∅ diff --git a/snapshots/whitequark/bug_473.txt b/snapshots/whitequark/bug_473.txt index fa4c23b8a5..904c5d5456 100644 --- a/snapshots/whitequark/bug_473.txt +++ b/snapshots/whitequark/bug_473.txt @@ -35,4 +35,5 @@ │ │ └── closing_loc: (1,7)-(1,8) = "}" │ └── closing_loc: (1,8)-(1,9) = "\"" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/bug_480.txt b/snapshots/whitequark/bug_480.txt index 0ddcbae41a..426b5fc89e 100644 --- a/snapshots/whitequark/bug_480.txt +++ b/snapshots/whitequark/bug_480.txt @@ -40,4 +40,5 @@ │ │ └── closing_loc: (1,10)-(1,11) = "}" │ └── closing_loc: (1,11)-(1,12) = "\"" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/bug_481.txt b/snapshots/whitequark/bug_481.txt index 32879a82b0..02604082aa 100644 --- a/snapshots/whitequark/bug_481.txt +++ b/snapshots/whitequark/bug_481.txt @@ -31,6 +31,7 @@ │ │ ├── equal_loc: ∅ │ │ └── end_keyword_loc: (1,11)-(1,14) = "end" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (1,16)-(1,28)) ├── flags: newline @@ -44,6 +45,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,22)-(1,28)) ├── flags: ∅ diff --git a/snapshots/whitequark/bug_cmd_string_lookahead.txt b/snapshots/whitequark/bug_cmd_string_lookahead.txt index 6a581ca6cc..8788e0b5ff 100644 --- a/snapshots/whitequark/bug_cmd_string_lookahead.txt +++ b/snapshots/whitequark/bug_cmd_string_lookahead.txt @@ -23,6 +23,7 @@ │ ├── closing_loc: (1,9)-(1,10) = "\"" │ └── unescaped: "foo" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,11)-(1,17)) ├── flags: ∅ diff --git a/snapshots/whitequark/bug_cmdarg.txt b/snapshots/whitequark/bug_cmdarg.txt index efdb375dc8..4ebd76086b 100644 --- a/snapshots/whitequark/bug_cmdarg.txt +++ b/snapshots/whitequark/bug_cmdarg.txt @@ -33,6 +33,7 @@ │ │ │ └── flags: static_literal │ │ └── operator_loc: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,11)) │ ├── flags: newline, ignore_visibility @@ -54,8 +55,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (5,0)-(5,26)) ├── flags: newline, ignore_visibility @@ -101,6 +104,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (5,16)-(5,22)) │ │ ├── flags: ∅ @@ -111,4 +115,5 @@ │ │ └── closing_loc: (5,19)-(5,22) = "end" │ └── operator_loc: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/bug_do_block_in_call_args.txt b/snapshots/whitequark/bug_do_block_in_call_args.txt index 770a175c2e..c0594ad36b 100644 --- a/snapshots/whitequark/bug_do_block_in_call_args.txt +++ b/snapshots/whitequark/bug_do_block_in_call_args.txt @@ -37,6 +37,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (1,23)-(1,29)) │ │ ├── flags: ∅ @@ -53,4 +54,5 @@ │ ├── equal_loc: ∅ │ └── end_keyword_loc: (1,30)-(1,33) = "end" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/bug_do_block_in_cmdarg.txt b/snapshots/whitequark/bug_do_block_in_cmdarg.txt index ff5af609e2..1e61315fc6 100644 --- a/snapshots/whitequark/bug_do_block_in_cmdarg.txt +++ b/snapshots/whitequark/bug_do_block_in_cmdarg.txt @@ -31,6 +31,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (1,10)-(1,16)) │ │ ├── flags: ∅ @@ -42,4 +43,5 @@ │ ├── opening_loc: (1,4)-(1,5) = "(" │ └── closing_loc: (1,16)-(1,17) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/bug_do_block_in_hash_brace.txt b/snapshots/whitequark/bug_do_block_in_hash_brace.txt index 0242d5e661..0aa4ce1f91 100644 --- a/snapshots/whitequark/bug_do_block_in_hash_brace.txt +++ b/snapshots/whitequark/bug_do_block_in_hash_brace.txt @@ -45,6 +45,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: │ │ │ │ │ @ BlockNode (location: (1,19)-(1,25)) │ │ │ │ │ ├── flags: ∅ @@ -73,6 +74,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: │ │ │ │ @ BlockNode (location: (1,35)-(1,41)) │ │ │ │ ├── flags: ∅ @@ -84,6 +86,7 @@ │ │ │ └── operator_loc: ∅ │ │ └── closing_loc: (1,41)-(1,42) = "}" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,40)) │ ├── flags: newline, ignore_visibility @@ -118,6 +121,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: │ │ │ │ │ @ BlockNode (location: (3,17)-(3,23)) │ │ │ │ │ ├── flags: ∅ @@ -146,6 +150,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: │ │ │ │ @ BlockNode (location: (3,33)-(3,39)) │ │ │ │ ├── flags: ∅ @@ -157,6 +162,7 @@ │ │ │ └── operator_loc: ∅ │ │ └── closing_loc: (3,39)-(3,40) = "}" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (5,0)-(5,43)) │ ├── flags: newline, ignore_visibility @@ -198,6 +204,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: │ │ │ │ │ @ BlockNode (location: (5,20)-(5,26)) │ │ │ │ │ ├── flags: ∅ @@ -226,6 +233,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: │ │ │ │ @ BlockNode (location: (5,36)-(5,42)) │ │ │ │ ├── flags: ∅ @@ -237,6 +245,7 @@ │ │ │ └── operator_loc: ∅ │ │ └── closing_loc: (5,42)-(5,43) = "}" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (7,0)-(7,40)) │ ├── flags: newline, ignore_visibility @@ -278,6 +287,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: │ │ │ │ │ @ BlockNode (location: (7,17)-(7,23)) │ │ │ │ │ ├── flags: ∅ @@ -306,6 +316,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: │ │ │ │ @ BlockNode (location: (7,33)-(7,39)) │ │ │ │ ├── flags: ∅ @@ -317,6 +328,7 @@ │ │ │ └── operator_loc: ∅ │ │ └── closing_loc: (7,39)-(7,40) = "}" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (9,0)-(9,52)) ├── flags: newline, ignore_visibility @@ -351,6 +363,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: │ │ │ │ @ BlockNode (location: (9,14)-(9,20)) │ │ │ │ ├── flags: ∅ @@ -369,6 +382,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: │ │ │ │ @ BlockNode (location: (9,29)-(9,35)) │ │ │ │ ├── flags: ∅ @@ -397,6 +411,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (9,45)-(9,51)) │ │ │ ├── flags: ∅ @@ -408,4 +423,5 @@ │ │ └── operator_loc: ∅ │ └── closing_loc: (9,51)-(9,52) = "}" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/bug_heredoc_do.txt b/snapshots/whitequark/bug_heredoc_do.txt index 46e721c46f..8f3c1a52a8 100644 --- a/snapshots/whitequark/bug_heredoc_do.txt +++ b/snapshots/whitequark/bug_heredoc_do.txt @@ -23,6 +23,7 @@ │ ├── closing_loc: (2,0)-(3,0) = "TABLE\n" │ └── unescaped: "" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,11)-(3,3)) ├── flags: ∅ diff --git a/snapshots/whitequark/bug_lambda_leakage.txt b/snapshots/whitequark/bug_lambda_leakage.txt index 66e3ebac76..fd0a7fd626 100644 --- a/snapshots/whitequark/bug_lambda_leakage.txt +++ b/snapshots/whitequark/bug_lambda_leakage.txt @@ -40,4 +40,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/bug_while_not_parens_do.txt b/snapshots/whitequark/bug_while_not_parens_do.txt index eadf0fe6e4..c52f62db3f 100644 --- a/snapshots/whitequark/bug_while_not_parens_do.txt +++ b/snapshots/whitequark/bug_while_not_parens_do.txt @@ -30,5 +30,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── statements: ∅ diff --git a/snapshots/whitequark/case_cond.txt b/snapshots/whitequark/case_cond.txt index 2d9572b88b..ed6f62071c 100644 --- a/snapshots/whitequark/case_cond.txt +++ b/snapshots/whitequark/case_cond.txt @@ -22,6 +22,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ └── statements: diff --git a/snapshots/whitequark/case_cond_else.txt b/snapshots/whitequark/case_cond_else.txt index c2ed1fe4b7..5826ddc83b 100644 --- a/snapshots/whitequark/case_cond_else.txt +++ b/snapshots/whitequark/case_cond_else.txt @@ -22,6 +22,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ └── statements: diff --git a/snapshots/whitequark/case_expr.txt b/snapshots/whitequark/case_expr.txt index 60ab69444f..cff0639836 100644 --- a/snapshots/whitequark/case_expr.txt +++ b/snapshots/whitequark/case_expr.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ WhenNode (location: (1,10)-(1,25)) @@ -43,6 +44,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── else_clause: ∅ ├── case_keyword_loc: (1,0)-(1,4) = "case" diff --git a/snapshots/whitequark/case_expr_else.txt b/snapshots/whitequark/case_expr_else.txt index fe687a1031..6d8c71e54c 100644 --- a/snapshots/whitequark/case_expr_else.txt +++ b/snapshots/whitequark/case_expr_else.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ WhenNode (location: (1,10)-(1,25)) @@ -43,6 +44,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── else_clause: │ @ ElseNode (location: (1,27)-(1,40)) @@ -61,6 +63,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (1,37)-(1,40) = "end" ├── case_keyword_loc: (1,0)-(1,4) = "case" diff --git a/snapshots/whitequark/class_super_label.txt b/snapshots/whitequark/class_super_label.txt index 590f971930..f851528563 100644 --- a/snapshots/whitequark/class_super_label.txt +++ b/snapshots/whitequark/class_super_label.txt @@ -33,6 +33,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "b" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── body: ∅ ├── end_keyword_loc: (1,17)-(1,20) = "end" diff --git a/snapshots/whitequark/comments_before_leading_dot__27.txt b/snapshots/whitequark/comments_before_leading_dot__27.txt index 0f3e727cb0..5fef160b43 100644 --- a/snapshots/whitequark/comments_before_leading_dot__27.txt +++ b/snapshots/whitequark/comments_before_leading_dot__27.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (3,0)-(3,2) = "&." │ ├── name: :foo @@ -24,6 +25,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (6,0)-(8,4)) │ ├── flags: newline @@ -37,6 +39,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (8,0)-(8,1) = "." │ ├── name: :foo @@ -44,6 +47,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (11,0)-(13,5)) │ ├── flags: newline, safe_navigation @@ -57,6 +61,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (13,0)-(13,2) = "&." │ ├── name: :foo @@ -64,6 +69,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (16,0)-(18,4)) ├── flags: newline @@ -77,6 +83,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (18,0)-(18,1) = "." ├── name: :foo @@ -84,4 +91,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/cond_begin.txt b/snapshots/whitequark/cond_begin.txt index a25e62a1dc..6ed2010a48 100644 --- a/snapshots/whitequark/cond_begin.txt +++ b/snapshots/whitequark/cond_begin.txt @@ -24,6 +24,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,3)-(1,4) = "(" │ └── closing_loc: (1,7)-(1,8) = ")" @@ -41,6 +42,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── subsequent: ∅ └── end_keyword_loc: (1,15)-(1,18) = "end" diff --git a/snapshots/whitequark/cond_begin_masgn.txt b/snapshots/whitequark/cond_begin_masgn.txt index 77211a717c..be8c624e70 100644 --- a/snapshots/whitequark/cond_begin_masgn.txt +++ b/snapshots/whitequark/cond_begin_masgn.txt @@ -24,6 +24,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ MultiWriteNode (location: (1,9)-(1,19)) │ │ ├── flags: newline @@ -51,6 +52,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,3)-(1,4) = "(" │ └── closing_loc: (1,19)-(1,20) = ")" diff --git a/snapshots/whitequark/cond_eflipflop.txt b/snapshots/whitequark/cond_eflipflop.txt index 7474993f0b..23205bed88 100644 --- a/snapshots/whitequark/cond_eflipflop.txt +++ b/snapshots/whitequark/cond_eflipflop.txt @@ -26,6 +26,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── right: │ │ │ │ @ CallNode (location: (1,8)-(1,11)) @@ -37,6 +38,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (1,5)-(1,8) = "..." │ │ ├── opening_loc: (1,1)-(1,2) = "(" @@ -47,6 +49,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ IfNode (location: (3,0)-(3,17)) ├── flags: newline @@ -64,6 +67,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (3,9)-(3,12)) @@ -75,6 +79,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (3,6)-(3,9) = "..." ├── then_keyword_loc: ∅ diff --git a/snapshots/whitequark/cond_eflipflop_with_beginless_range.txt b/snapshots/whitequark/cond_eflipflop_with_beginless_range.txt index f7ecd1aa6a..139407dbb9 100644 --- a/snapshots/whitequark/cond_eflipflop_with_beginless_range.txt +++ b/snapshots/whitequark/cond_eflipflop_with_beginless_range.txt @@ -22,6 +22,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (1,3)-(1,6) = "..." ├── then_keyword_loc: ∅ diff --git a/snapshots/whitequark/cond_eflipflop_with_endless_range.txt b/snapshots/whitequark/cond_eflipflop_with_endless_range.txt index f94785895e..11bae91bf0 100644 --- a/snapshots/whitequark/cond_eflipflop_with_endless_range.txt +++ b/snapshots/whitequark/cond_eflipflop_with_endless_range.txt @@ -21,6 +21,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: ∅ │ └── operator_loc: (1,6)-(1,9) = "..." diff --git a/snapshots/whitequark/cond_iflipflop.txt b/snapshots/whitequark/cond_iflipflop.txt index 7f11d52d77..a63db28534 100644 --- a/snapshots/whitequark/cond_iflipflop.txt +++ b/snapshots/whitequark/cond_iflipflop.txt @@ -26,6 +26,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── right: │ │ │ │ @ CallNode (location: (1,7)-(1,10)) @@ -37,6 +38,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: (1,5)-(1,7) = ".." │ │ ├── opening_loc: (1,1)-(1,2) = "(" @@ -47,6 +49,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ IfNode (location: (3,0)-(3,16)) ├── flags: newline @@ -64,6 +67,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (3,8)-(3,11)) @@ -75,6 +79,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (3,6)-(3,8) = ".." ├── then_keyword_loc: ∅ diff --git a/snapshots/whitequark/cond_iflipflop_with_beginless_range.txt b/snapshots/whitequark/cond_iflipflop_with_beginless_range.txt index f0c949755a..55619f83a4 100644 --- a/snapshots/whitequark/cond_iflipflop_with_beginless_range.txt +++ b/snapshots/whitequark/cond_iflipflop_with_beginless_range.txt @@ -22,6 +22,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (1,3)-(1,5) = ".." ├── then_keyword_loc: ∅ diff --git a/snapshots/whitequark/cond_iflipflop_with_endless_range.txt b/snapshots/whitequark/cond_iflipflop_with_endless_range.txt index 11b0f89083..af470eee5a 100644 --- a/snapshots/whitequark/cond_iflipflop_with_endless_range.txt +++ b/snapshots/whitequark/cond_iflipflop_with_endless_range.txt @@ -21,6 +21,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: ∅ │ └── operator_loc: (1,6)-(1,8) = ".." diff --git a/snapshots/whitequark/cond_match_current_line.txt b/snapshots/whitequark/cond_match_current_line.txt index 6694d733ce..a410794b6a 100644 --- a/snapshots/whitequark/cond_match_current_line.txt +++ b/snapshots/whitequark/cond_match_current_line.txt @@ -20,6 +20,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ IfNode (location: (3,0)-(3,13)) ├── flags: newline diff --git a/snapshots/whitequark/dedenting_heredoc.txt b/snapshots/whitequark/dedenting_heredoc.txt index 7ebfd094bc..07b97aba3a 100644 --- a/snapshots/whitequark/dedenting_heredoc.txt +++ b/snapshots/whitequark/dedenting_heredoc.txt @@ -17,7 +17,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (1,2)-(1,8)) - │ │ ├── flags: static_literal, mutable + │ │ ├── flags: ∅ │ │ ├── opening_loc: (1,2)-(1,8) = "<<~\"E\"" │ │ ├── parts: (length: 3) │ │ │ ├── @ StringNode (location: (2,0)-(3,0)) @@ -48,6 +48,7 @@ │ │ │ └── unescaped: "\n" │ │ └── closing_loc: (4,0)-(5,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (6,0)-(6,8)) │ ├── flags: newline, ignore_visibility @@ -86,6 +87,7 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ └── closing_loc: (8,7)-(8,8) = "}" │ │ │ └── @ StringNode (location: (8,8)-(9,0)) @@ -96,6 +98,7 @@ │ │ │ └── unescaped: "\n" │ │ └── closing_loc: (9,0)-(10,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (11,0)-(11,6)) │ ├── flags: newline, ignore_visibility @@ -109,7 +112,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (11,2)-(11,6)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (11,2)-(11,6) = "<<~E" │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (12,0)-(13,0)) @@ -126,6 +129,7 @@ │ │ │ └── unescaped: "y\n" │ │ └── closing_loc: (14,0)-(15,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (16,0)-(16,6)) │ ├── flags: newline, ignore_visibility @@ -139,7 +143,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (16,2)-(16,6)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (16,2)-(16,6) = "<<~E" │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (17,0)-(18,0)) @@ -156,6 +160,7 @@ │ │ │ └── unescaped: "y\n" │ │ └── closing_loc: (19,0)-(20,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (21,0)-(21,6)) │ ├── flags: newline, ignore_visibility @@ -169,7 +174,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (21,2)-(21,6)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (21,2)-(21,6) = "<<~E" │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (22,0)-(23,0)) @@ -186,6 +191,7 @@ │ │ │ └── unescaped: "y\n" │ │ └── closing_loc: (24,0)-(25,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (26,0)-(26,6)) │ ├── flags: newline, ignore_visibility @@ -199,7 +205,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (26,2)-(26,6)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (26,2)-(26,6) = "<<~E" │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (27,0)-(28,0)) @@ -216,6 +222,7 @@ │ │ │ └── unescaped: "y\n" │ │ └── closing_loc: (29,0)-(30,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (31,0)-(31,6)) │ ├── flags: newline, ignore_visibility @@ -229,7 +236,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (31,2)-(31,6)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (31,2)-(31,6) = "<<~E" │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (32,0)-(33,0)) @@ -246,6 +253,7 @@ │ │ │ └── unescaped: "\ty\n" │ │ └── closing_loc: (34,0)-(35,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (36,0)-(36,6)) │ ├── flags: newline, ignore_visibility @@ -259,7 +267,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (36,2)-(36,6)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (36,2)-(36,6) = "<<~E" │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (37,0)-(38,0)) @@ -276,6 +284,7 @@ │ │ │ └── unescaped: " y\n" │ │ └── closing_loc: (39,0)-(40,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (41,0)-(41,6)) │ ├── flags: newline, ignore_visibility @@ -295,6 +304,7 @@ │ │ ├── closing_loc: (42,0)-(43,0) = " E\n" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (44,0)-(44,6)) │ ├── flags: newline, ignore_visibility @@ -308,7 +318,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (44,2)-(44,6)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (44,2)-(44,6) = "<<~E" │ │ ├── parts: (length: 3) │ │ │ ├── @ StringNode (location: (45,0)-(46,0)) @@ -331,6 +341,7 @@ │ │ │ └── unescaped: "y\n" │ │ └── closing_loc: (48,0)-(49,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (50,0)-(50,6)) │ ├── flags: newline, ignore_visibility @@ -344,7 +355,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (50,2)-(50,6)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (50,2)-(50,6) = "<<~E" │ │ ├── parts: (length: 3) │ │ │ ├── @ StringNode (location: (51,0)-(52,0)) @@ -367,6 +378,7 @@ │ │ │ └── unescaped: "y\n" │ │ └── closing_loc: (54,0)-(55,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (56,0)-(56,6)) │ ├── flags: newline, ignore_visibility @@ -380,7 +392,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (56,2)-(56,6)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: (56,2)-(56,6) = "<<~E" │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (57,0)-(58,0)) @@ -397,6 +409,7 @@ │ │ │ └── unescaped: " y\n" │ │ └── closing_loc: (59,0)-(60,0) = "E\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (61,0)-(61,6)) │ ├── flags: newline, ignore_visibility @@ -416,6 +429,7 @@ │ │ ├── closing_loc: (63,0)-(64,0) = "E\n" │ │ └── unescaped: "x\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (65,0)-(65,6)) │ ├── flags: newline, ignore_visibility @@ -435,6 +449,7 @@ │ │ ├── closing_loc: (67,0)-(68,0) = "E\n" │ │ └── unescaped: "ð\n" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (69,0)-(69,6)) │ ├── flags: newline, ignore_visibility @@ -454,6 +469,7 @@ │ │ ├── closing_loc: (70,0)-(71,0) = "E\n" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (72,0)-(72,8)) ├── flags: newline, ignore_visibility @@ -492,6 +508,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (74,7)-(74,8) = "}" │ │ └── @ StringNode (location: (74,8)-(75,0)) @@ -502,4 +519,5 @@ │ │ └── unescaped: "\n" │ └── closing_loc: (75,0)-(76,0) = "E\n" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt b/snapshots/whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt index 6626d0a330..1847900cd7 100644 --- a/snapshots/whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt +++ b/snapshots/whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt @@ -6,7 +6,7 @@ ├── flags: ∅ └── body: (length: 1) └── @ InterpolatedStringNode (location: (1,0)-(1,8)) - ├── flags: newline, static_literal + ├── flags: newline ├── opening_loc: (1,0)-(1,8) = "<<~'FOO'" ├── parts: (length: 2) │ ├── @ StringNode (location: (2,0)-(3,0)) diff --git a/snapshots/whitequark/dedenting_non_interpolating_heredoc_line_continuation.txt b/snapshots/whitequark/dedenting_non_interpolating_heredoc_line_continuation.txt index ee985b46d6..ea395dbc4d 100644 --- a/snapshots/whitequark/dedenting_non_interpolating_heredoc_line_continuation.txt +++ b/snapshots/whitequark/dedenting_non_interpolating_heredoc_line_continuation.txt @@ -6,7 +6,7 @@ ├── flags: ∅ └── body: (length: 1) └── @ InterpolatedStringNode (location: (1,0)-(1,8)) - ├── flags: newline, static_literal + ├── flags: newline ├── opening_loc: (1,0)-(1,8) = "<<~'FOO'" ├── parts: (length: 2) │ ├── @ StringNode (location: (2,0)-(3,0)) diff --git a/snapshots/whitequark/defined.txt b/snapshots/whitequark/defined.txt index 77e102e539..ac3338b801 100644 --- a/snapshots/whitequark/defined.txt +++ b/snapshots/whitequark/defined.txt @@ -27,6 +27,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rparen_loc: ∅ │ └── keyword_loc: (3,0)-(3,8) = "defined?" @@ -43,6 +44,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rparen_loc: (5,12)-(5,13) = ")" └── keyword_loc: (5,0)-(5,8) = "defined?" diff --git a/snapshots/whitequark/defs.txt b/snapshots/whitequark/defs.txt index 92b9e38b62..43863d0d32 100644 --- a/snapshots/whitequark/defs.txt +++ b/snapshots/whitequark/defs.txt @@ -22,6 +22,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (1,4)-(1,5) = "(" │ │ └── closing_loc: (1,8)-(1,9) = ")" diff --git a/snapshots/whitequark/emit_arg_inside_procarg0_legacy.txt b/snapshots/whitequark/emit_arg_inside_procarg0_legacy.txt index aebe56988e..2215d24424 100644 --- a/snapshots/whitequark/emit_arg_inside_procarg0_legacy.txt +++ b/snapshots/whitequark/emit_arg_inside_procarg0_legacy.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,1)-(1,8)) ├── flags: ∅ diff --git a/snapshots/whitequark/endless_comparison_method.txt b/snapshots/whitequark/endless_comparison_method.txt index 81fd4a07c5..a0f5bbc7c1 100644 --- a/snapshots/whitequark/endless_comparison_method.txt +++ b/snapshots/whitequark/endless_comparison_method.txt @@ -36,6 +36,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:other] │ ├── def_keyword_loc: (1,0)-(1,3) = "def" @@ -75,6 +76,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:other] │ ├── def_keyword_loc: (3,0)-(3,3) = "def" @@ -114,6 +116,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:other] │ ├── def_keyword_loc: (5,0)-(5,3) = "def" @@ -153,6 +156,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:other] │ ├── def_keyword_loc: (7,0)-(7,3) = "def" @@ -192,6 +196,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:other] │ ├── def_keyword_loc: (9,0)-(9,3) = "def" @@ -231,6 +236,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:other] ├── def_keyword_loc: (11,0)-(11,3) = "def" diff --git a/snapshots/whitequark/endless_method.txt b/snapshots/whitequark/endless_method.txt index 3c24ab2a7d..23aa5e8db5 100644 --- a/snapshots/whitequark/endless_method.txt +++ b/snapshots/whitequark/endless_method.txt @@ -66,6 +66,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:x] │ ├── def_keyword_loc: (3,0)-(3,3) = "def" @@ -88,6 +89,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── parameters: ∅ │ ├── body: @@ -118,6 +120,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── parameters: │ @ ParametersNode (location: (7,12)-(7,13)) @@ -155,6 +158,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:x] ├── def_keyword_loc: (7,0)-(7,3) = "def" diff --git a/snapshots/whitequark/endless_method_command_syntax.txt b/snapshots/whitequark/endless_method_command_syntax.txt index db2c0cec6f..7ba7e00674 100644 --- a/snapshots/whitequark/endless_method_command_syntax.txt +++ b/snapshots/whitequark/endless_method_command_syntax.txt @@ -33,6 +33,7 @@ │ │ │ ├── closing_loc: (1,21)-(1,22) = "\"" │ │ │ └── unescaped: "Hello" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (1,0)-(1,3) = "def" @@ -69,6 +70,7 @@ │ │ │ ├── closing_loc: (3,23)-(3,24) = "\"" │ │ │ └── unescaped: "Hello" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (3,0)-(3,3) = "def" @@ -115,6 +117,7 @@ │ │ │ ├── name: :x │ │ │ └── depth: 0 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:x] │ ├── def_keyword_loc: (5,0)-(5,3) = "def" @@ -137,6 +140,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── parameters: ∅ │ ├── body: @@ -161,6 +165,7 @@ │ │ │ ├── closing_loc: (7,25)-(7,26) = "\"" │ │ │ └── unescaped: "Hello" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (7,0)-(7,3) = "def" @@ -183,6 +188,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── parameters: ∅ │ ├── body: @@ -207,6 +213,7 @@ │ │ │ ├── closing_loc: (9,27)-(9,28) = "\"" │ │ │ └── unescaped: "Hello" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (9,0)-(9,3) = "def" @@ -229,6 +236,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── parameters: │ │ @ ParametersNode (location: (11,12)-(11,13)) @@ -263,6 +271,7 @@ │ │ │ ├── name: :x │ │ │ └── depth: 0 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:x] │ ├── def_keyword_loc: (11,0)-(11,3) = "def" @@ -314,6 +323,7 @@ │ │ │ │ ├── closing_loc: (13,36)-(13,37) = "\"" │ │ │ │ └── unescaped: "to be caught" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (13,38)-(13,44) = "rescue" │ │ └── rescue_expression: @@ -392,6 +402,7 @@ │ │ │ ├── closing_loc: (15,41)-(15,42) = "\"" │ │ │ └── unescaped: "to be caught" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (15,43)-(15,49) = "rescue" │ └── rescue_expression: diff --git a/snapshots/whitequark/endless_method_forwarded_args_legacy.txt b/snapshots/whitequark/endless_method_forwarded_args_legacy.txt index eaa1061007..345bcafa39 100644 --- a/snapshots/whitequark/endless_method_forwarded_args_legacy.txt +++ b/snapshots/whitequark/endless_method_forwarded_args_legacy.txt @@ -40,6 +40,7 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,19)-(1,22)) │ │ └── flags: ∅ │ ├── closing_loc: (1,22)-(1,23) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/whitequark/ensure.txt b/snapshots/whitequark/ensure.txt index 63d4a3b05d..30791fb254 100644 --- a/snapshots/whitequark/ensure.txt +++ b/snapshots/whitequark/ensure.txt @@ -21,6 +21,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: ∅ ├── else_clause: ∅ @@ -41,6 +42,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (1,26)-(1,29) = "end" └── end_keyword_loc: (1,26)-(1,29) = "end" diff --git a/snapshots/whitequark/find_pattern.txt b/snapshots/whitequark/find_pattern.txt index 8a58386c4e..2c4d67507c 100644 --- a/snapshots/whitequark/find_pattern.txt +++ b/snapshots/whitequark/find_pattern.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (1,10)-(1,31)) @@ -64,6 +65,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (3,10)-(3,37)) @@ -114,6 +116,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (5,10)-(5,38)) @@ -164,6 +167,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (7,10)-(7,39)) diff --git a/snapshots/whitequark/for.txt b/snapshots/whitequark/for.txt index 8dca927c90..0d3ecffda1 100644 --- a/snapshots/whitequark/for.txt +++ b/snapshots/whitequark/for.txt @@ -22,6 +22,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── statements: │ │ @ StatementsNode (location: (1,16)-(1,19)) @@ -43,6 +44,7 @@ │ │ │ ├── name: :a │ │ │ └── depth: 0 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── for_keyword_loc: (1,0)-(1,3) = "for" │ ├── in_keyword_loc: (1,6)-(1,8) = "in" @@ -65,6 +67,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── statements: │ @ StatementsNode (location: (3,14)-(3,17)) @@ -86,6 +89,7 @@ │ │ ├── name: :a │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── for_keyword_loc: (3,0)-(3,3) = "for" ├── in_keyword_loc: (3,6)-(3,8) = "in" diff --git a/snapshots/whitequark/for_mlhs.txt b/snapshots/whitequark/for_mlhs.txt index 0f70dd8a7d..02f3d0fd12 100644 --- a/snapshots/whitequark/for_mlhs.txt +++ b/snapshots/whitequark/for_mlhs.txt @@ -33,6 +33,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── statements: │ @ StatementsNode (location: (1,17)-(1,23)) @@ -58,6 +59,7 @@ │ │ ├── name: :b │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── for_keyword_loc: (1,0)-(1,3) = "for" ├── in_keyword_loc: (1,9)-(1,11) = "in" diff --git a/snapshots/whitequark/forward_arg.txt b/snapshots/whitequark/forward_arg.txt index 3879314fa8..e24ae1f3a8 100644 --- a/snapshots/whitequark/forward_arg.txt +++ b/snapshots/whitequark/forward_arg.txt @@ -40,6 +40,7 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,18)-(1,21)) │ │ └── flags: ∅ │ ├── closing_loc: (1,21)-(1,22) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/whitequark/forward_arg_with_open_args.txt b/snapshots/whitequark/forward_arg_with_open_args.txt index ea36abae7e..78a359adf8 100644 --- a/snapshots/whitequark/forward_arg_with_open_args.txt +++ b/snapshots/whitequark/forward_arg_with_open_args.txt @@ -46,6 +46,7 @@ │ │ │ │ └── @ ForwardingArgumentsNode (location: (2,6)-(2,9)) │ │ │ │ └── flags: ∅ │ │ │ ├── closing_loc: (2,9)-(2,10) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── locals: [] │ │ ├── def_keyword_loc: (1,1)-(1,4) = "def" @@ -97,6 +98,7 @@ │ │ │ │ └── @ ForwardingArgumentsNode (location: (5,18)-(5,21)) │ │ │ │ └── flags: ∅ │ │ │ ├── closing_loc: (5,21)-(5,22) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── locals: [] │ │ ├── def_keyword_loc: (5,1)-(5,4) = "def" @@ -167,6 +169,7 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (10,17)-(10,20)) │ │ │ └── flags: ∅ │ │ ├── closing_loc: (10,20)-(10,21) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (10,0)-(10,3) = "def" @@ -213,6 +216,7 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (13,6)-(13,9)) │ │ │ └── flags: ∅ │ │ ├── closing_loc: (13,9)-(13,10) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:a] │ ├── def_keyword_loc: (12,0)-(12,3) = "def" @@ -259,6 +263,7 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (16,20)-(16,23)) │ │ │ └── flags: ∅ │ │ ├── closing_loc: (16,23)-(16,24) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:a] │ ├── def_keyword_loc: (16,0)-(16,3) = "def" @@ -348,6 +353,7 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (22,6)-(22,9)) │ │ │ └── flags: ∅ │ │ ├── closing_loc: (22,9)-(22,10) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:b] │ ├── def_keyword_loc: (21,0)-(21,3) = "def" @@ -400,6 +406,7 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (25,24)-(25,27)) │ │ │ └── flags: ∅ │ │ ├── closing_loc: (25,27)-(25,28) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [:b] │ ├── def_keyword_loc: (25,0)-(25,3) = "def" @@ -446,6 +453,7 @@ │ │ └── @ ForwardingArgumentsNode (location: (27,20)-(27,23)) │ │ └── flags: ∅ │ ├── closing_loc: (27,23)-(27,24) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:a] ├── def_keyword_loc: (27,0)-(27,3) = "def" diff --git a/snapshots/whitequark/forward_args_legacy.txt b/snapshots/whitequark/forward_args_legacy.txt index 2fda9338f3..a719c84924 100644 --- a/snapshots/whitequark/forward_args_legacy.txt +++ b/snapshots/whitequark/forward_args_legacy.txt @@ -40,6 +40,7 @@ │ │ │ └── @ ForwardingArgumentsNode (location: (1,18)-(1,21)) │ │ │ └── flags: ∅ │ │ ├── closing_loc: (1,21)-(1,22) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt b/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt index d80ace6fba..329920e876 100644 --- a/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt +++ b/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt @@ -55,6 +55,7 @@ │ │ ├── value: ∅ │ │ └── operator_loc: (1,37)-(1,39) = "**" │ ├── closing_loc: (1,39)-(1,40) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:argument] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/whitequark/forwarded_argument_with_restarg.txt b/snapshots/whitequark/forwarded_argument_with_restarg.txt index 2dd95c6cae..f71e0dcc59 100644 --- a/snapshots/whitequark/forwarded_argument_with_restarg.txt +++ b/snapshots/whitequark/forwarded_argument_with_restarg.txt @@ -52,6 +52,7 @@ │ │ ├── operator_loc: (1,36)-(1,37) = "*" │ │ └── expression: ∅ │ ├── closing_loc: (1,37)-(1,38) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:argument] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/whitequark/forwarded_kwrestarg.txt b/snapshots/whitequark/forwarded_kwrestarg.txt index 50cc9ca38b..2ad0bf5c34 100644 --- a/snapshots/whitequark/forwarded_kwrestarg.txt +++ b/snapshots/whitequark/forwarded_kwrestarg.txt @@ -48,6 +48,7 @@ │ │ ├── value: ∅ │ │ └── operator_loc: (1,17)-(1,19) = "**" │ ├── closing_loc: (1,19)-(1,20) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt b/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt index 32ace5cb3d..60716b1c7e 100644 --- a/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt +++ b/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt @@ -61,6 +61,7 @@ │ │ │ └── flags: static_literal │ │ └── operator_loc: ∅ │ ├── closing_loc: (1,35)-(1,36) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/whitequark/forwarded_restarg.txt b/snapshots/whitequark/forwarded_restarg.txt index 3e26b2b60e..86db7c5cf1 100644 --- a/snapshots/whitequark/forwarded_restarg.txt +++ b/snapshots/whitequark/forwarded_restarg.txt @@ -45,6 +45,7 @@ │ │ ├── operator_loc: (1,16)-(1,17) = "*" │ │ └── expression: ∅ │ ├── closing_loc: (1,17)-(1,18) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/whitequark/hash_kwsplat.txt b/snapshots/whitequark/hash_kwsplat.txt index acccc48b3d..6a08a94635 100644 --- a/snapshots/whitequark/hash_kwsplat.txt +++ b/snapshots/whitequark/hash_kwsplat.txt @@ -35,6 +35,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (1,10)-(1,12) = "**" └── closing_loc: (1,16)-(1,17) = "}" diff --git a/snapshots/whitequark/hash_label_end.txt b/snapshots/whitequark/hash_label_end.txt index 9e4accee00..bff14365e0 100644 --- a/snapshots/whitequark/hash_label_end.txt +++ b/snapshots/whitequark/hash_label_end.txt @@ -29,6 +29,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: (1,4)-(1,5) = "?" │ │ ├── statements: @@ -55,6 +56,7 @@ │ │ │ └── end_keyword_loc: ∅ │ │ └── end_keyword_loc: ∅ │ ├── closing_loc: (1,11)-(1,12) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ HashNode (location: (3,0)-(3,12)) │ ├── flags: newline, static_literal diff --git a/snapshots/whitequark/hash_pair_value_omission.txt b/snapshots/whitequark/hash_pair_value_omission.txt index d87b1ef0f9..7dd9b5a370 100644 --- a/snapshots/whitequark/hash_pair_value_omission.txt +++ b/snapshots/whitequark/hash_pair_value_omission.txt @@ -53,6 +53,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── operator_loc: ∅ │ │ └── @ AssocNode (location: (3,5)-(3,7)) @@ -77,6 +78,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: ∅ │ └── closing_loc: (3,7)-(3,8) = "}" @@ -106,6 +108,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: ∅ └── closing_loc: (5,6)-(5,7) = "}" diff --git a/snapshots/whitequark/if.txt b/snapshots/whitequark/if.txt index e381b29fb4..e5572e7bcf 100644 --- a/snapshots/whitequark/if.txt +++ b/snapshots/whitequark/if.txt @@ -18,6 +18,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (1,7)-(1,11) = "then" │ ├── statements: @@ -33,6 +34,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: ∅ │ └── end_keyword_loc: (1,17)-(1,20) = "end" @@ -49,6 +51,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: ∅ ├── statements: @@ -64,6 +67,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── subsequent: ∅ └── end_keyword_loc: (3,13)-(3,16) = "end" diff --git a/snapshots/whitequark/if_else.txt b/snapshots/whitequark/if_else.txt index efabd768ae..74b9943ecb 100644 --- a/snapshots/whitequark/if_else.txt +++ b/snapshots/whitequark/if_else.txt @@ -18,6 +18,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (1,7)-(1,11) = "then" │ ├── statements: @@ -33,6 +34,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── subsequent: │ │ @ ElseNode (location: (1,17)-(1,30)) @@ -51,6 +53,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (1,27)-(1,30) = "end" │ └── end_keyword_loc: (1,27)-(1,30) = "end" @@ -67,6 +70,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: ∅ ├── statements: @@ -82,6 +86,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── subsequent: │ @ ElseNode (location: (3,13)-(3,26)) @@ -100,6 +105,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (3,23)-(3,26) = "end" └── end_keyword_loc: (3,23)-(3,26) = "end" diff --git a/snapshots/whitequark/if_elsif.txt b/snapshots/whitequark/if_elsif.txt index 6edd4e920f..8c5c28e0d5 100644 --- a/snapshots/whitequark/if_elsif.txt +++ b/snapshots/whitequark/if_elsif.txt @@ -18,6 +18,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: ∅ ├── statements: @@ -33,6 +34,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── subsequent: │ @ IfNode (location: (1,13)-(1,38)) @@ -48,6 +50,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ ├── statements: diff --git a/snapshots/whitequark/if_masgn__24.txt b/snapshots/whitequark/if_masgn__24.txt index 5d8ed5808d..71f68de58e 100644 --- a/snapshots/whitequark/if_masgn__24.txt +++ b/snapshots/whitequark/if_masgn__24.txt @@ -41,6 +41,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,3)-(1,4) = "(" │ └── closing_loc: (1,14)-(1,15) = ")" diff --git a/snapshots/whitequark/if_mod.txt b/snapshots/whitequark/if_mod.txt index d2597fec66..6dc03f830e 100644 --- a/snapshots/whitequark/if_mod.txt +++ b/snapshots/whitequark/if_mod.txt @@ -18,6 +18,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: ∅ ├── statements: @@ -33,6 +34,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── subsequent: ∅ └── end_keyword_loc: ∅ diff --git a/snapshots/whitequark/if_nl_then.txt b/snapshots/whitequark/if_nl_then.txt index c6a424bbd9..8df4a45ecb 100644 --- a/snapshots/whitequark/if_nl_then.txt +++ b/snapshots/whitequark/if_nl_then.txt @@ -18,6 +18,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: (2,0)-(2,4) = "then" ├── statements: @@ -33,6 +34,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── subsequent: ∅ └── end_keyword_loc: (2,9)-(2,12) = "end" diff --git a/snapshots/whitequark/keyword_argument_omission.txt b/snapshots/whitequark/keyword_argument_omission.txt index ac32216061..0e6954b6f4 100644 --- a/snapshots/whitequark/keyword_argument_omission.txt +++ b/snapshots/whitequark/keyword_argument_omission.txt @@ -41,6 +41,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: ∅ │ └── @ AssocNode (location: (1,8)-(1,10)) @@ -65,7 +66,9 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: ∅ ├── closing_loc: (1,10)-(1,11) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/kwbegin_compstmt.txt b/snapshots/whitequark/kwbegin_compstmt.txt index 690c790966..ab9b5c09ba 100644 --- a/snapshots/whitequark/kwbegin_compstmt.txt +++ b/snapshots/whitequark/kwbegin_compstmt.txt @@ -21,6 +21,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ CallNode (location: (1,12)-(1,16)) │ ├── flags: newline, ignore_visibility @@ -31,6 +32,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: ∅ ├── else_clause: ∅ diff --git a/snapshots/whitequark/kwnilarg.txt b/snapshots/whitequark/kwnilarg.txt index 028fe07e74..a73b008308 100644 --- a/snapshots/whitequark/kwnilarg.txt +++ b/snapshots/whitequark/kwnilarg.txt @@ -68,6 +68,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (5,2)-(5,13)) ├── flags: ∅ diff --git a/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt b/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt index b233427556..8f8e1a0c8b 100644 --- a/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt +++ b/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt @@ -55,6 +55,7 @@ │ │ ├── value: ∅ │ │ └── operator_loc: (1,21)-(1,23) = "**" │ ├── closing_loc: (1,23)-(1,24) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:a] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/whitequark/lbrace_arg_after_command_args.txt b/snapshots/whitequark/lbrace_arg_after_command_args.txt index 9132ab64ab..9d22574fe2 100644 --- a/snapshots/whitequark/lbrace_arg_after_command_args.txt +++ b/snapshots/whitequark/lbrace_arg_after_command_args.txt @@ -31,6 +31,7 @@ │ ├── opening_loc: (1,4)-(1,5) = "(" │ └── closing_loc: (1,7)-(1,8) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,9)-(1,22)) ├── flags: ∅ @@ -49,6 +50,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,13)-(1,20)) │ ├── flags: ∅ diff --git a/snapshots/whitequark/lparenarg_after_lvar__since_25.txt b/snapshots/whitequark/lparenarg_after_lvar__since_25.txt index 4c11a17f86..7f491e80d3 100644 --- a/snapshots/whitequark/lparenarg_after_lvar__since_25.txt +++ b/snapshots/whitequark/lparenarg_after_lvar__since_25.txt @@ -36,8 +36,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (3,0)-(3,15)) ├── flags: newline, ignore_visibility @@ -70,6 +72,8 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/lvar.txt b/snapshots/whitequark/lvar.txt index 3de3483075..786532cacb 100644 --- a/snapshots/whitequark/lvar.txt +++ b/snapshots/whitequark/lvar.txt @@ -14,4 +14,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/lvar_injecting_match.txt b/snapshots/whitequark/lvar_injecting_match.txt index 644f14c01a..0b9806de05 100644 --- a/snapshots/whitequark/lvar_injecting_match.txt +++ b/snapshots/whitequark/lvar_injecting_match.txt @@ -32,6 +32,7 @@ │ │ │ ├── closing_loc: (1,15)-(1,16) = "'" │ │ │ └── unescaped: "a" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── targets: (length: 1) │ └── @ LocalVariableTargetNode (location: (1,4)-(1,5)) @@ -72,6 +73,7 @@ │ │ ├── closing_loc: (1,36)-(1,37) = "'" │ │ └── unescaped: "b" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ LocalVariableReadNode (location: (1,39)-(1,40)) │ ├── flags: newline @@ -86,6 +88,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ MatchWriteNode (location: (3,0)-(3,24)) │ ├── flags: newline @@ -114,6 +117,7 @@ │ │ │ ├── closing_loc: (3,23)-(3,24) = "'" │ │ │ └── unescaped: "bar" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── targets: (length: 1) │ └── @ LocalVariableTargetNode (location: (3,4)-(3,9)) diff --git a/snapshots/whitequark/masgn_cmd.txt b/snapshots/whitequark/masgn_cmd.txt index 8ca2afbba0..c52c95abec 100644 --- a/snapshots/whitequark/masgn_cmd.txt +++ b/snapshots/whitequark/masgn_cmd.txt @@ -38,4 +38,5 @@ │ ├── name: :foo │ └── depth: 0 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/masgn_nested.txt b/snapshots/whitequark/masgn_nested.txt index db92f24ab5..4177546912 100644 --- a/snapshots/whitequark/masgn_nested.txt +++ b/snapshots/whitequark/masgn_nested.txt @@ -36,6 +36,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ MultiWriteNode (location: (3,0)-(3,15)) ├── flags: newline @@ -74,4 +75,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/masgn_splat.txt b/snapshots/whitequark/masgn_splat.txt index e50174d9de..06ba67bd96 100644 --- a/snapshots/whitequark/masgn_splat.txt +++ b/snapshots/whitequark/masgn_splat.txt @@ -27,6 +27,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ MultiWriteNode (location: (3,0)-(3,13)) │ ├── flags: newline @@ -58,6 +59,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ MultiWriteNode (location: (5,0)-(5,8)) │ ├── flags: newline @@ -85,6 +87,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ MultiWriteNode (location: (7,0)-(7,11)) │ ├── flags: newline @@ -116,6 +119,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ MultiWriteNode (location: (9,0)-(9,18)) │ ├── flags: newline @@ -148,6 +152,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: ∅ │ └── closing_loc: ∅ @@ -177,6 +182,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ MultiWriteNode (location: (13,0)-(13,13)) │ ├── flags: newline @@ -208,6 +214,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ MultiWriteNode (location: (15,0)-(15,11)) │ ├── flags: newline @@ -239,6 +246,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ MultiWriteNode (location: (17,0)-(17,14)) │ ├── flags: newline @@ -274,6 +282,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ MultiWriteNode (location: (19,0)-(19,16)) ├── flags: newline @@ -308,6 +317,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ CallNode (location: (19,13)-(19,16)) │ ├── flags: variable_call, ignore_visibility @@ -318,6 +328,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: ∅ └── closing_loc: ∅ diff --git a/snapshots/whitequark/method_definition_in_while_cond.txt b/snapshots/whitequark/method_definition_in_while_cond.txt index 62cd4b7470..e1ef297eed 100644 --- a/snapshots/whitequark/method_definition_in_while_cond.txt +++ b/snapshots/whitequark/method_definition_in_while_cond.txt @@ -36,6 +36,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: │ │ │ │ @ BlockNode (location: (1,22)-(1,28)) │ │ │ │ ├── flags: ∅ @@ -90,6 +91,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (3,19)-(3,25)) │ │ │ ├── flags: ∅ @@ -146,6 +148,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: │ │ │ │ @ BlockNode (location: (5,27)-(5,33)) │ │ │ │ ├── flags: ∅ @@ -202,6 +205,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (7,24)-(7,30)) │ │ ├── flags: ∅ diff --git a/snapshots/whitequark/multiple_args_with_trailing_comma.txt b/snapshots/whitequark/multiple_args_with_trailing_comma.txt index 9fd60b2a3c..eda675709d 100644 --- a/snapshots/whitequark/multiple_args_with_trailing_comma.txt +++ b/snapshots/whitequark/multiple_args_with_trailing_comma.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,1)-(1,12)) ├── flags: ∅ diff --git a/snapshots/whitequark/newline_in_hash_argument.txt b/snapshots/whitequark/newline_in_hash_argument.txt index 2a7d06102d..6aa9a7415d 100644 --- a/snapshots/whitequark/newline_in_hash_argument.txt +++ b/snapshots/whitequark/newline_in_hash_argument.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 2) │ │ ├── @ InNode (location: (2,0)-(4,4)) @@ -112,6 +113,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (10,3)-(10,4) = "." │ ├── name: :set @@ -139,6 +141,7 @@ │ │ │ └── value: 1 │ │ └── operator_loc: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (13,0)-(14,1)) ├── flags: newline @@ -152,6 +155,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (13,3)-(13,4) = "." ├── name: :set @@ -179,4 +183,5 @@ │ │ └── value: 1 │ └── operator_loc: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/non_lvar_injecting_match.txt b/snapshots/whitequark/non_lvar_injecting_match.txt index 0322423e63..0f94c9a99f 100644 --- a/snapshots/whitequark/non_lvar_injecting_match.txt +++ b/snapshots/whitequark/non_lvar_injecting_match.txt @@ -45,4 +45,5 @@ │ ├── closing_loc: (1,27)-(1,28) = "'" │ └── unescaped: "bar" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/not.txt b/snapshots/whitequark/not.txt index 08037eae9a..7643b7da31 100644 --- a/snapshots/whitequark/not.txt +++ b/snapshots/whitequark/not.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :! @@ -24,6 +25,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,5)) │ ├── flags: newline @@ -39,6 +41,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (5,0)-(5,8)) ├── flags: newline @@ -52,6 +55,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :! @@ -59,4 +63,5 @@ ├── opening_loc: (5,3)-(5,4) = "(" ├── arguments: ∅ ├── closing_loc: (5,7)-(5,8) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/not_cmd.txt b/snapshots/whitequark/not_cmd.txt index 0ecd1cc67e..f2bafa1c6b 100644 --- a/snapshots/whitequark/not_cmd.txt +++ b/snapshots/whitequark/not_cmd.txt @@ -28,8 +28,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :! @@ -37,4 +39,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/not_masgn__24.txt b/snapshots/whitequark/not_masgn__24.txt index d84faadc50..9cecbe1a92 100644 --- a/snapshots/whitequark/not_masgn__24.txt +++ b/snapshots/whitequark/not_masgn__24.txt @@ -40,6 +40,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,1)-(1,2) = "(" │ └── closing_loc: (1,12)-(1,13) = ")" @@ -49,4 +50,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/numbered_args_after_27.txt b/snapshots/whitequark/numbered_args_after_27.txt index 7bf09f7904..a76ec96d42 100644 --- a/snapshots/whitequark/numbered_args_after_27.txt +++ b/snapshots/whitequark/numbered_args_after_27.txt @@ -39,6 +39,7 @@ │ │ ├── name: :_9 │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ LambdaNode (location: (3,0)-(3,13)) │ ├── flags: newline @@ -74,6 +75,7 @@ │ │ ├── name: :_9 │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (5,0)-(5,16)) │ ├── flags: newline, ignore_visibility @@ -84,6 +86,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,2)-(5,16)) │ ├── flags: ∅ @@ -116,6 +119,7 @@ │ │ │ ├── name: :_9 │ │ │ └── depth: 0 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (5,2)-(5,4) = "do" │ └── closing_loc: (5,13)-(5,16) = "end" @@ -128,6 +132,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (7,2)-(7,13)) ├── flags: ∅ @@ -160,6 +165,7 @@ │ │ ├── name: :_9 │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (7,2)-(7,3) = "{" └── closing_loc: (7,12)-(7,13) = "}" diff --git a/snapshots/whitequark/numparam_outside_block.txt b/snapshots/whitequark/numparam_outside_block.txt index beef05a392..7fd3bf6805 100644 --- a/snapshots/whitequark/numparam_outside_block.txt +++ b/snapshots/whitequark/numparam_outside_block.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ SingletonClassNode (location: (3,0)-(3,21)) │ ├── flags: newline @@ -30,6 +31,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── body: │ │ @ StatementsNode (location: (3,14)-(3,16)) @@ -44,6 +46,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (3,18)-(3,21) = "end" ├── @ ClassNode (location: (5,0)-(5,16)) @@ -69,6 +72,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── end_keyword_loc: (5,13)-(5,16) = "end" │ └── name: :A @@ -93,6 +97,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── locals: [] │ ├── def_keyword_loc: (7,0)-(7,3) = "def" @@ -122,6 +127,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── end_keyword_loc: (9,14)-(9,17) = "end" └── name: :A diff --git a/snapshots/whitequark/numparam_ruby_bug_19025.txt b/snapshots/whitequark/numparam_ruby_bug_19025.txt index 5043c9be48..4729523512 100644 --- a/snapshots/whitequark/numparam_ruby_bug_19025.txt +++ b/snapshots/whitequark/numparam_ruby_bug_19025.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,2)-(1,14)) ├── flags: ∅ @@ -48,6 +49,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 2 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,4)-(1,5) = "[" │ └── closing_loc: (1,11)-(1,12) = "]" diff --git a/snapshots/whitequark/op_asgn.txt b/snapshots/whitequark/op_asgn.txt index cac3e0e7b1..45d190dbd1 100644 --- a/snapshots/whitequark/op_asgn.txt +++ b/snapshots/whitequark/op_asgn.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,3)-(1,4) = "." │ ├── message_loc: (1,4)-(1,5) = "A" @@ -40,6 +41,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (3,3)-(3,4) = "." │ ├── message_loc: (3,4)-(3,5) = "a" @@ -63,6 +65,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (5,3)-(5,5) = "::" ├── message_loc: (5,5)-(5,6) = "a" diff --git a/snapshots/whitequark/op_asgn_cmd.txt b/snapshots/whitequark/op_asgn_cmd.txt index 6ee1650274..3329a06177 100644 --- a/snapshots/whitequark/op_asgn_cmd.txt +++ b/snapshots/whitequark/op_asgn_cmd.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,3)-(1,4) = "." │ ├── message_loc: (1,4)-(1,5) = "A" @@ -45,8 +46,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallOperatorWriteNode (location: (3,0)-(3,14)) │ ├── flags: newline @@ -60,6 +63,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (3,3)-(3,4) = "." │ ├── message_loc: (3,4)-(3,5) = "a" @@ -88,8 +92,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ ConstantPathOperatorWriteNode (location: (5,0)-(5,15)) │ ├── flags: newline @@ -106,6 +112,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── name: :A │ │ ├── delimiter_loc: (5,3)-(5,5) = "::" @@ -132,8 +139,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── binary_operator: :+ └── @ CallOperatorWriteNode (location: (7,0)-(7,15)) @@ -148,6 +157,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (7,3)-(7,5) = "::" ├── message_loc: (7,5)-(7,6) = "a" @@ -176,6 +186,8 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/op_asgn_index.txt b/snapshots/whitequark/op_asgn_index.txt index 0e2927f0fb..0186eb6d91 100644 --- a/snapshots/whitequark/op_asgn_index.txt +++ b/snapshots/whitequark/op_asgn_index.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── opening_loc: (1,3)-(1,4) = "[" diff --git a/snapshots/whitequark/op_asgn_index_cmd.txt b/snapshots/whitequark/op_asgn_index_cmd.txt index 84cef7867d..076cfd406b 100644 --- a/snapshots/whitequark/op_asgn_index_cmd.txt +++ b/snapshots/whitequark/op_asgn_index_cmd.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── opening_loc: (1,3)-(1,4) = "[" @@ -55,6 +56,8 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/or.txt b/snapshots/whitequark/or.txt index 7a23781399..9ac1920a05 100644 --- a/snapshots/whitequark/or.txt +++ b/snapshots/whitequark/or.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── right: │ │ @ CallNode (location: (1,7)-(1,10)) @@ -28,6 +29,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (1,4)-(1,6) = "or" └── @ OrNode (location: (3,0)-(3,10)) @@ -42,6 +44,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── right: │ @ CallNode (location: (3,7)-(3,10)) @@ -53,5 +56,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (3,4)-(3,6) = "||" diff --git a/snapshots/whitequark/or_asgn.txt b/snapshots/whitequark/or_asgn.txt index 7234587b45..b04ed44e06 100644 --- a/snapshots/whitequark/or_asgn.txt +++ b/snapshots/whitequark/or_asgn.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,3)-(1,4) = "." │ ├── message_loc: (1,4)-(1,5) = "a" @@ -39,6 +40,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── opening_loc: (3,3)-(3,4) = "[" diff --git a/snapshots/whitequark/parser_bug_272.txt b/snapshots/whitequark/parser_bug_272.txt index 64df1cf46d..a8e0d333b9 100644 --- a/snapshots/whitequark/parser_bug_272.txt +++ b/snapshots/whitequark/parser_bug_272.txt @@ -20,6 +20,7 @@ │ ├── flags: ∅ │ └── name: :@b ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,5)-(1,15)) ├── flags: ∅ diff --git a/snapshots/whitequark/parser_bug_525.txt b/snapshots/whitequark/parser_bug_525.txt index 46dca6f97d..7612a8fb7d 100644 --- a/snapshots/whitequark/parser_bug_525.txt +++ b/snapshots/whitequark/parser_bug_525.txt @@ -38,9 +38,11 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (1,6)-(1,8) = "=>" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,12)-(1,32)) ├── flags: ∅ @@ -59,6 +61,7 @@ │ ├── opening_loc: (1,18)-(1,19) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (1,19)-(1,20) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,21)-(1,27)) │ ├── flags: ∅ diff --git a/snapshots/whitequark/parser_bug_604.txt b/snapshots/whitequark/parser_bug_604.txt index aa58b2304f..2c1e8986fd 100644 --- a/snapshots/whitequark/parser_bug_604.txt +++ b/snapshots/whitequark/parser_bug_604.txt @@ -28,6 +28,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :+ @@ -46,10 +47,13 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,8)-(1,14)) ├── flags: ∅ diff --git a/snapshots/whitequark/parser_bug_640.txt b/snapshots/whitequark/parser_bug_640.txt index 1e535e769b..937e0613a5 100644 --- a/snapshots/whitequark/parser_bug_640.txt +++ b/snapshots/whitequark/parser_bug_640.txt @@ -6,7 +6,7 @@ ├── flags: ∅ └── body: (length: 1) └── @ InterpolatedStringNode (location: (1,0)-(1,6)) - ├── flags: newline, static_literal + ├── flags: newline ├── opening_loc: (1,0)-(1,6) = "<<~FOO" ├── parts: (length: 2) │ ├── @ StringNode (location: (2,0)-(3,0)) diff --git a/snapshots/whitequark/pattern_matching__FILE__LINE_literals.txt b/snapshots/whitequark/pattern_matching__FILE__LINE_literals.txt index 77b6f0b1ea..a4879bfa51 100644 --- a/snapshots/whitequark/pattern_matching__FILE__LINE_literals.txt +++ b/snapshots/whitequark/pattern_matching__FILE__LINE_literals.txt @@ -31,6 +31,7 @@ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ └── value: 1 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ SourceEncodingNode (location: (1,38)-(1,50)) │ │ └── flags: static_literal diff --git a/snapshots/whitequark/pattern_matching_const_pattern.txt b/snapshots/whitequark/pattern_matching_const_pattern.txt index 55a851073f..065eefa681 100644 --- a/snapshots/whitequark/pattern_matching_const_pattern.txt +++ b/snapshots/whitequark/pattern_matching_const_pattern.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (1,10)-(1,26)) @@ -56,6 +57,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (3,10)-(3,30)) @@ -101,6 +103,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (5,10)-(5,28)) @@ -157,6 +160,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (7,10)-(7,30)) @@ -202,6 +206,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (9,10)-(9,26)) @@ -241,6 +246,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (11,10)-(11,28)) diff --git a/snapshots/whitequark/pattern_matching_constants.txt b/snapshots/whitequark/pattern_matching_constants.txt index 8a05a70f80..78d86f86fa 100644 --- a/snapshots/whitequark/pattern_matching_constants.txt +++ b/snapshots/whitequark/pattern_matching_constants.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (1,10)-(1,26)) @@ -51,6 +52,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (3,10)-(3,24)) @@ -82,6 +84,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (5,10)-(5,27)) diff --git a/snapshots/whitequark/pattern_matching_explicit_array_match.txt b/snapshots/whitequark/pattern_matching_explicit_array_match.txt index 3a1eac348a..17aeed9bb3 100644 --- a/snapshots/whitequark/pattern_matching_explicit_array_match.txt +++ b/snapshots/whitequark/pattern_matching_explicit_array_match.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (1,10)-(1,29)) @@ -61,6 +62,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (3,10)-(3,30)) @@ -109,6 +111,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (5,10)-(5,32)) @@ -157,6 +160,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (7,10)-(7,33)) @@ -209,6 +213,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (9,10)-(9,32)) @@ -257,6 +262,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (11,10)-(11,33)) @@ -309,6 +315,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (13,10)-(13,30)) @@ -355,6 +362,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (15,10)-(15,29)) @@ -399,6 +407,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (17,10)-(17,26)) @@ -441,6 +450,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (19,10)-(19,25)) diff --git a/snapshots/whitequark/pattern_matching_expr_in_paren.txt b/snapshots/whitequark/pattern_matching_expr_in_paren.txt index 5be3526649..397bac22c0 100644 --- a/snapshots/whitequark/pattern_matching_expr_in_paren.txt +++ b/snapshots/whitequark/pattern_matching_expr_in_paren.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (1,10)-(1,26)) diff --git a/snapshots/whitequark/pattern_matching_hash.txt b/snapshots/whitequark/pattern_matching_hash.txt index c433b66a7b..ecedb02f0e 100644 --- a/snapshots/whitequark/pattern_matching_hash.txt +++ b/snapshots/whitequark/pattern_matching_hash.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (2,8)-(3,13)) @@ -103,6 +104,7 @@ │ │ │ │ ├── name: :c │ │ │ │ └── depth: 0 │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── in_loc: (2,8)-(2,10) = "in" │ │ └── then_loc: ∅ @@ -121,6 +123,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (7,8)-(9,15)) @@ -170,6 +173,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (13,8)-(15,15)) @@ -219,6 +223,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (19,8)-(21,14)) @@ -272,6 +277,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (25,8)-(27,15)) @@ -321,6 +327,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (30,10)-(30,25)) @@ -360,6 +367,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (32,10)-(32,26)) @@ -403,6 +411,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (34,10)-(34,27)) @@ -452,6 +461,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (36,10)-(36,36)) @@ -523,6 +533,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (38,10)-(38,33)) @@ -586,6 +597,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (40,10)-(40,25)) @@ -639,6 +651,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (42,10)-(42,29)) @@ -710,6 +723,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (44,10)-(44,31)) @@ -759,6 +773,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (46,10)-(46,32)) @@ -808,6 +823,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (48,10)-(48,25)) diff --git a/snapshots/whitequark/pattern_matching_if_unless_modifiers.txt b/snapshots/whitequark/pattern_matching_if_unless_modifiers.txt index 690bd54437..90761ce455 100644 --- a/snapshots/whitequark/pattern_matching_if_unless_modifiers.txt +++ b/snapshots/whitequark/pattern_matching_if_unless_modifiers.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (1,10)-(1,27)) @@ -62,6 +63,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (3,10)-(3,31)) diff --git a/snapshots/whitequark/pattern_matching_implicit_array_match.txt b/snapshots/whitequark/pattern_matching_implicit_array_match.txt index 021ede47ab..cd67a840a0 100644 --- a/snapshots/whitequark/pattern_matching_implicit_array_match.txt +++ b/snapshots/whitequark/pattern_matching_implicit_array_match.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (1,10)-(1,23)) @@ -57,6 +58,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (3,10)-(3,24)) @@ -101,6 +103,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (5,10)-(5,30)) @@ -153,6 +156,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (7,10)-(7,36)) @@ -213,6 +217,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (9,10)-(9,30)) @@ -265,6 +270,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (11,10)-(11,24)) @@ -307,6 +313,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (13,10)-(13,26)) @@ -351,6 +358,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (15,10)-(15,27)) diff --git a/snapshots/whitequark/pattern_matching_keyword_variable.txt b/snapshots/whitequark/pattern_matching_keyword_variable.txt index 282fd796fd..804f474f9c 100644 --- a/snapshots/whitequark/pattern_matching_keyword_variable.txt +++ b/snapshots/whitequark/pattern_matching_keyword_variable.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (1,10)-(1,27)) diff --git a/snapshots/whitequark/pattern_matching_lambda.txt b/snapshots/whitequark/pattern_matching_lambda.txt index 2b3db96815..4d9951c036 100644 --- a/snapshots/whitequark/pattern_matching_lambda.txt +++ b/snapshots/whitequark/pattern_matching_lambda.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (1,10)-(1,31)) diff --git a/snapshots/whitequark/pattern_matching_match_alt.txt b/snapshots/whitequark/pattern_matching_match_alt.txt index 37c52fcef6..f8e8f0d9c6 100644 --- a/snapshots/whitequark/pattern_matching_match_alt.txt +++ b/snapshots/whitequark/pattern_matching_match_alt.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (1,10)-(1,28)) diff --git a/snapshots/whitequark/pattern_matching_match_as.txt b/snapshots/whitequark/pattern_matching_match_as.txt index 81beffe0ec..5494319007 100644 --- a/snapshots/whitequark/pattern_matching_match_as.txt +++ b/snapshots/whitequark/pattern_matching_match_as.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (1,10)-(1,29)) diff --git a/snapshots/whitequark/pattern_matching_nil_pattern.txt b/snapshots/whitequark/pattern_matching_nil_pattern.txt index 8eed090e49..79a1b16334 100644 --- a/snapshots/whitequark/pattern_matching_nil_pattern.txt +++ b/snapshots/whitequark/pattern_matching_nil_pattern.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (1,10)-(1,28)) diff --git a/snapshots/whitequark/pattern_matching_no_body.txt b/snapshots/whitequark/pattern_matching_no_body.txt index 9b83bd6447..3a656ba5af 100644 --- a/snapshots/whitequark/pattern_matching_no_body.txt +++ b/snapshots/whitequark/pattern_matching_no_body.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (1,10)-(1,14)) diff --git a/snapshots/whitequark/pattern_matching_ranges.txt b/snapshots/whitequark/pattern_matching_ranges.txt index e8cd3afcaa..bd92db0e12 100644 --- a/snapshots/whitequark/pattern_matching_ranges.txt +++ b/snapshots/whitequark/pattern_matching_ranges.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (1,10)-(1,27)) @@ -53,6 +54,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (3,10)-(3,26)) @@ -89,6 +91,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (5,10)-(5,26)) @@ -125,6 +128,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (7,10)-(7,27)) @@ -161,6 +165,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (9,10)-(9,28)) @@ -200,6 +205,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (11,10)-(11,27)) diff --git a/snapshots/whitequark/pattern_matching_single_match.txt b/snapshots/whitequark/pattern_matching_single_match.txt index 117730bdb2..bc0bc99575 100644 --- a/snapshots/whitequark/pattern_matching_single_match.txt +++ b/snapshots/whitequark/pattern_matching_single_match.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (1,10)-(1,21)) diff --git a/snapshots/whitequark/pin_expr.txt b/snapshots/whitequark/pin_expr.txt index c9a36e112f..4eb7d44699 100644 --- a/snapshots/whitequark/pin_expr.txt +++ b/snapshots/whitequark/pin_expr.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (1,10)-(1,34)) @@ -47,6 +48,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (3,10)-(3,28)) @@ -73,6 +75,7 @@ │ │ │ │ │ ├── flags: static_literal, decimal │ │ │ │ │ └── value: 0 │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── operator_loc: (3,13)-(3,14) = "^" │ │ │ ├── lparen_loc: (3,14)-(3,15) = "(" @@ -100,6 +103,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (5,10)-(6,1)) @@ -132,6 +136,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (8,10)-(8,27)) @@ -169,6 +174,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (10,10)-(10,35)) @@ -199,6 +205,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── conditions: (length: 1) │ │ └── @ InNode (location: (12,10)-(12,16)) @@ -229,6 +236,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ InNode (location: (14,10)-(14,36)) diff --git a/snapshots/whitequark/procarg0.txt b/snapshots/whitequark/procarg0.txt index 90e03ce940..fbf8caed46 100644 --- a/snapshots/whitequark/procarg0.txt +++ b/snapshots/whitequark/procarg0.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,2)-(1,18)) │ ├── flags: ∅ @@ -59,6 +60,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (3,2)-(3,11)) ├── flags: ∅ diff --git a/snapshots/whitequark/procarg0_legacy.txt b/snapshots/whitequark/procarg0_legacy.txt index aebe56988e..2215d24424 100644 --- a/snapshots/whitequark/procarg0_legacy.txt +++ b/snapshots/whitequark/procarg0_legacy.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,1)-(1,8)) ├── flags: ∅ diff --git a/snapshots/whitequark/regex_interp.txt b/snapshots/whitequark/regex_interp.txt index e440274cc2..ae81b20463 100644 --- a/snapshots/whitequark/regex_interp.txt +++ b/snapshots/whitequark/regex_interp.txt @@ -31,6 +31,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,9)-(1,10) = "}" │ └── @ StringNode (location: (1,10)-(1,13)) diff --git a/snapshots/whitequark/resbody_list.txt b/snapshots/whitequark/resbody_list.txt index 6d74070a6a..70a488d9ae 100644 --- a/snapshots/whitequark/resbody_list.txt +++ b/snapshots/whitequark/resbody_list.txt @@ -21,6 +21,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: │ @ RescueNode (location: (1,13)-(1,34)) @@ -46,6 +47,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: ∅ ├── else_clause: ∅ diff --git a/snapshots/whitequark/resbody_list_mrhs.txt b/snapshots/whitequark/resbody_list_mrhs.txt index f9e5e8c108..cf0736fb20 100644 --- a/snapshots/whitequark/resbody_list_mrhs.txt +++ b/snapshots/whitequark/resbody_list_mrhs.txt @@ -21,6 +21,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: │ @ RescueNode (location: (1,13)-(1,39)) @@ -39,6 +40,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── operator_loc: ∅ │ ├── reference: ∅ @@ -56,6 +58,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: ∅ ├── else_clause: ∅ diff --git a/snapshots/whitequark/resbody_list_var.txt b/snapshots/whitequark/resbody_list_var.txt index ba7b58ac36..95f81a8d49 100644 --- a/snapshots/whitequark/resbody_list_var.txt +++ b/snapshots/whitequark/resbody_list_var.txt @@ -21,6 +21,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: │ @ RescueNode (location: (1,13)-(1,34)) @@ -36,6 +37,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── operator_loc: (1,24)-(1,26) = "=>" │ ├── reference: @@ -57,6 +59,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: ∅ ├── else_clause: ∅ diff --git a/snapshots/whitequark/resbody_var.txt b/snapshots/whitequark/resbody_var.txt index 0f686acd4a..f5f0bb0931 100644 --- a/snapshots/whitequark/resbody_var.txt +++ b/snapshots/whitequark/resbody_var.txt @@ -21,6 +21,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (1,13)-(1,31)) @@ -46,6 +47,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ @@ -67,6 +69,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: │ @ RescueNode (location: (3,13)-(3,30)) @@ -93,6 +96,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: ∅ ├── else_clause: ∅ diff --git a/snapshots/whitequark/rescue.txt b/snapshots/whitequark/rescue.txt index f495323544..e16a2d4415 100644 --- a/snapshots/whitequark/rescue.txt +++ b/snapshots/whitequark/rescue.txt @@ -21,6 +21,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: │ @ RescueNode (location: (1,13)-(1,24)) @@ -43,6 +44,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: ∅ ├── else_clause: ∅ diff --git a/snapshots/whitequark/rescue_else.txt b/snapshots/whitequark/rescue_else.txt index be0a9787eb..00fdfee598 100644 --- a/snapshots/whitequark/rescue_else.txt +++ b/snapshots/whitequark/rescue_else.txt @@ -21,6 +21,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: │ @ RescueNode (location: (1,13)-(1,24)) @@ -43,6 +44,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: ∅ ├── else_clause: @@ -62,6 +64,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (1,37)-(1,40) = "end" ├── ensure_clause: ∅ diff --git a/snapshots/whitequark/rescue_else_ensure.txt b/snapshots/whitequark/rescue_else_ensure.txt index c967ef912e..813e881dc5 100644 --- a/snapshots/whitequark/rescue_else_ensure.txt +++ b/snapshots/whitequark/rescue_else_ensure.txt @@ -21,6 +21,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: │ @ RescueNode (location: (1,13)-(1,24)) @@ -43,6 +44,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: ∅ ├── else_clause: @@ -62,6 +64,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (1,36)-(1,42) = "ensure" ├── ensure_clause: @@ -81,6 +84,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (1,48)-(1,51) = "end" └── end_keyword_loc: (1,48)-(1,51) = "end" diff --git a/snapshots/whitequark/rescue_ensure.txt b/snapshots/whitequark/rescue_ensure.txt index 22835ec30d..c519b956ea 100644 --- a/snapshots/whitequark/rescue_ensure.txt +++ b/snapshots/whitequark/rescue_ensure.txt @@ -21,6 +21,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: │ @ RescueNode (location: (1,13)-(1,24)) @@ -43,6 +44,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── subsequent: ∅ ├── else_clause: ∅ @@ -63,6 +65,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (1,39)-(1,42) = "end" └── end_keyword_loc: (1,39)-(1,42) = "end" diff --git a/snapshots/whitequark/rescue_mod.txt b/snapshots/whitequark/rescue_mod.txt index abed85c1b9..28651cce09 100644 --- a/snapshots/whitequark/rescue_mod.txt +++ b/snapshots/whitequark/rescue_mod.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── keyword_loc: (1,5)-(1,11) = "rescue" └── rescue_expression: @@ -29,4 +30,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/rescue_mod_asgn.txt b/snapshots/whitequark/rescue_mod_asgn.txt index a2fa161e4e..20a10aa9c6 100644 --- a/snapshots/whitequark/rescue_mod_asgn.txt +++ b/snapshots/whitequark/rescue_mod_asgn.txt @@ -23,6 +23,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (1,11)-(1,17) = "rescue" │ └── rescue_expression: @@ -35,5 +36,6 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── operator_loc: (1,4)-(1,5) = "=" diff --git a/snapshots/whitequark/rescue_mod_masgn.txt b/snapshots/whitequark/rescue_mod_masgn.txt index b5ca37b129..4fa3247bae 100644 --- a/snapshots/whitequark/rescue_mod_masgn.txt +++ b/snapshots/whitequark/rescue_mod_masgn.txt @@ -34,6 +34,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── keyword_loc: (1,16)-(1,22) = "rescue" └── rescue_expression: diff --git a/snapshots/whitequark/rescue_mod_op_assign.txt b/snapshots/whitequark/rescue_mod_op_assign.txt index 22101d7c98..710d134dae 100644 --- a/snapshots/whitequark/rescue_mod_op_assign.txt +++ b/snapshots/whitequark/rescue_mod_op_assign.txt @@ -22,6 +22,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (1,12)-(1,18) = "rescue" │ └── rescue_expression: @@ -34,6 +35,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── name: :foo ├── binary_operator: :+ diff --git a/snapshots/whitequark/rescue_without_begin_end.txt b/snapshots/whitequark/rescue_without_begin_end.txt index bf4fc14446..773cc64bc9 100644 --- a/snapshots/whitequark/rescue_without_begin_end.txt +++ b/snapshots/whitequark/rescue_without_begin_end.txt @@ -14,6 +14,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,5)-(1,30)) ├── flags: ∅ @@ -36,6 +37,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rescue_clause: │ │ @ RescueNode (location: (1,14)-(1,25)) @@ -58,6 +60,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── subsequent: ∅ │ ├── else_clause: ∅ diff --git a/snapshots/whitequark/return.txt b/snapshots/whitequark/return.txt index 1e059ba63c..8098bbd562 100644 --- a/snapshots/whitequark/return.txt +++ b/snapshots/whitequark/return.txt @@ -25,6 +25,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ ReturnNode (location: (5,0)-(5,8)) │ ├── flags: newline @@ -60,6 +61,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── opening_loc: (7,6)-(7,7) = "(" └── closing_loc: (7,10)-(7,11) = ")" diff --git a/snapshots/whitequark/return_block.txt b/snapshots/whitequark/return_block.txt index 90161b6750..478b875769 100644 --- a/snapshots/whitequark/return_block.txt +++ b/snapshots/whitequark/return_block.txt @@ -32,8 +32,10 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,15)-(1,21)) ├── flags: ∅ diff --git a/snapshots/whitequark/ruby_bug_10653.txt b/snapshots/whitequark/ruby_bug_10653.txt index 3a562d8b1f..d75ba77ee3 100644 --- a/snapshots/whitequark/ruby_bug_10653.txt +++ b/snapshots/whitequark/ruby_bug_10653.txt @@ -25,6 +25,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (1,14)-(1,20)) │ │ ├── flags: ∅ @@ -50,6 +51,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (1,27)-(1,33)) │ │ │ ├── flags: ∅ @@ -80,6 +82,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (3,14)-(3,16)) │ │ ├── flags: ∅ @@ -105,6 +108,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (3,23)-(3,25)) │ │ │ ├── flags: ∅ @@ -138,6 +142,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,13)-(5,27)) │ ├── flags: ∅ @@ -181,6 +186,7 @@ │ │ │ ├── name: :n │ │ │ └── depth: 0 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (5,13)-(5,15) = "do" │ └── closing_loc: (5,24)-(5,27) = "end" diff --git a/snapshots/whitequark/ruby_bug_11107.txt b/snapshots/whitequark/ruby_bug_11107.txt index 4ed332f903..2097cdb63e 100644 --- a/snapshots/whitequark/ruby_bug_11107.txt +++ b/snapshots/whitequark/ruby_bug_11107.txt @@ -42,6 +42,7 @@ │ ├── opening_loc: (1,11)-(1,12) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (1,12)-(1,13) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,14)-(1,20)) │ ├── flags: ∅ @@ -51,4 +52,5 @@ │ ├── opening_loc: (1,14)-(1,16) = "do" │ └── closing_loc: (1,17)-(1,20) = "end" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/ruby_bug_11380.txt b/snapshots/whitequark/ruby_bug_11380.txt index 5893034b65..6eb9d7b1e1 100644 --- a/snapshots/whitequark/ruby_bug_11380.txt +++ b/snapshots/whitequark/ruby_bug_11380.txt @@ -51,6 +51,7 @@ │ │ └── value: 1 │ └── operator_loc: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,22)-(1,28)) ├── flags: ∅ diff --git a/snapshots/whitequark/ruby_bug_11873.txt b/snapshots/whitequark/ruby_bug_11873.txt index a92b217482..411f2a2350 100644 --- a/snapshots/whitequark/ruby_bug_11873.txt +++ b/snapshots/whitequark/ruby_bug_11873.txt @@ -47,10 +47,13 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (1,7)-(1,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ StringNode (location: (1,10)-(1,13)) │ │ ├── flags: ∅ @@ -59,6 +62,7 @@ │ │ ├── closing_loc: (1,12)-(1,13) = "\"" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,14)-(1,20)) │ ├── flags: ∅ @@ -109,10 +113,13 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (3,7)-(3,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ RegularExpressionNode (location: (3,10)-(3,13)) │ │ ├── flags: static_literal, forced_us_ascii_encoding @@ -121,6 +128,7 @@ │ │ ├── closing_loc: (3,12)-(3,13) = "/" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,14)-(3,20)) │ ├── flags: ∅ @@ -171,10 +179,13 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (5,7)-(5,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ RegularExpressionNode (location: (5,10)-(5,14)) │ │ ├── flags: static_literal, multi_line, forced_us_ascii_encoding @@ -183,6 +194,7 @@ │ │ ├── closing_loc: (5,12)-(5,14) = "/m" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,15)-(5,21)) │ ├── flags: ∅ @@ -233,10 +245,13 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (7,7)-(7,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (7,8)-(7,9) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ StringNode (location: (7,11)-(7,14)) │ │ ├── flags: ∅ @@ -245,6 +260,7 @@ │ │ ├── closing_loc: (7,13)-(7,14) = "\"" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,15)-(7,21)) │ ├── flags: ∅ @@ -295,10 +311,13 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (9,7)-(9,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (9,8)-(9,9) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ RegularExpressionNode (location: (9,11)-(9,14)) │ │ ├── flags: static_literal, forced_us_ascii_encoding @@ -307,6 +326,7 @@ │ │ ├── closing_loc: (9,13)-(9,14) = "/" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (9,15)-(9,21)) │ ├── flags: ∅ @@ -357,10 +377,13 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (11,7)-(11,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (11,8)-(11,9) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ RegularExpressionNode (location: (11,11)-(11,15)) │ │ ├── flags: static_literal, multi_line, forced_us_ascii_encoding @@ -369,6 +392,7 @@ │ │ ├── closing_loc: (11,13)-(11,15) = "/m" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (11,16)-(11,22)) │ ├── flags: ∅ @@ -397,6 +421,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (13,3)-(13,8)) │ │ │ ├── flags: ∅ @@ -426,8 +451,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (13,3)-(13,4) = "{" │ │ │ └── closing_loc: (13,7)-(13,8) = "}" @@ -438,6 +465,7 @@ │ │ ├── closing_loc: (13,12)-(13,13) = "\"" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (13,14)-(13,20)) │ ├── flags: ∅ @@ -466,6 +494,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (15,3)-(15,8)) │ │ │ ├── flags: ∅ @@ -495,8 +524,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (15,3)-(15,4) = "{" │ │ │ └── closing_loc: (15,7)-(15,8) = "}" @@ -507,6 +538,7 @@ │ │ ├── closing_loc: (15,12)-(15,13) = "/" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (15,14)-(15,20)) │ ├── flags: ∅ @@ -535,6 +567,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (17,3)-(17,8)) │ │ │ ├── flags: ∅ @@ -564,8 +597,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (17,3)-(17,4) = "{" │ │ │ └── closing_loc: (17,7)-(17,8) = "}" @@ -576,6 +611,7 @@ │ │ ├── closing_loc: (17,12)-(17,14) = "/m" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (17,15)-(17,21)) │ ├── flags: ∅ @@ -604,6 +640,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (19,3)-(19,9)) │ │ │ ├── flags: ∅ @@ -633,8 +670,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (19,7)-(19,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (19,3)-(19,4) = "{" │ │ │ └── closing_loc: (19,8)-(19,9) = "}" @@ -645,6 +684,7 @@ │ │ ├── closing_loc: (19,13)-(19,14) = "\"" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (19,15)-(19,21)) │ ├── flags: ∅ @@ -673,6 +713,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (21,3)-(21,9)) │ │ │ ├── flags: ∅ @@ -702,8 +743,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (21,7)-(21,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (21,3)-(21,4) = "{" │ │ │ └── closing_loc: (21,8)-(21,9) = "}" @@ -714,6 +757,7 @@ │ │ ├── closing_loc: (21,13)-(21,14) = "/" │ │ └── unescaped: "x" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (21,15)-(21,21)) │ ├── flags: ∅ @@ -742,6 +786,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (23,3)-(23,9)) │ │ ├── flags: ∅ @@ -771,8 +816,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (23,7)-(23,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (23,3)-(23,4) = "{" │ │ └── closing_loc: (23,8)-(23,9) = "}" @@ -783,6 +830,7 @@ │ ├── closing_loc: (23,13)-(23,15) = "/m" │ └── unescaped: "x" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (23,16)-(23,22)) ├── flags: ∅ diff --git a/snapshots/whitequark/ruby_bug_11873_a.txt b/snapshots/whitequark/ruby_bug_11873_a.txt index 6897357de8..e9ff71af83 100644 --- a/snapshots/whitequark/ruby_bug_11873_a.txt +++ b/snapshots/whitequark/ruby_bug_11873_a.txt @@ -47,15 +47,19 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (1,7)-(1,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ IntegerNode (location: (1,10)-(1,11)) │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,12)-(1,18)) │ ├── flags: ∅ @@ -106,15 +110,19 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (3,7)-(3,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ FloatNode (location: (3,10)-(3,13)) │ │ ├── flags: static_literal │ │ └── value: 1.0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,14)-(3,20)) │ ├── flags: ∅ @@ -165,10 +173,13 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (5,7)-(5,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ ImaginaryNode (location: (5,10)-(5,14)) │ │ ├── flags: static_literal @@ -177,6 +188,7 @@ │ │ ├── flags: static_literal │ │ └── value: 1.0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,15)-(5,21)) │ ├── flags: ∅ @@ -227,16 +239,20 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (7,7)-(7,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ RationalNode (location: (7,10)-(7,14)) │ │ ├── flags: static_literal, decimal │ │ ├── numerator: 1 │ │ └── denominator: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (7,15)-(7,21)) │ ├── flags: ∅ @@ -287,10 +303,13 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (9,7)-(9,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ SymbolNode (location: (9,10)-(9,12)) │ │ ├── flags: static_literal, forced_us_ascii_encoding @@ -299,6 +318,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "e" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (9,13)-(9,19)) │ ├── flags: ∅ @@ -349,15 +369,19 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (11,7)-(11,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (11,8)-(11,9) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ IntegerNode (location: (11,11)-(11,12)) │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (11,13)-(11,19)) │ ├── flags: ∅ @@ -408,15 +432,19 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (13,7)-(13,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (13,8)-(13,9) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ FloatNode (location: (13,11)-(13,14)) │ │ ├── flags: static_literal │ │ └── value: 1.0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (13,15)-(13,21)) │ ├── flags: ∅ @@ -467,10 +495,13 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (15,7)-(15,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (15,8)-(15,9) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ ImaginaryNode (location: (15,11)-(15,15)) │ │ ├── flags: static_literal @@ -479,6 +510,7 @@ │ │ ├── flags: static_literal │ │ └── value: 1.0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (15,16)-(15,22)) │ ├── flags: ∅ @@ -529,16 +561,20 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (17,7)-(17,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (17,8)-(17,9) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ RationalNode (location: (17,11)-(17,15)) │ │ ├── flags: static_literal, decimal │ │ ├── numerator: 1 │ │ └── denominator: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (17,16)-(17,22)) │ ├── flags: ∅ @@ -589,10 +625,13 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (19,7)-(19,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (19,8)-(19,9) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── @ SymbolNode (location: (19,11)-(19,13)) │ │ ├── flags: static_literal, forced_us_ascii_encoding @@ -601,6 +640,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "e" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (19,14)-(19,20)) │ ├── flags: ∅ @@ -629,6 +669,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (21,3)-(21,8)) │ │ │ ├── flags: ∅ @@ -658,8 +699,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (21,3)-(21,4) = "{" │ │ │ └── closing_loc: (21,7)-(21,8) = "}" @@ -667,6 +710,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (21,12)-(21,18)) │ ├── flags: ∅ @@ -695,6 +739,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (23,3)-(23,8)) │ │ │ ├── flags: ∅ @@ -724,8 +769,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (23,3)-(23,4) = "{" │ │ │ └── closing_loc: (23,7)-(23,8) = "}" @@ -733,6 +780,7 @@ │ │ ├── flags: static_literal │ │ └── value: 1.0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (23,14)-(23,20)) │ ├── flags: ∅ @@ -761,6 +809,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (25,3)-(25,8)) │ │ │ ├── flags: ∅ @@ -790,8 +839,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (25,3)-(25,4) = "{" │ │ │ └── closing_loc: (25,7)-(25,8) = "}" @@ -802,6 +853,7 @@ │ │ ├── flags: static_literal │ │ └── value: 1.0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (25,15)-(25,21)) │ ├── flags: ∅ @@ -830,6 +882,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (27,3)-(27,8)) │ │ │ ├── flags: ∅ @@ -859,8 +912,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (27,3)-(27,4) = "{" │ │ │ └── closing_loc: (27,7)-(27,8) = "}" @@ -869,6 +924,7 @@ │ │ ├── numerator: 1 │ │ └── denominator: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (27,15)-(27,21)) │ ├── flags: ∅ @@ -897,6 +953,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (29,3)-(29,8)) │ │ │ ├── flags: ∅ @@ -926,8 +983,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (29,3)-(29,4) = "{" │ │ │ └── closing_loc: (29,7)-(29,8) = "}" @@ -938,6 +997,7 @@ │ │ ├── closing_loc: ∅ │ │ └── unescaped: "e" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (29,13)-(29,19)) │ ├── flags: ∅ @@ -966,6 +1026,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (31,3)-(31,9)) │ │ │ ├── flags: ∅ @@ -995,8 +1056,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (31,7)-(31,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (31,3)-(31,4) = "{" │ │ │ └── closing_loc: (31,8)-(31,9) = "}" @@ -1004,6 +1067,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (31,13)-(31,19)) │ ├── flags: ∅ @@ -1032,6 +1096,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (33,3)-(33,9)) │ │ │ ├── flags: ∅ @@ -1061,8 +1126,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (33,7)-(33,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (33,3)-(33,4) = "{" │ │ │ └── closing_loc: (33,8)-(33,9) = "}" @@ -1070,6 +1137,7 @@ │ │ ├── flags: static_literal │ │ └── value: 1.0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (33,15)-(33,21)) │ ├── flags: ∅ @@ -1098,6 +1166,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (35,3)-(35,9)) │ │ │ ├── flags: ∅ @@ -1127,8 +1196,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (35,7)-(35,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (35,3)-(35,4) = "{" │ │ │ └── closing_loc: (35,8)-(35,9) = "}" @@ -1139,6 +1210,7 @@ │ │ ├── flags: static_literal │ │ └── value: 1.0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (35,16)-(35,22)) │ ├── flags: ∅ @@ -1167,6 +1239,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: │ │ │ @ BlockNode (location: (37,3)-(37,9)) │ │ │ ├── flags: ∅ @@ -1196,8 +1269,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (37,7)-(37,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── opening_loc: (37,3)-(37,4) = "{" │ │ │ └── closing_loc: (37,8)-(37,9) = "}" @@ -1206,6 +1281,7 @@ │ │ ├── numerator: 1 │ │ └── denominator: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (37,16)-(37,22)) │ ├── flags: ∅ @@ -1234,6 +1310,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (39,3)-(39,9)) │ │ ├── flags: ∅ @@ -1263,8 +1340,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (39,7)-(39,8) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (39,3)-(39,4) = "{" │ │ └── closing_loc: (39,8)-(39,9) = "}" @@ -1275,6 +1354,7 @@ │ ├── closing_loc: ∅ │ └── unescaped: "e" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (39,14)-(39,20)) ├── flags: ∅ diff --git a/snapshots/whitequark/ruby_bug_11873_b.txt b/snapshots/whitequark/ruby_bug_11873_b.txt index 263f4f8dd3..6b0d983076 100644 --- a/snapshots/whitequark/ruby_bug_11873_b.txt +++ b/snapshots/whitequark/ruby_bug_11873_b.txt @@ -25,6 +25,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (1,3)-(1,13)) │ │ ├── flags: ∅ @@ -54,8 +55,10 @@ │ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ │ ├── arguments: ∅ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ ├── equal_loc: ∅ │ │ │ │ │ └── block: ∅ │ │ │ │ ├── closing_loc: (1,7)-(1,8) = ")" + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── @ CallNode (location: (1,9)-(1,12)) │ │ │ ├── flags: newline, ignore_visibility @@ -77,8 +80,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── opening_loc: (1,3)-(1,4) = "{" │ │ └── closing_loc: (1,12)-(1,13) = "}" @@ -91,8 +96,10 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,19)-(1,25)) ├── flags: ∅ diff --git a/snapshots/whitequark/ruby_bug_11989.txt b/snapshots/whitequark/ruby_bug_11989.txt index 96bafab7e9..6c0be687fc 100644 --- a/snapshots/whitequark/ruby_bug_11989.txt +++ b/snapshots/whitequark/ruby_bug_11989.txt @@ -23,4 +23,5 @@ │ ├── closing_loc: (3,0)-(4,0) = "E\n" │ └── unescaped: "x\n y\n" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/ruby_bug_11990.txt b/snapshots/whitequark/ruby_bug_11990.txt index 095381d130..e95f4b498f 100644 --- a/snapshots/whitequark/ruby_bug_11990.txt +++ b/snapshots/whitequark/ruby_bug_11990.txt @@ -17,7 +17,7 @@ │ ├── flags: ∅ │ └── arguments: (length: 1) │ └── @ InterpolatedStringNode (location: (1,2)-(1,12)) - │ ├── flags: static_literal + │ ├── flags: ∅ │ ├── opening_loc: ∅ │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (1,2)-(1,6)) @@ -34,4 +34,5 @@ │ │ └── unescaped: " y" │ └── closing_loc: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/ruby_bug_12073.txt b/snapshots/whitequark/ruby_bug_12073.txt index 0b20229de9..13a48456b8 100644 --- a/snapshots/whitequark/ruby_bug_12073.txt +++ b/snapshots/whitequark/ruby_bug_12073.txt @@ -44,6 +44,7 @@ │ │ │ └── value: 1 │ │ └── operator_loc: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ DefNode (location: (3,0)-(3,34)) ├── flags: newline @@ -94,6 +95,7 @@ │ │ ├── closing_loc: (3,28)-(3,29) = "'" │ │ └── unescaped: "" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:raise] ├── def_keyword_loc: (3,0)-(3,3) = "def" diff --git a/snapshots/whitequark/ruby_bug_12402.txt b/snapshots/whitequark/ruby_bug_12402.txt index 6f915342c0..6c2155ab14 100644 --- a/snapshots/whitequark/ruby_bug_12402.txt +++ b/snapshots/whitequark/ruby_bug_12402.txt @@ -33,8 +33,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (1,17)-(1,23) = "rescue" │ │ └── rescue_expression: @@ -71,8 +73,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (3,16)-(3,17) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (3,18)-(3,24) = "rescue" │ │ └── rescue_expression: @@ -110,8 +114,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (5,16)-(5,22) = "rescue" │ │ └── rescue_expression: @@ -147,8 +153,10 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ ├── closing_loc: (7,15)-(7,16) = ")" + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (7,17)-(7,23) = "rescue" │ │ └── rescue_expression: @@ -192,8 +200,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (9,19)-(9,25) = "rescue" │ └── rescue_expression: @@ -236,8 +246,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: (11,18)-(11,19) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (11,20)-(11,26) = "rescue" │ └── rescue_expression: @@ -280,8 +292,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (13,19)-(13,25) = "rescue" │ └── rescue_expression: @@ -324,8 +338,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: (15,18)-(15,19) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (15,20)-(15,26) = "rescue" │ └── rescue_expression: @@ -369,8 +385,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (17,21)-(17,27) = "rescue" │ └── rescue_expression: @@ -414,8 +432,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: (19,20)-(19,21) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (19,22)-(19,28) = "rescue" │ └── rescue_expression: @@ -458,8 +478,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (21,20)-(21,26) = "rescue" │ └── rescue_expression: @@ -502,8 +524,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: (23,19)-(23,20) = ")" + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (23,21)-(23,27) = "rescue" │ └── rescue_expression: @@ -553,8 +577,10 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── keyword_loc: (25,20)-(25,26) = "rescue" │ └── rescue_expression: @@ -604,8 +630,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (27,19)-(27,20) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── keyword_loc: (27,21)-(27,27) = "rescue" └── rescue_expression: diff --git a/snapshots/whitequark/ruby_bug_12669.txt b/snapshots/whitequark/ruby_bug_12669.txt index 9d1a924b79..2024462f81 100644 --- a/snapshots/whitequark/ruby_bug_12669.txt +++ b/snapshots/whitequark/ruby_bug_12669.txt @@ -33,6 +33,7 @@ │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "x" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── name: :b │ │ ├── binary_operator: :+ @@ -69,6 +70,7 @@ │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "x" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── operator_loc: (3,7)-(3,8) = "=" │ ├── name: :a @@ -103,6 +105,7 @@ │ │ │ │ ├── closing_loc: ∅ │ │ │ │ └── unescaped: "x" │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── name: :b │ │ ├── binary_operator: :+ @@ -138,6 +141,7 @@ │ │ │ ├── closing_loc: ∅ │ │ │ └── unescaped: "x" │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── operator_loc: (7,6)-(7,7) = "=" └── operator_loc: (7,2)-(7,3) = "=" diff --git a/snapshots/whitequark/ruby_bug_12686.txt b/snapshots/whitequark/ruby_bug_12686.txt index 515ee75674..f2a9d6c924 100644 --- a/snapshots/whitequark/ruby_bug_12686.txt +++ b/snapshots/whitequark/ruby_bug_12686.txt @@ -34,6 +34,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── keyword_loc: (1,5)-(1,11) = "rescue" │ │ └── rescue_expression: @@ -42,4 +43,5 @@ │ ├── opening_loc: (1,2)-(1,3) = "(" │ └── closing_loc: (1,15)-(1,16) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/ruby_bug_13547.txt b/snapshots/whitequark/ruby_bug_13547.txt index d0ac79d7ff..9cf44215b3 100644 --- a/snapshots/whitequark/ruby_bug_13547.txt +++ b/snapshots/whitequark/ruby_bug_13547.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[] @@ -24,6 +25,7 @@ ├── opening_loc: (1,4)-(1,5) = "[" ├── arguments: ∅ ├── closing_loc: (1,5)-(1,6) = "]" + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,7)-(1,9)) ├── flags: ∅ diff --git a/snapshots/whitequark/ruby_bug_14690.txt b/snapshots/whitequark/ruby_bug_14690.txt index 377c0e0a0e..0b6c9adccb 100644 --- a/snapshots/whitequark/ruby_bug_14690.txt +++ b/snapshots/whitequark/ruby_bug_14690.txt @@ -22,6 +22,7 @@ │ ├── opening_loc: (1,4)-(1,5) = "(" │ └── closing_loc: (1,5)-(1,6) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,7)-(1,23)) ├── flags: ∅ @@ -51,8 +52,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (1,12)-(1,13) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,14)-(1,21)) │ ├── flags: ∅ diff --git a/snapshots/whitequark/ruby_bug_15789.txt b/snapshots/whitequark/ruby_bug_15789.txt index c6ac7447a8..53392fde70 100644 --- a/snapshots/whitequark/ruby_bug_15789.txt +++ b/snapshots/whitequark/ruby_bug_15789.txt @@ -71,6 +71,7 @@ │ │ ├── name: :a │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (3,0)-(3,19)) ├── flags: newline, ignore_visibility @@ -137,4 +138,5 @@ │ ├── name: :a │ └── depth: 0 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/ruby_bug_18878.txt b/snapshots/whitequark/ruby_bug_18878.txt index feff9defb3..52aa416339 100644 --- a/snapshots/whitequark/ruby_bug_18878.txt +++ b/snapshots/whitequark/ruby_bug_18878.txt @@ -17,6 +17,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,9)-(1,19)) ├── flags: ∅ diff --git a/snapshots/whitequark/ruby_bug_19281.txt b/snapshots/whitequark/ruby_bug_19281.txt index 1af146e214..f024ab19e9 100644 --- a/snapshots/whitequark/ruby_bug_19281.txt +++ b/snapshots/whitequark/ruby_bug_19281.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,1)-(1,2) = "." │ ├── name: :b @@ -63,6 +64,7 @@ │ │ ├── opening_loc: (1,14)-(1,15) = "(" │ │ └── closing_loc: (1,16)-(1,17) = ")" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,13)) │ ├── flags: newline @@ -76,6 +78,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (3,1)-(3,2) = "." │ ├── name: :b @@ -101,6 +104,7 @@ │ │ ├── opening_loc: (3,11)-(3,12) = "(" │ │ └── closing_loc: (3,12)-(3,13) = ")" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (5,0)-(5,15)) │ ├── flags: newline, ignore_visibility @@ -150,6 +154,7 @@ │ │ ├── opening_loc: (5,12)-(5,13) = "(" │ │ └── closing_loc: (5,14)-(5,15) = ")" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (7,0)-(7,11)) ├── flags: newline, ignore_visibility @@ -178,4 +183,5 @@ │ ├── opening_loc: (7,9)-(7,10) = "(" │ └── closing_loc: (7,10)-(7,11) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/sclass.txt b/snapshots/whitequark/sclass.txt index 346d1a4149..5c31e4c0b5 100644 --- a/snapshots/whitequark/sclass.txt +++ b/snapshots/whitequark/sclass.txt @@ -20,6 +20,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── body: │ @ StatementsNode (location: (1,14)-(1,17)) diff --git a/snapshots/whitequark/send_attr_asgn.txt b/snapshots/whitequark/send_attr_asgn.txt index faeb5a7c7c..2002d67315 100644 --- a/snapshots/whitequark/send_attr_asgn.txt +++ b/snapshots/whitequark/send_attr_asgn.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,3)-(1,4) = "." │ ├── name: :A= @@ -30,6 +31,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: (1,6)-(1,7) = "=" │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,9)) │ ├── flags: newline, attribute_write @@ -43,6 +45,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (3,3)-(3,4) = "." │ ├── name: :a= @@ -56,6 +59,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: (3,6)-(3,7) = "=" │ └── block: ∅ ├── @ ConstantPathWriteNode (location: (5,0)-(5,10)) │ ├── flags: newline @@ -72,6 +76,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── name: :A │ │ ├── delimiter_loc: (5,3)-(5,5) = "::" @@ -93,6 +98,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (7,3)-(7,5) = "::" ├── name: :a= @@ -106,4 +112,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: (7,7)-(7,8) = "=" └── block: ∅ diff --git a/snapshots/whitequark/send_attr_asgn_conditional.txt b/snapshots/whitequark/send_attr_asgn_conditional.txt index cb849e3f05..db552e4a92 100644 --- a/snapshots/whitequark/send_attr_asgn_conditional.txt +++ b/snapshots/whitequark/send_attr_asgn_conditional.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,1)-(1,3) = "&." ├── name: :b= @@ -30,4 +31,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: (1,5)-(1,6) = "=" └── block: ∅ diff --git a/snapshots/whitequark/send_binary_op.txt b/snapshots/whitequark/send_binary_op.txt index 49a2cffa65..e9c98b9687 100644 --- a/snapshots/whitequark/send_binary_op.txt +++ b/snapshots/whitequark/send_binary_op.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :!= @@ -30,6 +31,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,8)) │ ├── flags: newline @@ -43,6 +45,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :!~ @@ -56,6 +59,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (5,0)-(5,7)) │ ├── flags: newline @@ -69,6 +73,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :% @@ -82,6 +87,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (7,0)-(7,7)) │ ├── flags: newline @@ -95,6 +101,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :& @@ -108,6 +115,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (9,0)-(9,7)) │ ├── flags: newline @@ -121,6 +129,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :* @@ -134,6 +143,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (11,0)-(11,8)) │ ├── flags: newline @@ -147,6 +157,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :** @@ -160,6 +171,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (13,0)-(13,7)) │ ├── flags: newline @@ -173,6 +185,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :+ @@ -186,6 +199,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (15,0)-(15,7)) │ ├── flags: newline @@ -199,6 +213,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :- @@ -212,6 +227,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (17,0)-(17,7)) │ ├── flags: newline @@ -225,6 +241,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :/ @@ -238,6 +255,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (19,0)-(19,7)) │ ├── flags: newline @@ -251,6 +269,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :< @@ -264,6 +283,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (21,0)-(21,8)) │ ├── flags: newline @@ -277,6 +297,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :<< @@ -290,6 +311,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (23,0)-(23,8)) │ ├── flags: newline @@ -303,6 +325,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :<= @@ -316,6 +339,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (25,0)-(25,9)) │ ├── flags: newline @@ -329,6 +353,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :<=> @@ -342,6 +367,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (27,0)-(27,8)) │ ├── flags: newline @@ -355,6 +381,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :== @@ -368,6 +395,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (29,0)-(29,9)) │ ├── flags: newline @@ -381,6 +409,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :=== @@ -394,6 +423,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (31,0)-(31,8)) │ ├── flags: newline @@ -407,6 +437,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :=~ @@ -420,6 +451,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (33,0)-(33,7)) │ ├── flags: newline @@ -433,6 +465,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :> @@ -446,6 +479,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (35,0)-(35,8)) │ ├── flags: newline @@ -459,6 +493,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :>= @@ -472,6 +507,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (37,0)-(37,8)) │ ├── flags: newline @@ -485,6 +521,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :>> @@ -498,6 +535,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (39,0)-(39,7)) │ ├── flags: newline @@ -511,6 +549,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :^ @@ -524,6 +563,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (41,0)-(41,7)) ├── flags: newline @@ -537,6 +577,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :| @@ -550,4 +591,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/send_block_chain_cmd.txt b/snapshots/whitequark/send_block_chain_cmd.txt index bce45c38ee..7656a08771 100644 --- a/snapshots/whitequark/send_block_chain_cmd.txt +++ b/snapshots/whitequark/send_block_chain_cmd.txt @@ -23,6 +23,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (1,7)-(1,13)) │ │ ├── flags: ∅ @@ -48,8 +49,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,28)) │ ├── flags: newline @@ -69,6 +72,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (3,7)-(3,13)) │ │ ├── flags: ∅ @@ -94,8 +98,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,22)-(3,28)) │ ├── flags: ∅ @@ -122,6 +128,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (5,7)-(5,13)) │ │ ├── flags: ∅ @@ -136,6 +143,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,18)-(5,20)) │ ├── flags: ∅ @@ -162,6 +170,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (7,7)-(7,13)) │ │ ├── flags: ∅ @@ -187,8 +196,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (7,21)-(7,22) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (9,0)-(9,25)) │ ├── flags: newline @@ -208,6 +219,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (9,7)-(9,13)) │ │ ├── flags: ∅ @@ -233,8 +245,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: (9,21)-(9,22) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (9,23)-(9,25)) │ ├── flags: ∅ @@ -261,6 +275,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 1 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: │ │ @ BlockNode (location: (11,7)-(11,13)) │ │ ├── flags: ∅ @@ -286,8 +301,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (13,0)-(13,23)) ├── flags: newline @@ -307,6 +324,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (13,7)-(13,13)) │ ├── flags: ∅ @@ -332,6 +350,8 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: (13,22)-(13,23) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/send_block_conditional.txt b/snapshots/whitequark/send_block_conditional.txt index 86ef0dbf36..4fb4ce99f8 100644 --- a/snapshots/whitequark/send_block_conditional.txt +++ b/snapshots/whitequark/send_block_conditional.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,3)-(1,5) = "&." ├── name: :bar @@ -24,6 +25,7 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,9)-(1,11)) ├── flags: ∅ diff --git a/snapshots/whitequark/send_call.txt b/snapshots/whitequark/send_call.txt index 4ed17fbaee..c025248b0d 100644 --- a/snapshots/whitequark/send_call.txt +++ b/snapshots/whitequark/send_call.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,3)-(1,4) = "." │ ├── name: :call @@ -30,6 +31,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 1 │ ├── closing_loc: (1,6)-(1,7) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (3,0)-(3,8)) ├── flags: newline @@ -43,6 +45,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (3,3)-(3,5) = "::" ├── name: :call @@ -56,4 +59,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: (3,7)-(3,8) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/send_conditional.txt b/snapshots/whitequark/send_conditional.txt index 7faa6ac04e..54d8f588d7 100644 --- a/snapshots/whitequark/send_conditional.txt +++ b/snapshots/whitequark/send_conditional.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,1)-(1,3) = "&." ├── name: :b @@ -24,4 +25,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/send_index.txt b/snapshots/whitequark/send_index.txt index 5aec47c484..02bef8bb3c 100644 --- a/snapshots/whitequark/send_index.txt +++ b/snapshots/whitequark/send_index.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[] @@ -33,4 +34,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: (1,8)-(1,9) = "]" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/send_index_asgn.txt b/snapshots/whitequark/send_index_asgn.txt index fe0f71956a..962a5d3da9 100644 --- a/snapshots/whitequark/send_index_asgn.txt +++ b/snapshots/whitequark/send_index_asgn.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[]= @@ -36,4 +37,5 @@ │ ├── flags: static_literal, decimal │ └── value: 3 ├── closing_loc: (1,8)-(1,9) = "]" + ├── equal_loc: (1,10)-(1,11) = "=" └── block: ∅ diff --git a/snapshots/whitequark/send_index_asgn_legacy.txt b/snapshots/whitequark/send_index_asgn_legacy.txt index fe0f71956a..962a5d3da9 100644 --- a/snapshots/whitequark/send_index_asgn_legacy.txt +++ b/snapshots/whitequark/send_index_asgn_legacy.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[]= @@ -36,4 +37,5 @@ │ ├── flags: static_literal, decimal │ └── value: 3 ├── closing_loc: (1,8)-(1,9) = "]" + ├── equal_loc: (1,10)-(1,11) = "=" └── block: ∅ diff --git a/snapshots/whitequark/send_index_cmd.txt b/snapshots/whitequark/send_index_cmd.txt index 89a5c41fc3..69128863f1 100644 --- a/snapshots/whitequark/send_index_cmd.txt +++ b/snapshots/whitequark/send_index_cmd.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[] @@ -46,8 +47,11 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: (1,9)-(1,10) = "]" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/send_index_legacy.txt b/snapshots/whitequark/send_index_legacy.txt index 5aec47c484..02bef8bb3c 100644 --- a/snapshots/whitequark/send_index_legacy.txt +++ b/snapshots/whitequark/send_index_legacy.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :[] @@ -33,4 +34,5 @@ │ ├── flags: static_literal, decimal │ └── value: 2 ├── closing_loc: (1,8)-(1,9) = "]" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/send_op_asgn_conditional.txt b/snapshots/whitequark/send_op_asgn_conditional.txt index 68e09171f8..436029dca8 100644 --- a/snapshots/whitequark/send_op_asgn_conditional.txt +++ b/snapshots/whitequark/send_op_asgn_conditional.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (1,1)-(1,3) = "&." ├── message_loc: (1,3)-(1,4) = "b" diff --git a/snapshots/whitequark/send_plain.txt b/snapshots/whitequark/send_plain.txt index 96643ddcab..dfdfc6873c 100644 --- a/snapshots/whitequark/send_plain.txt +++ b/snapshots/whitequark/send_plain.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,3)-(1,4) = "." │ ├── name: :fun @@ -24,6 +25,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,10)) │ ├── flags: newline @@ -37,6 +39,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (3,3)-(3,5) = "::" │ ├── name: :Fun @@ -44,6 +47,7 @@ │ ├── opening_loc: (3,8)-(3,9) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (3,9)-(3,10) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (5,0)-(5,8)) ├── flags: newline @@ -57,6 +61,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (5,3)-(5,5) = "::" ├── name: :fun @@ -64,4 +69,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/send_plain_cmd.txt b/snapshots/whitequark/send_plain_cmd.txt index 2785712baa..ba9a593134 100644 --- a/snapshots/whitequark/send_plain_cmd.txt +++ b/snapshots/whitequark/send_plain_cmd.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,3)-(1,4) = "." │ ├── name: :fun @@ -35,8 +36,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,12)) │ ├── flags: newline @@ -50,6 +53,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (3,3)-(3,5) = "::" │ ├── name: :Fun @@ -68,8 +72,10 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (5,0)-(5,12)) ├── flags: newline @@ -83,6 +89,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: (5,3)-(5,5) = "::" ├── name: :fun @@ -101,6 +108,8 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/send_self.txt b/snapshots/whitequark/send_self.txt index f3c56f5413..88b2bdb896 100644 --- a/snapshots/whitequark/send_self.txt +++ b/snapshots/whitequark/send_self.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,4)) │ ├── flags: newline, ignore_visibility @@ -24,6 +25,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (5,0)-(5,6)) ├── flags: newline, ignore_visibility @@ -40,4 +42,5 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: (5,5)-(5,6) = ")" + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/send_self_block.txt b/snapshots/whitequark/send_self_block.txt index 2d526d5d48..82269ea716 100644 --- a/snapshots/whitequark/send_self_block.txt +++ b/snapshots/whitequark/send_self_block.txt @@ -14,6 +14,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,4)-(1,10)) │ ├── flags: ∅ @@ -31,6 +32,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,4)-(3,7)) │ ├── flags: ∅ @@ -48,6 +50,7 @@ │ ├── opening_loc: (5,3)-(5,4) = "(" │ ├── arguments: ∅ │ ├── closing_loc: (5,4)-(5,5) = ")" + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (5,6)-(5,9)) │ ├── flags: ∅ @@ -71,6 +74,7 @@ │ ├── flags: static_literal, decimal │ └── value: 1 ├── closing_loc: (7,5)-(7,6) = ")" + ├── equal_loc: ∅ └── block: @ BlockNode (location: (7,7)-(7,10)) ├── flags: ∅ diff --git a/snapshots/whitequark/send_unary_op.txt b/snapshots/whitequark/send_unary_op.txt index 970b78417f..114ebfa86d 100644 --- a/snapshots/whitequark/send_unary_op.txt +++ b/snapshots/whitequark/send_unary_op.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :+@ @@ -24,6 +25,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,4)) │ ├── flags: newline @@ -37,6 +39,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :-@ @@ -44,6 +47,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (5,0)-(5,4)) ├── flags: newline @@ -57,6 +61,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :~ @@ -64,4 +69,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/slash_newline_in_heredocs.txt b/snapshots/whitequark/slash_newline_in_heredocs.txt index bd9fa7916d..f9820c20a5 100644 --- a/snapshots/whitequark/slash_newline_in_heredocs.txt +++ b/snapshots/whitequark/slash_newline_in_heredocs.txt @@ -12,7 +12,7 @@ │ ├── closing_loc: (5,0)-(6,0) = "E\n" │ └── unescaped: " 1 2\n 3\n" └── @ InterpolatedStringNode (location: (8,0)-(8,4)) - ├── flags: newline, static_literal + ├── flags: newline ├── opening_loc: (8,0)-(8,4) = "<<~E" ├── parts: (length: 3) │ ├── @ StringNode (location: (9,0)-(10,0)) diff --git a/snapshots/whitequark/space_args_arg.txt b/snapshots/whitequark/space_args_arg.txt index a0149c5f32..40c0474bad 100644 --- a/snapshots/whitequark/space_args_arg.txt +++ b/snapshots/whitequark/space_args_arg.txt @@ -28,4 +28,5 @@ │ ├── opening_loc: (1,4)-(1,5) = "(" │ └── closing_loc: (1,6)-(1,7) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/space_args_arg_block.txt b/snapshots/whitequark/space_args_arg_block.txt index c3289c1448..fbe64d62bc 100644 --- a/snapshots/whitequark/space_args_arg_block.txt +++ b/snapshots/whitequark/space_args_arg_block.txt @@ -17,6 +17,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (1,3)-(1,4) = "." │ ├── name: :fun @@ -38,6 +39,7 @@ │ │ ├── opening_loc: (1,8)-(1,9) = "(" │ │ └── closing_loc: (1,10)-(1,11) = ")" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (1,12)-(1,14)) │ ├── flags: ∅ @@ -58,6 +60,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: (3,3)-(3,5) = "::" │ ├── name: :fun @@ -79,6 +82,7 @@ │ │ ├── opening_loc: (3,9)-(3,10) = "(" │ │ └── closing_loc: (3,11)-(3,12) = ")" │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: │ @ BlockNode (location: (3,13)-(3,15)) │ ├── flags: ∅ @@ -110,6 +114,7 @@ │ ├── opening_loc: (5,4)-(5,5) = "(" │ └── closing_loc: (5,6)-(5,7) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (5,8)-(5,10)) ├── flags: ∅ diff --git a/snapshots/whitequark/space_args_arg_call.txt b/snapshots/whitequark/space_args_arg_call.txt index 538a865e2a..e8cfe45136 100644 --- a/snapshots/whitequark/space_args_arg_call.txt +++ b/snapshots/whitequark/space_args_arg_call.txt @@ -36,6 +36,8 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/space_args_arg_newline.txt b/snapshots/whitequark/space_args_arg_newline.txt index d3fbe23299..be99e96def 100644 --- a/snapshots/whitequark/space_args_arg_newline.txt +++ b/snapshots/whitequark/space_args_arg_newline.txt @@ -28,4 +28,5 @@ │ ├── opening_loc: (1,4)-(1,5) = "(" │ └── closing_loc: (2,0)-(2,1) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/space_args_block.txt b/snapshots/whitequark/space_args_block.txt index 19b5064886..2cf75fca9f 100644 --- a/snapshots/whitequark/space_args_block.txt +++ b/snapshots/whitequark/space_args_block.txt @@ -22,6 +22,7 @@ │ ├── opening_loc: (1,4)-(1,5) = "(" │ └── closing_loc: (1,5)-(1,6) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: @ BlockNode (location: (1,7)-(1,9)) ├── flags: ∅ diff --git a/snapshots/whitequark/space_args_cmd.txt b/snapshots/whitequark/space_args_cmd.txt index f91b7edbbe..44f30d76b9 100644 --- a/snapshots/whitequark/space_args_cmd.txt +++ b/snapshots/whitequark/space_args_cmd.txt @@ -42,10 +42,13 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,4)-(1,5) = "(" │ └── closing_loc: (1,10)-(1,11) = ")" ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/string_interp.txt b/snapshots/whitequark/string_interp.txt index 22ddaed0cd..2debd17ba2 100644 --- a/snapshots/whitequark/string_interp.txt +++ b/snapshots/whitequark/string_interp.txt @@ -31,6 +31,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,9)-(1,10) = "}" │ └── @ StringNode (location: (1,10)-(1,13)) diff --git a/snapshots/whitequark/super.txt b/snapshots/whitequark/super.txt index da89dbda28..0f83f6f294 100644 --- a/snapshots/whitequark/super.txt +++ b/snapshots/whitequark/super.txt @@ -22,6 +22,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── rparen_loc: ∅ │ └── block: ∅ @@ -49,6 +50,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rparen_loc: (5,9)-(5,10) = ")" └── block: ∅ diff --git a/snapshots/whitequark/super_block.txt b/snapshots/whitequark/super_block.txt index 095856ef40..794210b67d 100644 --- a/snapshots/whitequark/super_block.txt +++ b/snapshots/whitequark/super_block.txt @@ -32,6 +32,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ CallNode (location: (3,11)-(3,14)) │ ├── flags: variable_call, ignore_visibility @@ -42,6 +43,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rparen_loc: ∅ └── block: diff --git a/snapshots/whitequark/symbol_interp.txt b/snapshots/whitequark/symbol_interp.txt index 46a24b6c7e..567dfa4145 100644 --- a/snapshots/whitequark/symbol_interp.txt +++ b/snapshots/whitequark/symbol_interp.txt @@ -31,6 +31,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,10)-(1,11) = "}" │ └── @ StringNode (location: (1,11)-(1,14)) diff --git a/snapshots/whitequark/ternary.txt b/snapshots/whitequark/ternary.txt index 4aa7991675..add8f9e347 100644 --- a/snapshots/whitequark/ternary.txt +++ b/snapshots/whitequark/ternary.txt @@ -18,6 +18,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: (1,4)-(1,5) = "?" ├── statements: diff --git a/snapshots/whitequark/ternary_ambiguous_symbol.txt b/snapshots/whitequark/ternary_ambiguous_symbol.txt index 4d1900fc5f..db6fa66292 100644 --- a/snapshots/whitequark/ternary_ambiguous_symbol.txt +++ b/snapshots/whitequark/ternary_ambiguous_symbol.txt @@ -34,6 +34,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── opening_loc: (1,4)-(1,5) = "(" │ └── closing_loc: (1,8)-(1,9) = ")" diff --git a/snapshots/whitequark/trailing_forward_arg.txt b/snapshots/whitequark/trailing_forward_arg.txt index 75fce37a34..7c4a04c73e 100644 --- a/snapshots/whitequark/trailing_forward_arg.txt +++ b/snapshots/whitequark/trailing_forward_arg.txt @@ -53,6 +53,7 @@ │ │ └── @ ForwardingArgumentsNode (location: (1,31)-(1,34)) │ │ └── flags: ∅ │ ├── closing_loc: (1,34)-(1,35) = ")" + │ ├── equal_loc: ∅ │ └── block: ∅ ├── locals: [:a, :b] ├── def_keyword_loc: (1,0)-(1,3) = "def" diff --git a/snapshots/whitequark/unary_num_pow_precedence.txt b/snapshots/whitequark/unary_num_pow_precedence.txt index 0f2fb776b4..dfb2ca10ea 100644 --- a/snapshots/whitequark/unary_num_pow_precedence.txt +++ b/snapshots/whitequark/unary_num_pow_precedence.txt @@ -23,6 +23,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 10 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── @ CallNode (location: (3,0)-(3,8)) │ ├── flags: newline @@ -45,6 +46,7 @@ │ │ │ ├── flags: static_literal, decimal │ │ │ └── value: 10 │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── call_operator_loc: ∅ │ ├── name: :-@ @@ -52,6 +54,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ CallNode (location: (5,0)-(5,10)) ├── flags: newline @@ -74,6 +77,7 @@ │ │ ├── flags: static_literal, decimal │ │ └── value: 10 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── call_operator_loc: ∅ ├── name: :-@ @@ -81,4 +85,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/unless.txt b/snapshots/whitequark/unless.txt index 3d417e355d..7c81d72e27 100644 --- a/snapshots/whitequark/unless.txt +++ b/snapshots/whitequark/unless.txt @@ -18,6 +18,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (1,11)-(1,15) = "then" │ ├── statements: @@ -33,6 +34,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── else_clause: ∅ │ └── end_keyword_loc: (1,21)-(1,24) = "end" @@ -49,6 +51,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: ∅ ├── statements: @@ -64,6 +67,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── else_clause: ∅ └── end_keyword_loc: (3,17)-(3,20) = "end" diff --git a/snapshots/whitequark/unless_else.txt b/snapshots/whitequark/unless_else.txt index ffdb215692..77807c7d24 100644 --- a/snapshots/whitequark/unless_else.txt +++ b/snapshots/whitequark/unless_else.txt @@ -18,6 +18,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: (1,11)-(1,15) = "then" │ ├── statements: @@ -33,6 +34,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── else_clause: │ │ @ ElseNode (location: (1,21)-(1,34)) @@ -51,6 +53,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── end_keyword_loc: (1,31)-(1,34) = "end" │ └── end_keyword_loc: (1,31)-(1,34) = "end" @@ -67,6 +70,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: ∅ ├── statements: @@ -82,6 +86,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── else_clause: │ @ ElseNode (location: (3,17)-(3,30)) @@ -100,6 +105,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── end_keyword_loc: (3,27)-(3,30) = "end" └── end_keyword_loc: (3,27)-(3,30) = "end" diff --git a/snapshots/whitequark/unless_mod.txt b/snapshots/whitequark/unless_mod.txt index 5dd1c2d25d..0a0e2f4917 100644 --- a/snapshots/whitequark/unless_mod.txt +++ b/snapshots/whitequark/unless_mod.txt @@ -18,6 +18,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── then_keyword_loc: ∅ ├── statements: @@ -33,6 +34,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── else_clause: ∅ └── end_keyword_loc: ∅ diff --git a/snapshots/whitequark/until.txt b/snapshots/whitequark/until.txt index 9737c86bd2..2b31c70613 100644 --- a/snapshots/whitequark/until.txt +++ b/snapshots/whitequark/until.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── statements: │ @ StatementsNode (location: (1,13)-(1,17)) @@ -34,6 +35,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ UntilNode (location: (3,0)-(3,19)) ├── flags: newline @@ -50,6 +52,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── statements: @ StatementsNode (location: (3,11)-(3,15)) @@ -64,4 +67,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/until_mod.txt b/snapshots/whitequark/until_mod.txt index c7751ca5a4..dab63f0247 100644 --- a/snapshots/whitequark/until_mod.txt +++ b/snapshots/whitequark/until_mod.txt @@ -20,6 +20,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── statements: @ StatementsNode (location: (1,0)-(1,4)) @@ -34,4 +35,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/until_post.txt b/snapshots/whitequark/until_post.txt index 3e3ab838b9..2b65a3125a 100644 --- a/snapshots/whitequark/until_post.txt +++ b/snapshots/whitequark/until_post.txt @@ -20,6 +20,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── statements: @ StatementsNode (location: (1,0)-(1,14)) @@ -41,6 +42,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: ∅ ├── else_clause: ∅ diff --git a/snapshots/whitequark/var_op_asgn_cmd.txt b/snapshots/whitequark/var_op_asgn_cmd.txt index 381c98a95a..7900953558 100644 --- a/snapshots/whitequark/var_op_asgn_cmd.txt +++ b/snapshots/whitequark/var_op_asgn_cmd.txt @@ -26,6 +26,7 @@ │ │ ├── name: :foo │ │ └── depth: 0 │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── name: :foo ├── binary_operator: :+ diff --git a/snapshots/whitequark/when_multi.txt b/snapshots/whitequark/when_multi.txt index b4038b74a8..2aab67f1e3 100644 --- a/snapshots/whitequark/when_multi.txt +++ b/snapshots/whitequark/when_multi.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ WhenNode (location: (1,10)-(1,32)) @@ -49,6 +50,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── else_clause: ∅ ├── case_keyword_loc: (1,0)-(1,4) = "case" diff --git a/snapshots/whitequark/when_splat.txt b/snapshots/whitequark/when_splat.txt index f5d9080539..34c8032f77 100644 --- a/snapshots/whitequark/when_splat.txt +++ b/snapshots/whitequark/when_splat.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 2) │ ├── @ WhenNode (location: (1,10)-(1,27)) @@ -39,6 +40,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ ├── then_keyword_loc: ∅ │ │ └── statements: @@ -54,6 +56,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── @ WhenNode (location: (1,29)-(1,38)) │ ├── flags: ∅ @@ -72,6 +75,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ ├── then_keyword_loc: ∅ │ └── statements: ∅ diff --git a/snapshots/whitequark/when_then.txt b/snapshots/whitequark/when_then.txt index cb964cfb53..cf9e0c23ae 100644 --- a/snapshots/whitequark/when_then.txt +++ b/snapshots/whitequark/when_then.txt @@ -17,6 +17,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── conditions: (length: 1) │ └── @ WhenNode (location: (1,10)-(1,29)) @@ -43,6 +44,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── else_clause: ∅ ├── case_keyword_loc: (1,0)-(1,4) = "case" diff --git a/snapshots/whitequark/while.txt b/snapshots/whitequark/while.txt index 3d2469e8d1..41b104bd6d 100644 --- a/snapshots/whitequark/while.txt +++ b/snapshots/whitequark/while.txt @@ -20,6 +20,7 @@ │ │ ├── opening_loc: ∅ │ │ ├── arguments: ∅ │ │ ├── closing_loc: ∅ + │ │ ├── equal_loc: ∅ │ │ └── block: ∅ │ └── statements: │ @ StatementsNode (location: (1,13)-(1,17)) @@ -34,6 +35,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── @ WhileNode (location: (3,0)-(3,19)) ├── flags: newline @@ -50,6 +52,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── statements: @ StatementsNode (location: (3,11)-(3,15)) @@ -64,4 +67,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/while_mod.txt b/snapshots/whitequark/while_mod.txt index 584bdf61f1..41782c4b64 100644 --- a/snapshots/whitequark/while_mod.txt +++ b/snapshots/whitequark/while_mod.txt @@ -20,6 +20,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── statements: @ StatementsNode (location: (1,0)-(1,4)) @@ -34,4 +35,5 @@ ├── opening_loc: ∅ ├── arguments: ∅ ├── closing_loc: ∅ + ├── equal_loc: ∅ └── block: ∅ diff --git a/snapshots/whitequark/while_post.txt b/snapshots/whitequark/while_post.txt index 303068d4be..4a16f63a7c 100644 --- a/snapshots/whitequark/while_post.txt +++ b/snapshots/whitequark/while_post.txt @@ -20,6 +20,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ └── statements: @ StatementsNode (location: (1,0)-(1,14)) @@ -41,6 +42,7 @@ │ ├── opening_loc: ∅ │ ├── arguments: ∅ │ ├── closing_loc: ∅ + │ ├── equal_loc: ∅ │ └── block: ∅ ├── rescue_clause: ∅ ├── else_clause: ∅ diff --git a/snapshots/whitequark/xstring_interp.txt b/snapshots/whitequark/xstring_interp.txt index 7808b93250..500b2d9875 100644 --- a/snapshots/whitequark/xstring_interp.txt +++ b/snapshots/whitequark/xstring_interp.txt @@ -31,6 +31,7 @@ │ │ │ ├── opening_loc: ∅ │ │ │ ├── arguments: ∅ │ │ │ ├── closing_loc: ∅ + │ │ │ ├── equal_loc: ∅ │ │ │ └── block: ∅ │ │ └── closing_loc: (1,9)-(1,10) = "}" │ └── @ StringNode (location: (1,10)-(1,13)) diff --git a/snapshots/xstring.txt b/snapshots/xstring.txt index 530066fd45..f5d49a71d0 100644 --- a/snapshots/xstring.txt +++ b/snapshots/xstring.txt @@ -37,6 +37,7 @@ │ │ │ │ ├── opening_loc: ∅ │ │ │ │ ├── arguments: ∅ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ ├── equal_loc: ∅ │ │ │ │ └── block: ∅ │ │ │ └── closing_loc: (3,10)-(3,11) = "}" │ │ └── @ StringNode (location: (3,11)-(3,15)) diff --git a/src/encoding.c b/src/encoding.c index a4aeed104f..d7e5616840 100644 --- a/src/encoding.c +++ b/src/encoding.c @@ -2,7 +2,7 @@ typedef uint32_t pm_unicode_codepoint_t; -#define UNICODE_ALPHA_CODEPOINTS_LENGTH 1450 +#define UNICODE_ALPHA_CODEPOINTS_LENGTH 1508 static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_LENGTH] = { 0x100, 0x2C1, 0x2C6, 0x2D1, @@ -10,7 +10,7 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x2EC, 0x2EC, 0x2EE, 0x2EE, 0x345, 0x345, - 0x370, 0x374, + 0x363, 0x374, 0x376, 0x377, 0x37A, 0x37D, 0x37F, 0x37F, @@ -50,7 +50,8 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x840, 0x858, 0x860, 0x86A, 0x870, 0x887, - 0x889, 0x88E, + 0x889, 0x88F, + 0x897, 0x897, 0x8A0, 0x8C9, 0x8D4, 0x8DF, 0x8E3, 0x8E9, @@ -140,7 +141,7 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0xC4A, 0xC4C, 0xC55, 0xC56, 0xC58, 0xC5A, - 0xC5D, 0xC5D, + 0xC5C, 0xC5D, 0xC60, 0xC63, 0xC80, 0xC83, 0xC85, 0xC8C, @@ -152,7 +153,7 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0xCC6, 0xCC8, 0xCCA, 0xCCC, 0xCD5, 0xCD6, - 0xCDD, 0xCDE, + 0xCDC, 0xCDE, 0xCE0, 0xCE3, 0xCF1, 0xCF3, 0xD00, 0xD0C, @@ -264,7 +265,7 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x1C00, 0x1C36, 0x1C4D, 0x1C4F, 0x1C5A, 0x1C7D, - 0x1C80, 0x1C88, + 0x1C80, 0x1C8A, 0x1C90, 0x1CBA, 0x1CBD, 0x1CBF, 0x1CE9, 0x1CEC, @@ -272,7 +273,7 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x1CF5, 0x1CF6, 0x1CFA, 0x1CFA, 0x1D00, 0x1DBF, - 0x1DE7, 0x1DF4, + 0x1DD3, 0x1DF4, 0x1E00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, @@ -352,11 +353,8 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0xA67F, 0xA6EF, 0xA717, 0xA71F, 0xA722, 0xA788, - 0xA78B, 0xA7CA, - 0xA7D0, 0xA7D1, - 0xA7D3, 0xA7D3, - 0xA7D5, 0xA7D9, - 0xA7F2, 0xA805, + 0xA78B, 0xA7DC, + 0xA7F1, 0xA805, 0xA807, 0xA827, 0xA840, 0xA873, 0xA880, 0xA8C3, @@ -446,6 +444,7 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x105A3, 0x105B1, 0x105B3, 0x105B9, 0x105BB, 0x105BC, + 0x105C0, 0x105F3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, @@ -464,6 +463,7 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x108F4, 0x108F5, 0x10900, 0x10915, 0x10920, 0x10939, + 0x10940, 0x10959, 0x10980, 0x109B7, 0x109BE, 0x109BF, 0x10A00, 0x10A03, @@ -483,9 +483,14 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x10C80, 0x10CB2, 0x10CC0, 0x10CF2, 0x10D00, 0x10D27, + 0x10D4A, 0x10D65, + 0x10D69, 0x10D69, + 0x10D6F, 0x10D85, 0x10E80, 0x10EA9, 0x10EAB, 0x10EAC, 0x10EB0, 0x10EB1, + 0x10EC2, 0x10EC7, + 0x10EFA, 0x10EFC, 0x10F00, 0x10F1C, 0x10F27, 0x10F27, 0x10F30, 0x10F45, @@ -529,6 +534,17 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x11350, 0x11350, 0x11357, 0x11357, 0x1135D, 0x11363, + 0x11380, 0x11389, + 0x1138B, 0x1138B, + 0x1138E, 0x1138E, + 0x11390, 0x113B5, + 0x113B7, 0x113C0, + 0x113C2, 0x113C2, + 0x113C5, 0x113C5, + 0x113C7, 0x113CA, + 0x113CC, 0x113CD, + 0x113D1, 0x113D1, + 0x113D3, 0x113D3, 0x11400, 0x11441, 0x11443, 0x11445, 0x11447, 0x1144A, @@ -567,6 +583,8 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x11A50, 0x11A97, 0x11A9D, 0x11A9D, 0x11AB0, 0x11AF8, + 0x11B60, 0x11B67, + 0x11BC0, 0x11BE0, 0x11C00, 0x11C08, 0x11C0A, 0x11C36, 0x11C38, 0x11C3E, @@ -588,6 +606,7 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x11D90, 0x11D91, 0x11D93, 0x11D96, 0x11D98, 0x11D98, + 0x11DB0, 0x11DDB, 0x11EE0, 0x11EF6, 0x11F00, 0x11F10, 0x11F12, 0x11F3A, @@ -599,7 +618,9 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x12F90, 0x12FF0, 0x13000, 0x1342F, 0x13441, 0x13446, + 0x13460, 0x143FA, 0x14400, 0x14646, + 0x16100, 0x1612E, 0x16800, 0x16A38, 0x16A40, 0x16A5E, 0x16A70, 0x16ABE, @@ -608,16 +629,19 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x16B40, 0x16B43, 0x16B63, 0x16B77, 0x16B7D, 0x16B8F, + 0x16D40, 0x16D6C, 0x16E40, 0x16E7F, + 0x16EA0, 0x16EB8, + 0x16EBB, 0x16ED3, 0x16F00, 0x16F4A, 0x16F4F, 0x16F87, 0x16F8F, 0x16F9F, 0x16FE0, 0x16FE1, 0x16FE3, 0x16FE3, - 0x16FF0, 0x16FF1, - 0x17000, 0x187F7, - 0x18800, 0x18CD5, - 0x18D00, 0x18D08, + 0x16FF0, 0x16FF6, + 0x17000, 0x18CD5, + 0x18CFF, 0x18D1E, + 0x18D80, 0x18DF2, 0x1AFF0, 0x1AFF3, 0x1AFF5, 0x1AFFB, 0x1AFFD, 0x1AFFE, @@ -677,6 +701,11 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x1E290, 0x1E2AD, 0x1E2C0, 0x1E2EB, 0x1E4D0, 0x1E4EB, + 0x1E5D0, 0x1E5ED, + 0x1E5F0, 0x1E5F0, + 0x1E6C0, 0x1E6DE, + 0x1E6E0, 0x1E6F5, + 0x1E6FE, 0x1E6FF, 0x1E7E0, 0x1E7E6, 0x1E7E8, 0x1E7EB, 0x1E7ED, 0x1E7EE, @@ -722,16 +751,16 @@ static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEP 0x1F150, 0x1F169, 0x1F170, 0x1F189, 0x20000, 0x2A6DF, - 0x2A700, 0x2B739, - 0x2B740, 0x2B81D, - 0x2B820, 0x2CEA1, + 0x2A700, 0x2B81D, + 0x2B820, 0x2CEAD, 0x2CEB0, 0x2EBE0, + 0x2EBF0, 0x2EE5D, 0x2F800, 0x2FA1D, 0x30000, 0x3134A, - 0x31350, 0x323AF, + 0x31350, 0x33479, }; -#define UNICODE_ALNUM_CODEPOINTS_LENGTH 1528 +#define UNICODE_ALNUM_CODEPOINTS_LENGTH 1598 static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_LENGTH] = { 0x100, 0x2C1, 0x2C6, 0x2D1, @@ -739,7 +768,7 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x2EC, 0x2EC, 0x2EE, 0x2EE, 0x345, 0x345, - 0x370, 0x374, + 0x363, 0x374, 0x376, 0x377, 0x37A, 0x37D, 0x37F, 0x37F, @@ -778,7 +807,8 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x840, 0x858, 0x860, 0x86A, 0x870, 0x887, - 0x889, 0x88E, + 0x889, 0x88F, + 0x897, 0x897, 0x8A0, 0x8C9, 0x8D4, 0x8DF, 0x8E3, 0x8E9, @@ -872,7 +902,7 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0xC4A, 0xC4C, 0xC55, 0xC56, 0xC58, 0xC5A, - 0xC5D, 0xC5D, + 0xC5C, 0xC5D, 0xC60, 0xC63, 0xC66, 0xC6F, 0xC80, 0xC83, @@ -885,7 +915,7 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0xCC6, 0xCC8, 0xCCA, 0xCCC, 0xCD5, 0xCD6, - 0xCDD, 0xCDE, + 0xCDC, 0xCDE, 0xCE0, 0xCE3, 0xCE6, 0xCEF, 0xCF1, 0xCF3, @@ -1007,7 +1037,7 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x1C00, 0x1C36, 0x1C40, 0x1C49, 0x1C4D, 0x1C7D, - 0x1C80, 0x1C88, + 0x1C80, 0x1C8A, 0x1C90, 0x1CBA, 0x1CBD, 0x1CBF, 0x1CE9, 0x1CEC, @@ -1015,7 +1045,7 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x1CF5, 0x1CF6, 0x1CFA, 0x1CFA, 0x1D00, 0x1DBF, - 0x1DE7, 0x1DF4, + 0x1DD3, 0x1DF4, 0x1E00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, @@ -1094,11 +1124,8 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0xA67F, 0xA6EF, 0xA717, 0xA71F, 0xA722, 0xA788, - 0xA78B, 0xA7CA, - 0xA7D0, 0xA7D1, - 0xA7D3, 0xA7D3, - 0xA7D5, 0xA7D9, - 0xA7F2, 0xA805, + 0xA78B, 0xA7DC, + 0xA7F1, 0xA805, 0xA807, 0xA827, 0xA840, 0xA873, 0xA880, 0xA8C3, @@ -1191,6 +1218,7 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x105A3, 0x105B1, 0x105B3, 0x105B9, 0x105BB, 0x105BC, + 0x105C0, 0x105F3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, @@ -1209,6 +1237,7 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x108F4, 0x108F5, 0x10900, 0x10915, 0x10920, 0x10939, + 0x10940, 0x10959, 0x10980, 0x109B7, 0x109BE, 0x109BF, 0x10A00, 0x10A03, @@ -1229,9 +1258,14 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x10CC0, 0x10CF2, 0x10D00, 0x10D27, 0x10D30, 0x10D39, + 0x10D40, 0x10D65, + 0x10D69, 0x10D69, + 0x10D6F, 0x10D85, 0x10E80, 0x10EA9, 0x10EAB, 0x10EAC, 0x10EB0, 0x10EB1, + 0x10EC2, 0x10EC7, + 0x10EFA, 0x10EFC, 0x10F00, 0x10F1C, 0x10F27, 0x10F27, 0x10F30, 0x10F45, @@ -1278,6 +1312,17 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x11350, 0x11350, 0x11357, 0x11357, 0x1135D, 0x11363, + 0x11380, 0x11389, + 0x1138B, 0x1138B, + 0x1138E, 0x1138E, + 0x11390, 0x113B5, + 0x113B7, 0x113C0, + 0x113C2, 0x113C2, + 0x113C5, 0x113C5, + 0x113C7, 0x113CA, + 0x113CC, 0x113CD, + 0x113D1, 0x113D1, + 0x113D3, 0x113D3, 0x11400, 0x11441, 0x11443, 0x11445, 0x11447, 0x1144A, @@ -1297,6 +1342,7 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x11680, 0x116B5, 0x116B8, 0x116B8, 0x116C0, 0x116C9, + 0x116D0, 0x116E3, 0x11700, 0x1171A, 0x1171D, 0x1172A, 0x11730, 0x11739, @@ -1322,6 +1368,9 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x11A50, 0x11A97, 0x11A9D, 0x11A9D, 0x11AB0, 0x11AF8, + 0x11B60, 0x11B67, + 0x11BC0, 0x11BE0, + 0x11BF0, 0x11BF9, 0x11C00, 0x11C08, 0x11C0A, 0x11C36, 0x11C38, 0x11C3E, @@ -1346,6 +1395,8 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x11D93, 0x11D96, 0x11D98, 0x11D98, 0x11DA0, 0x11DA9, + 0x11DB0, 0x11DDB, + 0x11DE0, 0x11DE9, 0x11EE0, 0x11EF6, 0x11F00, 0x11F10, 0x11F12, 0x11F3A, @@ -1358,7 +1409,10 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x12F90, 0x12FF0, 0x13000, 0x1342F, 0x13441, 0x13446, + 0x13460, 0x143FA, 0x14400, 0x14646, + 0x16100, 0x1612E, + 0x16130, 0x16139, 0x16800, 0x16A38, 0x16A40, 0x16A5E, 0x16A60, 0x16A69, @@ -1370,16 +1424,20 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x16B50, 0x16B59, 0x16B63, 0x16B77, 0x16B7D, 0x16B8F, + 0x16D40, 0x16D6C, + 0x16D70, 0x16D79, 0x16E40, 0x16E7F, + 0x16EA0, 0x16EB8, + 0x16EBB, 0x16ED3, 0x16F00, 0x16F4A, 0x16F4F, 0x16F87, 0x16F8F, 0x16F9F, 0x16FE0, 0x16FE1, 0x16FE3, 0x16FE3, - 0x16FF0, 0x16FF1, - 0x17000, 0x187F7, - 0x18800, 0x18CD5, - 0x18D00, 0x18D08, + 0x16FF0, 0x16FF6, + 0x17000, 0x18CD5, + 0x18CFF, 0x18D1E, + 0x18D80, 0x18DF2, 0x1AFF0, 0x1AFF3, 0x1AFF5, 0x1AFFB, 0x1AFFD, 0x1AFFE, @@ -1394,6 +1452,7 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x1BC80, 0x1BC88, 0x1BC90, 0x1BC99, 0x1BC9E, 0x1BC9E, + 0x1CCF0, 0x1CCF9, 0x1D400, 0x1D454, 0x1D456, 0x1D49C, 0x1D49E, 0x1D49F, @@ -1443,6 +1502,11 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x1E2F0, 0x1E2F9, 0x1E4D0, 0x1E4EB, 0x1E4F0, 0x1E4F9, + 0x1E5D0, 0x1E5ED, + 0x1E5F0, 0x1E5FA, + 0x1E6C0, 0x1E6DE, + 0x1E6E0, 0x1E6F5, + 0x1E6FE, 0x1E6FF, 0x1E7E0, 0x1E7E6, 0x1E7E8, 0x1E7EB, 0x1E7ED, 0x1E7EE, @@ -1490,16 +1554,16 @@ static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEP 0x1F170, 0x1F189, 0x1FBF0, 0x1FBF9, 0x20000, 0x2A6DF, - 0x2A700, 0x2B739, - 0x2B740, 0x2B81D, - 0x2B820, 0x2CEA1, + 0x2A700, 0x2B81D, + 0x2B820, 0x2CEAD, 0x2CEB0, 0x2EBE0, + 0x2EBF0, 0x2EE5D, 0x2F800, 0x2FA1D, 0x30000, 0x3134A, - 0x31350, 0x323AF, + 0x31350, 0x33479, }; -#define UNICODE_ISUPPER_CODEPOINTS_LENGTH 1302 +#define UNICODE_ISUPPER_CODEPOINTS_LENGTH 1320 static const pm_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOINTS_LENGTH] = { 0x100, 0x100, 0x102, 0x102, @@ -1774,6 +1838,7 @@ static const pm_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_C 0x10C7, 0x10C7, 0x10CD, 0x10CD, 0x13A0, 0x13F5, + 0x1C89, 0x1C89, 0x1C90, 0x1CBA, 0x1CBD, 0x1CBF, 0x1E00, 0x1E00, @@ -2103,9 +2168,15 @@ static const pm_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_C 0xA7C2, 0xA7C2, 0xA7C4, 0xA7C7, 0xA7C9, 0xA7C9, + 0xA7CB, 0xA7CC, + 0xA7CE, 0xA7CE, 0xA7D0, 0xA7D0, + 0xA7D2, 0xA7D2, + 0xA7D4, 0xA7D4, 0xA7D6, 0xA7D6, 0xA7D8, 0xA7D8, + 0xA7DA, 0xA7DA, + 0xA7DC, 0xA7DC, 0xA7F5, 0xA7F5, 0xFF21, 0xFF3A, 0x10400, 0x10427, @@ -2115,8 +2186,10 @@ static const pm_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_C 0x1058C, 0x10592, 0x10594, 0x10595, 0x10C80, 0x10CB2, + 0x10D50, 0x10D65, 0x118A0, 0x118BF, 0x16E40, 0x16E5F, + 0x16EA0, 0x16EB8, 0x1D400, 0x1D419, 0x1D434, 0x1D44D, 0x1D468, 0x1D481, @@ -2304,6 +2377,10 @@ pm_encoding_utf_8_char_width(const uint8_t *b, ptrdiff_t n) { */ size_t pm_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n) { + if (n == 0) { + return 0; + } + if (*b < 0x80) { return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT) ? 1 : 0; } @@ -2324,6 +2401,10 @@ pm_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n) { */ size_t pm_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n) { + if (n == 0) { + return 0; + } + if (*b < 0x80) { return (pm_encoding_unicode_table[*b] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0; } @@ -2344,6 +2425,10 @@ pm_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n) { */ bool pm_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n) { + if (n == 0) { + return 0; + } + if (*b < 0x80) { return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false; } @@ -2362,7 +2447,8 @@ pm_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n) { static pm_unicode_codepoint_t pm_cesu_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) { - if (b[0] < 0x80) { + + if ((n > 0) && (b[0] < 0x80)) { *width = 1; return (pm_unicode_codepoint_t) b[0]; } @@ -2401,6 +2487,10 @@ pm_cesu_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) { static size_t pm_encoding_cesu_8_char_width(const uint8_t *b, ptrdiff_t n) { + if (n == 0) { + return 0; + } + size_t width; pm_cesu_8_codepoint(b, n, &width); return width; @@ -2408,6 +2498,10 @@ pm_encoding_cesu_8_char_width(const uint8_t *b, ptrdiff_t n) { static size_t pm_encoding_cesu_8_alpha_char(const uint8_t *b, ptrdiff_t n) { + if (n == 0) { + return 0; + } + if (*b < 0x80) { return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT) ? 1 : 0; } @@ -2424,6 +2518,10 @@ pm_encoding_cesu_8_alpha_char(const uint8_t *b, ptrdiff_t n) { static size_t pm_encoding_cesu_8_alnum_char(const uint8_t *b, ptrdiff_t n) { + if (n == 0) { + return 0; + } + if (*b < 0x80) { return (pm_encoding_unicode_table[*b] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0; } @@ -2440,6 +2538,10 @@ pm_encoding_cesu_8_alnum_char(const uint8_t *b, ptrdiff_t n) { static bool pm_encoding_cesu_8_isupper_char(const uint8_t *b, ptrdiff_t n) { + if (n == 0) { + return 0; + } + if (*b < 0x80) { return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false; } @@ -3855,14 +3957,14 @@ static const uint8_t pm_encoding_windows_874_table[256] = { }; #define PRISM_ENCODING_TABLE(name) \ - static size_t pm_encoding_ ##name ## _alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \ - return (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHABETIC_BIT); \ + static size_t pm_encoding_ ##name ## _alpha_char(const uint8_t *b, ptrdiff_t n) { \ + return ((n > 0) && (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHABETIC_BIT)); \ } \ - static size_t pm_encoding_ ##name ## _alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \ - return (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0; \ + static size_t pm_encoding_ ##name ## _alnum_char(const uint8_t *b, ptrdiff_t n) { \ + return ((n > 0) && (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0; \ } \ - static bool pm_encoding_ ##name ## _isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \ - return (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_UPPERCASE_BIT); \ + static bool pm_encoding_ ##name ## _isupper_char(const uint8_t *b, ptrdiff_t n) { \ + return ((n > 0) && (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_UPPERCASE_BIT)); \ } PRISM_ENCODING_TABLE(cp850) @@ -3931,8 +4033,8 @@ PRISM_ENCODING_TABLE(windows_874) * means that if the top bit is not set, the character is 1 byte long. */ static size_t -pm_encoding_ascii_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { - return *b < 0x80 ? 1 : 0; +pm_encoding_ascii_char_width(const uint8_t *b, ptrdiff_t n) { + return ((n > 0) && (*b < 0x80)) ? 1 : 0; } /** @@ -3940,8 +4042,8 @@ pm_encoding_ascii_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t * alphabetical character. */ static size_t -pm_encoding_ascii_alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { - return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT); +pm_encoding_ascii_alpha_char(const uint8_t *b, ptrdiff_t n) { + return (n > 0) ? (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT) : 0; } /** @@ -3951,7 +4053,7 @@ pm_encoding_ascii_alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t */ static size_t pm_encoding_ascii_alpha_char_7bit(const uint8_t *b, ptrdiff_t n) { - return (*b < 0x80) ? pm_encoding_ascii_alpha_char(b, n) : 0; + return ((n > 0) && (*b < 0x80)) ? pm_encoding_ascii_alpha_char(b, n) : 0; } /** @@ -3959,8 +4061,8 @@ pm_encoding_ascii_alpha_char_7bit(const uint8_t *b, ptrdiff_t n) { * alphanumeric character. */ static size_t -pm_encoding_ascii_alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { - return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0; +pm_encoding_ascii_alnum_char(const uint8_t *b, ptrdiff_t n) { + return ((n > 0) && (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT)) ? 1 : 0; } /** @@ -3970,7 +4072,7 @@ pm_encoding_ascii_alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t */ static size_t pm_encoding_ascii_alnum_char_7bit(const uint8_t *b, ptrdiff_t n) { - return (*b < 0x80) ? pm_encoding_ascii_alnum_char(b, n) : 0; + return ((n > 0) && (*b < 0x80)) ? pm_encoding_ascii_alnum_char(b, n) : 0; } /** @@ -3978,8 +4080,8 @@ pm_encoding_ascii_alnum_char_7bit(const uint8_t *b, ptrdiff_t n) { * character. */ static bool -pm_encoding_ascii_isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { - return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_UPPERCASE_BIT); +pm_encoding_ascii_isupper_char(const uint8_t *b, ptrdiff_t n) { + return (n > 0) && (pm_encoding_ascii_table[*b] & PRISM_ENCODING_UPPERCASE_BIT); } /** @@ -3998,7 +4100,7 @@ pm_encoding_single_char_width(PRISM_ATTRIBUTE_UNUSED const uint8_t *b, PRISM_ATT static size_t pm_encoding_euc_jp_char_width(const uint8_t *b, ptrdiff_t n) { // These are the single byte characters. - if (*b < 0x80) { + if ((n > 0) && (*b < 0x80)) { return 1; } @@ -4042,6 +4144,9 @@ pm_encoding_euc_jp_isupper_char(const uint8_t *b, ptrdiff_t n) { */ static size_t pm_encoding_shift_jis_char_width(const uint8_t *b, ptrdiff_t n) { + if (n == 0) { + return 0; + } // These are the single byte characters. if (b[0] < 0x80 || (b[0] >= 0xA1 && b[0] <= 0xDF)) { return 1; @@ -4105,7 +4210,7 @@ pm_encoding_shift_jis_isupper_char(const uint8_t *b, ptrdiff_t n) { */ static bool pm_encoding_ascii_isupper_char_7bit(const uint8_t *b, ptrdiff_t n) { - return (*b < 0x80) && pm_encoding_ascii_isupper_char(b, n); + return (n > 0) && (*b < 0x80) && pm_encoding_ascii_isupper_char(b, n); } /** @@ -4115,7 +4220,7 @@ pm_encoding_ascii_isupper_char_7bit(const uint8_t *b, ptrdiff_t n) { static size_t pm_encoding_big5_char_width(const uint8_t *b, ptrdiff_t n) { // These are the single byte characters. - if (*b < 0x80) { + if ((n > 0) && (*b < 0x80)) { return 1; } @@ -4134,7 +4239,7 @@ pm_encoding_big5_char_width(const uint8_t *b, ptrdiff_t n) { static size_t pm_encoding_cp949_char_width(const uint8_t *b, ptrdiff_t n) { // These are the single byte characters - if (*b <= 0x80) { + if ((n > 0) && (*b <= 0x80)) { return 1; } @@ -4153,7 +4258,7 @@ pm_encoding_cp949_char_width(const uint8_t *b, ptrdiff_t n) { static size_t pm_encoding_emacs_mule_char_width(const uint8_t *b, ptrdiff_t n) { // These are the 1 byte characters. - if (*b < 0x80) { + if ((n > 0) && (*b < 0x80)) { return 1; } @@ -4196,7 +4301,7 @@ pm_encoding_emacs_mule_char_width(const uint8_t *b, ptrdiff_t n) { static size_t pm_encoding_euc_kr_char_width(const uint8_t *b, ptrdiff_t n) { // These are the single byte characters. - if (*b < 0x80) { + if ((n > 0) && (*b < 0x80)) { return 1; } @@ -4215,7 +4320,7 @@ pm_encoding_euc_kr_char_width(const uint8_t *b, ptrdiff_t n) { static size_t pm_encoding_euc_tw_char_width(const uint8_t *b, ptrdiff_t n) { // These are the single byte characters. - if (*b < 0x80) { + if ((n > 0) && (*b < 0x80)) { return 1; } @@ -4239,7 +4344,7 @@ pm_encoding_euc_tw_char_width(const uint8_t *b, ptrdiff_t n) { static size_t pm_encoding_gb18030_char_width(const uint8_t *b, ptrdiff_t n) { // These are the 1 byte characters. - if (*b < 0x80) { + if ((n > 0) && (*b < 0x80)) { return 1; } @@ -4263,7 +4368,7 @@ pm_encoding_gb18030_char_width(const uint8_t *b, ptrdiff_t n) { static size_t pm_encoding_gbk_char_width(const uint8_t *b, ptrdiff_t n) { // These are the single byte characters. - if (*b <= 0x80) { + if ((n > 0) && (*b <= 0x80)) { return 1; } diff --git a/src/options.c b/src/options.c index a457178ce8..09d2a65a6c 100644 --- a/src/options.c +++ b/src/options.c @@ -88,27 +88,37 @@ pm_options_version_set(pm_options_t *options, const char *version, size_t length return true; } - if (strncmp(version, "3.5", 3) == 0) { - options->version = PM_OPTIONS_VERSION_LATEST; + if (strncmp(version, "3.5", 3) == 0 || strncmp(version, "4.0", 3) == 0) { + options->version = PM_OPTIONS_VERSION_CRUBY_4_0; + return true; + } + + if (strncmp(version, "4.1", 3) == 0) { + options->version = PM_OPTIONS_VERSION_CRUBY_4_1; return true; } return false; } - if (length >= 4) { - if (strncmp(version, "3.3.", 4) == 0 && is_number(version + 4, length - 4)) { + if (length >= 4 && is_number(version + 4, length - 4)) { + if (strncmp(version, "3.3.", 4) == 0) { options->version = PM_OPTIONS_VERSION_CRUBY_3_3; return true; } - if (strncmp(version, "3.4.", 4) == 0 && is_number(version + 4, length - 4)) { + if (strncmp(version, "3.4.", 4) == 0) { options->version = PM_OPTIONS_VERSION_CRUBY_3_4; return true; } - if (strncmp(version, "3.5.", 4) == 0 && is_number(version + 4, length - 4)) { - options->version = PM_OPTIONS_VERSION_LATEST; + if (strncmp(version, "3.5.", 4) == 0 || strncmp(version, "4.0.", 4) == 0) { + options->version = PM_OPTIONS_VERSION_CRUBY_4_0; + return true; + } + + if (strncmp(version, "4.1.", 4) == 0) { + options->version = PM_OPTIONS_VERSION_CRUBY_4_1; return true; } } diff --git a/src/prism.c b/src/prism.c index cc634b59e3..b158e505b2 100644 --- a/src/prism.c +++ b/src/prism.c @@ -18,6 +18,24 @@ pm_version(void) { #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) +/******************************************************************************/ +/* Helpful AST-related macros */ +/******************************************************************************/ + +#define FL PM_NODE_FLAGS +#define UP PM_NODE_UPCAST + +#define PM_TOKEN_START(token_) ((token_)->start) +#define PM_TOKEN_END(token_) ((token_)->end) + +#define PM_NODE_START(node_) (UP(node_)->location.start) +#define PM_NODE_END(node_) (UP(node_)->location.end) + +#define PM_LOCATION_NULL_VALUE(parser_) ((pm_location_t) { .start = (parser_)->start, .end = (parser_)->start }) +#define PM_LOCATION_TOKEN_VALUE(token_) ((pm_location_t) { .start = PM_TOKEN_START(token_), .end = PM_TOKEN_END(token_) }) +#define PM_LOCATION_NODE_VALUE(node_) ((pm_location_t) { .start = PM_NODE_START(node_), .end = PM_NODE_END(node_) }) +#define PM_OPTIONAL_LOCATION_TOKEN_VALUE(token) ((token)->type == PM_TOKEN_NOT_PROVIDED ? ((pm_location_t) { 0 }) : PM_LOCATION_TOKEN_VALUE(token)) + /******************************************************************************/ /* Lex mode manipulations */ /******************************************************************************/ @@ -1049,25 +1067,25 @@ pm_check_value_expression(pm_parser_t *parser, pm_node_t *node) { if (cast->ensure_clause != NULL) { if (cast->rescue_clause != NULL) { - pm_node_t *vn = pm_check_value_expression(parser, (pm_node_t *) cast->rescue_clause); + pm_node_t *vn = pm_check_value_expression(parser, UP(cast->rescue_clause)); if (vn != NULL) return vn; } if (cast->statements != NULL) { - pm_node_t *vn = pm_check_value_expression(parser, (pm_node_t *) cast->statements); + pm_node_t *vn = pm_check_value_expression(parser, UP(cast->statements)); if (vn != NULL) return vn; } - node = (pm_node_t *) cast->ensure_clause; + node = UP(cast->ensure_clause); } else if (cast->rescue_clause != NULL) { if (cast->statements == NULL) return NULL; - pm_node_t *vn = pm_check_value_expression(parser, (pm_node_t *) cast->statements); + pm_node_t *vn = pm_check_value_expression(parser, UP(cast->statements)); if (vn == NULL) return NULL; if (void_node == NULL) void_node = vn; for (pm_rescue_node_t *rescue_clause = cast->rescue_clause; rescue_clause != NULL; rescue_clause = rescue_clause->subsequent) { - pm_node_t *vn = pm_check_value_expression(parser, (pm_node_t *) rescue_clause->statements); + pm_node_t *vn = pm_check_value_expression(parser, UP(rescue_clause->statements)); if (vn == NULL) { void_node = NULL; break; @@ -1078,24 +1096,24 @@ pm_check_value_expression(pm_parser_t *parser, pm_node_t *node) { } if (cast->else_clause != NULL) { - node = (pm_node_t *) cast->else_clause; + node = UP(cast->else_clause); } else { return void_node; } } else { - node = (pm_node_t *) cast->statements; + node = UP(cast->statements); } break; } case PM_ENSURE_NODE: { pm_ensure_node_t *cast = (pm_ensure_node_t *) node; - node = (pm_node_t *) cast->statements; + node = UP(cast->statements); break; } case PM_PARENTHESES_NODE: { pm_parentheses_node_t *cast = (pm_parentheses_node_t *) node; - node = (pm_node_t *) cast->body; + node = UP(cast->body); break; } case PM_STATEMENTS_NODE: { @@ -1108,7 +1126,7 @@ pm_check_value_expression(pm_parser_t *parser, pm_node_t *node) { if (cast->statements == NULL || cast->subsequent == NULL) { return NULL; } - pm_node_t *vn = pm_check_value_expression(parser, (pm_node_t *) cast->statements); + pm_node_t *vn = pm_check_value_expression(parser, UP(cast->statements)); if (vn == NULL) { return NULL; } @@ -1123,19 +1141,19 @@ pm_check_value_expression(pm_parser_t *parser, pm_node_t *node) { if (cast->statements == NULL || cast->else_clause == NULL) { return NULL; } - pm_node_t *vn = pm_check_value_expression(parser, (pm_node_t *) cast->statements); + pm_node_t *vn = pm_check_value_expression(parser, UP(cast->statements)); if (vn == NULL) { return NULL; } if (void_node == NULL) { void_node = vn; } - node = (pm_node_t *) cast->else_clause; + node = UP(cast->else_clause); break; } case PM_ELSE_NODE: { pm_else_node_t *cast = (pm_else_node_t *) node; - node = (pm_node_t *) cast->statements; + node = UP(cast->statements); break; } case PM_AND_NODE: { @@ -1409,7 +1427,7 @@ pm_conditional_predicate_warn_write_literal_p(const pm_node_t *node) { static inline void pm_conditional_predicate_warn_write_literal(pm_parser_t *parser, const pm_node_t *node) { if (pm_conditional_predicate_warn_write_literal_p(node)) { - pm_parser_warn_node(parser, node, parser->version == PM_OPTIONS_VERSION_CRUBY_3_3 ? PM_WARN_EQUAL_IN_CONDITIONAL_3_3 : PM_WARN_EQUAL_IN_CONDITIONAL); + pm_parser_warn_node(parser, node, parser->version <= PM_OPTIONS_VERSION_CRUBY_3_3 ? PM_WARN_EQUAL_IN_CONDITIONAL_3_3 : PM_WARN_EQUAL_IN_CONDITIONAL); } } @@ -1559,13 +1577,6 @@ not_provided(pm_parser_t *parser) { return (pm_token_t) { .type = PM_TOKEN_NOT_PROVIDED, .start = parser->start, .end = parser->start }; } -#define PM_LOCATION_NULL_VALUE(parser) ((pm_location_t) { .start = (parser)->start, .end = (parser)->start }) -#define PM_LOCATION_TOKEN_VALUE(token) ((pm_location_t) { .start = (token)->start, .end = (token)->end }) -#define PM_LOCATION_NODE_VALUE(node) ((pm_location_t) { .start = (node)->location.start, .end = (node)->location.end }) -#define PM_LOCATION_NODE_BASE_VALUE(node) ((pm_location_t) { .start = (node)->base.location.start, .end = (node)->base.location.end }) -#define PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE ((pm_location_t) { .start = NULL, .end = NULL }) -#define PM_OPTIONAL_LOCATION_TOKEN_VALUE(token) ((token)->type == PM_TOKEN_NOT_PROVIDED ? PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE : PM_LOCATION_TOKEN_VALUE(token)) - /** * This is a special out parameter to the parse_arguments_list function that * includes opening and closing parentheses in addition to the arguments since @@ -1635,7 +1646,7 @@ pm_arguments_validate_block(pm_parser_t *parser, pm_arguments_t *arguments, pm_b // If we didn't hit a case before this check, then at this point we need to // add a syntax error. - pm_parser_err_node(parser, (pm_node_t *) block, PM_ERR_ARGUMENT_UNEXPECTED_BLOCK); + pm_parser_err_node(parser, UP(block), PM_ERR_ARGUMENT_UNEXPECTED_BLOCK); } /******************************************************************************/ @@ -1928,8 +1939,23 @@ pm_node_alloc(PRISM_ATTRIBUTE_UNUSED pm_parser_t *parser, size_t size) { return memory; } -#define PM_NODE_ALLOC(parser, type) (type *) pm_node_alloc(parser, sizeof(type)) -#define PM_NODE_IDENTIFY(parser) (++parser->node_id) +#define PM_NODE_ALLOC(parser_, type_) (type_ *) pm_node_alloc(parser_, sizeof(type_)) +#define PM_NODE_INIT(parser_, type_, flags_, start_, end_) (pm_node_t) { \ + .type = (type_), \ + .flags = (flags_), \ + .node_id = ++(parser_)->node_id, \ + .location = { .start = (start_), .end = (end_) } \ +} + +#define PM_NODE_INIT_UNSET(parser_, type_, flags_) PM_NODE_INIT(parser_, type_, flags_, NULL, NULL) +#define PM_NODE_INIT_BASE(parser_, type_, flags_) PM_NODE_INIT(parser_, type_, flags_, (parser_)->start, (parser_)->start) +#define PM_NODE_INIT_TOKEN(parser_, type_, flags_, token_) PM_NODE_INIT(parser_, type_, flags_, PM_TOKEN_START(token_), PM_TOKEN_END(token_)) +#define PM_NODE_INIT_NODE(parser_, type_, flags_, node_) PM_NODE_INIT(parser_, type_, flags_, PM_NODE_START(node_), PM_NODE_END(node_)) + +#define PM_NODE_INIT_TOKENS(parser_, type_, flags_, left_, right_) PM_NODE_INIT(parser_, type_, flags_, PM_TOKEN_START(left_), PM_TOKEN_END(right_)) +#define PM_NODE_INIT_NODES(parser_, type_, flags_, left_, right_) PM_NODE_INIT(parser_, type_, flags_, PM_NODE_START(left_), PM_NODE_END(right_)) +#define PM_NODE_INIT_TOKEN_NODE(parser_, type_, flags_, token_, node_) PM_NODE_INIT(parser_, type_, flags_, PM_TOKEN_START(token_), PM_NODE_END(node_)) +#define PM_NODE_INIT_NODE_TOKEN(parser_, type_, flags_, node_, token_) PM_NODE_INIT(parser_, type_, flags_, PM_NODE_START(node_), PM_TOKEN_END(token_)) /** * Allocate a new MissingNode node. @@ -1938,11 +1964,9 @@ static pm_missing_node_t * pm_missing_node_create(pm_parser_t *parser, const uint8_t *start, const uint8_t *end) { pm_missing_node_t *node = PM_NODE_ALLOC(parser, pm_missing_node_t); - *node = (pm_missing_node_t) {{ - .type = PM_MISSING_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { .start = start, .end = end } - }}; + *node = (pm_missing_node_t) { + .base = PM_NODE_INIT(parser, PM_MISSING_NODE, 0, start, end) + }; return node; } @@ -1956,14 +1980,7 @@ pm_alias_global_variable_node_create(pm_parser_t *parser, const pm_token_t *keyw pm_alias_global_variable_node_t *node = PM_NODE_ALLOC(parser, pm_alias_global_variable_node_t); *node = (pm_alias_global_variable_node_t) { - { - .type = PM_ALIAS_GLOBAL_VARIABLE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = old_name->location.end - }, - }, + .base = PM_NODE_INIT_TOKEN_NODE(parser, PM_ALIAS_GLOBAL_VARIABLE_NODE, 0, keyword, old_name), .new_name = new_name, .old_name = old_name, .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword) @@ -1981,14 +1998,7 @@ pm_alias_method_node_create(pm_parser_t *parser, const pm_token_t *keyword, pm_n pm_alias_method_node_t *node = PM_NODE_ALLOC(parser, pm_alias_method_node_t); *node = (pm_alias_method_node_t) { - { - .type = PM_ALIAS_METHOD_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = old_name->location.end - }, - }, + .base = PM_NODE_INIT_TOKEN_NODE(parser, PM_ALIAS_METHOD_NODE, 0, keyword, old_name), .new_name = new_name, .old_name = old_name, .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword) @@ -2005,14 +2015,7 @@ pm_alternation_pattern_node_create(pm_parser_t *parser, pm_node_t *left, pm_node pm_alternation_pattern_node_t *node = PM_NODE_ALLOC(parser, pm_alternation_pattern_node_t); *node = (pm_alternation_pattern_node_t) { - { - .type = PM_ALTERNATION_PATTERN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = left->location.start, - .end = right->location.end - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_ALTERNATION_PATTERN_NODE, 0, left, right), .left = left, .right = right, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) @@ -2031,14 +2034,7 @@ pm_and_node_create(pm_parser_t *parser, pm_node_t *left, const pm_token_t *opera pm_and_node_t *node = PM_NODE_ALLOC(parser, pm_and_node_t); *node = (pm_and_node_t) { - { - .type = PM_AND_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = left->location.start, - .end = right->location.end - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_AND_NODE, 0, left, right), .left = left, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .right = right @@ -2055,11 +2051,7 @@ pm_arguments_node_create(pm_parser_t *parser) { pm_arguments_node_t *node = PM_NODE_ALLOC(parser, pm_arguments_node_t); *node = (pm_arguments_node_t) { - { - .type = PM_ARGUMENTS_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_NULL_VALUE(parser) - }, + .base = PM_NODE_INIT_BASE(parser, PM_ARGUMENTS_NODE, 0), .arguments = { 0 } }; @@ -2083,14 +2075,17 @@ pm_arguments_node_arguments_append(pm_arguments_node_t *node, pm_node_t *argumen node->base.location.start = argument->location.start; } - node->base.location.end = argument->location.end; + if (node->base.location.end < argument->location.end) { + node->base.location.end = argument->location.end; + } + pm_node_list_append(&node->arguments, argument); if (PM_NODE_TYPE_P(argument, PM_SPLAT_NODE)) { if (PM_NODE_FLAG_P(node, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT)) { - pm_node_flag_set((pm_node_t *) node, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_MULTIPLE_SPLATS); + pm_node_flag_set(UP(node), PM_ARGUMENTS_NODE_FLAGS_CONTAINS_MULTIPLE_SPLATS); } else { - pm_node_flag_set((pm_node_t *) node, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT); + pm_node_flag_set(UP(node), PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT); } } } @@ -2103,12 +2098,7 @@ pm_array_node_create(pm_parser_t *parser, const pm_token_t *opening) { pm_array_node_t *node = PM_NODE_ALLOC(parser, pm_array_node_t); *node = (pm_array_node_t) { - { - .type = PM_ARRAY_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(opening) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_ARRAY_NODE, PM_NODE_FLAG_STATIC_LITERAL, opening), .opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening), .closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening), .elements = { 0 } @@ -2132,11 +2122,11 @@ pm_array_node_elements_append(pm_array_node_t *node, pm_node_t *element) { // If the element is not a static literal, then the array is not a static // literal. Turn that flag off. if (PM_NODE_TYPE_P(element, PM_ARRAY_NODE) || PM_NODE_TYPE_P(element, PM_HASH_NODE) || PM_NODE_TYPE_P(element, PM_RANGE_NODE) || !PM_NODE_FLAG_P(element, PM_NODE_FLAG_STATIC_LITERAL)) { - pm_node_flag_unset((pm_node_t *)node, PM_NODE_FLAG_STATIC_LITERAL); + pm_node_flag_unset(UP(node), PM_NODE_FLAG_STATIC_LITERAL); } if (PM_NODE_TYPE_P(element, PM_SPLAT_NODE)) { - pm_node_flag_set((pm_node_t *)node, PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT); + pm_node_flag_set(UP(node), PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT); } } @@ -2159,20 +2149,13 @@ pm_array_pattern_node_node_list_create(pm_parser_t *parser, pm_node_list_t *node pm_array_pattern_node_t *node = PM_NODE_ALLOC(parser, pm_array_pattern_node_t); *node = (pm_array_pattern_node_t) { - { - .type = PM_ARRAY_PATTERN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = nodes->nodes[0]->location.start, - .end = nodes->nodes[nodes->size - 1]->location.end - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_ARRAY_PATTERN_NODE, 0, nodes->nodes[0], nodes->nodes[nodes->size - 1]), .constant = NULL, .rest = NULL, .requireds = { 0 }, .posts = { 0 }, - .opening_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, - .closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE + .opening_loc = { 0 }, + .closing_loc = { 0 } }; // For now we're going to just copy over each pointer manually. This could be @@ -2202,17 +2185,13 @@ pm_array_pattern_node_rest_create(pm_parser_t *parser, pm_node_t *rest) { pm_array_pattern_node_t *node = PM_NODE_ALLOC(parser, pm_array_pattern_node_t); *node = (pm_array_pattern_node_t) { - { - .type = PM_ARRAY_PATTERN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = rest->location, - }, + .base = PM_NODE_INIT_NODE(parser, PM_ARRAY_PATTERN_NODE, 0, rest), .constant = NULL, .rest = rest, .requireds = { 0 }, .posts = { 0 }, - .opening_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, - .closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE + .opening_loc = { 0 }, + .closing_loc = { 0 } }; return node; @@ -2227,14 +2206,7 @@ pm_array_pattern_node_constant_create(pm_parser_t *parser, pm_node_t *constant, pm_array_pattern_node_t *node = PM_NODE_ALLOC(parser, pm_array_pattern_node_t); *node = (pm_array_pattern_node_t) { - { - .type = PM_ARRAY_PATTERN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = constant->location.start, - .end = closing->end - }, - }, + .base = PM_NODE_INIT_NODE_TOKEN(parser, PM_ARRAY_PATTERN_NODE, 0, constant, closing), .constant = constant, .rest = NULL, .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), @@ -2255,14 +2227,7 @@ pm_array_pattern_node_empty_create(pm_parser_t *parser, const pm_token_t *openin pm_array_pattern_node_t *node = PM_NODE_ALLOC(parser, pm_array_pattern_node_t); *node = (pm_array_pattern_node_t) { - { - .type = PM_ARRAY_PATTERN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = closing->end - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_ARRAY_PATTERN_NODE, 0, opening, closing), .constant = NULL, .rest = NULL, .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), @@ -2313,15 +2278,7 @@ pm_assoc_node_create(pm_parser_t *parser, pm_node_t *key, const pm_token_t *oper } *node = (pm_assoc_node_t) { - { - .type = PM_ASSOC_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = key->location.start, - .end = end - }, - }, + .base = PM_NODE_INIT(parser, PM_ASSOC_NODE, flags, key->location.start, end), .key = key, .operator_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(operator), .value = value @@ -2339,14 +2296,11 @@ pm_assoc_splat_node_create(pm_parser_t *parser, pm_node_t *value, const pm_token pm_assoc_splat_node_t *node = PM_NODE_ALLOC(parser, pm_assoc_splat_node_t); *node = (pm_assoc_splat_node_t) { - { - .type = PM_ASSOC_SPLAT_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = value == NULL ? operator->end : value->location.end - }, - }, + .base = ( + (value == NULL) + ? PM_NODE_INIT_TOKEN(parser, PM_ASSOC_SPLAT_NODE, 0, operator) + : PM_NODE_INIT_TOKEN_NODE(parser, PM_ASSOC_SPLAT_NODE, 0, operator, value) + ), .value = value, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) }; @@ -2363,11 +2317,7 @@ pm_back_reference_read_node_create(pm_parser_t *parser, const pm_token_t *name) pm_back_reference_read_node_t *node = PM_NODE_ALLOC(parser, pm_back_reference_read_node_t); *node = (pm_back_reference_read_node_t) { - { - .type = PM_BACK_REFERENCE_READ_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(name), - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_BACK_REFERENCE_READ_NODE, 0, name), .name = pm_parser_constant_id_token(parser, name) }; @@ -2382,17 +2332,14 @@ pm_begin_node_create(pm_parser_t *parser, const pm_token_t *begin_keyword, pm_st pm_begin_node_t *node = PM_NODE_ALLOC(parser, pm_begin_node_t); *node = (pm_begin_node_t) { - { - .type = PM_BEGIN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = begin_keyword->start, - .end = statements == NULL ? begin_keyword->end : statements->base.location.end - }, - }, + .base = ( + (statements == NULL) + ? PM_NODE_INIT_TOKEN(parser, PM_BEGIN_NODE, 0, begin_keyword) + : PM_NODE_INIT_TOKEN_NODE(parser, PM_BEGIN_NODE, 0, begin_keyword, statements) + ), .begin_keyword_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(begin_keyword), .statements = statements, - .end_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE + .end_keyword_loc = { 0 } }; return node; @@ -2448,14 +2395,11 @@ pm_block_argument_node_create(pm_parser_t *parser, const pm_token_t *operator, p pm_block_argument_node_t *node = PM_NODE_ALLOC(parser, pm_block_argument_node_t); *node = (pm_block_argument_node_t) { - { - .type = PM_BLOCK_ARGUMENT_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = expression == NULL ? operator->end : expression->location.end - }, - }, + .base = ( + (expression == NULL) + ? PM_NODE_INIT_TOKEN(parser, PM_BLOCK_ARGUMENT_NODE, 0, operator) + : PM_NODE_INIT_TOKEN_NODE(parser, PM_BLOCK_ARGUMENT_NODE, 0, operator, expression) + ), .expression = expression, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) }; @@ -2471,11 +2415,7 @@ pm_block_node_create(pm_parser_t *parser, pm_constant_id_list_t *locals, const p pm_block_node_t *node = PM_NODE_ALLOC(parser, pm_block_node_t); *node = (pm_block_node_t) { - { - .type = PM_BLOCK_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { .start = opening->start, .end = closing->end }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_BLOCK_NODE, 0, opening, closing), .locals = *locals, .parameters = parameters, .body = body, @@ -2495,14 +2435,11 @@ pm_block_parameter_node_create(pm_parser_t *parser, const pm_token_t *name, cons pm_block_parameter_node_t *node = PM_NODE_ALLOC(parser, pm_block_parameter_node_t); *node = (pm_block_parameter_node_t) { - { - .type = PM_BLOCK_PARAMETER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = (name->type == PM_TOKEN_NOT_PROVIDED ? operator->end : name->end) - }, - }, + .base = ( + (name->type == PM_TOKEN_NOT_PROVIDED) + ? PM_NODE_INIT_TOKEN(parser, PM_BLOCK_PARAMETER_NODE, 0, operator) + : PM_NODE_INIT_TOKENS(parser, PM_BLOCK_PARAMETER_NODE, 0, operator, name) + ), .name = pm_parser_optional_constant_id_token(parser, name), .name_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(name), .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) @@ -2537,17 +2474,10 @@ pm_block_parameters_node_create(pm_parser_t *parser, pm_parameters_node_t *param } *node = (pm_block_parameters_node_t) { - { - .type = PM_BLOCK_PARAMETERS_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = start, - .end = end - } - }, + .base = PM_NODE_INIT(parser, PM_BLOCK_PARAMETERS_NODE, 0, start, end), .parameters = parameters, .opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening), - .closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, + .closing_loc = { 0 }, .locals = { 0 } }; @@ -2573,11 +2503,7 @@ pm_block_local_variable_node_create(pm_parser_t *parser, const pm_token_t *name) pm_block_local_variable_node_t *node = PM_NODE_ALLOC(parser, pm_block_local_variable_node_t); *node = (pm_block_local_variable_node_t) { - { - .type = PM_BLOCK_LOCAL_VARIABLE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(name), - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_BLOCK_LOCAL_VARIABLE_NODE, 0, name), .name = pm_parser_constant_id_token(parser, name) }; @@ -2589,7 +2515,7 @@ pm_block_local_variable_node_create(pm_parser_t *parser, const pm_token_t *name) */ static void pm_block_parameters_node_append_local(pm_block_parameters_node_t *node, const pm_block_local_variable_node_t *local) { - pm_node_list_append(&node->locals, (pm_node_t *) local); + pm_node_list_append(&node->locals, UP(local)); if (node->base.location.start == NULL) node->base.location.start = local->base.location.start; node->base.location.end = local->base.location.end; @@ -2604,14 +2530,11 @@ pm_break_node_create(pm_parser_t *parser, const pm_token_t *keyword, pm_argument pm_break_node_t *node = PM_NODE_ALLOC(parser, pm_break_node_t); *node = (pm_break_node_t) { - { - .type = PM_BREAK_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = (arguments == NULL ? keyword->end : arguments->base.location.end) - }, - }, + .base = ( + (arguments == NULL) + ? PM_NODE_INIT_TOKEN(parser, PM_BREAK_NODE, 0, keyword) + : PM_NODE_INIT_TOKEN_NODE(parser, PM_BREAK_NODE, 0, keyword, arguments) + ), .arguments = arguments, .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword) }; @@ -2622,10 +2545,11 @@ pm_break_node_create(pm_parser_t *parser, const pm_token_t *keyword, pm_argument // There are certain flags that we want to use internally but don't want to // expose because they are not relevant beyond parsing. Therefore we'll define // them here and not define them in config.yml/a header file. -static const pm_node_flags_t PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY = 0x4; -static const pm_node_flags_t PM_CALL_NODE_FLAGS_IMPLICIT_ARRAY = 0x40; -static const pm_node_flags_t PM_CALL_NODE_FLAGS_COMPARISON = 0x80; -static const pm_node_flags_t PM_CALL_NODE_FLAGS_INDEX = 0x100; +static const pm_node_flags_t PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY = (1 << 2); + +static const pm_node_flags_t PM_CALL_NODE_FLAGS_IMPLICIT_ARRAY = ((PM_CALL_NODE_FLAGS_LAST - 1) << 1); +static const pm_node_flags_t PM_CALL_NODE_FLAGS_COMPARISON = ((PM_CALL_NODE_FLAGS_LAST - 1) << 2); +static const pm_node_flags_t PM_CALL_NODE_FLAGS_INDEX = ((PM_CALL_NODE_FLAGS_LAST - 1) << 3); /** * Allocate and initialize a new CallNode node. This sets everything to NULL or @@ -2637,18 +2561,14 @@ pm_call_node_create(pm_parser_t *parser, pm_node_flags_t flags) { pm_call_node_t *node = PM_NODE_ALLOC(parser, pm_call_node_t); *node = (pm_call_node_t) { - { - .type = PM_CALL_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_NULL_VALUE(parser), - }, + .base = PM_NODE_INIT_BASE(parser, PM_CALL_NODE, flags), .receiver = NULL, - .call_operator_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, - .message_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, - .opening_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, + .call_operator_loc = { 0 }, + .message_loc = { 0 }, + .opening_loc = { 0 }, .arguments = NULL, - .closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, + .closing_loc = { 0 }, + .equal_loc = { 0 }, .block = NULL, .name = 0 }; @@ -2720,6 +2640,8 @@ pm_call_node_binary_create(pm_parser_t *parser, pm_node_t *receiver, pm_token_t return node; } +static const uint8_t * parse_operator_symbol_name(const pm_token_t *); + /** * Allocate and initialize a new CallNode node from a call expression. */ @@ -2745,10 +2667,14 @@ pm_call_node_call_create(pm_parser_t *parser, pm_node_t *receiver, pm_token_t *o node->block = arguments->block; if (operator->type == PM_TOKEN_AMPERSAND_DOT) { - pm_node_flag_set((pm_node_t *)node, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION); + pm_node_flag_set(UP(node), PM_CALL_NODE_FLAGS_SAFE_NAVIGATION); } - node->name = pm_parser_constant_id_token(parser, message); + /** + * If the final character is `@` as is the case for `foo.~@`, + * we should ignore the @ in the same way we do for symbols. + */ + node->name = pm_parser_constant_id_location(parser, message->start, parse_operator_symbol_name(message)); return node; } @@ -2854,7 +2780,7 @@ pm_call_node_shorthand_create(pm_parser_t *parser, pm_node_t *receiver, pm_token node->block = arguments->block; if (operator->type == PM_TOKEN_AMPERSAND_DOT) { - pm_node_flag_set((pm_node_t *)node, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION); + pm_node_flag_set(UP(node), PM_CALL_NODE_FLAGS_SAFE_NAVIGATION); } node->name = pm_parser_constant_id_constant(parser, "call", 4); @@ -2942,15 +2868,7 @@ pm_call_and_write_node_create(pm_parser_t *parser, pm_call_node_t *target, const pm_call_and_write_node_t *node = PM_NODE_ALLOC(parser, pm_call_and_write_node_t); *node = (pm_call_and_write_node_t) { - { - .type = PM_CALL_AND_WRITE_NODE, - .flags = target->base.flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CALL_AND_WRITE_NODE, FL(target), target, value), .receiver = target->receiver, .call_operator_loc = target->call_operator_loc, .message_loc = target->message_loc, @@ -2976,7 +2894,7 @@ pm_call_and_write_node_create(pm_parser_t *parser, pm_call_node_t *target, const */ static void pm_index_arguments_check(pm_parser_t *parser, const pm_arguments_node_t *arguments, const pm_node_t *block) { - if (parser->version != PM_OPTIONS_VERSION_CRUBY_3_3) { + if (parser->version >= PM_OPTIONS_VERSION_CRUBY_3_4) { if (arguments != NULL && PM_NODE_FLAG_P(arguments, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS)) { pm_node_t *node; PM_NODE_LIST_FOREACH(&arguments->arguments, index, node) { @@ -3005,15 +2923,7 @@ pm_index_and_write_node_create(pm_parser_t *parser, pm_call_node_t *target, cons assert(!target->block || PM_NODE_TYPE_P(target->block, PM_BLOCK_ARGUMENT_NODE)); *node = (pm_index_and_write_node_t) { - { - .type = PM_INDEX_AND_WRITE_NODE, - .flags = target->base.flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_INDEX_AND_WRITE_NODE, FL(target), target, value), .receiver = target->receiver, .call_operator_loc = target->call_operator_loc, .opening_loc = target->opening_loc, @@ -3041,15 +2951,7 @@ pm_call_operator_write_node_create(pm_parser_t *parser, pm_call_node_t *target, pm_call_operator_write_node_t *node = PM_NODE_ALLOC(parser, pm_call_operator_write_node_t); *node = (pm_call_operator_write_node_t) { - { - .type = PM_CALL_OPERATOR_WRITE_NODE, - .flags = target->base.flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CALL_OPERATOR_WRITE_NODE, FL(target), target, value), .receiver = target->receiver, .call_operator_loc = target->call_operator_loc, .message_loc = target->message_loc, @@ -3081,15 +2983,7 @@ pm_index_operator_write_node_create(pm_parser_t *parser, pm_call_node_t *target, assert(!target->block || PM_NODE_TYPE_P(target->block, PM_BLOCK_ARGUMENT_NODE)); *node = (pm_index_operator_write_node_t) { - { - .type = PM_INDEX_OPERATOR_WRITE_NODE, - .flags = target->base.flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_INDEX_OPERATOR_WRITE_NODE, FL(target), target, value), .receiver = target->receiver, .call_operator_loc = target->call_operator_loc, .opening_loc = target->opening_loc, @@ -3119,15 +3013,7 @@ pm_call_or_write_node_create(pm_parser_t *parser, pm_call_node_t *target, const pm_call_or_write_node_t *node = PM_NODE_ALLOC(parser, pm_call_or_write_node_t); *node = (pm_call_or_write_node_t) { - { - .type = PM_CALL_OR_WRITE_NODE, - .flags = target->base.flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CALL_OR_WRITE_NODE, FL(target), target, value), .receiver = target->receiver, .call_operator_loc = target->call_operator_loc, .message_loc = target->message_loc, @@ -3159,15 +3045,7 @@ pm_index_or_write_node_create(pm_parser_t *parser, pm_call_node_t *target, const assert(!target->block || PM_NODE_TYPE_P(target->block, PM_BLOCK_ARGUMENT_NODE)); *node = (pm_index_or_write_node_t) { - { - .type = PM_INDEX_OR_WRITE_NODE, - .flags = target->base.flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_INDEX_OR_WRITE_NODE, FL(target), target, value), .receiver = target->receiver, .call_operator_loc = target->call_operator_loc, .opening_loc = target->opening_loc, @@ -3195,18 +3073,24 @@ pm_call_target_node_create(pm_parser_t *parser, pm_call_node_t *target) { pm_call_target_node_t *node = PM_NODE_ALLOC(parser, pm_call_target_node_t); *node = (pm_call_target_node_t) { - { - .type = PM_CALL_TARGET_NODE, - .flags = target->base.flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = target->base.location - }, + .base = PM_NODE_INIT_NODE(parser, PM_CALL_TARGET_NODE, FL(target), target), .receiver = target->receiver, .call_operator_loc = target->call_operator_loc, .name = target->name, .message_loc = target->message_loc }; + /* It is possible to get here where we have parsed an invalid syntax tree + * where the call operator was not present. In that case we will have a + * problem because it is a required location. In this case we need to fill + * it in with a fake location so that the syntax tree remains valid. */ + if (node->call_operator_loc.start == NULL) { + node->call_operator_loc = (pm_location_t) { + .start = target->base.location.start, + .end = target->base.location.start + }; + } + // Here we're going to free the target, since it is no longer necessary. // However, we don't want to call `pm_node_destroy` because we want to keep // around all of its children since we just reused them. @@ -3222,18 +3106,12 @@ pm_call_target_node_create(pm_parser_t *parser, pm_call_node_t *target) { static pm_index_target_node_t * pm_index_target_node_create(pm_parser_t *parser, pm_call_node_t *target) { pm_index_target_node_t *node = PM_NODE_ALLOC(parser, pm_index_target_node_t); - pm_node_flags_t flags = target->base.flags; pm_index_arguments_check(parser, target->arguments, target->block); - assert(!target->block || PM_NODE_TYPE_P(target->block, PM_BLOCK_ARGUMENT_NODE)); + *node = (pm_index_target_node_t) { - { - .type = PM_INDEX_TARGET_NODE, - .flags = flags | PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = target->base.location - }, + .base = PM_NODE_INIT_NODE(parser, PM_INDEX_TARGET_NODE, FL(target) | PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE, target), .receiver = target->receiver, .opening_loc = target->opening_loc, .arguments = target->arguments, @@ -3257,14 +3135,7 @@ pm_capture_pattern_node_create(pm_parser_t *parser, pm_node_t *value, pm_local_v pm_capture_pattern_node_t *node = PM_NODE_ALLOC(parser, pm_capture_pattern_node_t); *node = (pm_capture_pattern_node_t) { - { - .type = PM_CAPTURE_PATTERN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = value->location.start, - .end = target->base.location.end - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_CAPTURE_PATTERN_NODE, 0, value, target), .value = value, .target = target, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) @@ -3281,14 +3152,7 @@ pm_case_node_create(pm_parser_t *parser, const pm_token_t *case_keyword, pm_node pm_case_node_t *node = PM_NODE_ALLOC(parser, pm_case_node_t); *node = (pm_case_node_t) { - { - .type = PM_CASE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = case_keyword->start, - .end = end_keyword->end - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_CASE_NODE, 0, case_keyword, end_keyword), .predicate = predicate, .else_clause = NULL, .case_keyword_loc = PM_LOCATION_TOKEN_VALUE(case_keyword), @@ -3336,14 +3200,7 @@ pm_case_match_node_create(pm_parser_t *parser, const pm_token_t *case_keyword, p pm_case_match_node_t *node = PM_NODE_ALLOC(parser, pm_case_match_node_t); *node = (pm_case_match_node_t) { - { - .type = PM_CASE_MATCH_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = case_keyword->start, - .end = end_keyword->end - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_CASE_MATCH_NODE, 0, case_keyword, end_keyword), .predicate = predicate, .else_clause = NULL, .case_keyword_loc = PM_LOCATION_TOKEN_VALUE(case_keyword), @@ -3391,11 +3248,7 @@ pm_class_node_create(pm_parser_t *parser, pm_constant_id_list_t *locals, const p pm_class_node_t *node = PM_NODE_ALLOC(parser, pm_class_node_t); *node = (pm_class_node_t) { - { - .type = PM_CLASS_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { .start = class_keyword->start, .end = end_keyword->end }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_CLASS_NODE, 0, class_keyword, end_keyword), .locals = *locals, .class_keyword_loc = PM_LOCATION_TOKEN_VALUE(class_keyword), .constant_path = constant_path, @@ -3418,14 +3271,7 @@ pm_class_variable_and_write_node_create(pm_parser_t *parser, pm_class_variable_r pm_class_variable_and_write_node_t *node = PM_NODE_ALLOC(parser, pm_class_variable_and_write_node_t); *node = (pm_class_variable_and_write_node_t) { - { - .type = PM_CLASS_VARIABLE_AND_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CLASS_VARIABLE_AND_WRITE_NODE, 0, target, value), .name = target->name, .name_loc = target->base.location, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -3443,14 +3289,7 @@ pm_class_variable_operator_write_node_create(pm_parser_t *parser, pm_class_varia pm_class_variable_operator_write_node_t *node = PM_NODE_ALLOC(parser, pm_class_variable_operator_write_node_t); *node = (pm_class_variable_operator_write_node_t) { - { - .type = PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE, 0, target, value), .name = target->name, .name_loc = target->base.location, .binary_operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -3470,14 +3309,7 @@ pm_class_variable_or_write_node_create(pm_parser_t *parser, pm_class_variable_re pm_class_variable_or_write_node_t *node = PM_NODE_ALLOC(parser, pm_class_variable_or_write_node_t); *node = (pm_class_variable_or_write_node_t) { - { - .type = PM_CLASS_VARIABLE_OR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CLASS_VARIABLE_OR_WRITE_NODE, 0, target, value), .name = target->name, .name_loc = target->base.location, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -3496,11 +3328,7 @@ pm_class_variable_read_node_create(pm_parser_t *parser, const pm_token_t *token) pm_class_variable_read_node_t *node = PM_NODE_ALLOC(parser, pm_class_variable_read_node_t); *node = (pm_class_variable_read_node_t) { - { - .type = PM_CLASS_VARIABLE_READ_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_CLASS_VARIABLE_READ_NODE, 0, token), .name = pm_parser_constant_id_token(parser, token) }; @@ -3527,19 +3355,12 @@ pm_implicit_array_write_flags(const pm_node_t *node, pm_node_flags_t flags) { static pm_class_variable_write_node_t * pm_class_variable_write_node_create(pm_parser_t *parser, pm_class_variable_read_node_t *read_node, pm_token_t *operator, pm_node_t *value) { pm_class_variable_write_node_t *node = PM_NODE_ALLOC(parser, pm_class_variable_write_node_t); + pm_node_flags_t flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY); *node = (pm_class_variable_write_node_t) { - { - .type = PM_CLASS_VARIABLE_WRITE_NODE, - .flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY), - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = read_node->base.location.start, - .end = value->location.end - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_CLASS_VARIABLE_WRITE_NODE, flags, read_node, value), .name = read_node->name, - .name_loc = PM_LOCATION_NODE_VALUE((pm_node_t *) read_node), + .name_loc = PM_LOCATION_NODE_VALUE(UP(read_node)), .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .value = value }; @@ -3556,14 +3377,7 @@ pm_constant_path_and_write_node_create(pm_parser_t *parser, pm_constant_path_nod pm_constant_path_and_write_node_t *node = PM_NODE_ALLOC(parser, pm_constant_path_and_write_node_t); *node = (pm_constant_path_and_write_node_t) { - { - .type = PM_CONSTANT_PATH_AND_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CONSTANT_PATH_AND_WRITE_NODE, 0, target, value), .target = target, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .value = value @@ -3580,14 +3394,7 @@ pm_constant_path_operator_write_node_create(pm_parser_t *parser, pm_constant_pat pm_constant_path_operator_write_node_t *node = PM_NODE_ALLOC(parser, pm_constant_path_operator_write_node_t); *node = (pm_constant_path_operator_write_node_t) { - { - .type = PM_CONSTANT_PATH_OPERATOR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CONSTANT_PATH_OPERATOR_WRITE_NODE, 0, target, value), .target = target, .binary_operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .value = value, @@ -3606,14 +3413,7 @@ pm_constant_path_or_write_node_create(pm_parser_t *parser, pm_constant_path_node pm_constant_path_or_write_node_t *node = PM_NODE_ALLOC(parser, pm_constant_path_or_write_node_t); *node = (pm_constant_path_or_write_node_t) { - { - .type = PM_CONSTANT_PATH_OR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CONSTANT_PATH_OR_WRITE_NODE, 0, target, value), .target = target, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .value = value @@ -3635,20 +3435,23 @@ pm_constant_path_node_create(pm_parser_t *parser, pm_node_t *parent, const pm_to name = pm_parser_constant_id_token(parser, name_token); } - *node = (pm_constant_path_node_t) { - { - .type = PM_CONSTANT_PATH_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = parent == NULL ? delimiter->start : parent->location.start, - .end = name_token->end - }, - }, - .parent = parent, - .name = name, - .delimiter_loc = PM_LOCATION_TOKEN_VALUE(delimiter), - .name_loc = PM_LOCATION_TOKEN_VALUE(name_token) - }; + if (parent == NULL) { + *node = (pm_constant_path_node_t) { + .base = PM_NODE_INIT_TOKENS(parser, PM_CONSTANT_PATH_NODE, 0, delimiter, name_token), + .parent = parent, + .name = name, + .delimiter_loc = PM_LOCATION_TOKEN_VALUE(delimiter), + .name_loc = PM_LOCATION_TOKEN_VALUE(name_token) + }; + } else { + *node = (pm_constant_path_node_t) { + .base = PM_NODE_INIT_NODE_TOKEN(parser, PM_CONSTANT_PATH_NODE, 0, parent, name_token), + .parent = parent, + .name = name, + .delimiter_loc = PM_LOCATION_TOKEN_VALUE(delimiter), + .name_loc = PM_LOCATION_TOKEN_VALUE(name_token) + }; + } return node; } @@ -3659,17 +3462,10 @@ pm_constant_path_node_create(pm_parser_t *parser, pm_node_t *parent, const pm_to static pm_constant_path_write_node_t * pm_constant_path_write_node_create(pm_parser_t *parser, pm_constant_path_node_t *target, const pm_token_t *operator, pm_node_t *value) { pm_constant_path_write_node_t *node = PM_NODE_ALLOC(parser, pm_constant_path_write_node_t); + pm_node_flags_t flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY); *node = (pm_constant_path_write_node_t) { - { - .type = PM_CONSTANT_PATH_WRITE_NODE, - .flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY), - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_CONSTANT_PATH_WRITE_NODE, flags, target, value), .target = target, .operator_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(operator), .value = value @@ -3687,14 +3483,7 @@ pm_constant_and_write_node_create(pm_parser_t *parser, pm_constant_read_node_t * pm_constant_and_write_node_t *node = PM_NODE_ALLOC(parser, pm_constant_and_write_node_t); *node = (pm_constant_and_write_node_t) { - { - .type = PM_CONSTANT_AND_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CONSTANT_AND_WRITE_NODE, 0, target, value), .name = target->name, .name_loc = target->base.location, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -3712,14 +3501,7 @@ pm_constant_operator_write_node_create(pm_parser_t *parser, pm_constant_read_nod pm_constant_operator_write_node_t *node = PM_NODE_ALLOC(parser, pm_constant_operator_write_node_t); *node = (pm_constant_operator_write_node_t) { - { - .type = PM_CONSTANT_OPERATOR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CONSTANT_OPERATOR_WRITE_NODE, 0, target, value), .name = target->name, .name_loc = target->base.location, .binary_operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -3739,14 +3521,7 @@ pm_constant_or_write_node_create(pm_parser_t *parser, pm_constant_read_node_t *t pm_constant_or_write_node_t *node = PM_NODE_ALLOC(parser, pm_constant_or_write_node_t); *node = (pm_constant_or_write_node_t) { - { - .type = PM_CONSTANT_OR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CONSTANT_OR_WRITE_NODE, 0, target, value), .name = target->name, .name_loc = target->base.location, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -3765,11 +3540,7 @@ pm_constant_read_node_create(pm_parser_t *parser, const pm_token_t *name) { pm_constant_read_node_t *node = PM_NODE_ALLOC(parser, pm_constant_read_node_t); *node = (pm_constant_read_node_t) { - { - .type = PM_CONSTANT_READ_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(name) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_CONSTANT_READ_NODE, 0, name), .name = pm_parser_constant_id_token(parser, name) }; @@ -3782,17 +3553,10 @@ pm_constant_read_node_create(pm_parser_t *parser, const pm_token_t *name) { static pm_constant_write_node_t * pm_constant_write_node_create(pm_parser_t *parser, pm_constant_read_node_t *target, const pm_token_t *operator, pm_node_t *value) { pm_constant_write_node_t *node = PM_NODE_ALLOC(parser, pm_constant_write_node_t); + pm_node_flags_t flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY); *node = (pm_constant_write_node_t) { - { - .type = PM_CONSTANT_WRITE_NODE, - .flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY), - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_CONSTANT_WRITE_NODE, flags, target, value), .name = target->name, .name_loc = target->base.location, .operator_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(operator), @@ -3810,7 +3574,7 @@ pm_def_node_receiver_check(pm_parser_t *parser, const pm_node_t *node) { switch (PM_NODE_TYPE(node)) { case PM_BEGIN_NODE: { const pm_begin_node_t *cast = (pm_begin_node_t *) node; - if (cast->statements != NULL) pm_def_node_receiver_check(parser, (pm_node_t *) cast->statements); + if (cast->statements != NULL) pm_def_node_receiver_check(parser, UP(cast->statements)); break; } case PM_PARENTHESES_NODE: { @@ -3866,24 +3630,17 @@ pm_def_node_create( const pm_token_t *end_keyword ) { pm_def_node_t *node = PM_NODE_ALLOC(parser, pm_def_node_t); - const uint8_t *end; - - if (end_keyword->type == PM_TOKEN_NOT_PROVIDED) { - end = body->location.end; - } else { - end = end_keyword->end; - } if (receiver != NULL) { pm_def_node_receiver_check(parser, receiver); } *node = (pm_def_node_t) { - { - .type = PM_DEF_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { .start = def_keyword->start, .end = end }, - }, + .base = ( + (end_keyword->type == PM_TOKEN_NOT_PROVIDED) + ? PM_NODE_INIT_TOKEN_NODE(parser, PM_DEF_NODE, 0, def_keyword, body) + : PM_NODE_INIT_TOKENS(parser, PM_DEF_NODE, 0, def_keyword, end_keyword) + ), .name = name, .name_loc = PM_LOCATION_TOKEN_VALUE(name_loc), .receiver = receiver, @@ -3905,22 +3662,19 @@ pm_def_node_create( * Allocate a new DefinedNode node. */ static pm_defined_node_t * -pm_defined_node_create(pm_parser_t *parser, const pm_token_t *lparen, pm_node_t *value, const pm_token_t *rparen, const pm_location_t *keyword_loc) { +pm_defined_node_create(pm_parser_t *parser, const pm_token_t *lparen, pm_node_t *value, const pm_token_t *rparen, const pm_token_t *keyword) { pm_defined_node_t *node = PM_NODE_ALLOC(parser, pm_defined_node_t); *node = (pm_defined_node_t) { - { - .type = PM_DEFINED_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword_loc->start, - .end = (rparen->type == PM_TOKEN_NOT_PROVIDED ? value->location.end : rparen->end) - }, - }, + .base = ( + (rparen->type == PM_TOKEN_NOT_PROVIDED) + ? PM_NODE_INIT_TOKEN_NODE(parser, PM_DEFINED_NODE, 0, keyword, value) + : PM_NODE_INIT_TOKENS(parser, PM_DEFINED_NODE, 0, keyword, rparen) + ), .lparen_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(lparen), .value = value, .rparen_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(rparen), - .keyword_loc = *keyword_loc + .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword) }; return node; @@ -3932,22 +3686,13 @@ pm_defined_node_create(pm_parser_t *parser, const pm_token_t *lparen, pm_node_t static pm_else_node_t * pm_else_node_create(pm_parser_t *parser, const pm_token_t *else_keyword, pm_statements_node_t *statements, const pm_token_t *end_keyword) { pm_else_node_t *node = PM_NODE_ALLOC(parser, pm_else_node_t); - const uint8_t *end = NULL; - if ((end_keyword->type == PM_TOKEN_NOT_PROVIDED) && (statements != NULL)) { - end = statements->base.location.end; - } else { - end = end_keyword->end; - } *node = (pm_else_node_t) { - { - .type = PM_ELSE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = else_keyword->start, - .end = end, - }, - }, + .base = ( + ((end_keyword->type == PM_TOKEN_NOT_PROVIDED) && (statements != NULL)) + ? PM_NODE_INIT_TOKEN_NODE(parser, PM_ELSE_NODE, 0, else_keyword, statements) + : PM_NODE_INIT_TOKENS(parser, PM_ELSE_NODE, 0, else_keyword, end_keyword) + ), .else_keyword_loc = PM_LOCATION_TOKEN_VALUE(else_keyword), .statements = statements, .end_keyword_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(end_keyword) @@ -3964,14 +3709,7 @@ pm_embedded_statements_node_create(pm_parser_t *parser, const pm_token_t *openin pm_embedded_statements_node_t *node = PM_NODE_ALLOC(parser, pm_embedded_statements_node_t); *node = (pm_embedded_statements_node_t) { - { - .type = PM_EMBEDDED_STATEMENTS_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = closing->end - } - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_EMBEDDED_STATEMENTS_NODE, 0, opening, closing), .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), .statements = statements, .closing_loc = PM_LOCATION_TOKEN_VALUE(closing) @@ -3988,14 +3726,7 @@ pm_embedded_variable_node_create(pm_parser_t *parser, const pm_token_t *operator pm_embedded_variable_node_t *node = PM_NODE_ALLOC(parser, pm_embedded_variable_node_t); *node = (pm_embedded_variable_node_t) { - { - .type = PM_EMBEDDED_VARIABLE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = variable->location.end - } - }, + .base = PM_NODE_INIT_TOKEN_NODE(parser, PM_EMBEDDED_VARIABLE_NODE, 0, operator, variable), .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .variable = variable }; @@ -4011,14 +3742,7 @@ pm_ensure_node_create(pm_parser_t *parser, const pm_token_t *ensure_keyword, pm_ pm_ensure_node_t *node = PM_NODE_ALLOC(parser, pm_ensure_node_t); *node = (pm_ensure_node_t) { - { - .type = PM_ENSURE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = ensure_keyword->start, - .end = end_keyword->end - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_ENSURE_NODE, 0, ensure_keyword, end_keyword), .ensure_keyword_loc = PM_LOCATION_TOKEN_VALUE(ensure_keyword), .statements = statements, .end_keyword_loc = PM_LOCATION_TOKEN_VALUE(end_keyword) @@ -4035,12 +3759,9 @@ pm_false_node_create(pm_parser_t *parser, const pm_token_t *token) { assert(token->type == PM_TOKEN_KEYWORD_FALSE); pm_false_node_t *node = PM_NODE_ALLOC(parser, pm_false_node_t); - *node = (pm_false_node_t) {{ - .type = PM_FALSE_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }}; + *node = (pm_false_node_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_FALSE_NODE, PM_NODE_FLAG_STATIC_LITERAL, token) + }; return node; } @@ -4060,7 +3781,7 @@ pm_find_pattern_node_create(pm_parser_t *parser, pm_node_list_t *nodes) { pm_node_t *right; if (nodes->size == 1) { - right = (pm_node_t *) pm_missing_node_create(parser, left->location.end, left->location.end); + right = UP(pm_missing_node_create(parser, left->location.end, left->location.end)); } else { right = nodes->nodes[nodes->size - 1]; assert(PM_NODE_TYPE_P(right, PM_SPLAT_NODE)); @@ -4074,20 +3795,13 @@ pm_find_pattern_node_create(pm_parser_t *parser, pm_node_list_t *nodes) { pm_node_t *right_splat_node = right; #endif *node = (pm_find_pattern_node_t) { - { - .type = PM_FIND_PATTERN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = left->location.start, - .end = right->location.end, - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_FIND_PATTERN_NODE, 0, left, right), .constant = NULL, .left = left_splat_node, .right = right_splat_node, .requireds = { 0 }, - .opening_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, - .closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE + .opening_loc = { 0 }, + .closing_loc = { 0 } }; // For now we're going to just copy over each pointer manually. This could be @@ -4182,12 +3896,7 @@ pm_float_node_create(pm_parser_t *parser, const pm_token_t *token) { pm_float_node_t *node = PM_NODE_ALLOC(parser, pm_float_node_t); *node = (pm_float_node_t) { - { - .type = PM_FLOAT_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_FLOAT_NODE, PM_NODE_FLAG_STATIC_LITERAL, token), .value = pm_double_parse(parser, token) }; @@ -4203,17 +3912,12 @@ pm_float_node_imaginary_create(pm_parser_t *parser, const pm_token_t *token) { pm_imaginary_node_t *node = PM_NODE_ALLOC(parser, pm_imaginary_node_t); *node = (pm_imaginary_node_t) { - { - .type = PM_IMAGINARY_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, - .numeric = (pm_node_t *) pm_float_node_create(parser, &((pm_token_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_IMAGINARY_NODE, PM_NODE_FLAG_STATIC_LITERAL, token), + .numeric = UP(pm_float_node_create(parser, &((pm_token_t) { .type = PM_TOKEN_FLOAT, .start = token->start, .end = token->end - 1 - })) + }))) }; return node; @@ -4228,12 +3932,7 @@ pm_float_node_rational_create(pm_parser_t *parser, const pm_token_t *token) { pm_rational_node_t *node = PM_NODE_ALLOC(parser, pm_rational_node_t); *node = (pm_rational_node_t) { - { - .type = PM_RATIONAL_NODE, - .flags = PM_INTEGER_BASE_FLAGS_DECIMAL | PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_RATIONAL_NODE, PM_INTEGER_BASE_FLAGS_DECIMAL | PM_NODE_FLAG_STATIC_LITERAL, token), .numerator = { 0 }, .denominator = { 0 } }; @@ -4263,9 +3962,13 @@ pm_float_node_rational_create(pm_parser_t *parser, const pm_token_t *token) { memcpy(digits + (point - start), point + 1, (unsigned long) (end - point - 1)); pm_integer_parse(&node->numerator, PM_INTEGER_BASE_DEFAULT, digits, digits + length - 1); + size_t fract_length = 0; + for (const uint8_t *fract = point; fract < end; ++fract) { + if (*fract != '_') ++fract_length; + } digits[0] = '1'; - if (end - point > 1) memset(digits + 1, '0', (size_t) (end - point - 1)); - pm_integer_parse(&node->denominator, PM_INTEGER_BASE_DEFAULT, digits, digits + (end - point)); + if (fract_length > 1) memset(digits + 1, '0', fract_length - 1); + pm_integer_parse(&node->denominator, PM_INTEGER_BASE_DEFAULT, digits, digits + fract_length); xfree(digits); pm_integers_reduce(&node->numerator, &node->denominator); @@ -4282,17 +3985,12 @@ pm_float_node_rational_imaginary_create(pm_parser_t *parser, const pm_token_t *t pm_imaginary_node_t *node = PM_NODE_ALLOC(parser, pm_imaginary_node_t); *node = (pm_imaginary_node_t) { - { - .type = PM_IMAGINARY_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, - .numeric = (pm_node_t *) pm_float_node_rational_create(parser, &((pm_token_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_IMAGINARY_NODE, PM_NODE_FLAG_STATIC_LITERAL, token), + .numeric = UP(pm_float_node_rational_create(parser, &((pm_token_t) { .type = PM_TOKEN_FLOAT_RATIONAL, .start = token->start, .end = token->end - 1 - })) + }))) }; return node; @@ -4315,14 +4013,7 @@ pm_for_node_create( pm_for_node_t *node = PM_NODE_ALLOC(parser, pm_for_node_t); *node = (pm_for_node_t) { - { - .type = PM_FOR_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = for_keyword->start, - .end = end_keyword->end - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_FOR_NODE, 0, for_keyword, end_keyword), .index = index, .collection = collection, .statements = statements, @@ -4343,11 +4034,9 @@ pm_forwarding_arguments_node_create(pm_parser_t *parser, const pm_token_t *token assert(token->type == PM_TOKEN_UDOT_DOT_DOT); pm_forwarding_arguments_node_t *node = PM_NODE_ALLOC(parser, pm_forwarding_arguments_node_t); - *node = (pm_forwarding_arguments_node_t) {{ - .type = PM_FORWARDING_ARGUMENTS_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }}; + *node = (pm_forwarding_arguments_node_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_FORWARDING_ARGUMENTS_NODE, 0, token) + }; return node; } @@ -4360,11 +4049,9 @@ pm_forwarding_parameter_node_create(pm_parser_t *parser, const pm_token_t *token assert(token->type == PM_TOKEN_UDOT_DOT_DOT); pm_forwarding_parameter_node_t *node = PM_NODE_ALLOC(parser, pm_forwarding_parameter_node_t); - *node = (pm_forwarding_parameter_node_t) {{ - .type = PM_FORWARDING_PARAMETER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }}; + *node = (pm_forwarding_parameter_node_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_FORWARDING_PARAMETER_NODE, 0, token) + }; return node; } @@ -4384,14 +4071,11 @@ pm_forwarding_super_node_create(pm_parser_t *parser, const pm_token_t *token, pm } *node = (pm_forwarding_super_node_t) { - { - .type = PM_FORWARDING_SUPER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = token->start, - .end = block != NULL ? block->base.location.end : token->end - }, - }, + .base = ( + (block == NULL) + ? PM_NODE_INIT_TOKEN(parser, PM_FORWARDING_SUPER_NODE, 0, token) + : PM_NODE_INIT_TOKEN_NODE(parser, PM_FORWARDING_SUPER_NODE, 0, token, block) + ), .block = block }; @@ -4407,14 +4091,7 @@ pm_hash_pattern_node_empty_create(pm_parser_t *parser, const pm_token_t *opening pm_hash_pattern_node_t *node = PM_NODE_ALLOC(parser, pm_hash_pattern_node_t); *node = (pm_hash_pattern_node_t) { - { - .type = PM_HASH_PATTERN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = closing->end - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_HASH_PATTERN_NODE, 0, opening, closing), .constant = NULL, .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), .closing_loc = PM_LOCATION_TOKEN_VALUE(closing), @@ -4437,8 +4114,8 @@ pm_hash_pattern_node_node_list_create(pm_parser_t *parser, pm_node_list_t *eleme if (elements->size > 0) { if (rest) { - start = elements->nodes[0]->location.start; - end = rest->location.end; + start = MIN(rest->location.start, elements->nodes[0]->location.start); + end = MAX(rest->location.end, elements->nodes[elements->size - 1]->location.end); } else { start = elements->nodes[0]->location.start; end = elements->nodes[elements->size - 1]->location.end; @@ -4450,26 +4127,15 @@ pm_hash_pattern_node_node_list_create(pm_parser_t *parser, pm_node_list_t *eleme } *node = (pm_hash_pattern_node_t) { - { - .type = PM_HASH_PATTERN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = start, - .end = end - }, - }, + .base = PM_NODE_INIT(parser, PM_HASH_PATTERN_NODE, 0, start, end), .constant = NULL, .elements = { 0 }, .rest = rest, - .opening_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, - .closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE + .opening_loc = { 0 }, + .closing_loc = { 0 } }; - pm_node_t *element; - PM_NODE_LIST_FOREACH(elements, index, element) { - pm_node_list_append(&node->elements, element); - } - + pm_node_list_concat(&node->elements, elements); return node; } @@ -4502,14 +4168,7 @@ pm_global_variable_and_write_node_create(pm_parser_t *parser, pm_node_t *target, pm_global_variable_and_write_node_t *node = PM_NODE_ALLOC(parser, pm_global_variable_and_write_node_t); *node = (pm_global_variable_and_write_node_t) { - { - .type = PM_GLOBAL_VARIABLE_AND_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_GLOBAL_VARIABLE_AND_WRITE_NODE, 0, target, value), .name = pm_global_variable_write_name(parser, target), .name_loc = target->location, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -4527,14 +4186,7 @@ pm_global_variable_operator_write_node_create(pm_parser_t *parser, pm_node_t *ta pm_global_variable_operator_write_node_t *node = PM_NODE_ALLOC(parser, pm_global_variable_operator_write_node_t); *node = (pm_global_variable_operator_write_node_t) { - { - .type = PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE, 0, target, value), .name = pm_global_variable_write_name(parser, target), .name_loc = target->location, .binary_operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -4554,14 +4206,7 @@ pm_global_variable_or_write_node_create(pm_parser_t *parser, pm_node_t *target, pm_global_variable_or_write_node_t *node = PM_NODE_ALLOC(parser, pm_global_variable_or_write_node_t); *node = (pm_global_variable_or_write_node_t) { - { - .type = PM_GLOBAL_VARIABLE_OR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_GLOBAL_VARIABLE_OR_WRITE_NODE, 0, target, value), .name = pm_global_variable_write_name(parser, target), .name_loc = target->location, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -4579,11 +4224,7 @@ pm_global_variable_read_node_create(pm_parser_t *parser, const pm_token_t *name) pm_global_variable_read_node_t *node = PM_NODE_ALLOC(parser, pm_global_variable_read_node_t); *node = (pm_global_variable_read_node_t) { - { - .type = PM_GLOBAL_VARIABLE_READ_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(name), - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_GLOBAL_VARIABLE_READ_NODE, 0, name), .name = pm_parser_constant_id_token(parser, name) }; @@ -4598,11 +4239,7 @@ pm_global_variable_read_node_synthesized_create(pm_parser_t *parser, pm_constant pm_global_variable_read_node_t *node = PM_NODE_ALLOC(parser, pm_global_variable_read_node_t); *node = (pm_global_variable_read_node_t) { - { - .type = PM_GLOBAL_VARIABLE_READ_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_NULL_VALUE(parser) - }, + .base = PM_NODE_INIT_BASE(parser, PM_GLOBAL_VARIABLE_READ_NODE, 0), .name = name }; @@ -4615,17 +4252,10 @@ pm_global_variable_read_node_synthesized_create(pm_parser_t *parser, pm_constant static pm_global_variable_write_node_t * pm_global_variable_write_node_create(pm_parser_t *parser, pm_node_t *target, const pm_token_t *operator, pm_node_t *value) { pm_global_variable_write_node_t *node = PM_NODE_ALLOC(parser, pm_global_variable_write_node_t); + pm_node_flags_t flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY); *node = (pm_global_variable_write_node_t) { - { - .type = PM_GLOBAL_VARIABLE_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY), - .location = { - .start = target->location.start, - .end = value->location.end - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_GLOBAL_VARIABLE_WRITE_NODE, flags, target, value), .name = pm_global_variable_write_name(parser, target), .name_loc = PM_LOCATION_NODE_VALUE(target), .operator_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(operator), @@ -4643,11 +4273,7 @@ pm_global_variable_write_node_synthesized_create(pm_parser_t *parser, pm_constan pm_global_variable_write_node_t *node = PM_NODE_ALLOC(parser, pm_global_variable_write_node_t); *node = (pm_global_variable_write_node_t) { - { - .type = PM_GLOBAL_VARIABLE_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_NULL_VALUE(parser) - }, + .base = PM_NODE_INIT_BASE(parser, PM_GLOBAL_VARIABLE_WRITE_NODE, 0), .name = name, .name_loc = PM_LOCATION_NULL_VALUE(parser), .operator_loc = PM_LOCATION_NULL_VALUE(parser), @@ -4666,12 +4292,7 @@ pm_hash_node_create(pm_parser_t *parser, const pm_token_t *opening) { pm_hash_node_t *node = PM_NODE_ALLOC(parser, pm_hash_node_t); *node = (pm_hash_node_t) { - { - .type = PM_HASH_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(opening) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_HASH_NODE, PM_NODE_FLAG_STATIC_LITERAL, opening), .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), .closing_loc = PM_LOCATION_NULL_VALUE(parser), .elements = { 0 } @@ -4696,7 +4317,7 @@ pm_hash_node_elements_append(pm_hash_node_t *hash, pm_node_t *element) { } if (!static_literal) { - pm_node_flag_unset((pm_node_t *)hash, PM_NODE_FLAG_STATIC_LITERAL); + pm_node_flag_unset(UP(hash), PM_NODE_FLAG_STATIC_LITERAL); } } @@ -4733,15 +4354,7 @@ pm_if_node_create(pm_parser_t *parser, } *node = (pm_if_node_t) { - { - .type = PM_IF_NODE, - .flags = PM_NODE_FLAG_NEWLINE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = if_keyword->start, - .end = end - }, - }, + .base = PM_NODE_INIT(parser, PM_IF_NODE, PM_NODE_FLAG_NEWLINE, if_keyword->start, end), .if_keyword_loc = PM_LOCATION_TOKEN_VALUE(if_keyword), .predicate = predicate, .then_keyword_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(then_keyword), @@ -4765,21 +4378,13 @@ pm_if_node_modifier_create(pm_parser_t *parser, pm_node_t *statement, const pm_t pm_statements_node_body_append(parser, statements, statement, true); *node = (pm_if_node_t) { - { - .type = PM_IF_NODE, - .flags = PM_NODE_FLAG_NEWLINE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = statement->location.start, - .end = predicate->location.end - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_IF_NODE, PM_NODE_FLAG_NEWLINE, statement, predicate), .if_keyword_loc = PM_LOCATION_TOKEN_VALUE(if_keyword), .predicate = predicate, - .then_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, + .then_keyword_loc = { 0 }, .statements = statements, .subsequent = NULL, - .end_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE + .end_keyword_loc = { 0 } }; return node; @@ -4805,21 +4410,13 @@ pm_if_node_ternary_create(pm_parser_t *parser, pm_node_t *predicate, const pm_to pm_if_node_t *node = PM_NODE_ALLOC(parser, pm_if_node_t); *node = (pm_if_node_t) { - { - .type = PM_IF_NODE, - .flags = PM_NODE_FLAG_NEWLINE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = predicate->location.start, - .end = false_expression->location.end, - }, - }, - .if_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, + .base = PM_NODE_INIT_NODES(parser, PM_IF_NODE, PM_NODE_FLAG_NEWLINE, predicate, false_expression), + .if_keyword_loc = { 0 }, .predicate = predicate, .then_keyword_loc = PM_LOCATION_TOKEN_VALUE(qmark), .statements = if_statements, - .subsequent = (pm_node_t *) else_node, - .end_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE + .subsequent = UP(else_node), + .end_keyword_loc = { 0 } }; return node; @@ -4846,11 +4443,7 @@ pm_implicit_node_create(pm_parser_t *parser, pm_node_t *value) { pm_implicit_node_t *node = PM_NODE_ALLOC(parser, pm_implicit_node_t); *node = (pm_implicit_node_t) { - { - .type = PM_IMPLICIT_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = value->location - }, + .base = PM_NODE_INIT_NODE(parser, PM_IMPLICIT_NODE, 0, value), .value = value }; @@ -4867,11 +4460,7 @@ pm_implicit_rest_node_create(pm_parser_t *parser, const pm_token_t *token) { pm_implicit_rest_node_t *node = PM_NODE_ALLOC(parser, pm_implicit_rest_node_t); *node = (pm_implicit_rest_node_t) { - { - .type = PM_IMPLICIT_REST_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - } + .base = PM_NODE_INIT_TOKEN(parser, PM_IMPLICIT_REST_NODE, 0, token) }; return node; @@ -4886,12 +4475,7 @@ pm_integer_node_create(pm_parser_t *parser, pm_node_flags_t base, const pm_token pm_integer_node_t *node = PM_NODE_ALLOC(parser, pm_integer_node_t); *node = (pm_integer_node_t) { - { - .type = PM_INTEGER_NODE, - .flags = base | PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_INTEGER_NODE, base | PM_NODE_FLAG_STATIC_LITERAL, token), .value = { 0 } }; @@ -4918,17 +4502,12 @@ pm_integer_node_imaginary_create(pm_parser_t *parser, pm_node_flags_t base, cons pm_imaginary_node_t *node = PM_NODE_ALLOC(parser, pm_imaginary_node_t); *node = (pm_imaginary_node_t) { - { - .type = PM_IMAGINARY_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, - .numeric = (pm_node_t *) pm_integer_node_create(parser, base, &((pm_token_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_IMAGINARY_NODE, PM_NODE_FLAG_STATIC_LITERAL, token), + .numeric = UP(pm_integer_node_create(parser, base, &((pm_token_t) { .type = PM_TOKEN_INTEGER, .start = token->start, .end = token->end - 1 - })) + }))) }; return node; @@ -4944,12 +4523,7 @@ pm_integer_node_rational_create(pm_parser_t *parser, pm_node_flags_t base, const pm_rational_node_t *node = PM_NODE_ALLOC(parser, pm_rational_node_t); *node = (pm_rational_node_t) { - { - .type = PM_RATIONAL_NODE, - .flags = base | PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_RATIONAL_NODE, base | PM_NODE_FLAG_STATIC_LITERAL, token), .numerator = { 0 }, .denominator = { .value = 1, 0 } }; @@ -4978,17 +4552,12 @@ pm_integer_node_rational_imaginary_create(pm_parser_t *parser, pm_node_flags_t b pm_imaginary_node_t *node = PM_NODE_ALLOC(parser, pm_imaginary_node_t); *node = (pm_imaginary_node_t) { - { - .type = PM_IMAGINARY_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, - .numeric = (pm_node_t *) pm_integer_node_rational_create(parser, base, &((pm_token_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_IMAGINARY_NODE, PM_NODE_FLAG_STATIC_LITERAL, token), + .numeric = UP(pm_integer_node_rational_create(parser, base, &((pm_token_t) { .type = PM_TOKEN_INTEGER_RATIONAL, .start = token->start, .end = token->end - 1 - })) + }))) }; return node; @@ -5011,14 +4580,7 @@ pm_in_node_create(pm_parser_t *parser, pm_node_t *pattern, pm_statements_node_t } *node = (pm_in_node_t) { - { - .type = PM_IN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = in_keyword->start, - .end = end - }, - }, + .base = PM_NODE_INIT(parser, PM_IN_NODE, 0, in_keyword->start, end), .pattern = pattern, .statements = statements, .in_loc = PM_LOCATION_TOKEN_VALUE(in_keyword), @@ -5037,14 +4599,7 @@ pm_instance_variable_and_write_node_create(pm_parser_t *parser, pm_instance_vari pm_instance_variable_and_write_node_t *node = PM_NODE_ALLOC(parser, pm_instance_variable_and_write_node_t); *node = (pm_instance_variable_and_write_node_t) { - { - .type = PM_INSTANCE_VARIABLE_AND_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_INSTANCE_VARIABLE_AND_WRITE_NODE, 0, target, value), .name = target->name, .name_loc = target->base.location, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -5062,14 +4617,7 @@ pm_instance_variable_operator_write_node_create(pm_parser_t *parser, pm_instance pm_instance_variable_operator_write_node_t *node = PM_NODE_ALLOC(parser, pm_instance_variable_operator_write_node_t); *node = (pm_instance_variable_operator_write_node_t) { - { - .type = PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE, 0, target, value), .name = target->name, .name_loc = target->base.location, .binary_operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -5089,14 +4637,7 @@ pm_instance_variable_or_write_node_create(pm_parser_t *parser, pm_instance_varia pm_instance_variable_or_write_node_t *node = PM_NODE_ALLOC(parser, pm_instance_variable_or_write_node_t); *node = (pm_instance_variable_or_write_node_t) { - { - .type = PM_INSTANCE_VARIABLE_OR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_INSTANCE_VARIABLE_OR_WRITE_NODE, 0, target, value), .name = target->name, .name_loc = target->base.location, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -5115,11 +4656,7 @@ pm_instance_variable_read_node_create(pm_parser_t *parser, const pm_token_t *tok pm_instance_variable_read_node_t *node = PM_NODE_ALLOC(parser, pm_instance_variable_read_node_t); *node = (pm_instance_variable_read_node_t) { - { - .type = PM_INSTANCE_VARIABLE_READ_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_INSTANCE_VARIABLE_READ_NODE, 0, token), .name = pm_parser_constant_id_token(parser, token) }; @@ -5133,18 +4670,12 @@ pm_instance_variable_read_node_create(pm_parser_t *parser, const pm_token_t *tok static pm_instance_variable_write_node_t * pm_instance_variable_write_node_create(pm_parser_t *parser, pm_instance_variable_read_node_t *read_node, pm_token_t *operator, pm_node_t *value) { pm_instance_variable_write_node_t *node = PM_NODE_ALLOC(parser, pm_instance_variable_write_node_t); + pm_node_flags_t flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY); + *node = (pm_instance_variable_write_node_t) { - { - .type = PM_INSTANCE_VARIABLE_WRITE_NODE, - .flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY), - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = read_node->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_INSTANCE_VARIABLE_WRITE_NODE, flags, read_node, value), .name = read_node->name, - .name_loc = PM_LOCATION_NODE_BASE_VALUE(read_node), + .name_loc = PM_LOCATION_NODE_VALUE(read_node), .operator_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(operator), .value = value }; @@ -5186,7 +4717,7 @@ pm_interpolated_node_append(pm_node_t *node, pm_node_list_t *parts, pm_node_t *p break; } case PM_EMBEDDED_VARIABLE_NODE: - pm_node_flag_unset((pm_node_t *) node, PM_NODE_FLAG_STATIC_LITERAL); + pm_node_flag_unset(UP(node), PM_NODE_FLAG_STATIC_LITERAL); break; default: assert(false && "unexpected node type"); @@ -5204,15 +4735,7 @@ pm_interpolated_regular_expression_node_create(pm_parser_t *parser, const pm_tok pm_interpolated_regular_expression_node_t *node = PM_NODE_ALLOC(parser, pm_interpolated_regular_expression_node_t); *node = (pm_interpolated_regular_expression_node_t) { - { - .type = PM_INTERPOLATED_REGULAR_EXPRESSION_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = NULL, - }, - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_INTERPOLATED_REGULAR_EXPRESSION_NODE, PM_NODE_FLAG_STATIC_LITERAL, opening), .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), .closing_loc = PM_LOCATION_TOKEN_VALUE(opening), .parts = { 0 } @@ -5230,14 +4753,14 @@ pm_interpolated_regular_expression_node_append(pm_interpolated_regular_expressio node->base.location.end = part->location.end; } - pm_interpolated_node_append((pm_node_t *) node, &node->parts, part); + pm_interpolated_node_append(UP(node), &node->parts, part); } static inline void pm_interpolated_regular_expression_node_closing_set(pm_parser_t *parser, pm_interpolated_regular_expression_node_t *node, const pm_token_t *closing) { node->closing_loc = PM_LOCATION_TOKEN_VALUE(closing); node->base.location.end = closing->end; - pm_node_flag_set((pm_node_t *) node, pm_regular_expression_flags_create(parser, closing)); + pm_node_flag_set(UP(node), pm_regular_expression_flags_create(parser, closing)); } /** @@ -5266,10 +4789,10 @@ pm_interpolated_regular_expression_node_closing_set(pm_parser_t *parser, pm_inte static inline void pm_interpolated_string_node_append(pm_interpolated_string_node_t *node, pm_node_t *part) { #define CLEAR_FLAGS(node) \ - node->base.flags = (pm_node_flags_t) (node->base.flags & ~(PM_NODE_FLAG_STATIC_LITERAL | PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN | PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE)) + node->base.flags = (pm_node_flags_t) (FL(node) & ~(PM_NODE_FLAG_STATIC_LITERAL | PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN | PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE)) #define MUTABLE_FLAGS(node) \ - node->base.flags = (pm_node_flags_t) ((node->base.flags | PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE) & ~PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN); + node->base.flags = (pm_node_flags_t) ((FL(node) | PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE) & ~PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN); if (node->parts.size == 0 && node->opening_loc.start == NULL) { node->base.location.start = part->location.start; @@ -5279,6 +4802,12 @@ pm_interpolated_string_node_append(pm_interpolated_string_node_t *node, pm_node_ switch (PM_NODE_TYPE(part)) { case PM_STRING_NODE: + // If inner string is not frozen, it stops being a static literal. We should *not* clear other flags, + // because concatenating two frozen strings (`'foo' 'bar'`) is still frozen. This holds true for + // as long as this interpolation only consists of other string literals. + if (!PM_NODE_FLAG_P(part, PM_STRING_FLAGS_FROZEN)) { + pm_node_flag_unset(UP(node), PM_NODE_FLAG_STATIC_LITERAL); + } part->flags = (pm_node_flags_t) ((part->flags | PM_NODE_FLAG_STATIC_LITERAL | PM_STRING_FLAGS_FROZEN) & ~PM_STRING_FLAGS_MUTABLE); break; case PM_INTERPOLATED_STRING_NODE: @@ -5330,8 +4859,10 @@ pm_interpolated_string_node_append(pm_interpolated_string_node_t *node, pm_node_ break; case PM_X_STRING_NODE: case PM_INTERPOLATED_X_STRING_NODE: - // If this is an x string, then this is a syntax error. But we want - // to handle it here so that we don't fail the assertion. + case PM_SYMBOL_NODE: + case PM_INTERPOLATED_SYMBOL_NODE: + // These will only happen in error cases. But we want to handle it + // here so that we don't fail the assertion. CLEAR_FLAGS(node); break; default: @@ -5363,15 +4894,7 @@ pm_interpolated_string_node_create(pm_parser_t *parser, const pm_token_t *openin } *node = (pm_interpolated_string_node_t) { - { - .type = PM_INTERPOLATED_STRING_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = closing->end, - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_INTERPOLATED_STRING_NODE, flags, opening, closing), .opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening), .closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing), .parts = { 0 } @@ -5402,7 +4925,7 @@ pm_interpolated_symbol_node_append(pm_interpolated_symbol_node_t *node, pm_node_ node->base.location.start = part->location.start; } - pm_interpolated_node_append((pm_node_t *) node, &node->parts, part); + pm_interpolated_node_append(UP(node), &node->parts, part); node->base.location.end = MAX(node->base.location.end, part->location.end); } @@ -5420,15 +4943,7 @@ pm_interpolated_symbol_node_create(pm_parser_t *parser, const pm_token_t *openin pm_interpolated_symbol_node_t *node = PM_NODE_ALLOC(parser, pm_interpolated_symbol_node_t); *node = (pm_interpolated_symbol_node_t) { - { - .type = PM_INTERPOLATED_SYMBOL_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = closing->end, - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_INTERPOLATED_SYMBOL_NODE, PM_NODE_FLAG_STATIC_LITERAL, opening, closing), .opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening), .closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing), .parts = { 0 } @@ -5452,14 +4967,7 @@ pm_interpolated_xstring_node_create(pm_parser_t *parser, const pm_token_t *openi pm_interpolated_x_string_node_t *node = PM_NODE_ALLOC(parser, pm_interpolated_x_string_node_t); *node = (pm_interpolated_x_string_node_t) { - { - .type = PM_INTERPOLATED_X_STRING_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = closing->end - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_INTERPOLATED_X_STRING_NODE, 0, opening, closing), .opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening), .closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing), .parts = { 0 } @@ -5470,7 +4978,7 @@ pm_interpolated_xstring_node_create(pm_parser_t *parser, const pm_token_t *openi static inline void pm_interpolated_xstring_node_append(pm_interpolated_x_string_node_t *node, pm_node_t *part) { - pm_interpolated_node_append((pm_node_t *) node, &node->parts, part); + pm_interpolated_node_append(UP(node), &node->parts, part); node->base.location.end = part->location.end; } @@ -5488,11 +4996,7 @@ pm_it_local_variable_read_node_create(pm_parser_t *parser, const pm_token_t *nam pm_it_local_variable_read_node_t *node = PM_NODE_ALLOC(parser, pm_it_local_variable_read_node_t); *node = (pm_it_local_variable_read_node_t) { - { - .type = PM_IT_LOCAL_VARIABLE_READ_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(name) - } + .base = PM_NODE_INIT_TOKEN(parser, PM_IT_LOCAL_VARIABLE_READ_NODE, 0, name), }; return node; @@ -5506,14 +5010,7 @@ pm_it_parameters_node_create(pm_parser_t *parser, const pm_token_t *opening, con pm_it_parameters_node_t *node = PM_NODE_ALLOC(parser, pm_it_parameters_node_t); *node = (pm_it_parameters_node_t) { - { - .type = PM_IT_PARAMETERS_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = closing->end - } - } + .base = PM_NODE_INIT_TOKENS(parser, PM_IT_PARAMETERS_NODE, 0, opening, closing), }; return node; @@ -5527,12 +5024,7 @@ pm_keyword_hash_node_create(pm_parser_t *parser) { pm_keyword_hash_node_t *node = PM_NODE_ALLOC(parser, pm_keyword_hash_node_t); *node = (pm_keyword_hash_node_t) { - .base = { - .type = PM_KEYWORD_HASH_NODE, - .flags = PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE - }, + .base = PM_NODE_INIT_UNSET(parser, PM_KEYWORD_HASH_NODE, PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS), .elements = { 0 } }; @@ -5547,7 +5039,7 @@ pm_keyword_hash_node_elements_append(pm_keyword_hash_node_t *hash, pm_node_t *el // If the element being added is not an AssocNode or does not have a symbol // key, then we want to turn the SYMBOL_KEYS flag off. if (!PM_NODE_TYPE_P(element, PM_ASSOC_NODE) || !PM_NODE_TYPE_P(((pm_assoc_node_t *) element)->key, PM_SYMBOL_NODE)) { - pm_node_flag_unset((pm_node_t *)hash, PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS); + pm_node_flag_unset(UP(hash), PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS); } pm_node_list_append(&hash->elements, element); @@ -5565,14 +5057,7 @@ pm_required_keyword_parameter_node_create(pm_parser_t *parser, const pm_token_t pm_required_keyword_parameter_node_t *node = PM_NODE_ALLOC(parser, pm_required_keyword_parameter_node_t); *node = (pm_required_keyword_parameter_node_t) { - { - .type = PM_REQUIRED_KEYWORD_PARAMETER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = name->start, - .end = name->end - }, - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_REQUIRED_KEYWORD_PARAMETER_NODE, 0, name), .name = pm_parser_constant_id_location(parser, name->start, name->end - 1), .name_loc = PM_LOCATION_TOKEN_VALUE(name), }; @@ -5588,14 +5073,7 @@ pm_optional_keyword_parameter_node_create(pm_parser_t *parser, const pm_token_t pm_optional_keyword_parameter_node_t *node = PM_NODE_ALLOC(parser, pm_optional_keyword_parameter_node_t); *node = (pm_optional_keyword_parameter_node_t) { - { - .type = PM_OPTIONAL_KEYWORD_PARAMETER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = name->start, - .end = value->location.end - }, - }, + .base = PM_NODE_INIT_TOKEN_NODE(parser, PM_OPTIONAL_KEYWORD_PARAMETER_NODE, 0, name, value), .name = pm_parser_constant_id_location(parser, name->start, name->end - 1), .name_loc = PM_LOCATION_TOKEN_VALUE(name), .value = value @@ -5612,14 +5090,11 @@ pm_keyword_rest_parameter_node_create(pm_parser_t *parser, const pm_token_t *ope pm_keyword_rest_parameter_node_t *node = PM_NODE_ALLOC(parser, pm_keyword_rest_parameter_node_t); *node = (pm_keyword_rest_parameter_node_t) { - { - .type = PM_KEYWORD_REST_PARAMETER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = (name->type == PM_TOKEN_NOT_PROVIDED ? operator->end : name->end) - }, - }, + .base = ( + (name->type == PM_TOKEN_NOT_PROVIDED) + ? PM_NODE_INIT_TOKEN(parser, PM_KEYWORD_REST_PARAMETER_NODE, 0, operator) + : PM_NODE_INIT_TOKENS(parser, PM_KEYWORD_REST_PARAMETER_NODE, 0, operator, name) + ), .name = pm_parser_optional_constant_id_token(parser, name), .name_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(name), .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) @@ -5644,14 +5119,7 @@ pm_lambda_node_create( pm_lambda_node_t *node = PM_NODE_ALLOC(parser, pm_lambda_node_t); *node = (pm_lambda_node_t) { - { - .type = PM_LAMBDA_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = closing->end - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_LAMBDA_NODE, 0, operator, closing), .locals = *locals, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), @@ -5673,14 +5141,7 @@ pm_local_variable_and_write_node_create(pm_parser_t *parser, pm_node_t *target, pm_local_variable_and_write_node_t *node = PM_NODE_ALLOC(parser, pm_local_variable_and_write_node_t); *node = (pm_local_variable_and_write_node_t) { - { - .type = PM_LOCAL_VARIABLE_AND_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_LOCAL_VARIABLE_AND_WRITE_NODE, 0, target, value), .name_loc = target->location, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .value = value, @@ -5699,14 +5160,7 @@ pm_local_variable_operator_write_node_create(pm_parser_t *parser, pm_node_t *tar pm_local_variable_operator_write_node_t *node = PM_NODE_ALLOC(parser, pm_local_variable_operator_write_node_t); *node = (pm_local_variable_operator_write_node_t) { - { - .type = PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE, 0, target, value), .name_loc = target->location, .binary_operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .value = value, @@ -5728,14 +5182,7 @@ pm_local_variable_or_write_node_create(pm_parser_t *parser, pm_node_t *target, c pm_local_variable_or_write_node_t *node = PM_NODE_ALLOC(parser, pm_local_variable_or_write_node_t); *node = (pm_local_variable_or_write_node_t) { - { - .type = PM_LOCAL_VARIABLE_OR_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_LOCAL_VARIABLE_OR_WRITE_NODE, 0, target, value), .name_loc = target->location, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .value = value, @@ -5756,11 +5203,7 @@ pm_local_variable_read_node_create_constant_id(pm_parser_t *parser, const pm_tok pm_local_variable_read_node_t *node = PM_NODE_ALLOC(parser, pm_local_variable_read_node_t); *node = (pm_local_variable_read_node_t) { - { - .type = PM_LOCAL_VARIABLE_READ_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(name) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_LOCAL_VARIABLE_READ_NODE, 0, name), .name = name_id, .depth = depth }; @@ -5793,17 +5236,10 @@ pm_local_variable_read_node_missing_create(pm_parser_t *parser, const pm_token_t static pm_local_variable_write_node_t * pm_local_variable_write_node_create(pm_parser_t *parser, pm_constant_id_t name, uint32_t depth, pm_node_t *value, const pm_location_t *name_loc, const pm_token_t *operator) { pm_local_variable_write_node_t *node = PM_NODE_ALLOC(parser, pm_local_variable_write_node_t); + pm_node_flags_t flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY); *node = (pm_local_variable_write_node_t) { - { - .type = PM_LOCAL_VARIABLE_WRITE_NODE, - .flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY), - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = name_loc->start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_TOKEN_NODE(parser, PM_LOCAL_VARIABLE_WRITE_NODE, flags, name_loc, value), .name = name, .depth = depth, .value = value, @@ -5852,11 +5288,7 @@ pm_local_variable_target_node_create(pm_parser_t *parser, const pm_location_t *l pm_local_variable_target_node_t *node = PM_NODE_ALLOC(parser, pm_local_variable_target_node_t); *node = (pm_local_variable_target_node_t) { - { - .type = PM_LOCAL_VARIABLE_TARGET_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = *location - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_LOCAL_VARIABLE_TARGET_NODE, 0, location), .name = name, .depth = depth }; @@ -5874,14 +5306,7 @@ pm_match_predicate_node_create(pm_parser_t *parser, pm_node_t *value, pm_node_t pm_match_predicate_node_t *node = PM_NODE_ALLOC(parser, pm_match_predicate_node_t); *node = (pm_match_predicate_node_t) { - { - .type = PM_MATCH_PREDICATE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = value->location.start, - .end = pattern->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_MATCH_PREDICATE_NODE, 0, value, pattern), .value = value, .pattern = pattern, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) @@ -5900,14 +5325,7 @@ pm_match_required_node_create(pm_parser_t *parser, pm_node_t *value, pm_node_t * pm_match_required_node_t *node = PM_NODE_ALLOC(parser, pm_match_required_node_t); *node = (pm_match_required_node_t) { - { - .type = PM_MATCH_REQUIRED_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = value->location.start, - .end = pattern->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_MATCH_REQUIRED_NODE, 0, value, pattern), .value = value, .pattern = pattern, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) @@ -5924,11 +5342,7 @@ pm_match_write_node_create(pm_parser_t *parser, pm_call_node_t *call) { pm_match_write_node_t *node = PM_NODE_ALLOC(parser, pm_match_write_node_t); *node = (pm_match_write_node_t) { - { - .type = PM_MATCH_WRITE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = call->base.location - }, + .base = PM_NODE_INIT_NODE(parser, PM_MATCH_WRITE_NODE, 0, call), .call = call, .targets = { 0 } }; @@ -5944,14 +5358,7 @@ pm_module_node_create(pm_parser_t *parser, pm_constant_id_list_t *locals, const pm_module_node_t *node = PM_NODE_ALLOC(parser, pm_module_node_t); *node = (pm_module_node_t) { - { - .type = PM_MODULE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = module_keyword->start, - .end = end_keyword->end - } - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_MODULE_NODE, 0, module_keyword, end_keyword), .locals = (locals == NULL ? ((pm_constant_id_list_t) { .ids = NULL, .size = 0, .capacity = 0 }) : *locals), .module_keyword_loc = PM_LOCATION_TOKEN_VALUE(module_keyword), .constant_path = constant_path, @@ -5971,16 +5378,12 @@ pm_multi_target_node_create(pm_parser_t *parser) { pm_multi_target_node_t *node = PM_NODE_ALLOC(parser, pm_multi_target_node_t); *node = (pm_multi_target_node_t) { - { - .type = PM_MULTI_TARGET_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { .start = NULL, .end = NULL } - }, + .base = PM_NODE_INIT_UNSET(parser, PM_MULTI_TARGET_NODE, 0), .lefts = { 0 }, .rest = NULL, .rights = { 0 }, - .lparen_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, - .rparen_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE + .lparen_loc = { 0 }, + .rparen_loc = { 0 } }; return node; @@ -6044,17 +5447,10 @@ pm_multi_target_node_closing_set(pm_multi_target_node_t *node, const pm_token_t static pm_multi_write_node_t * pm_multi_write_node_create(pm_parser_t *parser, pm_multi_target_node_t *target, const pm_token_t *operator, pm_node_t *value) { pm_multi_write_node_t *node = PM_NODE_ALLOC(parser, pm_multi_write_node_t); + pm_node_flags_t flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY); *node = (pm_multi_write_node_t) { - { - .type = PM_MULTI_WRITE_NODE, - .flags = pm_implicit_array_write_flags(value, PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY), - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = target->base.location.start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_MULTI_WRITE_NODE, flags, target, value), .lefts = target->lefts, .rest = target->rest, .rights = target->rights, @@ -6080,14 +5476,11 @@ pm_next_node_create(pm_parser_t *parser, const pm_token_t *keyword, pm_arguments pm_next_node_t *node = PM_NODE_ALLOC(parser, pm_next_node_t); *node = (pm_next_node_t) { - { - .type = PM_NEXT_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = (arguments == NULL ? keyword->end : arguments->base.location.end) - } - }, + .base = ( + (arguments == NULL) + ? PM_NODE_INIT_TOKEN(parser, PM_NEXT_NODE, 0, keyword) + : PM_NODE_INIT_TOKEN_NODE(parser, PM_NEXT_NODE, 0, keyword, arguments) + ), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .arguments = arguments }; @@ -6103,12 +5496,9 @@ pm_nil_node_create(pm_parser_t *parser, const pm_token_t *token) { assert(token->type == PM_TOKEN_KEYWORD_NIL); pm_nil_node_t *node = PM_NODE_ALLOC(parser, pm_nil_node_t); - *node = (pm_nil_node_t) {{ - .type = PM_NIL_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }}; + *node = (pm_nil_node_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_NIL_NODE, PM_NODE_FLAG_STATIC_LITERAL, token) + }; return node; } @@ -6123,14 +5513,7 @@ pm_no_keywords_parameter_node_create(pm_parser_t *parser, const pm_token_t *oper pm_no_keywords_parameter_node_t *node = PM_NODE_ALLOC(parser, pm_no_keywords_parameter_node_t); *node = (pm_no_keywords_parameter_node_t) { - { - .type = PM_NO_KEYWORDS_PARAMETER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = keyword->end - } - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_NO_KEYWORDS_PARAMETER_NODE, 0, operator, keyword), .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword) }; @@ -6146,11 +5529,7 @@ pm_numbered_parameters_node_create(pm_parser_t *parser, const pm_location_t *loc pm_numbered_parameters_node_t *node = PM_NODE_ALLOC(parser, pm_numbered_parameters_node_t); *node = (pm_numbered_parameters_node_t) { - { - .type = PM_NUMBERED_PARAMETERS_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = *location - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_NUMBERED_PARAMETERS_NODE, 0, location), .maximum = maximum }; @@ -6215,11 +5594,7 @@ pm_numbered_reference_read_node_create(pm_parser_t *parser, const pm_token_t *na pm_numbered_reference_read_node_t *node = PM_NODE_ALLOC(parser, pm_numbered_reference_read_node_t); *node = (pm_numbered_reference_read_node_t) { - { - .type = PM_NUMBERED_REFERENCE_READ_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(name), - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_NUMBERED_REFERENCE_READ_NODE, 0, name), .number = pm_numbered_reference_read_node_number(parser, name) }; @@ -6234,14 +5609,7 @@ pm_optional_parameter_node_create(pm_parser_t *parser, const pm_token_t *name, c pm_optional_parameter_node_t *node = PM_NODE_ALLOC(parser, pm_optional_parameter_node_t); *node = (pm_optional_parameter_node_t) { - { - .type = PM_OPTIONAL_PARAMETER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = name->start, - .end = value->location.end - } - }, + .base = PM_NODE_INIT_TOKEN_NODE(parser, PM_OPTIONAL_PARAMETER_NODE, 0, name, value), .name = pm_parser_constant_id_token(parser, name), .name_loc = PM_LOCATION_TOKEN_VALUE(name), .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -6261,14 +5629,7 @@ pm_or_node_create(pm_parser_t *parser, pm_node_t *left, const pm_token_t *operat pm_or_node_t *node = PM_NODE_ALLOC(parser, pm_or_node_t); *node = (pm_or_node_t) { - { - .type = PM_OR_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = left->location.start, - .end = right->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_OR_NODE, 0, left, right), .left = left, .right = right, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) @@ -6285,11 +5646,7 @@ pm_parameters_node_create(pm_parser_t *parser) { pm_parameters_node_t *node = PM_NODE_ALLOC(parser, pm_parameters_node_t); *node = (pm_parameters_node_t) { - { - .type = PM_PARAMETERS_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(&parser->current) - }, + .base = PM_NODE_INIT_UNSET(parser, PM_PARAMETERS_NODE, 0), .rest = NULL, .keyword_rest = NULL, .block = NULL, @@ -6334,8 +5691,8 @@ pm_parameters_node_requireds_append(pm_parameters_node_t *params, pm_node_t *par */ static void pm_parameters_node_optionals_append(pm_parameters_node_t *params, pm_optional_parameter_node_t *param) { - pm_parameters_node_location_set(params, (pm_node_t *) param); - pm_node_list_append(¶ms->optionals, (pm_node_t *) param); + pm_parameters_node_location_set(params, UP(param)); + pm_node_list_append(¶ms->optionals, UP(param)); } /** @@ -6381,7 +5738,7 @@ pm_parameters_node_keyword_rest_set(pm_parameters_node_t *params, pm_node_t *par static void pm_parameters_node_block_set(pm_parameters_node_t *params, pm_block_parameter_node_t *param) { assert(params->block == NULL); - pm_parameters_node_location_set(params, (pm_node_t *) param); + pm_parameters_node_location_set(params, UP(param)); params->block = param; } @@ -6393,14 +5750,7 @@ pm_program_node_create(pm_parser_t *parser, pm_constant_id_list_t *locals, pm_st pm_program_node_t *node = PM_NODE_ALLOC(parser, pm_program_node_t); *node = (pm_program_node_t) { - { - .type = PM_PROGRAM_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = statements == NULL ? parser->start : statements->base.location.start, - .end = statements == NULL ? parser->end : statements->base.location.end - } - }, + .base = PM_NODE_INIT_NODE(parser, PM_PROGRAM_NODE, 0, statements), .locals = *locals, .statements = statements }; @@ -6416,15 +5766,7 @@ pm_parentheses_node_create(pm_parser_t *parser, const pm_token_t *opening, pm_no pm_parentheses_node_t *node = PM_NODE_ALLOC(parser, pm_parentheses_node_t); *node = (pm_parentheses_node_t) { - { - .type = PM_PARENTHESES_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = closing->end - } - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_PARENTHESES_NODE, flags, opening, closing), .body = body, .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), .closing_loc = PM_LOCATION_TOKEN_VALUE(closing) @@ -6441,14 +5783,7 @@ pm_pinned_expression_node_create(pm_parser_t *parser, pm_node_t *expression, con pm_pinned_expression_node_t *node = PM_NODE_ALLOC(parser, pm_pinned_expression_node_t); *node = (pm_pinned_expression_node_t) { - { - .type = PM_PINNED_EXPRESSION_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = rparen->end - } - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_PINNED_EXPRESSION_NODE, 0, operator, rparen), .expression = expression, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .lparen_loc = PM_LOCATION_TOKEN_VALUE(lparen), @@ -6466,14 +5801,7 @@ pm_pinned_variable_node_create(pm_parser_t *parser, const pm_token_t *operator, pm_pinned_variable_node_t *node = PM_NODE_ALLOC(parser, pm_pinned_variable_node_t); *node = (pm_pinned_variable_node_t) { - { - .type = PM_PINNED_VARIABLE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = variable->location.end - } - }, + .base = PM_NODE_INIT_TOKEN_NODE(parser, PM_PINNED_VARIABLE_NODE, 0, operator, variable), .variable = variable, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) }; @@ -6489,14 +5817,7 @@ pm_post_execution_node_create(pm_parser_t *parser, const pm_token_t *keyword, co pm_post_execution_node_t *node = PM_NODE_ALLOC(parser, pm_post_execution_node_t); *node = (pm_post_execution_node_t) { - { - .type = PM_POST_EXECUTION_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = closing->end - } - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_POST_EXECUTION_NODE, 0, keyword, closing), .statements = statements, .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), @@ -6514,14 +5835,7 @@ pm_pre_execution_node_create(pm_parser_t *parser, const pm_token_t *keyword, con pm_pre_execution_node_t *node = PM_NODE_ALLOC(parser, pm_pre_execution_node_t); *node = (pm_pre_execution_node_t) { - { - .type = PM_PRE_EXECUTION_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = closing->end - } - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_PRE_EXECUTION_NODE, 0, keyword, closing), .statements = statements, .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), @@ -6558,15 +5872,7 @@ pm_range_node_create(pm_parser_t *parser, pm_node_t *left, const pm_token_t *ope } *node = (pm_range_node_t) { - { - .type = PM_RANGE_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = (left == NULL ? operator->start : left->location.start), - .end = (right == NULL ? operator->end : right->location.end) - } - }, + .base = PM_NODE_INIT(parser, PM_RANGE_NODE, flags, (left == NULL ? operator->start : left->location.start), (right == NULL ? operator->end : right->location.end)), .left = left, .right = right, .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) @@ -6583,11 +5889,9 @@ pm_redo_node_create(pm_parser_t *parser, const pm_token_t *token) { assert(token->type == PM_TOKEN_KEYWORD_REDO); pm_redo_node_t *node = PM_NODE_ALLOC(parser, pm_redo_node_t); - *node = (pm_redo_node_t) {{ - .type = PM_REDO_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }}; + *node = (pm_redo_node_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_REDO_NODE, 0, token) + }; return node; } @@ -6599,17 +5903,10 @@ pm_redo_node_create(pm_parser_t *parser, const pm_token_t *token) { static pm_regular_expression_node_t * pm_regular_expression_node_create_unescaped(pm_parser_t *parser, const pm_token_t *opening, const pm_token_t *content, const pm_token_t *closing, const pm_string_t *unescaped) { pm_regular_expression_node_t *node = PM_NODE_ALLOC(parser, pm_regular_expression_node_t); + pm_node_flags_t flags = pm_regular_expression_flags_create(parser, closing) | PM_NODE_FLAG_STATIC_LITERAL; *node = (pm_regular_expression_node_t) { - { - .type = PM_REGULAR_EXPRESSION_NODE, - .flags = pm_regular_expression_flags_create(parser, closing) | PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = MIN(opening->start, closing->start), - .end = MAX(opening->end, closing->end) - } - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_REGULAR_EXPRESSION_NODE, flags, opening, closing), .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), .content_loc = PM_LOCATION_TOKEN_VALUE(content), .closing_loc = PM_LOCATION_TOKEN_VALUE(closing), @@ -6635,11 +5932,7 @@ pm_required_parameter_node_create(pm_parser_t *parser, const pm_token_t *token) pm_required_parameter_node_t *node = PM_NODE_ALLOC(parser, pm_required_parameter_node_t); *node = (pm_required_parameter_node_t) { - { - .type = PM_REQUIRED_PARAMETER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_REQUIRED_PARAMETER_NODE, 0, token), .name = pm_parser_constant_id_token(parser, token) }; @@ -6654,14 +5947,7 @@ pm_rescue_modifier_node_create(pm_parser_t *parser, pm_node_t *expression, const pm_rescue_modifier_node_t *node = PM_NODE_ALLOC(parser, pm_rescue_modifier_node_t); *node = (pm_rescue_modifier_node_t) { - { - .type = PM_RESCUE_MODIFIER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = expression->location.start, - .end = rescue_expression->location.end - } - }, + .base = PM_NODE_INIT_NODES(parser, PM_RESCUE_MODIFIER_NODE, 0, expression, rescue_expression), .expression = expression, .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .rescue_expression = rescue_expression @@ -6678,14 +5964,10 @@ pm_rescue_node_create(pm_parser_t *parser, const pm_token_t *keyword) { pm_rescue_node_t *node = PM_NODE_ALLOC(parser, pm_rescue_node_t); *node = (pm_rescue_node_t) { - { - .type = PM_RESCUE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(keyword) - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_RESCUE_NODE, 0, keyword), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), - .operator_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, - .then_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, + .operator_loc = { 0 }, + .then_keyword_loc = { 0 }, .reference = NULL, .statements = NULL, .subsequent = NULL, @@ -6746,14 +6028,11 @@ pm_rest_parameter_node_create(pm_parser_t *parser, const pm_token_t *operator, c pm_rest_parameter_node_t *node = PM_NODE_ALLOC(parser, pm_rest_parameter_node_t); *node = (pm_rest_parameter_node_t) { - { - .type = PM_REST_PARAMETER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = (name->type == PM_TOKEN_NOT_PROVIDED ? operator->end : name->end) - } - }, + .base = ( + (name->type == PM_TOKEN_NOT_PROVIDED) + ? PM_NODE_INIT_TOKEN(parser, PM_REST_PARAMETER_NODE, 0, operator) + : PM_NODE_INIT_TOKENS(parser, PM_REST_PARAMETER_NODE, 0, operator, name) + ), .name = pm_parser_optional_constant_id_token(parser, name), .name_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(name), .operator_loc = PM_LOCATION_TOKEN_VALUE(operator) @@ -6770,11 +6049,9 @@ pm_retry_node_create(pm_parser_t *parser, const pm_token_t *token) { assert(token->type == PM_TOKEN_KEYWORD_RETRY); pm_retry_node_t *node = PM_NODE_ALLOC(parser, pm_retry_node_t); - *node = (pm_retry_node_t) {{ - .type = PM_RETRY_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }}; + *node = (pm_retry_node_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_RETRY_NODE, 0, token) + }; return node; } @@ -6787,14 +6064,11 @@ pm_return_node_create(pm_parser_t *parser, const pm_token_t *keyword, pm_argumen pm_return_node_t *node = PM_NODE_ALLOC(parser, pm_return_node_t); *node = (pm_return_node_t) { - { - .type = PM_RETURN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = (arguments == NULL ? keyword->end : arguments->base.location.end) - } - }, + .base = ( + (arguments == NULL) + ? PM_NODE_INIT_TOKEN(parser, PM_RETURN_NODE, 0, keyword) + : PM_NODE_INIT_TOKEN_NODE(parser, PM_RETURN_NODE, 0, keyword, arguments) + ), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .arguments = arguments }; @@ -6810,11 +6084,9 @@ pm_self_node_create(pm_parser_t *parser, const pm_token_t *token) { assert(token->type == PM_TOKEN_KEYWORD_SELF); pm_self_node_t *node = PM_NODE_ALLOC(parser, pm_self_node_t); - *node = (pm_self_node_t) {{ - .type = PM_SELF_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }}; + *node = (pm_self_node_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_SELF_NODE, 0, token) + }; return node; } @@ -6827,12 +6099,7 @@ pm_shareable_constant_node_create(pm_parser_t *parser, pm_node_t *write, pm_shar pm_shareable_constant_node_t *node = PM_NODE_ALLOC(parser, pm_shareable_constant_node_t); *node = (pm_shareable_constant_node_t) { - { - .type = PM_SHAREABLE_CONSTANT_NODE, - .flags = (pm_node_flags_t) value, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_NODE_VALUE(write) - }, + .base = PM_NODE_INIT_NODE(parser, PM_SHAREABLE_CONSTANT_NODE, (pm_node_flags_t) value, write), .write = write }; @@ -6847,14 +6114,7 @@ pm_singleton_class_node_create(pm_parser_t *parser, pm_constant_id_list_t *local pm_singleton_class_node_t *node = PM_NODE_ALLOC(parser, pm_singleton_class_node_t); *node = (pm_singleton_class_node_t) { - { - .type = PM_SINGLETON_CLASS_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = class_keyword->start, - .end = end_keyword->end - } - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_SINGLETON_CLASS_NODE, 0, class_keyword, end_keyword), .locals = *locals, .class_keyword_loc = PM_LOCATION_TOKEN_VALUE(class_keyword), .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), @@ -6874,12 +6134,9 @@ pm_source_encoding_node_create(pm_parser_t *parser, const pm_token_t *token) { assert(token->type == PM_TOKEN_KEYWORD___ENCODING__); pm_source_encoding_node_t *node = PM_NODE_ALLOC(parser, pm_source_encoding_node_t); - *node = (pm_source_encoding_node_t) {{ - .type = PM_SOURCE_ENCODING_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }}; + *node = (pm_source_encoding_node_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_SOURCE_ENCODING_NODE, PM_NODE_FLAG_STATIC_LITERAL, token) + }; return node; } @@ -6904,12 +6161,7 @@ pm_source_file_node_create(pm_parser_t *parser, const pm_token_t *file_keyword) } *node = (pm_source_file_node_t) { - { - .type = PM_SOURCE_FILE_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(file_keyword), - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_SOURCE_FILE_NODE, flags, file_keyword), .filepath = parser->filepath }; @@ -6924,12 +6176,9 @@ pm_source_line_node_create(pm_parser_t *parser, const pm_token_t *token) { assert(token->type == PM_TOKEN_KEYWORD___LINE__); pm_source_line_node_t *node = PM_NODE_ALLOC(parser, pm_source_line_node_t); - *node = (pm_source_line_node_t) {{ - .type = PM_SOURCE_LINE_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }}; + *node = (pm_source_line_node_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_SOURCE_LINE_NODE, PM_NODE_FLAG_STATIC_LITERAL, token) + }; return node; } @@ -6942,14 +6191,11 @@ pm_splat_node_create(pm_parser_t *parser, const pm_token_t *operator, pm_node_t pm_splat_node_t *node = PM_NODE_ALLOC(parser, pm_splat_node_t); *node = (pm_splat_node_t) { - { - .type = PM_SPLAT_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = operator->start, - .end = (expression == NULL ? operator->end : expression->location.end) - } - }, + .base = ( + (expression == NULL) + ? PM_NODE_INIT_TOKEN(parser, PM_SPLAT_NODE, 0, operator) + : PM_NODE_INIT_TOKEN_NODE(parser, PM_SPLAT_NODE, 0, operator, expression) + ), .operator_loc = PM_LOCATION_TOKEN_VALUE(operator), .expression = expression }; @@ -6965,11 +6211,7 @@ pm_statements_node_create(pm_parser_t *parser) { pm_statements_node_t *node = PM_NODE_ALLOC(parser, pm_statements_node_t); *node = (pm_statements_node_t) { - { - .type = PM_STATEMENTS_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_NULL_VALUE(parser) - }, + .base = PM_NODE_INIT_BASE(parser, PM_STATEMENTS_NODE, 0), .body = { 0 } }; @@ -7061,16 +6303,11 @@ pm_string_node_create_unescaped(pm_parser_t *parser, const pm_token_t *opening, break; } + const uint8_t *start = (opening->type == PM_TOKEN_NOT_PROVIDED ? content->start : opening->start); + const uint8_t *end = (closing->type == PM_TOKEN_NOT_PROVIDED ? content->end : closing->end); + *node = (pm_string_node_t) { - { - .type = PM_STRING_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = (opening->type == PM_TOKEN_NOT_PROVIDED ? content->start : opening->start), - .end = (closing->type == PM_TOKEN_NOT_PROVIDED ? content->end : closing->end) - } - }, + .base = PM_NODE_INIT(parser, PM_STRING_NODE, flags, start, end), .opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening), .content_loc = PM_LOCATION_TOKEN_VALUE(content), .closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing), @@ -7113,14 +6350,7 @@ pm_super_node_create(pm_parser_t *parser, const pm_token_t *keyword, pm_argument } *node = (pm_super_node_t) { - { - .type = PM_SUPER_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = end, - } - }, + .base = PM_NODE_INIT(parser, PM_SUPER_NODE, 0, keyword->start, end), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .lparen_loc = arguments->opening_loc, .arguments = arguments->arguments, @@ -7349,16 +6579,11 @@ static pm_symbol_node_t * pm_symbol_node_create_unescaped(pm_parser_t *parser, const pm_token_t *opening, const pm_token_t *value, const pm_token_t *closing, const pm_string_t *unescaped, pm_node_flags_t flags) { pm_symbol_node_t *node = PM_NODE_ALLOC(parser, pm_symbol_node_t); + const uint8_t *start = (opening->type == PM_TOKEN_NOT_PROVIDED ? value->start : opening->start); + const uint8_t *end = (closing->type == PM_TOKEN_NOT_PROVIDED ? value->end : closing->end); + *node = (pm_symbol_node_t) { - { - .type = PM_SYMBOL_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL | flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = (opening->type == PM_TOKEN_NOT_PROVIDED ? value->start : opening->start), - .end = (closing->type == PM_TOKEN_NOT_PROVIDED ? value->end : closing->end) - } - }, + .base = PM_NODE_INIT(parser, PM_SYMBOL_NODE, PM_NODE_FLAG_STATIC_LITERAL | flags, start, end), .opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening), .value_loc = PM_LOCATION_TOKEN_VALUE(value), .closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing), @@ -7403,7 +6628,7 @@ pm_symbol_node_label_create(pm_parser_t *parser, const pm_token_t *token) { assert((label.end - label.start) >= 0); pm_string_shared_init(&node->unescaped, label.start, label.end); - pm_node_flag_set((pm_node_t *) node, parse_symbol_encoding(parser, &label, &node->unescaped, false)); + pm_node_flag_set(UP(node), parse_symbol_encoding(parser, &label, &node->unescaped, false)); break; } @@ -7432,12 +6657,7 @@ pm_symbol_node_synthesized_create(pm_parser_t *parser, const char *content) { pm_symbol_node_t *node = PM_NODE_ALLOC(parser, pm_symbol_node_t); *node = (pm_symbol_node_t) { - { - .type = PM_SYMBOL_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL | PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_NULL_VALUE(parser) - }, + .base = PM_NODE_INIT_BASE(parser, PM_SYMBOL_NODE, PM_NODE_FLAG_STATIC_LITERAL | PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING), .value_loc = PM_LOCATION_NULL_VALUE(parser), .unescaped = { 0 } }; @@ -7475,15 +6695,7 @@ pm_string_node_to_symbol_node(pm_parser_t *parser, pm_string_node_t *node, const pm_symbol_node_t *new_node = PM_NODE_ALLOC(parser, pm_symbol_node_t); *new_node = (pm_symbol_node_t) { - { - .type = PM_SYMBOL_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = closing->end - } - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_SYMBOL_NODE, PM_NODE_FLAG_STATIC_LITERAL, opening, closing), .opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening), .value_loc = node->content_loc, .closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing), @@ -7491,7 +6703,7 @@ pm_string_node_to_symbol_node(pm_parser_t *parser, pm_string_node_t *node, const }; pm_token_t content = { .type = PM_TOKEN_IDENTIFIER, .start = node->content_loc.start, .end = node->content_loc.end }; - pm_node_flag_set((pm_node_t *) new_node, parse_symbol_encoding(parser, &content, &node->unescaped, true)); + pm_node_flag_set(UP(new_node), parse_symbol_encoding(parser, &content, &node->unescaped, true)); // We are explicitly _not_ using pm_node_destroy here because we don't want // to trash the unescaped string. We could instead copy the string if we @@ -7519,12 +6731,7 @@ pm_symbol_node_to_string_node(pm_parser_t *parser, pm_symbol_node_t *node) { } *new_node = (pm_string_node_t) { - { - .type = PM_STRING_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = node->base.location - }, + .base = PM_NODE_INIT_NODE(parser, PM_STRING_NODE, flags, node), .opening_loc = node->opening_loc, .content_loc = node->value_loc, .closing_loc = node->closing_loc, @@ -7547,12 +6754,9 @@ pm_true_node_create(pm_parser_t *parser, const pm_token_t *token) { assert(token->type == PM_TOKEN_KEYWORD_TRUE); pm_true_node_t *node = PM_NODE_ALLOC(parser, pm_true_node_t); - *node = (pm_true_node_t) {{ - .type = PM_TRUE_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token) - }}; + *node = (pm_true_node_t) { + .base = PM_NODE_INIT_TOKEN(parser, PM_TRUE_NODE, PM_NODE_FLAG_STATIC_LITERAL, token) + }; return node; } @@ -7564,12 +6768,9 @@ static pm_true_node_t * pm_true_node_synthesized_create(pm_parser_t *parser) { pm_true_node_t *node = PM_NODE_ALLOC(parser, pm_true_node_t); - *node = (pm_true_node_t) {{ - .type = PM_TRUE_NODE, - .flags = PM_NODE_FLAG_STATIC_LITERAL, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { .start = parser->start, .end = parser->end } - }}; + *node = (pm_true_node_t) { + .base = PM_NODE_INIT_BASE(parser, PM_TRUE_NODE, PM_NODE_FLAG_STATIC_LITERAL) + }; return node; } @@ -7583,11 +6784,7 @@ pm_undef_node_create(pm_parser_t *parser, const pm_token_t *token) { pm_undef_node_t *node = PM_NODE_ALLOC(parser, pm_undef_node_t); *node = (pm_undef_node_t) { - { - .type = PM_UNDEF_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_TOKEN_VALUE(token), - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_UNDEF_NODE, 0, token), .keyword_loc = PM_LOCATION_TOKEN_VALUE(token), .names = { 0 } }; @@ -7610,31 +6807,18 @@ pm_undef_node_append(pm_undef_node_t *node, pm_node_t *name) { static pm_unless_node_t * pm_unless_node_create(pm_parser_t *parser, const pm_token_t *keyword, pm_node_t *predicate, const pm_token_t *then_keyword, pm_statements_node_t *statements) { pm_conditional_predicate(parser, predicate, PM_CONDITIONAL_PREDICATE_TYPE_CONDITIONAL); - pm_unless_node_t *node = PM_NODE_ALLOC(parser, pm_unless_node_t); - const uint8_t *end; - if (statements != NULL) { - end = statements->base.location.end; - } else { - end = predicate->location.end; - } + pm_unless_node_t *node = PM_NODE_ALLOC(parser, pm_unless_node_t); + pm_node_t *end = statements == NULL ? predicate : UP(statements); *node = (pm_unless_node_t) { - { - .type = PM_UNLESS_NODE, - .flags = PM_NODE_FLAG_NEWLINE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = end - }, - }, + .base = PM_NODE_INIT_TOKEN_NODE(parser, PM_UNLESS_NODE, PM_NODE_FLAG_NEWLINE, keyword, end), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .predicate = predicate, .then_keyword_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(then_keyword), .statements = statements, .else_clause = NULL, - .end_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE + .end_keyword_loc = { 0 } }; return node; @@ -7652,21 +6836,13 @@ pm_unless_node_modifier_create(pm_parser_t *parser, pm_node_t *statement, const pm_statements_node_body_append(parser, statements, statement, true); *node = (pm_unless_node_t) { - { - .type = PM_UNLESS_NODE, - .flags = PM_NODE_FLAG_NEWLINE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = statement->location.start, - .end = predicate->location.end - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_UNLESS_NODE, PM_NODE_FLAG_NEWLINE, statement, predicate), .keyword_loc = PM_LOCATION_TOKEN_VALUE(unless_keyword), .predicate = predicate, - .then_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, + .then_keyword_loc = { 0 }, .statements = statements, .else_clause = NULL, - .end_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE + .end_keyword_loc = { 0 } }; return node; @@ -7710,15 +6886,7 @@ pm_until_node_create(pm_parser_t *parser, const pm_token_t *keyword, const pm_to pm_conditional_predicate(parser, predicate, PM_CONDITIONAL_PREDICATE_TYPE_CONDITIONAL); *node = (pm_until_node_t) { - { - .type = PM_UNTIL_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = closing->end, - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_UNTIL_NODE, flags, keyword, closing), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .do_keyword_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(do_keyword), .closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing), @@ -7739,18 +6907,10 @@ pm_until_node_modifier_create(pm_parser_t *parser, const pm_token_t *keyword, pm pm_loop_modifier_block_exits(parser, statements); *node = (pm_until_node_t) { - { - .type = PM_UNTIL_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = statements->base.location.start, - .end = predicate->location.end, - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_UNTIL_NODE, flags, statements, predicate), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), - .do_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, - .closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, + .do_keyword_loc = { 0 }, + .closing_loc = { 0 }, .predicate = predicate, .statements = statements }; @@ -7766,17 +6926,10 @@ pm_when_node_create(pm_parser_t *parser, const pm_token_t *keyword) { pm_when_node_t *node = PM_NODE_ALLOC(parser, pm_when_node_t); *node = (pm_when_node_t) { - { - .type = PM_WHEN_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = NULL - } - }, + .base = PM_NODE_INIT_TOKEN(parser, PM_WHEN_NODE, 0, keyword), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .statements = NULL, - .then_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, + .then_keyword_loc = { 0 }, .conditions = { 0 } }; @@ -7822,15 +6975,7 @@ pm_while_node_create(pm_parser_t *parser, const pm_token_t *keyword, const pm_to pm_conditional_predicate(parser, predicate, PM_CONDITIONAL_PREDICATE_TYPE_CONDITIONAL); *node = (pm_while_node_t) { - { - .type = PM_WHILE_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = closing->end - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_WHILE_NODE, flags, keyword, closing), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .do_keyword_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(do_keyword), .closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing), @@ -7851,18 +6996,10 @@ pm_while_node_modifier_create(pm_parser_t *parser, const pm_token_t *keyword, pm pm_loop_modifier_block_exits(parser, statements); *node = (pm_while_node_t) { - { - .type = PM_WHILE_NODE, - .flags = flags, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = statements->base.location.start, - .end = predicate->location.end - }, - }, + .base = PM_NODE_INIT_NODES(parser, PM_WHILE_NODE, flags, statements, predicate), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), - .do_keyword_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, - .closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE, + .do_keyword_loc = { 0 }, + .closing_loc = { 0 }, .predicate = predicate, .statements = statements }; @@ -7878,11 +7015,7 @@ pm_while_node_synthesized_create(pm_parser_t *parser, pm_node_t *predicate, pm_s pm_while_node_t *node = PM_NODE_ALLOC(parser, pm_while_node_t); *node = (pm_while_node_t) { - { - .type = PM_WHILE_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = PM_LOCATION_NULL_VALUE(parser) - }, + .base = PM_NODE_INIT_BASE(parser, PM_WHILE_NODE, 0), .keyword_loc = PM_LOCATION_NULL_VALUE(parser), .do_keyword_loc = PM_LOCATION_NULL_VALUE(parser), .closing_loc = PM_LOCATION_NULL_VALUE(parser), @@ -7902,15 +7035,7 @@ pm_xstring_node_create_unescaped(pm_parser_t *parser, const pm_token_t *opening, pm_x_string_node_t *node = PM_NODE_ALLOC(parser, pm_x_string_node_t); *node = (pm_x_string_node_t) { - { - .type = PM_X_STRING_NODE, - .flags = PM_STRING_FLAGS_FROZEN, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = opening->start, - .end = closing->end - }, - }, + .base = PM_NODE_INIT_TOKENS(parser, PM_X_STRING_NODE, PM_STRING_FLAGS_FROZEN, opening, closing), .opening_loc = PM_LOCATION_TOKEN_VALUE(opening), .content_loc = PM_LOCATION_TOKEN_VALUE(content), .closing_loc = PM_LOCATION_TOKEN_VALUE(closing), @@ -7947,14 +7072,7 @@ pm_yield_node_create(pm_parser_t *parser, const pm_token_t *keyword, const pm_lo } *node = (pm_yield_node_t) { - { - .type = PM_YIELD_NODE, - .node_id = PM_NODE_IDENTIFY(parser), - .location = { - .start = keyword->start, - .end = end - }, - }, + .base = PM_NODE_INIT(parser, PM_YIELD_NODE, 0, keyword->start, end), .keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword), .lparen_loc = *lparen_loc, .arguments = arguments, @@ -7964,9 +7082,6 @@ pm_yield_node_create(pm_parser_t *parser, const pm_token_t *keyword, const pm_lo return node; } -#undef PM_NODE_ALLOC -#undef PM_NODE_IDENTIFY - /** * Check if any of the currently visible scopes contain a local variable * described by the given constant id. @@ -8429,7 +7544,7 @@ parser_lex_magic_comment(pm_parser_t *parser, bool semantic_token_seen) { if (*cursor == '\\' && (cursor + 1 < end)) cursor++; } value_end = cursor; - if (*cursor == '"') cursor++; + if (cursor < end && *cursor == '"') cursor++; } else { value_start = cursor; while (cursor < end && *cursor != '"' && *cursor != ';' && !pm_char_is_whitespace(*cursor)) cursor++; @@ -8558,109 +7673,91 @@ parser_lex_magic_comment(pm_parser_t *parser, bool semantic_token_seen) { ); } } - } - - // When we're done, we want to free the string in case we had to - // allocate memory for it. - pm_string_free(&key); - - // Allocate a new magic comment node to append to the parser's list. - pm_magic_comment_t *magic_comment; - if ((magic_comment = (pm_magic_comment_t *) xcalloc(1, sizeof(pm_magic_comment_t))) != NULL) { - magic_comment->key_start = key_start; - magic_comment->value_start = value_start; - magic_comment->key_length = (uint32_t) key_length; - magic_comment->value_length = value_length; - pm_list_append(&parser->magic_comment_list, (pm_list_node_t *) magic_comment); - } - } - - return result; -} - -/******************************************************************************/ -/* Context manipulations */ -/******************************************************************************/ - -static bool -context_terminator(pm_context_t context, pm_token_t *token) { - switch (context) { - case PM_CONTEXT_MAIN: - case PM_CONTEXT_DEF_PARAMS: - case PM_CONTEXT_DEFINED: - case PM_CONTEXT_MULTI_TARGET: - case PM_CONTEXT_TERNARY: - case PM_CONTEXT_RESCUE_MODIFIER: - return token->type == PM_TOKEN_EOF; - case PM_CONTEXT_DEFAULT_PARAMS: - return token->type == PM_TOKEN_COMMA || token->type == PM_TOKEN_PARENTHESIS_RIGHT; - case PM_CONTEXT_PREEXE: - case PM_CONTEXT_POSTEXE: - return token->type == PM_TOKEN_BRACE_RIGHT; - case PM_CONTEXT_MODULE: - case PM_CONTEXT_CLASS: - case PM_CONTEXT_SCLASS: - case PM_CONTEXT_LAMBDA_DO_END: - case PM_CONTEXT_DEF: - case PM_CONTEXT_BLOCK_KEYWORDS: - return token->type == PM_TOKEN_KEYWORD_END || token->type == PM_TOKEN_KEYWORD_RESCUE || token->type == PM_TOKEN_KEYWORD_ENSURE; - case PM_CONTEXT_WHILE: - case PM_CONTEXT_UNTIL: - case PM_CONTEXT_ELSE: - case PM_CONTEXT_FOR: - case PM_CONTEXT_BEGIN_ENSURE: - case PM_CONTEXT_BLOCK_ENSURE: - case PM_CONTEXT_CLASS_ENSURE: - case PM_CONTEXT_DEF_ENSURE: - case PM_CONTEXT_LAMBDA_ENSURE: - case PM_CONTEXT_MODULE_ENSURE: - case PM_CONTEXT_SCLASS_ENSURE: - return token->type == PM_TOKEN_KEYWORD_END; - case PM_CONTEXT_LOOP_PREDICATE: - return token->type == PM_TOKEN_KEYWORD_DO || token->type == PM_TOKEN_KEYWORD_THEN; - case PM_CONTEXT_FOR_INDEX: - return token->type == PM_TOKEN_KEYWORD_IN; - case PM_CONTEXT_CASE_WHEN: - return token->type == PM_TOKEN_KEYWORD_WHEN || token->type == PM_TOKEN_KEYWORD_END || token->type == PM_TOKEN_KEYWORD_ELSE; - case PM_CONTEXT_CASE_IN: - return token->type == PM_TOKEN_KEYWORD_IN || token->type == PM_TOKEN_KEYWORD_END || token->type == PM_TOKEN_KEYWORD_ELSE; - case PM_CONTEXT_IF: - case PM_CONTEXT_ELSIF: - return token->type == PM_TOKEN_KEYWORD_ELSE || token->type == PM_TOKEN_KEYWORD_ELSIF || token->type == PM_TOKEN_KEYWORD_END; - case PM_CONTEXT_UNLESS: - return token->type == PM_TOKEN_KEYWORD_ELSE || token->type == PM_TOKEN_KEYWORD_END; - case PM_CONTEXT_EMBEXPR: - return token->type == PM_TOKEN_EMBEXPR_END; - case PM_CONTEXT_BLOCK_BRACES: - return token->type == PM_TOKEN_BRACE_RIGHT; - case PM_CONTEXT_PARENS: - return token->type == PM_TOKEN_PARENTHESIS_RIGHT; - case PM_CONTEXT_BEGIN: - case PM_CONTEXT_BEGIN_RESCUE: - case PM_CONTEXT_BLOCK_RESCUE: - case PM_CONTEXT_CLASS_RESCUE: - case PM_CONTEXT_DEF_RESCUE: - case PM_CONTEXT_LAMBDA_RESCUE: - case PM_CONTEXT_MODULE_RESCUE: - case PM_CONTEXT_SCLASS_RESCUE: - return token->type == PM_TOKEN_KEYWORD_ENSURE || token->type == PM_TOKEN_KEYWORD_RESCUE || token->type == PM_TOKEN_KEYWORD_ELSE || token->type == PM_TOKEN_KEYWORD_END; - case PM_CONTEXT_BEGIN_ELSE: - case PM_CONTEXT_BLOCK_ELSE: - case PM_CONTEXT_CLASS_ELSE: - case PM_CONTEXT_DEF_ELSE: - case PM_CONTEXT_LAMBDA_ELSE: - case PM_CONTEXT_MODULE_ELSE: - case PM_CONTEXT_SCLASS_ELSE: - return token->type == PM_TOKEN_KEYWORD_ENSURE || token->type == PM_TOKEN_KEYWORD_END; - case PM_CONTEXT_LAMBDA_BRACES: - return token->type == PM_TOKEN_BRACE_RIGHT; - case PM_CONTEXT_PREDICATE: - return token->type == PM_TOKEN_KEYWORD_THEN || token->type == PM_TOKEN_NEWLINE || token->type == PM_TOKEN_SEMICOLON; - case PM_CONTEXT_NONE: - return false; + } + + // When we're done, we want to free the string in case we had to + // allocate memory for it. + pm_string_free(&key); + + // Allocate a new magic comment node to append to the parser's list. + pm_magic_comment_t *magic_comment; + if ((magic_comment = (pm_magic_comment_t *) xcalloc(1, sizeof(pm_magic_comment_t))) != NULL) { + magic_comment->key_start = key_start; + magic_comment->value_start = value_start; + magic_comment->key_length = (uint32_t) key_length; + magic_comment->value_length = value_length; + pm_list_append(&parser->magic_comment_list, (pm_list_node_t *) magic_comment); + } } - return false; + return result; +} + +/******************************************************************************/ +/* Context manipulations */ +/******************************************************************************/ + +static const uint32_t context_terminators[] = { + [PM_CONTEXT_NONE] = 0, + [PM_CONTEXT_BEGIN] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_BEGIN_ENSURE] = (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_BEGIN_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_BEGIN_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_BLOCK_BRACES] = (1U << PM_TOKEN_BRACE_RIGHT), + [PM_CONTEXT_BLOCK_KEYWORDS] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE), + [PM_CONTEXT_BLOCK_ENSURE] = (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_BLOCK_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_BLOCK_PARAMETERS] = (1U << PM_TOKEN_PIPE), + [PM_CONTEXT_BLOCK_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_CASE_WHEN] = (1U << PM_TOKEN_KEYWORD_WHEN) | (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_ELSE), + [PM_CONTEXT_CASE_IN] = (1U << PM_TOKEN_KEYWORD_IN) | (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_ELSE), + [PM_CONTEXT_CLASS] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE), + [PM_CONTEXT_CLASS_ENSURE] = (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_CLASS_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_CLASS_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_DEF] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE), + [PM_CONTEXT_DEF_ENSURE] = (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_DEF_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_DEF_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_DEF_PARAMS] = (1U << PM_TOKEN_EOF), + [PM_CONTEXT_DEFINED] = (1U << PM_TOKEN_EOF), + [PM_CONTEXT_DEFAULT_PARAMS] = (1U << PM_TOKEN_COMMA) | (1U << PM_TOKEN_PARENTHESIS_RIGHT), + [PM_CONTEXT_ELSE] = (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_ELSIF] = (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_ELSIF) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_EMBEXPR] = (1U << PM_TOKEN_EMBEXPR_END), + [PM_CONTEXT_FOR] = (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_FOR_INDEX] = (1U << PM_TOKEN_KEYWORD_IN), + [PM_CONTEXT_IF] = (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_ELSIF) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_LAMBDA_BRACES] = (1U << PM_TOKEN_BRACE_RIGHT), + [PM_CONTEXT_LAMBDA_DO_END] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE), + [PM_CONTEXT_LAMBDA_ENSURE] = (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_LAMBDA_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_LAMBDA_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_LOOP_PREDICATE] = (1U << PM_TOKEN_KEYWORD_DO) | (1U << PM_TOKEN_KEYWORD_THEN), + [PM_CONTEXT_MAIN] = (1U << PM_TOKEN_EOF), + [PM_CONTEXT_MODULE] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE), + [PM_CONTEXT_MODULE_ENSURE] = (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_MODULE_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_MODULE_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_MULTI_TARGET] = (1U << PM_TOKEN_EOF), + [PM_CONTEXT_PARENS] = (1U << PM_TOKEN_PARENTHESIS_RIGHT), + [PM_CONTEXT_POSTEXE] = (1U << PM_TOKEN_BRACE_RIGHT), + [PM_CONTEXT_PREDICATE] = (1U << PM_TOKEN_KEYWORD_THEN) | (1U << PM_TOKEN_NEWLINE) | (1U << PM_TOKEN_SEMICOLON), + [PM_CONTEXT_PREEXE] = (1U << PM_TOKEN_BRACE_RIGHT), + [PM_CONTEXT_RESCUE_MODIFIER] = (1U << PM_TOKEN_EOF), + [PM_CONTEXT_SCLASS] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE), + [PM_CONTEXT_SCLASS_ENSURE] = (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_SCLASS_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_SCLASS_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_TERNARY] = (1U << PM_TOKEN_EOF), + [PM_CONTEXT_UNLESS] = (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_UNTIL] = (1U << PM_TOKEN_KEYWORD_END), + [PM_CONTEXT_WHILE] = (1U << PM_TOKEN_KEYWORD_END), +}; + +static inline bool +context_terminator(pm_context_t context, pm_token_t *token) { + return token->type < 32 && (context_terminators[context] & (1U << token->type)); } /** @@ -8761,6 +7858,7 @@ context_human(pm_context_t context) { case PM_CONTEXT_BEGIN: return "begin statement"; case PM_CONTEXT_BLOCK_BRACES: return "'{'..'}' block"; case PM_CONTEXT_BLOCK_KEYWORDS: return "'do'..'end' block"; + case PM_CONTEXT_BLOCK_PARAMETERS: return "'|'..'|' block parameter"; case PM_CONTEXT_CASE_WHEN: return "'when' clause"; case PM_CONTEXT_CASE_IN: return "'in' clause"; case PM_CONTEXT_CLASS: return "class definition"; @@ -9109,7 +8207,7 @@ lex_global_variable(pm_parser_t *parser) { } while ((width = char_is_identifier(parser, parser->current.end, parser->end - parser->current.end)) > 0); // $0 isn't allowed to be followed by anything. - pm_diagnostic_id_t diag_id = parser->version == PM_OPTIONS_VERSION_CRUBY_3_3 ? PM_ERR_INVALID_VARIABLE_GLOBAL_3_3 : PM_ERR_INVALID_VARIABLE_GLOBAL; + pm_diagnostic_id_t diag_id = parser->version <= PM_OPTIONS_VERSION_CRUBY_3_3 ? PM_ERR_INVALID_VARIABLE_GLOBAL_3_3 : PM_ERR_INVALID_VARIABLE_GLOBAL; PM_PARSER_ERR_TOKEN_FORMAT_CONTENT(parser, parser->current, diag_id); } @@ -9146,7 +8244,7 @@ lex_global_variable(pm_parser_t *parser) { } else { // If we get here, then we have a $ followed by something that // isn't recognized as a global variable. - pm_diagnostic_id_t diag_id = parser->version == PM_OPTIONS_VERSION_CRUBY_3_3 ? PM_ERR_INVALID_VARIABLE_GLOBAL_3_3 : PM_ERR_INVALID_VARIABLE_GLOBAL; + pm_diagnostic_id_t diag_id = parser->version <= PM_OPTIONS_VERSION_CRUBY_3_3 ? PM_ERR_INVALID_VARIABLE_GLOBAL_3_3 : PM_ERR_INVALID_VARIABLE_GLOBAL; const uint8_t *end = parser->current.end + parser->encoding->char_width(parser->current.end, parser->end - parser->current.end); PM_PARSER_ERR_FORMAT(parser, parser->current.start, end, diag_id, (int) (end - parser->current.start), (const char *) parser->current.start); } @@ -9519,7 +8617,7 @@ escape_hexadecimal_digit(const uint8_t value) { * validated. */ static inline uint32_t -escape_unicode(pm_parser_t *parser, const uint8_t *string, size_t length) { +escape_unicode(pm_parser_t *parser, const uint8_t *string, size_t length, const pm_location_t *error_location) { uint32_t value = 0; for (size_t index = 0; index < length; index++) { if (index != 0) value <<= 4; @@ -9529,7 +8627,11 @@ escape_unicode(pm_parser_t *parser, const uint8_t *string, size_t length) { // Here we're going to verify that the value is actually a valid Unicode // codepoint and not a surrogate pair. if (value >= 0xD800 && value <= 0xDFFF) { - pm_parser_err(parser, string, string + length, PM_ERR_ESCAPE_INVALID_UNICODE); + if (error_location != NULL) { + pm_parser_err(parser, error_location->start, error_location->end, PM_ERR_ESCAPE_INVALID_UNICODE); + } else { + pm_parser_err(parser, string, string + length, PM_ERR_ESCAPE_INVALID_UNICODE); + } return 0xFFFD; } @@ -9829,7 +8931,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, pm_buffer_t *regular_expre extra_codepoints_start = unicode_start; } - uint32_t value = escape_unicode(parser, unicode_start, hexadecimal_length); + uint32_t value = escape_unicode(parser, unicode_start, hexadecimal_length, NULL); escape_write_unicode(parser, buffer, flags, unicode_start, parser->current.end, value); parser->current.end += pm_strspn_inline_whitespace(parser->current.end, parser->end - parser->current.end); @@ -9870,7 +8972,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, pm_buffer_t *regular_expre PM_PARSER_ERR_FORMAT(parser, start, parser->current.end, PM_ERR_ESCAPE_INVALID_UNICODE_SHORT, 2, start); } } else if (length == 4) { - uint32_t value = escape_unicode(parser, parser->current.end, 4); + uint32_t value = escape_unicode(parser, parser->current.end, 4, NULL); if (flags & PM_ESCAPE_FLAG_REGEXP) { pm_buffer_append_bytes(regular_expression_buffer, start, (size_t) (parser->current.end + 4 - start)); @@ -10173,7 +9275,7 @@ lex_at_variable(pm_parser_t *parser) { } } else if (parser->current.end < end && pm_char_is_decimal_digit(*parser->current.end)) { pm_diagnostic_id_t diag_id = (type == PM_TOKEN_CLASS_VARIABLE) ? PM_ERR_INCOMPLETE_VARIABLE_CLASS : PM_ERR_INCOMPLETE_VARIABLE_INSTANCE; - if (parser->version == PM_OPTIONS_VERSION_CRUBY_3_3) { + if (parser->version <= PM_OPTIONS_VERSION_CRUBY_3_3) { diag_id = (type == PM_TOKEN_CLASS_VARIABLE) ? PM_ERR_INCOMPLETE_VARIABLE_CLASS_3_3 : PM_ERR_INCOMPLETE_VARIABLE_INSTANCE_3_3; } @@ -10849,14 +9951,37 @@ parser_lex(pm_parser_t *parser) { following = next_newline(following, parser->end - following); } - // If the lex state was ignored, or we hit a '.' or a '&.', - // we will lex the ignored newline + // If the lex state was ignored, we will lex the + // ignored newline. + if (lex_state_ignored_p(parser)) { + if (!lexed_comment) parser_lex_ignored_newline(parser); + lexed_comment = false; + goto lex_next_token; + } + + // If we hit a '.' or a '&.' we will lex the ignored + // newline. + if (following && ( + (peek_at(parser, following) == '.') || + (peek_at(parser, following) == '&' && peek_at(parser, following + 1) == '.') + )) { + if (!lexed_comment) parser_lex_ignored_newline(parser); + lexed_comment = false; + goto lex_next_token; + } + + + // If we are parsing as CRuby 4.0 or later and we + // hit a '&&' or a '||' then we will lex the ignored + // newline. if ( - lex_state_ignored_p(parser) || - (following && ( - (peek_at(parser, following) == '.') || - (peek_at(parser, following) == '&' && peek_at(parser, following + 1) == '.') - )) + (parser->version >= PM_OPTIONS_VERSION_CRUBY_4_0) && + following && ( + (peek_at(parser, following) == '&' && peek_at(parser, following + 1) == '&') || + (peek_at(parser, following) == '|' && peek_at(parser, following + 1) == '|') || + (peek_at(parser, following) == 'a' && peek_at(parser, following + 1) == 'n' && peek_at(parser, following + 2) == 'd' && !char_is_identifier(parser, following + 3, parser->end - (following + 3))) || + (peek_at(parser, following) == 'o' && peek_at(parser, following + 1) == 'r' && !char_is_identifier(parser, following + 2, parser->end - (following + 2))) + ) ) { if (!lexed_comment) parser_lex_ignored_newline(parser); lexed_comment = false; @@ -10896,6 +10021,63 @@ parser_lex(pm_parser_t *parser) { parser->next_start = NULL; LEX(PM_TOKEN_AMPERSAND_DOT); } + + if (parser->version >= PM_OPTIONS_VERSION_CRUBY_4_0) { + // If we hit an && then we are in a logical chain + // and we need to return the logical operator. + if (peek_at(parser, next_content) == '&' && peek_at(parser, next_content + 1) == '&') { + if (!lexed_comment) parser_lex_ignored_newline(parser); + lex_state_set(parser, PM_LEX_STATE_BEG); + parser->current.start = next_content; + parser->current.end = next_content + 2; + parser->next_start = NULL; + LEX(PM_TOKEN_AMPERSAND_AMPERSAND); + } + + // If we hit a || then we are in a logical chain and + // we need to return the logical operator. + if (peek_at(parser, next_content) == '|' && peek_at(parser, next_content + 1) == '|') { + if (!lexed_comment) parser_lex_ignored_newline(parser); + lex_state_set(parser, PM_LEX_STATE_BEG); + parser->current.start = next_content; + parser->current.end = next_content + 2; + parser->next_start = NULL; + LEX(PM_TOKEN_PIPE_PIPE); + } + + // If we hit an 'and' then we are in a logical chain + // and we need to return the logical operator. + if ( + peek_at(parser, next_content) == 'a' && + peek_at(parser, next_content + 1) == 'n' && + peek_at(parser, next_content + 2) == 'd' && + !char_is_identifier(parser, next_content + 3, parser->end - (next_content + 3)) + ) { + if (!lexed_comment) parser_lex_ignored_newline(parser); + lex_state_set(parser, PM_LEX_STATE_BEG); + parser->current.start = next_content; + parser->current.end = next_content + 3; + parser->next_start = NULL; + parser->command_start = true; + LEX(PM_TOKEN_KEYWORD_AND); + } + + // If we hit a 'or' then we are in a logical chain + // and we need to return the logical operator. + if ( + peek_at(parser, next_content) == 'o' && + peek_at(parser, next_content + 1) == 'r' && + !char_is_identifier(parser, next_content + 2, parser->end - (next_content + 2)) + ) { + if (!lexed_comment) parser_lex_ignored_newline(parser); + lex_state_set(parser, PM_LEX_STATE_BEG); + parser->current.start = next_content; + parser->current.end = next_content + 2; + parser->next_start = NULL; + parser->command_start = true; + LEX(PM_TOKEN_KEYWORD_OR); + } + } } // At this point we know this is a regular newline, and we can set the @@ -12170,7 +11352,13 @@ parser_lex(pm_parser_t *parser) { size_t eol_length = match_eol_at(parser, breakpoint); if (eol_length) { parser->current.end = breakpoint + eol_length; - pm_newline_list_append(&parser->newline_list, parser->current.end - 1); + + // Track the newline if we're not in a heredoc that + // would have already have added the newline to the + // list. + if (parser->heredoc_end == NULL) { + pm_newline_list_append(&parser->newline_list, parser->current.end - 1); + } } else { parser->current.end = breakpoint + 1; } @@ -12424,7 +11612,13 @@ parser_lex(pm_parser_t *parser) { size_t eol_length = match_eol_at(parser, breakpoint); if (eol_length) { parser->current.end = breakpoint + eol_length; - pm_newline_list_append(&parser->newline_list, parser->current.end - 1); + + // Track the newline if we're not in a heredoc that + // would have already have added the newline to the + // list. + if (parser->heredoc_end == NULL) { + pm_newline_list_append(&parser->newline_list, parser->current.end - 1); + } } else { parser->current.end = breakpoint + 1; } @@ -12436,6 +11630,13 @@ parser_lex(pm_parser_t *parser) { LEX(PM_TOKEN_LABEL_END); } + // When the delimiter itself is a newline, we won't + // get a chance to flush heredocs in the usual places since + // the newline is already consumed. + if (term == '\n' && parser->heredoc_end) { + parser_flush_heredoc_end(parser); + } + lex_state_set(parser, PM_LEX_STATE_END); lex_mode_pop(parser); LEX(PM_TOKEN_STRING_END); @@ -12841,7 +12042,10 @@ parser_lex(pm_parser_t *parser) { // string content. if (heredoc_lex_mode->indent == PM_HEREDOC_INDENT_TILDE) { const uint8_t *end = parser->current.end; - pm_newline_list_append(&parser->newline_list, end); + + if (parser->heredoc_end == NULL) { + pm_newline_list_append(&parser->newline_list, end); + } // Here we want the buffer to only // include up to the backslash. @@ -13142,14 +12346,6 @@ match8(const pm_parser_t *parser, pm_token_type_t type1, pm_token_type_t type2, return match1(parser, type1) || match1(parser, type2) || match1(parser, type3) || match1(parser, type4) || match1(parser, type5) || match1(parser, type6) || match1(parser, type7) || match1(parser, type8); } -/** - * Returns true if the current token is any of the nine given types. - */ -static inline bool -match9(const pm_parser_t *parser, pm_token_type_t type1, pm_token_type_t type2, pm_token_type_t type3, pm_token_type_t type4, pm_token_type_t type5, pm_token_type_t type6, pm_token_type_t type7, pm_token_type_t type8, pm_token_type_t type9) { - return match1(parser, type1) || match1(parser, type2) || match1(parser, type3) || match1(parser, type4) || match1(parser, type5) || match1(parser, type6) || match1(parser, type7) || match1(parser, type8) || match1(parser, type9); -} - /** * If the current token is of the specified type, lex forward by one token and * return true. Otherwise, return false. For example: @@ -13230,6 +12426,22 @@ expect1_heredoc_term(pm_parser_t *parser, const uint8_t *ident_start, size_t ide } } +/** + * A special expect1 that attaches the error to the opening token location + * rather than the current position. This is useful for errors about missing + * closing tokens, where we want to point to the line with the opening token + * (e.g., `def`, `class`, `if`, `{`) rather than the end of the file. + */ +static void +expect1_opening(pm_parser_t *parser, pm_token_type_t type, pm_diagnostic_id_t diag_id, const pm_token_t *opening) { + if (accept1(parser, type)) return; + + pm_parser_err(parser, opening->start, opening->end, diag_id); + + parser->previous.start = parser->previous.end; + parser->previous.type = PM_TOKEN_MISSING; +} + static pm_node_t * parse_expression(pm_parser_t *parser, pm_binding_power_t binding_power, bool accepts_command_call, bool accepts_label, pm_diagnostic_id_t diag_id, uint16_t depth); @@ -13327,12 +12539,87 @@ parse_starred_expression(pm_parser_t *parser, pm_binding_power_t binding_power, if (accept1(parser, PM_TOKEN_USTAR)) { pm_token_t operator = parser->previous; pm_node_t *expression = parse_value_expression(parser, binding_power, false, false, PM_ERR_EXPECT_EXPRESSION_AFTER_STAR, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_splat_node_create(parser, &operator, expression); + return UP(pm_splat_node_create(parser, &operator, expression)); } return parse_value_expression(parser, binding_power, accepts_command_call, false, diag_id, depth); } +static bool +pm_node_unreference_each(const pm_node_t *node, void *data) { + switch (PM_NODE_TYPE(node)) { + /* When we are about to destroy a set of nodes that could potentially + * contain block exits for the current scope, we need to check if they + * are contained in the list of block exits and remove them if they are. + */ + case PM_BREAK_NODE: + case PM_NEXT_NODE: + case PM_REDO_NODE: { + pm_parser_t *parser = (pm_parser_t *) data; + size_t index = 0; + + while (index < parser->current_block_exits->size) { + pm_node_t *block_exit = parser->current_block_exits->nodes[index]; + + if (block_exit == node) { + if (index + 1 < parser->current_block_exits->size) { + memmove( + &parser->current_block_exits->nodes[index], + &parser->current_block_exits->nodes[index + 1], + (parser->current_block_exits->size - index - 1) * sizeof(pm_node_t *) + ); + } + parser->current_block_exits->size--; + + /* Note returning true here because these nodes could have + * arguments that are themselves block exits. */ + return true; + } + + index++; + } + + return true; + } + /* When an implicit local variable is written to or targeted, it becomes + * a regular, named local variable. This branch removes it from the list + * of implicit parameters when that happens. */ + case PM_LOCAL_VARIABLE_READ_NODE: + case PM_IT_LOCAL_VARIABLE_READ_NODE: { + pm_parser_t *parser = (pm_parser_t *) data; + pm_node_list_t *implicit_parameters = &parser->current_scope->implicit_parameters; + + for (size_t index = 0; index < implicit_parameters->size; index++) { + if (implicit_parameters->nodes[index] == node) { + /* If the node is not the last one in the list, we need to + * shift the remaining nodes down to fill the gap. This is + * extremely unlikely to happen. */ + if (index != implicit_parameters->size - 1) { + memmove(&implicit_parameters->nodes[index], &implicit_parameters->nodes[index + 1], (implicit_parameters->size - index - 1) * sizeof(pm_node_t *)); + } + + implicit_parameters->size--; + break; + } + } + + return false; + } + default: + return true; + } +} + +/** + * When we are about to destroy a set of nodes that could potentially be + * referenced by one or more lists on the parser, then remove them from those + * lists so we don't get a use-after-free. + */ +static void +pm_node_unreference(pm_parser_t *parser, const pm_node_t *node) { + pm_visit_node(node, pm_node_unreference_each, parser); +} + /** * Convert the name of a method into the corresponding write method name. For * example, foo would be turned into foo=. @@ -13380,31 +12667,7 @@ parse_unwriteable_target(pm_parser_t *parser, pm_node_t *target) { pm_local_variable_target_node_t *result = pm_local_variable_target_node_create(parser, &target->location, name, 0); pm_node_destroy(parser, target); - return (pm_node_t *) result; -} - -/** - * When an implicit local variable is written to or targeted, it becomes a - * regular, named local variable. This function removes it from the list of - * implicit parameters when that happens. - */ -static void -parse_target_implicit_parameter(pm_parser_t *parser, pm_node_t *node) { - pm_node_list_t *implicit_parameters = &parser->current_scope->implicit_parameters; - - for (size_t index = 0; index < implicit_parameters->size; index++) { - if (implicit_parameters->nodes[index] == node) { - // If the node is not the last one in the list, we need to shift the - // remaining nodes down to fill the gap. This is extremely unlikely - // to happen. - if (index != implicit_parameters->size - 1) { - memcpy(&implicit_parameters->nodes[index], &implicit_parameters->nodes[index + 1], (implicit_parameters->size - index - 1) * sizeof(pm_node_t *)); - } - - implicit_parameters->size--; - break; - } - } + return UP(result); } /** @@ -13464,7 +12727,7 @@ parse_target(pm_parser_t *parser, pm_node_t *target, bool multiple, bool splat_p case PM_LOCAL_VARIABLE_READ_NODE: { if (pm_token_is_numbered_parameter(target->location.start, target->location.end)) { PM_PARSER_ERR_FORMAT(parser, target->location.start, target->location.end, PM_ERR_PARAMETER_NUMBERED_RESERVED, target->location.start); - parse_target_implicit_parameter(parser, target); + pm_node_unreference(parser, target); } const pm_local_variable_read_node_t *cast = (const pm_local_variable_read_node_t *) target; @@ -13479,9 +12742,9 @@ parse_target(pm_parser_t *parser, pm_node_t *target, bool multiple, bool splat_p } case PM_IT_LOCAL_VARIABLE_READ_NODE: { pm_constant_id_t name = pm_parser_local_add_constant(parser, "it", 2); - pm_node_t *node = (pm_node_t *) pm_local_variable_target_node_create(parser, &target->location, name, 0); + pm_node_t *node = UP(pm_local_variable_target_node_create(parser, &target->location, name, 0)); - parse_target_implicit_parameter(parser, target); + pm_node_unreference(parser, target); pm_node_destroy(parser, target); return node; @@ -13505,7 +12768,7 @@ parse_target(pm_parser_t *parser, pm_node_t *target, bool multiple, bool splat_p splat->expression = parse_target(parser, splat->expression, multiple, true); } - return (pm_node_t *) splat; + return UP(splat); } case PM_CALL_NODE: { pm_call_node_t *call = (pm_call_node_t *) target; @@ -13536,16 +12799,16 @@ parse_target(pm_parser_t *parser, pm_node_t *target, bool multiple, bool splat_p pm_constant_id_t name = pm_parser_local_add_location(parser, message_loc.start, message_loc.end, 0); pm_node_destroy(parser, target); - return (pm_node_t *) pm_local_variable_target_node_create(parser, &message_loc, name, 0); + return UP(pm_local_variable_target_node_create(parser, &message_loc, name, 0)); } - if (*call->message_loc.start == '_' || parser->encoding->alnum_char(call->message_loc.start, call->message_loc.end - call->message_loc.start)) { + if (peek_at(parser, call->message_loc.start) == '_' || parser->encoding->alnum_char(call->message_loc.start, call->message_loc.end - call->message_loc.start)) { if (multiple && PM_NODE_FLAG_P(call, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) { pm_parser_err_node(parser, (const pm_node_t *) call, PM_ERR_UNEXPECTED_SAFE_NAVIGATION); } parse_write_name(parser, &call->name); - return (pm_node_t *) pm_call_target_node_create(parser, call); + return UP(pm_call_target_node_create(parser, call)); } } @@ -13553,7 +12816,7 @@ parse_target(pm_parser_t *parser, pm_node_t *target, bool multiple, bool splat_p // an aref expression, and we can transform it into an aset // expression. if (PM_NODE_FLAG_P(call, PM_CALL_NODE_FLAGS_INDEX)) { - return (pm_node_t *) pm_index_target_node_create(parser, call); + return UP(pm_index_target_node_create(parser, call)); } } PRISM_FALLTHROUGH @@ -13596,7 +12859,7 @@ parse_shareable_constant_write(pm_parser_t *parser, pm_node_t *write) { pm_shareable_constant_value_t shareable_constant = pm_parser_scope_shareable_constant_get(parser); if (shareable_constant != PM_SCOPE_SHAREABLE_CONSTANT_NONE) { - return (pm_node_t *) pm_shareable_constant_node_create(parser, write, shareable_constant); + return UP(pm_shareable_constant_node_create(parser, write, shareable_constant)); } return write; @@ -13614,10 +12877,10 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod case PM_CLASS_VARIABLE_READ_NODE: { pm_class_variable_write_node_t *node = pm_class_variable_write_node_create(parser, (pm_class_variable_read_node_t *) target, operator, value); pm_node_destroy(parser, target); - return (pm_node_t *) node; + return UP(node); } case PM_CONSTANT_PATH_NODE: { - pm_node_t *node = (pm_node_t *) pm_constant_path_write_node_create(parser, (pm_constant_path_node_t *) target, operator, value); + pm_node_t *node = UP(pm_constant_path_write_node_create(parser, (pm_constant_path_node_t *) target, operator, value)); if (context_def_p(parser)) { pm_parser_err_node(parser, node, PM_ERR_WRITE_TARGET_IN_METHOD); @@ -13626,7 +12889,7 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod return parse_shareable_constant_write(parser, node); } case PM_CONSTANT_READ_NODE: { - pm_node_t *node = (pm_node_t *) pm_constant_write_node_create(parser, (pm_constant_read_node_t *) target, operator, value); + pm_node_t *node = UP(pm_constant_write_node_create(parser, (pm_constant_read_node_t *) target, operator, value)); if (context_def_p(parser)) { pm_parser_err_node(parser, node, PM_ERR_WRITE_TARGET_IN_METHOD); @@ -13642,7 +12905,7 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod case PM_GLOBAL_VARIABLE_READ_NODE: { pm_global_variable_write_node_t *node = pm_global_variable_write_node_create(parser, target, operator, value); pm_node_destroy(parser, target); - return (pm_node_t *) node; + return UP(node); } case PM_LOCAL_VARIABLE_READ_NODE: { pm_local_variable_read_node_t *local_read = (pm_local_variable_read_node_t *) target; @@ -13656,30 +12919,30 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod if (pm_token_is_numbered_parameter(target->location.start, target->location.end)) { pm_diagnostic_id_t diag_id = (scope->parameters & PM_SCOPE_PARAMETERS_NUMBERED_FOUND) ? PM_ERR_EXPRESSION_NOT_WRITABLE_NUMBERED : PM_ERR_PARAMETER_NUMBERED_RESERVED; PM_PARSER_ERR_FORMAT(parser, target->location.start, target->location.end, diag_id, target->location.start); - parse_target_implicit_parameter(parser, target); + pm_node_unreference(parser, target); } pm_locals_unread(&scope->locals, name); pm_node_destroy(parser, target); - return (pm_node_t *) pm_local_variable_write_node_create(parser, name, depth, value, &name_loc, operator); + return UP(pm_local_variable_write_node_create(parser, name, depth, value, &name_loc, operator)); } case PM_IT_LOCAL_VARIABLE_READ_NODE: { pm_constant_id_t name = pm_parser_local_add_constant(parser, "it", 2); - pm_node_t *node = (pm_node_t *) pm_local_variable_write_node_create(parser, name, 0, value, &target->location, operator); + pm_node_t *node = UP(pm_local_variable_write_node_create(parser, name, 0, value, &target->location, operator)); - parse_target_implicit_parameter(parser, target); + pm_node_unreference(parser, target); pm_node_destroy(parser, target); return node; } case PM_INSTANCE_VARIABLE_READ_NODE: { - pm_node_t *write_node = (pm_node_t *) pm_instance_variable_write_node_create(parser, (pm_instance_variable_read_node_t *) target, operator, value); + pm_node_t *write_node = UP(pm_instance_variable_write_node_create(parser, (pm_instance_variable_read_node_t *) target, operator, value)); pm_node_destroy(parser, target); return write_node; } case PM_MULTI_TARGET_NODE: - return (pm_node_t *) pm_multi_write_node_create(parser, (pm_multi_target_node_t *) target, operator, value); + return UP(pm_multi_write_node_create(parser, (pm_multi_target_node_t *) target, operator, value)); case PM_SPLAT_NODE: { pm_splat_node_t *splat = (pm_splat_node_t *) target; @@ -13688,9 +12951,9 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod } pm_multi_target_node_t *multi_target = pm_multi_target_node_create(parser); - pm_multi_target_node_targets_append(parser, multi_target, (pm_node_t *) splat); + pm_multi_target_node_targets_append(parser, multi_target, UP(splat)); - return (pm_node_t *) pm_multi_write_node_create(parser, multi_target, operator, value); + return UP(pm_multi_write_node_create(parser, multi_target, operator, value)); } case PM_CALL_NODE: { pm_call_node_t *call = (pm_call_node_t *) target; @@ -13722,7 +12985,7 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod pm_node_destroy(parser, target); pm_constant_id_t constant_id = pm_parser_constant_id_location(parser, message.start, message.end); - target = (pm_node_t *) pm_local_variable_write_node_create(parser, constant_id, 0, value, &message, operator); + target = UP(pm_local_variable_write_node_create(parser, constant_id, 0, value, &message, operator)); pm_refute_numbered_parameter(parser, message.start, message.end); return target; @@ -13744,11 +13007,12 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod pm_arguments_node_arguments_append(arguments, value); call->base.location.end = arguments->base.location.end; + call->equal_loc = PM_LOCATION_TOKEN_VALUE(operator); parse_write_name(parser, &call->name); - pm_node_flag_set((pm_node_t *) call, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE | pm_implicit_array_write_flags(value, PM_CALL_NODE_FLAGS_IMPLICIT_ARRAY)); + pm_node_flag_set(UP(call), PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE | pm_implicit_array_write_flags(value, PM_CALL_NODE_FLAGS_IMPLICIT_ARRAY)); - return (pm_node_t *) call; + return UP(call); } } @@ -13765,19 +13029,26 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod // Replace the name with "[]=". call->name = pm_parser_constant_id_constant(parser, "[]=", 3); + call->equal_loc = PM_LOCATION_TOKEN_VALUE(operator); // Ensure that the arguments for []= don't contain keywords pm_index_arguments_check(parser, call->arguments, call->block); - pm_node_flag_set((pm_node_t *) call, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE | pm_implicit_array_write_flags(value, PM_CALL_NODE_FLAGS_IMPLICIT_ARRAY)); + pm_node_flag_set(UP(call), PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE | pm_implicit_array_write_flags(value, PM_CALL_NODE_FLAGS_IMPLICIT_ARRAY)); return target; } - // If there are arguments on the call node, then it can't be a method - // call ending with = or a local variable write, so it must be a - // syntax error. In this case we'll fall through to our default + // If there are arguments on the call node, then it can't be a + // method call ending with = or a local variable write, so it must + // be a syntax error. In this case we'll fall through to our default // handling. We need to free the value that we parsed because there // is no way for us to attach it to the tree at this point. + // + // Since it is possible for the value to contain an implicit + // parameter somewhere in its subtree, we need to walk it and remove + // any implicit parameters from the list of implicit parameters for + // the current scope. + pm_node_unreference(parser, value); pm_node_destroy(parser, value); } PRISM_FALLTHROUGH @@ -13813,7 +13084,7 @@ parse_unwriteable_write(pm_parser_t *parser, pm_node_t *target, const pm_token_t pm_local_variable_write_node_t *result = pm_local_variable_write_node_create(parser, name, 0, value, &target->location, equals); pm_node_destroy(parser, target); - return (pm_node_t *) result; + return UP(result); } /** @@ -13850,7 +13121,7 @@ parse_targets(pm_parser_t *parser, pm_node_t *first_target, pm_binding_power_t b name = parse_target(parser, name, true, true); } - pm_node_t *splat = (pm_node_t *) pm_splat_node_create(parser, &star_operator, name); + pm_node_t *splat = UP(pm_splat_node_create(parser, &star_operator, name)); pm_multi_target_node_targets_append(parser, result, splat); has_rest = true; } else if (match1(parser, PM_TOKEN_PARENTHESIS_LEFT)) { @@ -13868,13 +13139,13 @@ parse_targets(pm_parser_t *parser, pm_node_t *first_target, pm_binding_power_t b } else if (!match1(parser, PM_TOKEN_EOF)) { // If we get here, then we have a trailing , in a multi target node. // We'll add an implicit rest node to represent this. - pm_node_t *rest = (pm_node_t *) pm_implicit_rest_node_create(parser, &parser->previous); + pm_node_t *rest = UP(pm_implicit_rest_node_create(parser, &parser->previous)); pm_multi_target_node_targets_append(parser, result, rest); break; } } - return (pm_node_t *) result; + return UP(result); } /** @@ -14068,7 +13339,7 @@ parse_assocs(pm_parser_t *parser, pm_static_literals_t *literals, pm_node_t *nod pm_parser_scope_forwarding_keywords_check(parser, &operator); } - element = (pm_node_t *) pm_assoc_splat_node_create(parser, value, &operator); + element = UP(pm_assoc_splat_node_create(parser, value, &operator)); contains_keyword_splat = true; break; } @@ -14076,7 +13347,7 @@ parse_assocs(pm_parser_t *parser, pm_static_literals_t *literals, pm_node_t *nod pm_token_t label = parser->current; parser_lex(parser); - pm_node_t *key = (pm_node_t *) pm_symbol_node_label_create(parser, &label); + pm_node_t *key = UP(pm_symbol_node_label_create(parser, &label)); pm_hash_key_static_literals_add(parser, literals, key); pm_token_t operator = not_provided(parser); @@ -14087,7 +13358,7 @@ parse_assocs(pm_parser_t *parser, pm_static_literals_t *literals, pm_node_t *nod } else { if (parser->encoding->isupper_char(label.start, (label.end - 1) - label.start)) { pm_token_t constant = { .type = PM_TOKEN_CONSTANT, .start = label.start, .end = label.end - 1 }; - value = (pm_node_t *) pm_constant_read_node_create(parser, &constant); + value = UP(pm_constant_read_node_create(parser, &constant)); } else { int depth = -1; pm_token_t identifier = { .type = PM_TOKEN_IDENTIFIER, .start = label.start, .end = label.end - 1 }; @@ -14099,17 +13370,17 @@ parse_assocs(pm_parser_t *parser, pm_static_literals_t *literals, pm_node_t *nod } if (depth == -1) { - value = (pm_node_t *) pm_call_node_variable_call_create(parser, &identifier); + value = UP(pm_call_node_variable_call_create(parser, &identifier)); } else { - value = (pm_node_t *) pm_local_variable_read_node_create(parser, &identifier, (uint32_t) depth); + value = UP(pm_local_variable_read_node_create(parser, &identifier, (uint32_t) depth)); } } value->location.end++; - value = (pm_node_t *) pm_implicit_node_create(parser, value); + value = UP(pm_implicit_node_create(parser, value)); } - element = (pm_node_t *) pm_assoc_node_create(parser, key, &operator, value); + element = UP(pm_assoc_node_create(parser, key, &operator, value)); break; } default: { @@ -14132,7 +13403,7 @@ parse_assocs(pm_parser_t *parser, pm_static_literals_t *literals, pm_node_t *nod } pm_node_t *value = parse_value_expression(parser, PM_BINDING_POWER_DEFINED, false, false, PM_ERR_HASH_VALUE, (uint16_t) (depth + 1)); - element = (pm_node_t *) pm_assoc_node_create(parser, key, &operator, value); + element = UP(pm_assoc_node_create(parser, key, &operator, value)); break; } } @@ -14161,6 +13432,30 @@ parse_assocs(pm_parser_t *parser, pm_static_literals_t *literals, pm_node_t *nod return contains_keyword_splat; } +static inline bool +argument_allowed_for_bare_hash(pm_parser_t *parser, pm_node_t *argument) { + if (pm_symbol_node_label_p(argument)) { + return true; + } + + switch (PM_NODE_TYPE(argument)) { + case PM_CALL_NODE: { + pm_call_node_t *cast = (pm_call_node_t *) argument; + if (cast->opening_loc.start == NULL && cast->arguments != NULL) { + if (PM_NODE_FLAG_P(cast->arguments, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS | PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT)) { + return false; + } + if (cast->block != NULL) { + return false; + } + } + break; + } + default: break; + } + return accept1(parser, PM_TOKEN_EQUAL_GREATER); +} + /** * Append an argument to a list of arguments. */ @@ -14210,16 +13505,16 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for } pm_keyword_hash_node_t *hash = pm_keyword_hash_node_create(parser); - argument = (pm_node_t *) hash; + argument = UP(hash); pm_static_literals_t hash_keys = { 0 }; - bool contains_keyword_splat = parse_assocs(parser, &hash_keys, (pm_node_t *) hash, (uint16_t) (depth + 1)); + bool contains_keyword_splat = parse_assocs(parser, &hash_keys, UP(hash), (uint16_t) (depth + 1)); parse_arguments_append(parser, arguments, argument); pm_node_flags_t flags = PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS; if (contains_keyword_splat) flags |= PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT; - pm_node_flag_set((pm_node_t *) arguments->arguments, flags); + pm_node_flag_set(UP(arguments->arguments), flags); pm_static_literals_free(&hash_keys); parsed_bare_hash = true; @@ -14237,7 +13532,7 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for pm_parser_scope_forwarding_block_check(parser, &operator); } - argument = (pm_node_t *) pm_block_argument_node_create(parser, &operator, expression); + argument = UP(pm_block_argument_node_create(parser, &operator, expression)); if (parsed_block_argument) { parse_arguments_append(parser, arguments, argument); } else { @@ -14257,7 +13552,7 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for if (match4(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_TOKEN_COMMA, PM_TOKEN_SEMICOLON, PM_TOKEN_BRACKET_RIGHT)) { pm_parser_scope_forwarding_positionals_check(parser, &operator); - argument = (pm_node_t *) pm_splat_node_create(parser, &operator, NULL); + argument = UP(pm_splat_node_create(parser, &operator, NULL)); if (parsed_bare_hash) { pm_parser_err_previous(parser, PM_ERR_ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT); } @@ -14268,7 +13563,7 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for pm_parser_err(parser, operator.start, expression->location.end, PM_ERR_ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT); } - argument = (pm_node_t *) pm_splat_node_create(parser, &operator, expression); + argument = UP(pm_splat_node_create(parser, &operator, expression)); } parse_arguments_append(parser, arguments, argument); @@ -14293,16 +13588,16 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for pm_parser_err(parser, range->operator_loc.start, range->operator_loc.end, PM_ERR_UNEXPECTED_RANGE_OPERATOR); } - argument = (pm_node_t *) pm_range_node_create(parser, NULL, &operator, right); + argument = UP(pm_range_node_create(parser, NULL, &operator, right)); } else { pm_parser_scope_forwarding_all_check(parser, &parser->previous); if (parsed_first_argument && terminator == PM_TOKEN_EOF) { pm_parser_err_previous(parser, PM_ERR_ARGUMENT_FORWARDING_UNBOUND); } - argument = (pm_node_t *) pm_forwarding_arguments_node_create(parser, &parser->previous); + argument = UP(pm_forwarding_arguments_node_create(parser, &parser->previous)); parse_arguments_append(parser, arguments, argument); - pm_node_flag_set((pm_node_t *) arguments->arguments, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_FORWARDING); + pm_node_flag_set(UP(arguments->arguments), PM_ARGUMENTS_NODE_FLAGS_CONTAINS_FORWARDING); arguments->has_forwarding = true; parsed_forwarding_arguments = true; break; @@ -14318,7 +13613,7 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for bool contains_keywords = false; bool contains_keyword_splat = false; - if (pm_symbol_node_label_p(argument) || accept1(parser, PM_TOKEN_EQUAL_GREATER)) { + if (argument_allowed_for_bare_hash(parser, argument)){ if (parsed_bare_hash) { pm_parser_err_previous(parser, PM_ERR_ARGUMENT_BARE_HASH); } @@ -14339,17 +13634,17 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for // Finish parsing the one we are part way through. pm_node_t *value = parse_value_expression(parser, PM_BINDING_POWER_DEFINED, false, false, PM_ERR_HASH_VALUE, (uint16_t) (depth + 1)); - argument = (pm_node_t *) pm_assoc_node_create(parser, argument, &operator, value); + argument = UP(pm_assoc_node_create(parser, argument, &operator, value)); pm_keyword_hash_node_elements_append(bare_hash, argument); - argument = (pm_node_t *) bare_hash; + argument = UP(bare_hash); // Then parse more if we have a comma if (accept1(parser, PM_TOKEN_COMMA) && ( token_begins_expression_p(parser->current.type) || match2(parser, PM_TOKEN_USTAR_STAR, PM_TOKEN_LABEL) )) { - contains_keyword_splat = parse_assocs(parser, &hash_keys, (pm_node_t *) bare_hash, (uint16_t) (depth + 1)); + contains_keyword_splat = parse_assocs(parser, &hash_keys, UP(bare_hash), (uint16_t) (depth + 1)); } pm_static_literals_free(&hash_keys); @@ -14361,7 +13656,7 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for pm_node_flags_t flags = 0; if (contains_keywords) flags |= PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS; if (contains_keyword_splat) flags |= PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT; - pm_node_flag_set((pm_node_t *) arguments->arguments, flags); + pm_node_flag_set(UP(arguments->arguments), flags); break; } @@ -14390,6 +13685,17 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for if (accepted_newline) { pm_parser_err_previous(parser, PM_ERR_INVALID_COMMA); } + + // If this is a command call and an argument takes a block, + // there can be no further arguments. For example, + // `foo(bar 1 do end, 2)` should be rejected. + if (PM_NODE_TYPE_P(argument, PM_CALL_NODE)) { + pm_call_node_t *call = (pm_call_node_t *) argument; + if (call->opening_loc.start == NULL && call->arguments != NULL && call->block != NULL) { + pm_parser_err_previous(parser, PM_ERR_INVALID_COMMA); + break; + } + } } else { // If there is no comma at the end of the argument list then we're // done parsing arguments and can break out of this loop. @@ -14427,33 +13733,33 @@ parse_required_destructured_parameter(pm_parser_t *parser) { // commas, so here we'll assume this is a mistake of the user not // knowing it's not allowed here. if (node->lefts.size > 0 && match1(parser, PM_TOKEN_PARENTHESIS_RIGHT)) { - param = (pm_node_t *) pm_implicit_rest_node_create(parser, &parser->previous); + param = UP(pm_implicit_rest_node_create(parser, &parser->previous)); pm_multi_target_node_targets_append(parser, node, param); pm_parser_err_current(parser, PM_ERR_PARAMETER_WILD_LOOSE_COMMA); break; } if (match1(parser, PM_TOKEN_PARENTHESIS_LEFT)) { - param = (pm_node_t *) parse_required_destructured_parameter(parser); + param = UP(parse_required_destructured_parameter(parser)); } else if (accept1(parser, PM_TOKEN_USTAR)) { pm_token_t star = parser->previous; pm_node_t *value = NULL; if (accept1(parser, PM_TOKEN_IDENTIFIER)) { pm_token_t name = parser->previous; - value = (pm_node_t *) pm_required_parameter_node_create(parser, &name); + value = UP(pm_required_parameter_node_create(parser, &name)); if (pm_parser_parameter_name_check(parser, &name)) { pm_node_flag_set_repeated_parameter(value); } pm_parser_local_add_token(parser, &name, 1); } - param = (pm_node_t *) pm_splat_node_create(parser, &star, value); + param = UP(pm_splat_node_create(parser, &star, value)); } else { expect1(parser, PM_TOKEN_IDENTIFIER, PM_ERR_EXPECT_IDENT_REQ_PARAMETER); pm_token_t name = parser->previous; - param = (pm_node_t *) pm_required_parameter_node_create(parser, &name); + param = UP(pm_required_parameter_node_create(parser, &name)); if (pm_parser_parameter_name_check(parser, &name)) { pm_node_flag_set_repeated_parameter(param); } @@ -14566,7 +13872,7 @@ parse_parameters( switch (parser->current.type) { case PM_TOKEN_PARENTHESIS_LEFT: { update_parameter_state(parser, &parser->current, &order); - pm_node_t *param = (pm_node_t *) parse_required_destructured_parameter(parser); + pm_node_t *param = UP(parse_required_destructured_parameter(parser)); if (order > PM_PARAMETERS_ORDER_AFTER_OPTIONAL) { pm_parameters_node_requireds_append(params, param); @@ -14595,13 +13901,13 @@ parse_parameters( pm_block_parameter_node_t *param = pm_block_parameter_node_create(parser, &name, &operator); if (repeated) { - pm_node_flag_set_repeated_parameter((pm_node_t *)param); + pm_node_flag_set_repeated_parameter(UP(param)); } if (params->block == NULL) { pm_parameters_node_block_set(params, param); } else { - pm_parser_err_node(parser, (pm_node_t *) param, PM_ERR_PARAMETER_BLOCK_MULTI); - pm_parameters_node_posts_append(params, (pm_node_t *) param); + pm_parser_err_node(parser, UP(param), PM_ERR_PARAMETER_BLOCK_MULTI); + pm_parameters_node_posts_append(params, UP(param)); } break; @@ -14626,7 +13932,7 @@ parse_parameters( params->keyword_rest = NULL; } - pm_parameters_node_keyword_rest_set(params, (pm_node_t *) param); + pm_parameters_node_keyword_rest_set(params, UP(param)); break; } case PM_TOKEN_CLASS_VARIABLE: @@ -14671,7 +13977,7 @@ parse_parameters( parser_lex(parser); pm_constant_id_t name_id = pm_parser_constant_id_token(parser, &name); - uint32_t reads = parser->version == PM_OPTIONS_VERSION_CRUBY_3_3 ? pm_locals_reads(&parser->current_scope->locals, name_id) : 0; + uint32_t reads = parser->version <= PM_OPTIONS_VERSION_CRUBY_3_3 ? pm_locals_reads(&parser->current_scope->locals, name_id) : 0; if (accepts_blocks_in_defaults) pm_accepts_block_stack_push(parser, true); pm_node_t *value = parse_value_expression(parser, binding_power, false, false, PM_ERR_PARAMETER_NO_DEFAULT, (uint16_t) (depth + 1)); @@ -14680,14 +13986,14 @@ parse_parameters( pm_optional_parameter_node_t *param = pm_optional_parameter_node_create(parser, &name, &operator, value); if (repeated) { - pm_node_flag_set_repeated_parameter((pm_node_t *) param); + pm_node_flag_set_repeated_parameter(UP(param)); } pm_parameters_node_optionals_append(params, param); // If the value of the parameter increased the number of // reads of that parameter, then we need to warn that we // have a circular definition. - if ((parser->version == PM_OPTIONS_VERSION_CRUBY_3_3) && (pm_locals_reads(&parser->current_scope->locals, name_id) != reads)) { + if ((parser->version <= PM_OPTIONS_VERSION_CRUBY_3_3) && (pm_locals_reads(&parser->current_scope->locals, name_id) != reads)) { PM_PARSER_ERR_TOKEN_FORMAT_CONTENT(parser, name, PM_ERR_PARAMETER_CIRCULAR); } @@ -14703,15 +14009,15 @@ parse_parameters( } else if (order > PM_PARAMETERS_ORDER_AFTER_OPTIONAL) { pm_required_parameter_node_t *param = pm_required_parameter_node_create(parser, &name); if (repeated) { - pm_node_flag_set_repeated_parameter((pm_node_t *)param); + pm_node_flag_set_repeated_parameter(UP(param)); } - pm_parameters_node_requireds_append(params, (pm_node_t *) param); + pm_parameters_node_requireds_append(params, UP(param)); } else { pm_required_parameter_node_t *param = pm_required_parameter_node_create(parser, &name); if (repeated) { - pm_node_flag_set_repeated_parameter((pm_node_t *)param); + pm_node_flag_set_repeated_parameter(UP(param)); } - pm_parameters_node_posts_append(params, (pm_node_t *) param); + pm_parameters_node_posts_append(params, UP(param)); } break; @@ -14742,7 +14048,7 @@ parse_parameters( case PM_TOKEN_PIPE: { context_pop(parser); - pm_node_t *param = (pm_node_t *) pm_required_keyword_parameter_node_create(parser, &name); + pm_node_t *param = UP(pm_required_keyword_parameter_node_create(parser, &name)); if (repeated) { pm_node_flag_set_repeated_parameter(param); } @@ -14759,7 +14065,7 @@ parse_parameters( break; } - pm_node_t *param = (pm_node_t *) pm_required_keyword_parameter_node_create(parser, &name); + pm_node_t *param = UP(pm_required_keyword_parameter_node_create(parser, &name)); if (repeated) { pm_node_flag_set_repeated_parameter(param); } @@ -14772,20 +14078,20 @@ parse_parameters( if (token_begins_expression_p(parser->current.type)) { pm_constant_id_t name_id = pm_parser_constant_id_token(parser, &local); - uint32_t reads = parser->version == PM_OPTIONS_VERSION_CRUBY_3_3 ? pm_locals_reads(&parser->current_scope->locals, name_id) : 0; + uint32_t reads = parser->version <= PM_OPTIONS_VERSION_CRUBY_3_3 ? pm_locals_reads(&parser->current_scope->locals, name_id) : 0; if (accepts_blocks_in_defaults) pm_accepts_block_stack_push(parser, true); pm_node_t *value = parse_value_expression(parser, binding_power, false, false, PM_ERR_PARAMETER_NO_DEFAULT_KW, (uint16_t) (depth + 1)); if (accepts_blocks_in_defaults) pm_accepts_block_stack_pop(parser); - if (parser->version == PM_OPTIONS_VERSION_CRUBY_3_3 && (pm_locals_reads(&parser->current_scope->locals, name_id) != reads)) { + if (parser->version <= PM_OPTIONS_VERSION_CRUBY_3_3 && (pm_locals_reads(&parser->current_scope->locals, name_id) != reads)) { PM_PARSER_ERR_TOKEN_FORMAT_CONTENT(parser, local, PM_ERR_PARAMETER_CIRCULAR); } - param = (pm_node_t *) pm_optional_keyword_parameter_node_create(parser, &name, value); + param = UP(pm_optional_keyword_parameter_node_create(parser, &name, value)); } else { - param = (pm_node_t *) pm_required_keyword_parameter_node_create(parser, &name); + param = UP(pm_required_keyword_parameter_node_create(parser, &name)); } if (repeated) { @@ -14826,7 +14132,7 @@ parse_parameters( parser->current_scope->parameters |= PM_SCOPE_PARAMETERS_FORWARDING_POSITIONALS; } - pm_node_t *param = (pm_node_t *) pm_rest_parameter_node_create(parser, &operator, &name); + pm_node_t *param = UP(pm_rest_parameter_node_create(parser, &operator, &name)); if (repeated) { pm_node_flag_set_repeated_parameter(param); } @@ -14854,7 +14160,7 @@ parse_parameters( pm_parser_err_previous(parser, PM_ERR_PARAMETER_UNEXPECTED_NO_KW); } - param = (pm_node_t *) pm_no_keywords_parameter_node_create(parser, &operator, &parser->previous); + param = UP(pm_no_keywords_parameter_node_create(parser, &operator, &parser->previous)); } else { pm_token_t name; @@ -14868,7 +14174,7 @@ parse_parameters( parser->current_scope->parameters |= PM_SCOPE_PARAMETERS_FORWARDING_KEYWORDS; } - param = (pm_node_t *) pm_keyword_rest_parameter_node_create(parser, &operator, &name); + param = UP(pm_keyword_rest_parameter_node_create(parser, &operator, &name)); if (repeated) { pm_node_flag_set_repeated_parameter(param); } @@ -14888,13 +14194,13 @@ parse_parameters( if (allows_trailing_comma && order >= PM_PARAMETERS_ORDER_NAMED) { // If we get here, then we have a trailing comma in a // block parameter list. - pm_node_t *param = (pm_node_t *) pm_implicit_rest_node_create(parser, &parser->previous); + pm_node_t *param = UP(pm_implicit_rest_node_create(parser, &parser->previous)); if (params->rest == NULL) { pm_parameters_node_rest_set(params, param); } else { - pm_parser_err_node(parser, (pm_node_t *) param, PM_ERR_PARAMETER_SPLAT_MULTI); - pm_parameters_node_posts_append(params, (pm_node_t *) param); + pm_parser_err_node(parser, UP(param), PM_ERR_PARAMETER_SPLAT_MULTI); + pm_parameters_node_posts_append(params, UP(param)); } } else { pm_parser_err_previous(parser, PM_ERR_PARAMETER_WILD_LOOSE_COMMA); @@ -14931,7 +14237,7 @@ parse_parameters( // If we don't have any parameters, return `NULL` instead of an empty `ParametersNode`. if (params->base.location.start == params->base.location.end) { - pm_node_destroy(parser, (pm_node_t *) params); + pm_node_destroy(parser, UP(params)); return NULL; } @@ -15203,7 +14509,7 @@ parse_rescues(pm_parser_t *parser, size_t opening_newline_index, const pm_token_ // If we don't have a `current` rescue node, then this is a dangling // else, and it's an error. - if (current == NULL) pm_parser_err_node(parser, (pm_node_t *) else_clause, PM_ERR_BEGIN_LONELY_ELSE); + if (current == NULL) pm_parser_err_node(parser, UP(else_clause), PM_ERR_BEGIN_LONELY_ELSE); } if (match1(parser, PM_TOKEN_KEYWORD_ENSURE)) { @@ -15277,6 +14583,9 @@ parse_block_parameters( ) { pm_parameters_node_t *parameters = NULL; if (!match1(parser, PM_TOKEN_SEMICOLON)) { + if (!is_lambda_literal) { + context_push(parser, PM_CONTEXT_BLOCK_PARAMETERS); + } parameters = parse_parameters( parser, is_lambda_literal ? PM_BINDING_POWER_DEFINED : PM_BINDING_POWER_INDEX, @@ -15287,6 +14596,9 @@ parse_block_parameters( true, (uint16_t) (depth + 1) ); + if (!is_lambda_literal) { + context_pop(parser); + } } pm_block_parameters_node_t *block_parameters = pm_block_parameters_node_create(parser, parameters, opening); @@ -15321,7 +14633,7 @@ parse_block_parameters( pm_parser_local_add_token(parser, &parser->previous, 1); pm_block_local_variable_node_t *local = pm_block_local_variable_node_create(parser, &parser->previous); - if (repeated) pm_node_flag_set_repeated_parameter((pm_node_t *) local); + if (repeated) pm_node_flag_set_repeated_parameter(UP(local)); pm_block_parameters_node_append_local(block_parameters, local); } while (accept1(parser, PM_TOKEN_COMMA)); @@ -15425,11 +14737,11 @@ parse_blocklike_parameters(pm_parser_t *parser, pm_node_t *parameters, const pm_ } const pm_location_t location = { .start = opening->start, .end = closing->end }; - return (pm_node_t *) pm_numbered_parameters_node_create(parser, &location, numbered_parameter); + return UP(pm_numbered_parameters_node_create(parser, &location, numbered_parameter)); } if (it_parameter) { - return (pm_node_t *) pm_it_parameters_node_create(parser, opening, closing); + return UP(pm_it_parameters_node_create(parser, opening, closing)); } return NULL; @@ -15469,30 +14781,30 @@ parse_block(pm_parser_t *parser, uint16_t depth) { if (opening.type == PM_TOKEN_BRACE_LEFT) { if (!match1(parser, PM_TOKEN_BRACE_RIGHT)) { - statements = (pm_node_t *) parse_statements(parser, PM_CONTEXT_BLOCK_BRACES, (uint16_t) (depth + 1)); + statements = UP(parse_statements(parser, PM_CONTEXT_BLOCK_BRACES, (uint16_t) (depth + 1))); } - expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_BLOCK_TERM_BRACE); + expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_BLOCK_TERM_BRACE, &opening); } else { if (!match1(parser, PM_TOKEN_KEYWORD_END)) { if (!match3(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ELSE, PM_TOKEN_KEYWORD_ENSURE)) { pm_accepts_block_stack_push(parser, true); - statements = (pm_node_t *) parse_statements(parser, PM_CONTEXT_BLOCK_KEYWORDS, (uint16_t) (depth + 1)); + statements = UP(parse_statements(parser, PM_CONTEXT_BLOCK_KEYWORDS, (uint16_t) (depth + 1))); pm_accepts_block_stack_pop(parser); } if (match2(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { assert(statements == NULL || PM_NODE_TYPE_P(statements, PM_STATEMENTS_NODE)); - statements = (pm_node_t *) parse_rescues_implicit_begin(parser, 0, NULL, opening.start, (pm_statements_node_t *) statements, PM_RESCUES_BLOCK, (uint16_t) (depth + 1)); + statements = UP(parse_rescues_implicit_begin(parser, 0, NULL, opening.start, (pm_statements_node_t *) statements, PM_RESCUES_BLOCK, (uint16_t) (depth + 1))); } } - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_BLOCK_TERM_END); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_BLOCK_TERM_END, &opening); } pm_constant_id_list_t locals; pm_locals_order(parser, &parser->current_scope->locals, &locals, pm_parser_scope_toplevel_p(parser)); - pm_node_t *parameters = parse_blocklike_parameters(parser, (pm_node_t *) block_parameters, &opening, &parser->previous); + pm_node_t *parameters = parse_blocklike_parameters(parser, UP(block_parameters), &opening, &parser->previous); pm_parser_scope_pop(parser); pm_accepts_block_stack_pop(parser); @@ -15564,9 +14876,9 @@ parse_arguments_list(pm_parser_t *parser, pm_arguments_t *arguments, bool accept if (block != NULL) { if (arguments->block == NULL && !arguments->has_forwarding) { - arguments->block = (pm_node_t *) block; + arguments->block = UP(block); } else { - pm_parser_err_node(parser, (pm_node_t *) block, PM_ERR_ARGUMENT_BLOCK_MULTI); + pm_parser_err_node(parser, UP(block), PM_ERR_ARGUMENT_BLOCK_MULTI); if (arguments->block != NULL) { if (arguments->arguments == NULL) { @@ -15574,7 +14886,7 @@ parse_arguments_list(pm_parser_t *parser, pm_arguments_t *arguments, bool accept } pm_arguments_node_arguments_append(arguments->arguments, arguments->block); } - arguments->block = (pm_node_t *) block; + arguments->block = UP(block); } } } @@ -15642,6 +14954,7 @@ parse_return(pm_parser_t *parser, pm_node_t *node) { case PM_CONTEXT_BLOCK_ENSURE: case PM_CONTEXT_BLOCK_KEYWORDS: case PM_CONTEXT_BLOCK_RESCUE: + case PM_CONTEXT_BLOCK_PARAMETERS: case PM_CONTEXT_DEF_ELSE: case PM_CONTEXT_DEF_ENSURE: case PM_CONTEXT_DEF_PARAMS: @@ -15661,7 +14974,7 @@ parse_return(pm_parser_t *parser, pm_node_t *node) { break; } } - if (in_sclass) { + if (in_sclass && parser->version >= PM_OPTIONS_VERSION_CRUBY_3_4) { pm_parser_err_node(parser, node, PM_ERR_RETURN_INVALID); } } @@ -15678,6 +14991,7 @@ parse_block_exit(pm_parser_t *parser, pm_node_t *node) { case PM_CONTEXT_BLOCK_KEYWORDS: case PM_CONTEXT_BLOCK_ELSE: case PM_CONTEXT_BLOCK_ENSURE: + case PM_CONTEXT_BLOCK_PARAMETERS: case PM_CONTEXT_BLOCK_RESCUE: case PM_CONTEXT_DEFINED: case PM_CONTEXT_FOR: @@ -15860,10 +15174,10 @@ parse_conditional(pm_parser_t *parser, pm_context_t context, size_t opening_newl switch (context) { case PM_CONTEXT_IF: - parent = (pm_node_t *) pm_if_node_create(parser, &keyword, predicate, &then_keyword, statements, NULL, &end_keyword); + parent = UP(pm_if_node_create(parser, &keyword, predicate, &then_keyword, statements, NULL, &end_keyword)); break; case PM_CONTEXT_UNLESS: - parent = (pm_node_t *) pm_unless_node_create(parser, &keyword, predicate, &then_keyword, statements); + parent = UP(pm_unless_node_create(parser, &keyword, predicate, &then_keyword, statements)); break; default: assert(false && "unreachable"); @@ -15891,7 +15205,7 @@ parse_conditional(pm_parser_t *parser, pm_context_t context, size_t opening_newl pm_accepts_block_stack_pop(parser); accept2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON); - pm_node_t *elsif = (pm_node_t *) pm_if_node_create(parser, &elsif_keyword, predicate, &then_keyword, statements, NULL, &end_keyword); + pm_node_t *elsif = UP(pm_if_node_create(parser, &elsif_keyword, predicate, &then_keyword, statements, NULL, &end_keyword)); ((pm_if_node_t *) current)->subsequent = elsif; current = elsif; } @@ -15910,13 +15224,13 @@ parse_conditional(pm_parser_t *parser, pm_context_t context, size_t opening_newl accept2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON); parser_warn_indentation_mismatch(parser, opening_newline_index, &else_keyword, false, false); - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CONDITIONAL_TERM_ELSE); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CONDITIONAL_TERM_ELSE, &keyword); pm_else_node_t *else_node = pm_else_node_create(parser, &else_keyword, else_statements, &parser->previous); switch (context) { case PM_CONTEXT_IF: - ((pm_if_node_t *) current)->subsequent = (pm_node_t *) else_node; + ((pm_if_node_t *) current)->subsequent = UP(else_node); break; case PM_CONTEXT_UNLESS: ((pm_unless_node_t *) parent)->else_clause = else_node; @@ -15927,7 +15241,7 @@ parse_conditional(pm_parser_t *parser, pm_context_t context, size_t opening_newl } } else { parser_warn_indentation_mismatch(parser, opening_newline_index, &keyword, if_after_else, false); - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CONDITIONAL_TERM); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CONDITIONAL_TERM, &keyword); } // Set the appropriate end location for all of the nodes in the subtree. @@ -16074,7 +15388,7 @@ parse_string_part(pm_parser_t *parser, uint16_t depth) { pm_token_t opening = not_provided(parser); pm_token_t closing = not_provided(parser); - pm_node_t *node = (pm_node_t *) pm_string_node_create_current_string(parser, &opening, &parser->current, &closing); + pm_node_t *node = UP(pm_string_node_create_current_string(parser, &opening, &parser->current, &closing)); pm_node_flag_set(node, parse_unescaped_encoding(parser)); parser_lex(parser); @@ -16120,7 +15434,7 @@ parse_string_part(pm_parser_t *parser, uint16_t depth) { pm_node_flag_unset(statements->body.nodes[0], PM_NODE_FLAG_NEWLINE); } - return (pm_node_t *) pm_embedded_statements_node_create(parser, &opening, statements, &closing); + return UP(pm_embedded_statements_node_create(parser, &opening, statements, &closing)); } // Here the lexer has returned the beginning of an embedded variable. @@ -16145,42 +15459,42 @@ parse_string_part(pm_parser_t *parser, uint16_t depth) { // create a global variable read node. case PM_TOKEN_BACK_REFERENCE: parser_lex(parser); - variable = (pm_node_t *) pm_back_reference_read_node_create(parser, &parser->previous); + variable = UP(pm_back_reference_read_node_create(parser, &parser->previous)); break; // In this case an nth reference is being interpolated. We'll // create a global variable read node. case PM_TOKEN_NUMBERED_REFERENCE: parser_lex(parser); - variable = (pm_node_t *) pm_numbered_reference_read_node_create(parser, &parser->previous); + variable = UP(pm_numbered_reference_read_node_create(parser, &parser->previous)); break; // In this case a global variable is being interpolated. We'll // create a global variable read node. case PM_TOKEN_GLOBAL_VARIABLE: parser_lex(parser); - variable = (pm_node_t *) pm_global_variable_read_node_create(parser, &parser->previous); + variable = UP(pm_global_variable_read_node_create(parser, &parser->previous)); break; // In this case an instance variable is being interpolated. // We'll create an instance variable read node. case PM_TOKEN_INSTANCE_VARIABLE: parser_lex(parser); - variable = (pm_node_t *) pm_instance_variable_read_node_create(parser, &parser->previous); + variable = UP(pm_instance_variable_read_node_create(parser, &parser->previous)); break; // In this case a class variable is being interpolated. We'll // create a class variable read node. case PM_TOKEN_CLASS_VARIABLE: parser_lex(parser); - variable = (pm_node_t *) pm_class_variable_read_node_create(parser, &parser->previous); + variable = UP(pm_class_variable_read_node_create(parser, &parser->previous)); break; // We can hit here if we got an invalid token. In that case // we'll not attempt to lex this token and instead just return a // missing node. default: expect1(parser, PM_TOKEN_IDENTIFIER, PM_ERR_EMBVAR_INVALID); - variable = (pm_node_t *) pm_missing_node_create(parser, parser->current.start, parser->current.end); + variable = UP(pm_missing_node_create(parser, parser->current.start, parser->current.end)); break; } - return (pm_node_t *) pm_embedded_variable_node_create(parser, &operator, variable); + return UP(pm_embedded_variable_node_create(parser, &operator, variable)); } default: parser_lex(parser); @@ -16217,9 +15531,9 @@ parse_operator_symbol(pm_parser_t *parser, const pm_token_t *opening, pm_lex_sta parser_lex(parser); pm_string_shared_init(&symbol->unescaped, parser->previous.start, end); - pm_node_flag_set((pm_node_t *) symbol, PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING); + pm_node_flag_set(UP(symbol), PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING); - return (pm_node_t *) symbol; + return UP(symbol); } /** @@ -16257,9 +15571,9 @@ parse_symbol(pm_parser_t *parser, pm_lex_mode_t *lex_mode, pm_lex_state_t next_s pm_symbol_node_t *symbol = pm_symbol_node_create(parser, &opening, &parser->previous, &closing); pm_string_shared_init(&symbol->unescaped, parser->previous.start, parser->previous.end); - pm_node_flag_set((pm_node_t *) symbol, parse_symbol_encoding(parser, &parser->previous, &symbol->unescaped, false)); + pm_node_flag_set(UP(symbol), parse_symbol_encoding(parser, &parser->previous, &symbol->unescaped, false)); - return (pm_node_t *) symbol; + return UP(symbol); } if (lex_mode->as.string.interpolation) { @@ -16270,7 +15584,7 @@ parse_symbol(pm_parser_t *parser, pm_lex_mode_t *lex_mode, pm_lex_state_t next_s pm_token_t content = not_provided(parser); pm_token_t closing = parser->previous; - return (pm_node_t *) pm_symbol_node_create(parser, &opening, &content, &closing); + return UP(pm_symbol_node_create(parser, &opening, &content, &closing)); } // Now we can parse the first part of the symbol. @@ -16282,7 +15596,7 @@ parse_symbol(pm_parser_t *parser, pm_lex_mode_t *lex_mode, pm_lex_state_t next_s if (next_state != PM_LEX_STATE_NONE) lex_state_set(parser, next_state); expect1(parser, PM_TOKEN_STRING_END, PM_ERR_SYMBOL_TERM_INTERPOLATED); - return (pm_node_t *) pm_string_node_to_symbol_node(parser, (pm_string_node_t *) part, &opening, &parser->previous); + return UP(pm_string_node_to_symbol_node(parser, (pm_string_node_t *) part, &opening, &parser->previous)); } pm_interpolated_symbol_node_t *symbol = pm_interpolated_symbol_node_create(parser, &opening, NULL, &opening); @@ -16302,7 +15616,7 @@ parse_symbol(pm_parser_t *parser, pm_lex_mode_t *lex_mode, pm_lex_state_t next_s } pm_interpolated_symbol_node_closing_loc_set(symbol, &parser->previous); - return (pm_node_t *) symbol; + return UP(symbol); } pm_token_t content; @@ -16326,10 +15640,10 @@ parse_symbol(pm_parser_t *parser, pm_lex_mode_t *lex_mode, pm_lex_state_t next_s pm_interpolated_symbol_node_t *symbol = pm_interpolated_symbol_node_create(parser, &opening, NULL, &opening); pm_token_t bounds = not_provided(parser); - pm_node_t *part = (pm_node_t *) pm_string_node_create_unescaped(parser, &bounds, &content, &bounds, &unescaped); + pm_node_t *part = UP(pm_string_node_create_unescaped(parser, &bounds, &content, &bounds, &unescaped)); pm_interpolated_symbol_node_append(symbol, part); - part = (pm_node_t *) pm_string_node_create_unescaped(parser, &bounds, &parser->current, &bounds, &parser->current_string); + part = UP(pm_string_node_create_unescaped(parser, &bounds, &parser->current, &bounds, &parser->current_string)); pm_interpolated_symbol_node_append(symbol, part); if (next_state != PM_LEX_STATE_NONE) { @@ -16340,7 +15654,7 @@ parse_symbol(pm_parser_t *parser, pm_lex_mode_t *lex_mode, pm_lex_state_t next_s expect1(parser, PM_TOKEN_STRING_END, PM_ERR_SYMBOL_TERM_DYNAMIC); pm_interpolated_symbol_node_closing_loc_set(symbol, &parser->previous); - return (pm_node_t *) symbol; + return UP(symbol); } } else { content = (pm_token_t) { .type = PM_TOKEN_STRING_CONTENT, .start = parser->previous.end, .end = parser->previous.end }; @@ -16357,7 +15671,7 @@ parse_symbol(pm_parser_t *parser, pm_lex_mode_t *lex_mode, pm_lex_state_t next_s expect1(parser, PM_TOKEN_STRING_END, PM_ERR_SYMBOL_TERM_DYNAMIC); } - return (pm_node_t *) pm_symbol_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped, parse_symbol_encoding(parser, &content, &unescaped, false)); + return UP(pm_symbol_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped, parse_symbol_encoding(parser, &content, &unescaped, false))); } /** @@ -16382,9 +15696,9 @@ parse_undef_argument(pm_parser_t *parser, uint16_t depth) { pm_symbol_node_t *symbol = pm_symbol_node_create(parser, &opening, &parser->previous, &closing); pm_string_shared_init(&symbol->unescaped, parser->previous.start, parser->previous.end); - pm_node_flag_set((pm_node_t *) symbol, parse_symbol_encoding(parser, &parser->previous, &symbol->unescaped, false)); + pm_node_flag_set(UP(symbol), parse_symbol_encoding(parser, &parser->previous, &symbol->unescaped, false)); - return (pm_node_t *) symbol; + return UP(symbol); } case PM_TOKEN_SYMBOL_BEGIN: { pm_lex_mode_t lex_mode = *parser->lex_modes.current; @@ -16394,7 +15708,7 @@ parse_undef_argument(pm_parser_t *parser, uint16_t depth) { } default: pm_parser_err_current(parser, PM_ERR_UNDEF_ARGUMENT); - return (pm_node_t *) pm_missing_node_create(parser, parser->current.start, parser->current.end); + return UP(pm_missing_node_create(parser, parser->current.start, parser->current.end)); } } @@ -16423,9 +15737,9 @@ parse_alias_argument(pm_parser_t *parser, bool first, uint16_t depth) { pm_symbol_node_t *symbol = pm_symbol_node_create(parser, &opening, &parser->previous, &closing); pm_string_shared_init(&symbol->unescaped, parser->previous.start, parser->previous.end); - pm_node_flag_set((pm_node_t *) symbol, parse_symbol_encoding(parser, &parser->previous, &symbol->unescaped, false)); + pm_node_flag_set(UP(symbol), parse_symbol_encoding(parser, &parser->previous, &symbol->unescaped, false)); - return (pm_node_t *) symbol; + return UP(symbol); } case PM_TOKEN_SYMBOL_BEGIN: { pm_lex_mode_t lex_mode = *parser->lex_modes.current; @@ -16435,16 +15749,16 @@ parse_alias_argument(pm_parser_t *parser, bool first, uint16_t depth) { } case PM_TOKEN_BACK_REFERENCE: parser_lex(parser); - return (pm_node_t *) pm_back_reference_read_node_create(parser, &parser->previous); + return UP(pm_back_reference_read_node_create(parser, &parser->previous)); case PM_TOKEN_NUMBERED_REFERENCE: parser_lex(parser); - return (pm_node_t *) pm_numbered_reference_read_node_create(parser, &parser->previous); + return UP(pm_numbered_reference_read_node_create(parser, &parser->previous)); case PM_TOKEN_GLOBAL_VARIABLE: parser_lex(parser); - return (pm_node_t *) pm_global_variable_read_node_create(parser, &parser->previous); + return UP(pm_global_variable_read_node_create(parser, &parser->previous)); default: pm_parser_err_current(parser, PM_ERR_ALIAS_ARGUMENT); - return (pm_node_t *) pm_missing_node_create(parser, parser->current.start, parser->current.end); + return UP(pm_missing_node_create(parser, parser->current.start, parser->current.end)); } } @@ -16459,7 +15773,7 @@ parse_variable(pm_parser_t *parser) { bool is_numbered_param = pm_token_is_numbered_parameter(parser->previous.start, parser->previous.end); if (!is_numbered_param && ((depth = pm_parser_local_depth_constant_id(parser, name_id)) != -1)) { - return (pm_node_t *) pm_local_variable_read_node_create_constant_id(parser, &parser->previous, name_id, (uint32_t) depth, false); + return UP(pm_local_variable_read_node_create_constant_id(parser, &parser->previous, name_id, (uint32_t) depth, false)); } pm_scope_t *current_scope = parser->current_scope; @@ -16478,12 +15792,12 @@ parse_variable(pm_parser_t *parser) { parser->current_scope->parameters |= PM_SCOPE_PARAMETERS_NUMBERED_FOUND; } - pm_node_t *node = (pm_node_t *) pm_local_variable_read_node_create_constant_id(parser, &parser->previous, name_id, 0, false); + pm_node_t *node = UP(pm_local_variable_read_node_create_constant_id(parser, &parser->previous, name_id, 0, false)); pm_node_list_append(¤t_scope->implicit_parameters, node); return node; - } else if ((parser->version != PM_OPTIONS_VERSION_CRUBY_3_3) && pm_token_is_it(parser->previous.start, parser->previous.end)) { - pm_node_t *node = (pm_node_t *) pm_it_local_variable_read_node_create(parser, &parser->previous); + } else if ((parser->version >= PM_OPTIONS_VERSION_CRUBY_3_4) && pm_token_is_it(parser->previous.start, parser->previous.end)) { + pm_node_t *node = UP(pm_it_local_variable_read_node_create(parser, &parser->previous)); pm_node_list_append(¤t_scope->implicit_parameters, node); return node; @@ -16507,9 +15821,9 @@ parse_variable_call(pm_parser_t *parser) { } pm_call_node_t *node = pm_call_node_variable_call_create(parser, &parser->previous); - pm_node_flag_set((pm_node_t *)node, flags); + pm_node_flag_set(UP(node), flags); - return (pm_node_t *) node; + return UP(node); } /** @@ -16658,7 +15972,7 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1 pm_string_node_t *string = pm_string_node_create(parser, &opening, &content, &parser->previous); pm_string_shared_init(&string->unescaped, content.start, content.end); - node = (pm_node_t *) string; + node = UP(string); } else if (accept1(parser, PM_TOKEN_LABEL_END)) { // If we get here, then we have an end of a label immediately // after a start. In that case we'll create an empty symbol @@ -16667,7 +15981,7 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1 pm_symbol_node_t *symbol = pm_symbol_node_create(parser, &opening, &content, &parser->previous); pm_string_shared_init(&symbol->unescaped, content.start, content.end); - node = (pm_node_t *) symbol; + node = UP(symbol); if (!label_allowed) pm_parser_err_node(parser, node, PM_ERR_UNEXPECTED_LABEL); } else if (!lex_interpolation) { @@ -16700,32 +16014,32 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1 pm_node_list_t parts = { 0 }; pm_token_t delimiters = not_provided(parser); - pm_node_t *part = (pm_node_t *) pm_string_node_create_unescaped(parser, &delimiters, &content, &delimiters, &unescaped); + pm_node_t *part = UP(pm_string_node_create_unescaped(parser, &delimiters, &content, &delimiters, &unescaped)); pm_node_list_append(&parts, part); do { - part = (pm_node_t *) pm_string_node_create_current_string(parser, &delimiters, &parser->current, &delimiters); + part = UP(pm_string_node_create_current_string(parser, &delimiters, &parser->current, &delimiters)); pm_node_list_append(&parts, part); parser_lex(parser); } while (match1(parser, PM_TOKEN_STRING_CONTENT)); expect1(parser, PM_TOKEN_STRING_END, PM_ERR_STRING_LITERAL_EOF); - node = (pm_node_t *) pm_interpolated_string_node_create(parser, &opening, &parts, &parser->previous); + node = UP(pm_interpolated_string_node_create(parser, &opening, &parts, &parser->previous)); pm_node_list_free(&parts); } else if (accept1(parser, PM_TOKEN_LABEL_END)) { - node = (pm_node_t *) pm_symbol_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped, parse_symbol_encoding(parser, &content, &unescaped, true)); + node = UP(pm_symbol_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped, parse_symbol_encoding(parser, &content, &unescaped, true))); if (!label_allowed) pm_parser_err_node(parser, node, PM_ERR_UNEXPECTED_LABEL); } else if (match1(parser, PM_TOKEN_EOF)) { pm_parser_err_token(parser, &opening, PM_ERR_STRING_LITERAL_EOF); - node = (pm_node_t *) pm_string_node_create_unescaped(parser, &opening, &content, &parser->current, &unescaped); + node = UP(pm_string_node_create_unescaped(parser, &opening, &content, &parser->current, &unescaped)); } else if (accept1(parser, PM_TOKEN_STRING_END)) { - node = (pm_node_t *) pm_string_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped); + node = UP(pm_string_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped)); } else { PM_PARSER_ERR_TOKEN_FORMAT(parser, parser->previous, PM_ERR_STRING_LITERAL_TERM, pm_token_type_human(parser->previous.type)); parser->previous.start = parser->previous.end; parser->previous.type = PM_TOKEN_MISSING; - node = (pm_node_t *) pm_string_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped); + node = UP(pm_string_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped)); } } else if (match1(parser, PM_TOKEN_STRING_CONTENT)) { // In this case we've hit string content so we know the string @@ -16737,7 +16051,7 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1 parser_lex(parser); if (match2(parser, PM_TOKEN_STRING_END, PM_TOKEN_EOF)) { - node = (pm_node_t *) pm_string_node_create_unescaped(parser, &opening, &content, &parser->current, &unescaped); + node = UP(pm_string_node_create_unescaped(parser, &opening, &content, &parser->current, &unescaped)); pm_node_flag_set(node, parse_unescaped_encoding(parser)); // Kind of odd behavior, but basically if we have an @@ -16753,7 +16067,7 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1 parser->previous.type = PM_TOKEN_MISSING; } } else if (accept1(parser, PM_TOKEN_LABEL_END)) { - node = (pm_node_t *) pm_symbol_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped, parse_symbol_encoding(parser, &content, &unescaped, true)); + node = UP(pm_symbol_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped, parse_symbol_encoding(parser, &content, &unescaped, true))); if (!label_allowed) pm_parser_err_node(parser, node, PM_ERR_UNEXPECTED_LABEL); } else { // If we get here, then we have interpolation so we'll need @@ -16762,7 +16076,7 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1 pm_token_t string_opening = not_provided(parser); pm_token_t string_closing = not_provided(parser); - pm_node_t *part = (pm_node_t *) pm_string_node_create_unescaped(parser, &string_opening, &parser->previous, &string_closing, &unescaped); + pm_node_t *part = UP(pm_string_node_create_unescaped(parser, &string_opening, &parser->previous, &string_closing, &unescaped)); pm_node_flag_set(part, parse_unescaped_encoding(parser)); pm_node_list_append(&parts, part); @@ -16773,14 +16087,14 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1 } if (accept1(parser, PM_TOKEN_LABEL_END)) { - node = (pm_node_t *) pm_interpolated_symbol_node_create(parser, &opening, &parts, &parser->previous); + node = UP(pm_interpolated_symbol_node_create(parser, &opening, &parts, &parser->previous)); if (!label_allowed) pm_parser_err_node(parser, node, PM_ERR_UNEXPECTED_LABEL); } else if (match1(parser, PM_TOKEN_EOF)) { pm_parser_err_token(parser, &opening, PM_ERR_STRING_INTERPOLATED_TERM); - node = (pm_node_t *) pm_interpolated_string_node_create(parser, &opening, &parts, &parser->current); + node = UP(pm_interpolated_string_node_create(parser, &opening, &parts, &parser->current)); } else { expect1(parser, PM_TOKEN_STRING_END, PM_ERR_STRING_INTERPOLATED_TERM); - node = (pm_node_t *) pm_interpolated_string_node_create(parser, &opening, &parts, &parser->previous); + node = UP(pm_interpolated_string_node_create(parser, &opening, &parts, &parser->previous)); } pm_node_list_free(&parts); @@ -16799,14 +16113,14 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1 } if (accept1(parser, PM_TOKEN_LABEL_END)) { - node = (pm_node_t *) pm_interpolated_symbol_node_create(parser, &opening, &parts, &parser->previous); + node = UP(pm_interpolated_symbol_node_create(parser, &opening, &parts, &parser->previous)); if (!label_allowed) pm_parser_err_node(parser, node, PM_ERR_UNEXPECTED_LABEL); } else if (match1(parser, PM_TOKEN_EOF)) { pm_parser_err_token(parser, &opening, PM_ERR_STRING_INTERPOLATED_TERM); - node = (pm_node_t *) pm_interpolated_string_node_create(parser, &opening, &parts, &parser->current); + node = UP(pm_interpolated_string_node_create(parser, &opening, &parts, &parser->current)); } else { expect1(parser, PM_TOKEN_STRING_END, PM_ERR_STRING_INTERPOLATED_TERM); - node = (pm_node_t *) pm_interpolated_string_node_create(parser, &opening, &parts, &parser->previous); + node = UP(pm_interpolated_string_node_create(parser, &opening, &parts, &parser->previous)); } pm_node_list_free(&parts); @@ -16843,7 +16157,7 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1 pm_interpolated_string_node_t *container = pm_interpolated_string_node_create(parser, &bounds, NULL, &bounds); pm_interpolated_string_node_append(container, current); - current = (pm_node_t *) container; + current = UP(container); } pm_interpolated_string_node_append((pm_interpolated_string_node_t *) current, node); @@ -16868,7 +16182,7 @@ parse_pattern(pm_parser_t *parser, pm_constant_id_list_t *captures, uint8_t flag static void parse_pattern_capture(pm_parser_t *parser, pm_constant_id_list_t *captures, pm_constant_id_t capture, const pm_location_t *location) { // Skip this capture if it starts with an underscore. - if (*location->start == '_') return; + if (peek_at(parser, location->start) == '_') return; if (pm_constant_id_list_includes(captures, capture)) { pm_parser_err(parser, location->start, location->end, PM_ERR_PATTERN_CAPTURE_DUPLICATE); @@ -16887,7 +16201,7 @@ parse_pattern_constant_path(pm_parser_t *parser, pm_constant_id_list_t *captures while (accept1(parser, PM_TOKEN_COLON_COLON)) { pm_token_t delimiter = parser->previous; expect1(parser, PM_TOKEN_CONSTANT, PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT); - node = (pm_node_t *) pm_constant_path_node_create(parser, node, &delimiter, &parser->previous); + node = UP(pm_constant_path_node_create(parser, node, &delimiter, &parser->previous)); } // If there is a [ or ( that follows, then this is part of a larger pattern @@ -16908,7 +16222,7 @@ parse_pattern_constant_path(pm_parser_t *parser, pm_constant_id_list_t *captures if (!accept1(parser, PM_TOKEN_BRACKET_RIGHT)) { inner = parse_pattern(parser, captures, PM_PARSE_PATTERN_TOP | PM_PARSE_PATTERN_MULTI, PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET, (uint16_t) (depth + 1)); accept1(parser, PM_TOKEN_NEWLINE); - expect1(parser, PM_TOKEN_BRACKET_RIGHT, PM_ERR_PATTERN_TERM_BRACKET); + expect1_opening(parser, PM_TOKEN_BRACKET_RIGHT, PM_ERR_PATTERN_TERM_BRACKET, &opening); } closing = parser->previous; @@ -16920,7 +16234,7 @@ parse_pattern_constant_path(pm_parser_t *parser, pm_constant_id_list_t *captures if (!accept1(parser, PM_TOKEN_PARENTHESIS_RIGHT)) { inner = parse_pattern(parser, captures, PM_PARSE_PATTERN_TOP | PM_PARSE_PATTERN_MULTI, PM_ERR_PATTERN_EXPRESSION_AFTER_PAREN, (uint16_t) (depth + 1)); accept1(parser, PM_TOKEN_NEWLINE); - expect1(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN); + expect1_opening(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN, &opening); } closing = parser->previous; @@ -16929,7 +16243,7 @@ parse_pattern_constant_path(pm_parser_t *parser, pm_constant_id_list_t *captures if (!inner) { // If there was no inner pattern, then we have something like Foo() or // Foo[]. In that case we'll create an array pattern with no requireds. - return (pm_node_t *) pm_array_pattern_node_constant_create(parser, node, &opening, &closing); + return UP(pm_array_pattern_node_constant_create(parser, node, &opening, &closing)); } // Now that we have the inner pattern, check to see if it's an array, find, @@ -16948,7 +16262,7 @@ parse_pattern_constant_path(pm_parser_t *parser, pm_constant_id_list_t *captures pattern_node->opening_loc = PM_LOCATION_TOKEN_VALUE(&opening); pattern_node->closing_loc = PM_LOCATION_TOKEN_VALUE(&closing); - return (pm_node_t *) pattern_node; + return UP(pattern_node); } break; @@ -16964,7 +16278,7 @@ parse_pattern_constant_path(pm_parser_t *parser, pm_constant_id_list_t *captures pattern_node->opening_loc = PM_LOCATION_TOKEN_VALUE(&opening); pattern_node->closing_loc = PM_LOCATION_TOKEN_VALUE(&closing); - return (pm_node_t *) pattern_node; + return UP(pattern_node); } break; @@ -16980,7 +16294,7 @@ parse_pattern_constant_path(pm_parser_t *parser, pm_constant_id_list_t *captures pattern_node->opening_loc = PM_LOCATION_TOKEN_VALUE(&opening); pattern_node->closing_loc = PM_LOCATION_TOKEN_VALUE(&closing); - return (pm_node_t *) pattern_node; + return UP(pattern_node); } break; @@ -16994,7 +16308,7 @@ parse_pattern_constant_path(pm_parser_t *parser, pm_constant_id_list_t *captures // attach our constant to it. pm_array_pattern_node_t *pattern_node = pm_array_pattern_node_constant_create(parser, node, &opening, &closing); pm_array_pattern_node_requireds_append(pattern_node, inner); - return (pm_node_t *) pattern_node; + return UP(pattern_node); } /** @@ -17019,12 +16333,12 @@ parse_pattern_rest(pm_parser_t *parser, pm_constant_id_list_t *captures) { } parse_pattern_capture(parser, captures, constant_id, &PM_LOCATION_TOKEN_VALUE(&identifier)); - name = (pm_node_t *) pm_local_variable_target_node_create( + name = UP(pm_local_variable_target_node_create( parser, &PM_LOCATION_TOKEN_VALUE(&identifier), constant_id, (uint32_t) (depth == -1 ? 0 : depth) - ); + )); } // Finally we can return the created node. @@ -17043,7 +16357,7 @@ parse_pattern_keyword_rest(pm_parser_t *parser, pm_constant_id_list_t *captures) pm_node_t *value = NULL; if (accept1(parser, PM_TOKEN_KEYWORD_NIL)) { - return (pm_node_t *) pm_no_keywords_parameter_node_create(parser, &operator, &parser->previous); + return UP(pm_no_keywords_parameter_node_create(parser, &operator, &parser->previous)); } if (accept1(parser, PM_TOKEN_IDENTIFIER)) { @@ -17055,15 +16369,15 @@ parse_pattern_keyword_rest(pm_parser_t *parser, pm_constant_id_list_t *captures) } parse_pattern_capture(parser, captures, constant_id, &PM_LOCATION_TOKEN_VALUE(&parser->previous)); - value = (pm_node_t *) pm_local_variable_target_node_create( + value = UP(pm_local_variable_target_node_create( parser, &PM_LOCATION_TOKEN_VALUE(&parser->previous), constant_id, (uint32_t) (depth == -1 ? 0 : depth) - ); + )); } - return (pm_node_t *) pm_assoc_splat_node_create(parser, value, &operator); + return UP(pm_assoc_splat_node_create(parser, value, &operator)); } /** @@ -17126,7 +16440,7 @@ parse_pattern_hash_implicit_value(pm_parser_t *parser, pm_constant_id_list_t *ca (uint32_t) (depth == -1 ? 0 : depth) ); - return (pm_node_t *) pm_implicit_node_create(parser, (pm_node_t *) target); + return UP(pm_implicit_node_create(parser, UP(target))); } /** @@ -17170,7 +16484,7 @@ parse_pattern_hash(pm_parser_t *parser, pm_constant_id_list_t *captures, pm_node } pm_token_t operator = not_provided(parser); - pm_node_t *assoc = (pm_node_t *) pm_assoc_node_create(parser, first_node, &operator, value); + pm_node_t *assoc = UP(pm_assoc_node_create(parser, first_node, &operator, value)); pm_node_list_append(&assocs, assoc); break; @@ -17185,8 +16499,8 @@ parse_pattern_hash(pm_parser_t *parser, pm_constant_id_list_t *captures, pm_node pm_parser_err_node(parser, first_node, diag_id); pm_token_t operator = not_provided(parser); - pm_node_t *value = (pm_node_t *) pm_missing_node_create(parser, first_node->location.start, first_node->location.end); - pm_node_t *assoc = (pm_node_t *) pm_assoc_node_create(parser, first_node, &operator, value); + pm_node_t *value = UP(pm_missing_node_create(parser, first_node->location.start, first_node->location.end)); + pm_node_t *assoc = UP(pm_assoc_node_create(parser, first_node, &operator, value)); pm_node_list_append(&assocs, assoc); break; @@ -17227,20 +16541,24 @@ parse_pattern_hash(pm_parser_t *parser, pm_constant_id_list_t *captures, pm_node } } else { expect1(parser, PM_TOKEN_LABEL, PM_ERR_PATTERN_LABEL_AFTER_COMMA); - key = (pm_node_t *) pm_symbol_node_label_create(parser, &parser->previous); + key = UP(pm_symbol_node_label_create(parser, &parser->previous)); } parse_pattern_hash_key(parser, &keys, key); pm_node_t *value = NULL; if (match7(parser, PM_TOKEN_COMMA, PM_TOKEN_KEYWORD_THEN, PM_TOKEN_BRACE_RIGHT, PM_TOKEN_BRACKET_RIGHT, PM_TOKEN_PARENTHESIS_RIGHT, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON)) { - value = parse_pattern_hash_implicit_value(parser, captures, (pm_symbol_node_t *) key); + if (PM_NODE_TYPE_P(key, PM_SYMBOL_NODE)) { + value = parse_pattern_hash_implicit_value(parser, captures, (pm_symbol_node_t *) key); + } else { + value = UP(pm_missing_node_create(parser, key->location.end, key->location.end)); + } } else { value = parse_pattern(parser, captures, PM_PARSE_PATTERN_SINGLE, PM_ERR_PATTERN_EXPRESSION_AFTER_KEY, (uint16_t) (depth + 1)); } pm_token_t operator = not_provided(parser); - pm_node_t *assoc = (pm_node_t *) pm_assoc_node_create(parser, key, &operator, value); + pm_node_t *assoc = UP(pm_assoc_node_create(parser, key, &operator, value)); if (rest != NULL) { pm_parser_err_node(parser, assoc, PM_ERR_PATTERN_EXPRESSION_AFTER_REST); @@ -17274,12 +16592,12 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm } parse_pattern_capture(parser, captures, constant_id, &PM_LOCATION_TOKEN_VALUE(&parser->previous)); - return (pm_node_t *) pm_local_variable_target_node_create( + return UP(pm_local_variable_target_node_create( parser, &PM_LOCATION_TOKEN_VALUE(&parser->previous), constant_id, (uint32_t) (depth == -1 ? 0 : depth) - ); + )); } case PM_TOKEN_BRACKET_LEFT_ARRAY: { pm_token_t opening = parser->current; @@ -17288,7 +16606,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm if (accept1(parser, PM_TOKEN_BRACKET_RIGHT)) { // If we have an empty array pattern, then we'll just return a new // array pattern node. - return (pm_node_t *) pm_array_pattern_node_empty_create(parser, &opening, &parser->previous); + return UP(pm_array_pattern_node_empty_create(parser, &opening, &parser->previous)); } // Otherwise, we'll parse the inner pattern, then deal with it depending @@ -17296,7 +16614,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm pm_node_t *inner = parse_pattern(parser, captures, PM_PARSE_PATTERN_MULTI, PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET, (uint16_t) (depth + 1)); accept1(parser, PM_TOKEN_NEWLINE); - expect1(parser, PM_TOKEN_BRACKET_RIGHT, PM_ERR_PATTERN_TERM_BRACKET); + expect1_opening(parser, PM_TOKEN_BRACKET_RIGHT, PM_ERR_PATTERN_TERM_BRACKET, &opening); pm_token_t closing = parser->previous; switch (PM_NODE_TYPE(inner)) { @@ -17309,7 +16627,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm pattern_node->opening_loc = PM_LOCATION_TOKEN_VALUE(&opening); pattern_node->closing_loc = PM_LOCATION_TOKEN_VALUE(&closing); - return (pm_node_t *) pattern_node; + return UP(pattern_node); } break; @@ -17323,7 +16641,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm pattern_node->opening_loc = PM_LOCATION_TOKEN_VALUE(&opening); pattern_node->closing_loc = PM_LOCATION_TOKEN_VALUE(&closing); - return (pm_node_t *) pattern_node; + return UP(pattern_node); } break; @@ -17334,7 +16652,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm pm_array_pattern_node_t *node = pm_array_pattern_node_empty_create(parser, &opening, &closing); pm_array_pattern_node_requireds_append(node, inner); - return (pm_node_t *) node; + return UP(node); } case PM_TOKEN_BRACE_LEFT: { bool previous_pattern_matching_newlines = parser->pattern_matching_newlines; @@ -17354,7 +16672,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm switch (parser->current.type) { case PM_TOKEN_LABEL: parser_lex(parser); - first_node = (pm_node_t *) pm_symbol_node_label_create(parser, &parser->previous); + first_node = UP(pm_symbol_node_label_create(parser, &parser->previous)); break; case PM_TOKEN_USTAR_STAR: first_node = parse_pattern_keyword_rest(parser, captures); @@ -17366,7 +16684,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm PM_PARSER_ERR_TOKEN_FORMAT(parser, parser->current, PM_ERR_PATTERN_HASH_KEY, pm_token_type_human(parser->current.type)); parser_lex(parser); - first_node = (pm_node_t *) pm_missing_node_create(parser, parser->previous.start, parser->previous.end); + first_node = UP(pm_missing_node_create(parser, parser->previous.start, parser->previous.end)); break; } } @@ -17374,7 +16692,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm node = parse_pattern_hash(parser, captures, first_node, (uint16_t) (depth + 1)); accept1(parser, PM_TOKEN_NEWLINE); - expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_PATTERN_TERM_BRACE); + expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_PATTERN_TERM_BRACE, &opening); pm_token_t closing = parser->previous; node->base.location.start = opening.start; @@ -17385,7 +16703,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm } parser->pattern_matching_newlines = previous_pattern_matching_newlines; - return (pm_node_t *) node; + return UP(node); } case PM_TOKEN_UDOT_DOT: case PM_TOKEN_UDOT_DOT_DOT: { @@ -17397,12 +16715,12 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm switch (parser->current.type) { case PM_CASE_PRIMITIVE: { pm_node_t *right = parse_expression(parser, PM_BINDING_POWER_MAX, false, false, PM_ERR_PATTERN_EXPRESSION_AFTER_RANGE, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_range_node_create(parser, NULL, &operator, right); + return UP(pm_range_node_create(parser, NULL, &operator, right)); } default: { pm_parser_err_token(parser, &operator, PM_ERR_PATTERN_EXPRESSION_AFTER_RANGE); - pm_node_t *right = (pm_node_t *) pm_missing_node_create(parser, operator.start, operator.end); - return (pm_node_t *) pm_range_node_create(parser, NULL, &operator, right); + pm_node_t *right = UP(pm_missing_node_create(parser, operator.start, operator.end)); + return UP(pm_range_node_create(parser, NULL, &operator, right)); } } } @@ -17412,6 +16730,16 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm // If we found a label, we need to immediately return to the caller. if (pm_symbol_node_label_p(node)) return node; + // Call nodes (arithmetic operations) are not allowed in patterns + if (PM_NODE_TYPE(node) == PM_CALL_NODE) { + pm_parser_err_node(parser, node, diag_id); + pm_missing_node_t *missing_node = pm_missing_node_create(parser, node->location.start, node->location.end); + + pm_node_unreference(parser, node); + pm_node_destroy(parser, node); + return UP(missing_node); + } + // Now that we have a primitive, we need to check if it's part of a range. if (accept2(parser, PM_TOKEN_DOT_DOT, PM_TOKEN_DOT_DOT_DOT)) { pm_token_t operator = parser->previous; @@ -17422,10 +16750,10 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm switch (parser->current.type) { case PM_CASE_PRIMITIVE: { pm_node_t *right = parse_expression(parser, PM_BINDING_POWER_MAX, false, false, PM_ERR_PATTERN_EXPRESSION_AFTER_RANGE, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_range_node_create(parser, node, &operator, right); + return UP(pm_range_node_create(parser, node, &operator, right)); } default: - return (pm_node_t *) pm_range_node_create(parser, node, &operator, NULL); + return UP(pm_range_node_create(parser, node, &operator, NULL)); } } @@ -17440,44 +16768,44 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm switch (parser->current.type) { case PM_TOKEN_IDENTIFIER: { parser_lex(parser); - pm_node_t *variable = (pm_node_t *) parse_variable(parser); + pm_node_t *variable = UP(parse_variable(parser)); if (variable == NULL) { PM_PARSER_ERR_TOKEN_FORMAT_CONTENT(parser, parser->previous, PM_ERR_NO_LOCAL_VARIABLE); - variable = (pm_node_t *) pm_local_variable_read_node_missing_create(parser, &parser->previous, 0); + variable = UP(pm_local_variable_read_node_missing_create(parser, &parser->previous, 0)); } - return (pm_node_t *) pm_pinned_variable_node_create(parser, &operator, variable); + return UP(pm_pinned_variable_node_create(parser, &operator, variable)); } case PM_TOKEN_INSTANCE_VARIABLE: { parser_lex(parser); - pm_node_t *variable = (pm_node_t *) pm_instance_variable_read_node_create(parser, &parser->previous); + pm_node_t *variable = UP(pm_instance_variable_read_node_create(parser, &parser->previous)); - return (pm_node_t *) pm_pinned_variable_node_create(parser, &operator, variable); + return UP(pm_pinned_variable_node_create(parser, &operator, variable)); } case PM_TOKEN_CLASS_VARIABLE: { parser_lex(parser); - pm_node_t *variable = (pm_node_t *) pm_class_variable_read_node_create(parser, &parser->previous); + pm_node_t *variable = UP(pm_class_variable_read_node_create(parser, &parser->previous)); - return (pm_node_t *) pm_pinned_variable_node_create(parser, &operator, variable); + return UP(pm_pinned_variable_node_create(parser, &operator, variable)); } case PM_TOKEN_GLOBAL_VARIABLE: { parser_lex(parser); - pm_node_t *variable = (pm_node_t *) pm_global_variable_read_node_create(parser, &parser->previous); + pm_node_t *variable = UP(pm_global_variable_read_node_create(parser, &parser->previous)); - return (pm_node_t *) pm_pinned_variable_node_create(parser, &operator, variable); + return UP(pm_pinned_variable_node_create(parser, &operator, variable)); } case PM_TOKEN_NUMBERED_REFERENCE: { parser_lex(parser); - pm_node_t *variable = (pm_node_t *) pm_numbered_reference_read_node_create(parser, &parser->previous); + pm_node_t *variable = UP(pm_numbered_reference_read_node_create(parser, &parser->previous)); - return (pm_node_t *) pm_pinned_variable_node_create(parser, &operator, variable); + return UP(pm_pinned_variable_node_create(parser, &operator, variable)); } case PM_TOKEN_BACK_REFERENCE: { parser_lex(parser); - pm_node_t *variable = (pm_node_t *) pm_back_reference_read_node_create(parser, &parser->previous); + pm_node_t *variable = UP(pm_back_reference_read_node_create(parser, &parser->previous)); - return (pm_node_t *) pm_pinned_variable_node_create(parser, &operator, variable); + return UP(pm_pinned_variable_node_create(parser, &operator, variable)); } case PM_TOKEN_PARENTHESIS_LEFT: { bool previous_pattern_matching_newlines = parser->pattern_matching_newlines; @@ -17490,15 +16818,15 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm parser->pattern_matching_newlines = previous_pattern_matching_newlines; accept1(parser, PM_TOKEN_NEWLINE); - expect1(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN); - return (pm_node_t *) pm_pinned_expression_node_create(parser, expression, &operator, &lparen, &parser->previous); + expect1_opening(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN, &lparen); + return UP(pm_pinned_expression_node_create(parser, expression, &operator, &lparen, &parser->previous)); } default: { // If we get here, then we have a pin operator followed by something // not understood. We'll create a missing node and return that. pm_parser_err_token(parser, &operator, PM_ERR_PATTERN_EXPRESSION_AFTER_PIN); - pm_node_t *variable = (pm_node_t *) pm_missing_node_create(parser, operator.start, operator.end); - return (pm_node_t *) pm_pinned_variable_node_create(parser, &operator, variable); + pm_node_t *variable = UP(pm_missing_node_create(parser, operator.start, operator.end)); + return UP(pm_pinned_variable_node_create(parser, &operator, variable)); } } } @@ -17509,21 +16837,41 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm expect1(parser, PM_TOKEN_CONSTANT, PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT); pm_constant_path_node_t *node = pm_constant_path_node_create(parser, NULL, &delimiter, &parser->previous); - return parse_pattern_constant_path(parser, captures, (pm_node_t *) node, (uint16_t) (depth + 1)); + return parse_pattern_constant_path(parser, captures, UP(node), (uint16_t) (depth + 1)); } case PM_TOKEN_CONSTANT: { pm_token_t constant = parser->current; parser_lex(parser); - pm_node_t *node = (pm_node_t *) pm_constant_read_node_create(parser, &constant); + pm_node_t *node = UP(pm_constant_read_node_create(parser, &constant)); return parse_pattern_constant_path(parser, captures, node, (uint16_t) (depth + 1)); } default: pm_parser_err_current(parser, diag_id); - return (pm_node_t *) pm_missing_node_create(parser, parser->current.start, parser->current.end); + return UP(pm_missing_node_create(parser, parser->current.start, parser->current.end)); + } +} + +static bool +parse_pattern_alternation_error_each(const pm_node_t *node, void *data) { + switch (PM_NODE_TYPE(node)) { + case PM_LOCAL_VARIABLE_TARGET_NODE: + pm_parser_err((pm_parser_t *) data, node->location.start, node->location.end, PM_ERR_PATTERN_CAPTURE_IN_ALTERNATIVE); + return false; + default: + return true; } } +/** + * When we get here, we know that we already have a syntax error, because we + * know we have captured a variable and that we are in an alternation. + */ +static void +parse_pattern_alternation_error(pm_parser_t *parser, const pm_node_t *node) { + pm_visit_node(node, parse_pattern_alternation_error_each, parser); +} + /** * Parse any number of primitives joined by alternation and ended optionally by * assignment. @@ -17531,9 +16879,12 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm static pm_node_t * parse_pattern_primitives(pm_parser_t *parser, pm_constant_id_list_t *captures, pm_node_t *first_node, pm_diagnostic_id_t diag_id, uint16_t depth) { pm_node_t *node = first_node; + bool alternation = false; - while ((node == NULL) || accept1(parser, PM_TOKEN_PIPE)) { - pm_token_t operator = parser->previous; + while ((node == NULL) || (alternation = accept1(parser, PM_TOKEN_PIPE))) { + if (alternation && !PM_NODE_TYPE_P(node, PM_ALTERNATION_PATTERN_NODE) && captures->size) { + parse_pattern_alternation_error(parser, node); + } switch (parser->current.type) { case PM_TOKEN_IDENTIFIER: @@ -17545,41 +16896,47 @@ parse_pattern_primitives(pm_parser_t *parser, pm_constant_id_list_t *captures, p case PM_TOKEN_UDOT_DOT: case PM_TOKEN_UDOT_DOT_DOT: case PM_CASE_PRIMITIVE: { - if (node == NULL) { + if (!alternation) { node = parse_pattern_primitive(parser, captures, diag_id, (uint16_t) (depth + 1)); } else { + pm_token_t operator = parser->previous; pm_node_t *right = parse_pattern_primitive(parser, captures, PM_ERR_PATTERN_EXPRESSION_AFTER_PIPE, (uint16_t) (depth + 1)); - node = (pm_node_t *) pm_alternation_pattern_node_create(parser, node, right, &operator); + + if (captures->size) parse_pattern_alternation_error(parser, right); + node = UP(pm_alternation_pattern_node_create(parser, node, right, &operator)); } break; } case PM_TOKEN_PARENTHESIS_LEFT: case PM_TOKEN_PARENTHESIS_LEFT_PARENTHESES: { + pm_token_t operator = parser->previous; pm_token_t opening = parser->current; parser_lex(parser); pm_node_t *body = parse_pattern(parser, captures, PM_PARSE_PATTERN_SINGLE, PM_ERR_PATTERN_EXPRESSION_AFTER_PAREN, (uint16_t) (depth + 1)); accept1(parser, PM_TOKEN_NEWLINE); - expect1(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN); - pm_node_t *right = (pm_node_t *) pm_parentheses_node_create(parser, &opening, body, &parser->previous, 0); + expect1_opening(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN, &opening); + pm_node_t *right = UP(pm_parentheses_node_create(parser, &opening, body, &parser->previous, 0)); - if (node == NULL) { + if (!alternation) { node = right; } else { - node = (pm_node_t *) pm_alternation_pattern_node_create(parser, node, right, &operator); + if (captures->size) parse_pattern_alternation_error(parser, right); + node = UP(pm_alternation_pattern_node_create(parser, node, right, &operator)); } break; } default: { pm_parser_err_current(parser, diag_id); - pm_node_t *right = (pm_node_t *) pm_missing_node_create(parser, parser->current.start, parser->current.end); + pm_node_t *right = UP(pm_missing_node_create(parser, parser->current.start, parser->current.end)); - if (node == NULL) { + if (!alternation) { node = right; } else { - node = (pm_node_t *) pm_alternation_pattern_node_create(parser, node, right, &operator); + if (captures->size) parse_pattern_alternation_error(parser, right); + node = UP(pm_alternation_pattern_node_create(parser, node, right, &parser->previous)); } break; @@ -17608,7 +16965,7 @@ parse_pattern_primitives(pm_parser_t *parser, pm_constant_id_list_t *captures, p (uint32_t) (depth == -1 ? 0 : depth) ); - node = (pm_node_t *) pm_capture_pattern_node_create(parser, node, target, &operator); + node = UP(pm_capture_pattern_node_create(parser, node, target, &operator)); } return node; @@ -17627,8 +16984,8 @@ parse_pattern(pm_parser_t *parser, pm_constant_id_list_t *captures, uint8_t flag switch (parser->current.type) { case PM_TOKEN_LABEL: { parser_lex(parser); - pm_node_t *key = (pm_node_t *) pm_symbol_node_label_create(parser, &parser->previous); - node = (pm_node_t *) parse_pattern_hash(parser, captures, key, (uint16_t) (depth + 1)); + pm_node_t *key = UP(pm_symbol_node_label_create(parser, &parser->previous)); + node = UP(parse_pattern_hash(parser, captures, key, (uint16_t) (depth + 1))); if (!(flags & PM_PARSE_PATTERN_TOP)) { pm_parser_err_node(parser, node, PM_ERR_PATTERN_HASH_IMPLICIT); @@ -17638,7 +16995,7 @@ parse_pattern(pm_parser_t *parser, pm_constant_id_list_t *captures, uint8_t flag } case PM_TOKEN_USTAR_STAR: { node = parse_pattern_keyword_rest(parser, captures); - node = (pm_node_t *) parse_pattern_hash(parser, captures, node, (uint16_t) (depth + 1)); + node = UP(parse_pattern_hash(parser, captures, node, (uint16_t) (depth + 1))); if (!(flags & PM_PARSE_PATTERN_TOP)) { pm_parser_err_node(parser, node, PM_ERR_PATTERN_HASH_IMPLICIT); @@ -17652,7 +17009,7 @@ parse_pattern(pm_parser_t *parser, pm_constant_id_list_t *captures, uint8_t flag node = parse_pattern_primitive(parser, captures, diag_id, (uint16_t) (depth + 1)); if (pm_symbol_node_label_p(node)) { - node = (pm_node_t *) parse_pattern_hash(parser, captures, node, (uint16_t) (depth + 1)); + node = UP(parse_pattern_hash(parser, captures, node, (uint16_t) (depth + 1))); if (!(flags & PM_PARSE_PATTERN_TOP)) { pm_parser_err_node(parser, node, PM_ERR_PATTERN_HASH_IMPLICIT); @@ -17667,7 +17024,7 @@ parse_pattern(pm_parser_t *parser, pm_constant_id_list_t *captures, uint8_t flag case PM_TOKEN_USTAR: { if (flags & (PM_PARSE_PATTERN_TOP | PM_PARSE_PATTERN_MULTI)) { parser_lex(parser); - node = (pm_node_t *) parse_pattern_rest(parser, captures); + node = UP(parse_pattern_rest(parser, captures)); leading_rest = true; break; } @@ -17681,7 +17038,7 @@ parse_pattern(pm_parser_t *parser, pm_constant_id_list_t *captures, uint8_t flag // If we got a dynamic label symbol, then we need to treat it like the // beginning of a hash pattern. if (pm_symbol_node_label_p(node)) { - return (pm_node_t *) parse_pattern_hash(parser, captures, node, (uint16_t) (depth + 1)); + return UP(parse_pattern_hash(parser, captures, node, (uint16_t) (depth + 1))); } if ((flags & PM_PARSE_PATTERN_MULTI) && match1(parser, PM_TOKEN_COMMA)) { @@ -17694,15 +17051,15 @@ parse_pattern(pm_parser_t *parser, pm_constant_id_list_t *captures, uint8_t flag // Gather up all of the patterns into the list. while (accept1(parser, PM_TOKEN_COMMA)) { // Break early here in case we have a trailing comma. - if (match9(parser, PM_TOKEN_KEYWORD_THEN, PM_TOKEN_BRACE_RIGHT, PM_TOKEN_BRACKET_RIGHT, PM_TOKEN_PARENTHESIS_RIGHT, PM_TOKEN_SEMICOLON, PM_TOKEN_NEWLINE, PM_TOKEN_EOF,PM_TOKEN_KEYWORD_AND, PM_TOKEN_KEYWORD_OR)) { - node = (pm_node_t *) pm_implicit_rest_node_create(parser, &parser->previous); + if (match7(parser, PM_TOKEN_KEYWORD_THEN, PM_TOKEN_BRACE_RIGHT, PM_TOKEN_BRACKET_RIGHT, PM_TOKEN_PARENTHESIS_RIGHT, PM_TOKEN_SEMICOLON, PM_TOKEN_KEYWORD_AND, PM_TOKEN_KEYWORD_OR)) { + node = UP(pm_implicit_rest_node_create(parser, &parser->previous)); pm_node_list_append(&nodes, node); trailing_rest = true; break; } if (accept1(parser, PM_TOKEN_USTAR)) { - node = (pm_node_t *) parse_pattern_rest(parser, captures); + node = UP(parse_pattern_rest(parser, captures)); // If we have already parsed a splat pattern, then this is an // error. We will continue to parse the rest of the patterns, @@ -17724,13 +17081,13 @@ parse_pattern(pm_parser_t *parser, pm_constant_id_list_t *captures, uint8_t flag // are in between because we know we already added the appropriate // errors. Otherwise we will create an array pattern. if (leading_rest && PM_NODE_TYPE_P(nodes.nodes[nodes.size - 1], PM_SPLAT_NODE)) { - node = (pm_node_t *) pm_find_pattern_node_create(parser, &nodes); + node = UP(pm_find_pattern_node_create(parser, &nodes)); if (nodes.size == 2) { pm_parser_err_node(parser, node, PM_ERR_PATTERN_FIND_MISSING_INNER); } } else { - node = (pm_node_t *) pm_array_pattern_node_node_list_create(parser, &nodes); + node = UP(pm_array_pattern_node_node_list_create(parser, &nodes)); if (leading_rest && trailing_rest) { pm_parser_err_node(parser, node, PM_ERR_PATTERN_ARRAY_MULTIPLE_RESTS); @@ -17741,7 +17098,7 @@ parse_pattern(pm_parser_t *parser, pm_constant_id_list_t *captures, uint8_t flag } else if (leading_rest) { // Otherwise, if we parsed a single splat pattern, then we know we have // an array pattern, so we can go ahead and create that node. - node = (pm_node_t *) pm_array_pattern_node_rest_create(parser, node); + node = UP(pm_array_pattern_node_rest_create(parser, node)); } return node; @@ -17887,6 +17244,7 @@ parse_retry(pm_parser_t *parser, const pm_node_t *node) { case PM_CONTEXT_BEGIN: case PM_CONTEXT_BLOCK_BRACES: case PM_CONTEXT_BLOCK_KEYWORDS: + case PM_CONTEXT_BLOCK_PARAMETERS: case PM_CONTEXT_CASE_IN: case PM_CONTEXT_CASE_WHEN: case PM_CONTEXT_DEFAULT_PARAMS: @@ -17967,6 +17325,7 @@ parse_yield(pm_parser_t *parser, const pm_node_t *node) { case PM_CONTEXT_BLOCK_KEYWORDS: case PM_CONTEXT_BLOCK_ELSE: case PM_CONTEXT_BLOCK_ENSURE: + case PM_CONTEXT_BLOCK_PARAMETERS: case PM_CONTEXT_BLOCK_RESCUE: case PM_CONTEXT_CASE_IN: case PM_CONTEXT_CASE_WHEN: @@ -18117,13 +17476,13 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b expression = parse_value_expression(parser, PM_BINDING_POWER_DEFINED, false, false, PM_ERR_ARRAY_EXPRESSION_AFTER_STAR, (uint16_t) (depth + 1)); } - element = (pm_node_t *) pm_splat_node_create(parser, &operator, expression); + element = UP(pm_splat_node_create(parser, &operator, expression)); } else if (match2(parser, PM_TOKEN_LABEL, PM_TOKEN_USTAR_STAR)) { if (parsed_bare_hash) { pm_parser_err_current(parser, PM_ERR_EXPRESSION_BARE_HASH); } - element = (pm_node_t *) pm_keyword_hash_node_create(parser); + element = UP(pm_keyword_hash_node_create(parser)); pm_static_literals_t hash_keys = { 0 }; if (!match8(parser, PM_TOKEN_EOF, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON, PM_TOKEN_EOF, PM_TOKEN_BRACE_RIGHT, PM_TOKEN_BRACKET_RIGHT, PM_TOKEN_KEYWORD_DO, PM_TOKEN_PARENTHESIS_RIGHT)) { @@ -18152,10 +17511,10 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } pm_node_t *value = parse_value_expression(parser, PM_BINDING_POWER_DEFINED, false, false, PM_ERR_HASH_VALUE, (uint16_t) (depth + 1)); - pm_node_t *assoc = (pm_node_t *) pm_assoc_node_create(parser, element, &operator, value); + pm_node_t *assoc = UP(pm_assoc_node_create(parser, element, &operator, value)); pm_keyword_hash_node_elements_append(hash, assoc); - element = (pm_node_t *) hash; + element = UP(hash); if (accept1(parser, PM_TOKEN_COMMA) && !match1(parser, PM_TOKEN_BRACKET_RIGHT)) { parse_assocs(parser, &hash_keys, element, (uint16_t) (depth + 1)); } @@ -18180,7 +17539,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_array_node_close_set(array, &parser->previous); pm_accepts_block_stack_pop(parser); - return (pm_node_t *) array; + return UP(array); } case PM_TOKEN_PARENTHESIS_LEFT: case PM_TOKEN_PARENTHESIS_LEFT_PARENTHESES: { @@ -18207,7 +17566,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pop_block_exits(parser, previous_block_exits); pm_node_list_free(¤t_block_exits); - return (pm_node_t *) pm_parentheses_node_create(parser, &opening, NULL, &parser->previous, flags); + return UP(pm_parentheses_node_create(parser, &opening, NULL, &parser->previous, flags)); } // Otherwise, we're going to parse the first statement in the list @@ -18276,10 +17635,10 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_node_t *result; if (match1(parser, PM_TOKEN_COMMA) && (binding_power == PM_BINDING_POWER_STATEMENT)) { - result = parse_targets(parser, (pm_node_t *) multi_target, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); + result = parse_targets(parser, UP(multi_target), PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); accept1(parser, PM_TOKEN_NEWLINE); } else { - result = (pm_node_t *) multi_target; + result = UP(multi_target); } if (context_p(parser, PM_CONTEXT_MULTI_TARGET)) { @@ -18308,7 +17667,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_statements_node_t *statements = pm_statements_node_create(parser); pm_statements_node_body_append(parser, statements, statement, true); - return (pm_node_t *) pm_parentheses_node_create(parser, &opening, (pm_node_t *) statements, &parser->previous, flags); + return UP(pm_parentheses_node_create(parser, &opening, UP(statements), &parser->previous, flags)); } // If we have more than one statement in the set of parentheses, @@ -18373,16 +17732,16 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_multi_target_node_t *multi_target = pm_multi_target_node_create(parser); pm_multi_target_node_targets_append(parser, multi_target, statement); - statement = (pm_node_t *) multi_target; + statement = UP(multi_target); statements->body.nodes[statements->body.size - 1] = statement; } if (PM_NODE_TYPE_P(statement, PM_MULTI_TARGET_NODE)) { const uint8_t *offset = statement->location.end; pm_token_t operator = { .type = PM_TOKEN_EQUAL, .start = offset, .end = offset }; - pm_node_t *value = (pm_node_t *) pm_missing_node_create(parser, offset, offset); + pm_node_t *value = UP(pm_missing_node_create(parser, offset, offset)); - statement = (pm_node_t *) pm_multi_write_node_create(parser, (pm_multi_target_node_t *) statement, &operator, value); + statement = UP(pm_multi_write_node_create(parser, (pm_multi_target_node_t *) statement, &operator, value)); statements->body.nodes[statements->body.size - 1] = statement; pm_parser_err_node(parser, statement, PM_ERR_WRITE_TARGET_UNEXPECTED); @@ -18393,7 +17752,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_node_list_free(¤t_block_exits); pm_void_statements_check(parser, statements, true); - return (pm_node_t *) pm_parentheses_node_create(parser, &opening, (pm_node_t *) statements, &parser->previous, flags); + return UP(pm_parentheses_node_create(parser, &opening, UP(statements), &parser->previous, flags)); } case PM_TOKEN_BRACE_LEFT: { // If we were passed a current_hash_keys via the parser, then that @@ -18409,14 +17768,15 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_accepts_block_stack_push(parser, true); parser_lex(parser); - pm_hash_node_t *node = pm_hash_node_create(parser, &parser->previous); + pm_token_t opening = parser->previous; + pm_hash_node_t *node = pm_hash_node_create(parser, &opening); if (!match2(parser, PM_TOKEN_BRACE_RIGHT, PM_TOKEN_EOF)) { if (current_hash_keys != NULL) { - parse_assocs(parser, current_hash_keys, (pm_node_t *) node, (uint16_t) (depth + 1)); + parse_assocs(parser, current_hash_keys, UP(node), (uint16_t) (depth + 1)); } else { pm_static_literals_t hash_keys = { 0 }; - parse_assocs(parser, &hash_keys, (pm_node_t *) node, (uint16_t) (depth + 1)); + parse_assocs(parser, &hash_keys, UP(node), (uint16_t) (depth + 1)); pm_static_literals_free(&hash_keys); } @@ -18424,26 +17784,34 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } pm_accepts_block_stack_pop(parser); - expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_HASH_TERM); + expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_HASH_TERM, &opening); pm_hash_node_closing_loc_set(node, &parser->previous); - return (pm_node_t *) node; + return UP(node); } case PM_TOKEN_CHARACTER_LITERAL: { - parser_lex(parser); - - pm_token_t opening = parser->previous; - opening.type = PM_TOKEN_STRING_BEGIN; - opening.end = opening.start + 1; - - pm_token_t content = parser->previous; - content.type = PM_TOKEN_STRING_CONTENT; - content.start = content.start + 1; - pm_token_t closing = not_provided(parser); - pm_node_t *node = (pm_node_t *) pm_string_node_create_current_string(parser, &opening, &content, &closing); + pm_node_t *node = UP(pm_string_node_create_current_string( + parser, + &(pm_token_t) { + .type = PM_TOKEN_STRING_BEGIN, + .start = parser->current.start, + .end = parser->current.start + 1 + }, + &(pm_token_t) { + .type = PM_TOKEN_STRING_CONTENT, + .start = parser->current.start + 1, + .end = parser->current.end + }, + &closing + )); + pm_node_flag_set(node, parse_unescaped_encoding(parser)); + // Skip past the character literal here, since now we have handled + // parser->explicit_encoding correctly. + parser_lex(parser); + // Characters can be followed by strings in which case they are // automatically concatenated. if (match1(parser, PM_TOKEN_STRING_BEGIN)) { @@ -18454,7 +17822,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } case PM_TOKEN_CLASS_VARIABLE: { parser_lex(parser); - pm_node_t *node = (pm_node_t *) pm_class_variable_read_node_create(parser, &parser->previous); + pm_node_t *node = UP(pm_class_variable_read_node_create(parser, &parser->previous)); if (binding_power == PM_BINDING_POWER_STATEMENT && match1(parser, PM_TOKEN_COMMA)) { node = parse_targets_validate(parser, node, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); @@ -18476,10 +17844,10 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b ) { pm_arguments_t arguments = { 0 }; parse_arguments_list(parser, &arguments, true, accepts_command_call, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_call_node_fcall_create(parser, &constant, &arguments); + return UP(pm_call_node_fcall_create(parser, &constant, &arguments)); } - pm_node_t *node = (pm_node_t *) pm_constant_read_node_create(parser, &parser->previous); + pm_node_t *node = UP(pm_constant_read_node_create(parser, &parser->previous)); if ((binding_power == PM_BINDING_POWER_STATEMENT) && match1(parser, PM_TOKEN_COMMA)) { // If we get here, then we have a comma immediately following a @@ -18494,7 +17862,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t delimiter = parser->previous; expect1(parser, PM_TOKEN_CONSTANT, PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT); - pm_node_t *node = (pm_node_t *) pm_constant_path_node_create(parser, NULL, &delimiter, &parser->previous); + pm_node_t *node = UP(pm_constant_path_node_create(parser, NULL, &delimiter, &parser->previous)); if ((binding_power == PM_BINDING_POWER_STATEMENT) && match1(parser, PM_TOKEN_COMMA)) { node = parse_targets_validate(parser, node, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); @@ -18517,23 +17885,23 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_parser_err_current(parser, PM_ERR_UNEXPECTED_RANGE_OPERATOR); } - return (pm_node_t *) pm_range_node_create(parser, NULL, &operator, right); + return UP(pm_range_node_create(parser, NULL, &operator, right)); } case PM_TOKEN_FLOAT: parser_lex(parser); - return (pm_node_t *) pm_float_node_create(parser, &parser->previous); + return UP(pm_float_node_create(parser, &parser->previous)); case PM_TOKEN_FLOAT_IMAGINARY: parser_lex(parser); - return (pm_node_t *) pm_float_node_imaginary_create(parser, &parser->previous); + return UP(pm_float_node_imaginary_create(parser, &parser->previous)); case PM_TOKEN_FLOAT_RATIONAL: parser_lex(parser); - return (pm_node_t *) pm_float_node_rational_create(parser, &parser->previous); + return UP(pm_float_node_rational_create(parser, &parser->previous)); case PM_TOKEN_FLOAT_RATIONAL_IMAGINARY: parser_lex(parser); - return (pm_node_t *) pm_float_node_rational_imaginary_create(parser, &parser->previous); + return UP(pm_float_node_rational_imaginary_create(parser, &parser->previous)); case PM_TOKEN_NUMBERED_REFERENCE: { parser_lex(parser); - pm_node_t *node = (pm_node_t *) pm_numbered_reference_read_node_create(parser, &parser->previous); + pm_node_t *node = UP(pm_numbered_reference_read_node_create(parser, &parser->previous)); if (binding_power == PM_BINDING_POWER_STATEMENT && match1(parser, PM_TOKEN_COMMA)) { node = parse_targets_validate(parser, node, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); @@ -18543,7 +17911,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } case PM_TOKEN_GLOBAL_VARIABLE: { parser_lex(parser); - pm_node_t *node = (pm_node_t *) pm_global_variable_read_node_create(parser, &parser->previous); + pm_node_t *node = UP(pm_global_variable_read_node_create(parser, &parser->previous)); if (binding_power == PM_BINDING_POWER_STATEMENT && match1(parser, PM_TOKEN_COMMA)) { node = parse_targets_validate(parser, node, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); @@ -18553,7 +17921,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } case PM_TOKEN_BACK_REFERENCE: { parser_lex(parser); - pm_node_t *node = (pm_node_t *) pm_back_reference_read_node_create(parser, &parser->previous); + pm_node_t *node = UP(pm_back_reference_read_node_create(parser, &parser->previous)); if (binding_power == PM_BINDING_POWER_STATEMENT && match1(parser, PM_TOKEN_COMMA)) { node = parse_targets_validate(parser, node, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); @@ -18578,24 +17946,18 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (parse_arguments_list(parser, &arguments, true, accepts_command_call, (uint16_t) (depth + 1))) { // Since we found arguments, we need to turn off the // variable call bit in the flags. - pm_node_flag_unset((pm_node_t *)call, PM_CALL_NODE_FLAGS_VARIABLE_CALL); + pm_node_flag_unset(UP(call), PM_CALL_NODE_FLAGS_VARIABLE_CALL); call->opening_loc = arguments.opening_loc; call->arguments = arguments.arguments; call->closing_loc = arguments.closing_loc; call->block = arguments.block; - if (arguments.block != NULL) { - call->base.location.end = arguments.block->location.end; - } else if (arguments.closing_loc.start == NULL) { - if (arguments.arguments != NULL) { - call->base.location.end = arguments.arguments->base.location.end; - } else { - call->base.location.end = call->message_loc.end; - } - } else { - call->base.location.end = arguments.closing_loc.end; + const uint8_t *end = pm_arguments_end(&arguments); + if (!end) { + end = call->message_loc.end; } + call->base.location.end = end; } } else { // Otherwise, we know the identifier is in the local table. This @@ -18614,7 +17976,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // If we're about to convert an 'it' implicit local // variable read into a method call, we need to remove // it from the list of implicit local variables. - parse_target_implicit_parameter(parser, node); + pm_node_unreference(parser, node); } else { // Otherwise, we're about to convert a regular local // variable read into a method call, in which case we @@ -18623,7 +17985,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b assert(PM_NODE_TYPE_P(node, PM_LOCAL_VARIABLE_READ_NODE)); if (pm_token_is_numbered_parameter(identifier.start, identifier.end)) { - parse_target_implicit_parameter(parser, node); + pm_node_unreference(parser, node); } else { pm_local_variable_read_node_t *cast = (pm_local_variable_read_node_t *) node; pm_locals_unread(&pm_parser_scope_find(parser, cast->depth)->locals, cast->name); @@ -18631,7 +17993,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } pm_node_destroy(parser, node); - return (pm_node_t *) fcall; + return UP(fcall); } } @@ -18663,9 +18025,9 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t content = parse_strings_empty_content(parser->previous.start); if (lex_mode.quote == PM_HEREDOC_QUOTE_BACKTICK) { - node = (pm_node_t *) pm_xstring_node_create_unescaped(parser, &opening, &content, &parser->previous, &PM_STRING_EMPTY); + node = UP(pm_xstring_node_create_unescaped(parser, &opening, &content, &parser->previous, &PM_STRING_EMPTY)); } else { - node = (pm_node_t *) pm_string_node_create_unescaped(parser, &opening, &content, &parser->previous, &PM_STRING_EMPTY); + node = UP(pm_string_node_create_unescaped(parser, &opening, &content, &parser->previous, &PM_STRING_EMPTY)); } node->location.end = opening.end; @@ -18676,7 +18038,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // // parse_string_part handles its own errors, so there is no need // for us to add one here. - node = (pm_node_t *) pm_missing_node_create(parser, parser->previous.start, parser->previous.end); + node = UP(pm_missing_node_create(parser, parser->previous.start, parser->previous.end)); } else if (PM_NODE_TYPE_P(part, PM_STRING_NODE) && match2(parser, PM_TOKEN_HEREDOC_END, PM_TOKEN_EOF)) { // If we get here, then the part that we parsed was plain string // content and we're at the end of the heredoc, so we can return @@ -18698,7 +18060,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b parse_heredoc_dedent_string(&cast->unescaped, common_whitespace); } - node = (pm_node_t *) cast; + node = UP(cast); expect1_heredoc_term(parser, lex_mode.ident_start, lex_mode.ident_length); } else { // If we get here, then we have multiple parts in the heredoc, @@ -18723,7 +18085,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_interpolated_xstring_node_closing_set(cast, &parser->previous); cast->base.location = cast->opening_loc; - node = (pm_node_t *) cast; + node = UP(cast); } else { pm_interpolated_string_node_t *cast = pm_interpolated_string_node_create(parser, &opening, &parts, &opening); pm_node_list_free(&parts); @@ -18732,7 +18094,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_interpolated_string_node_closing_set(cast, &parser->previous); cast->base.location = cast->opening_loc; - node = (pm_node_t *) cast; + node = UP(cast); } // If this is a heredoc that is indented with a ~, then we need @@ -18757,7 +18119,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } case PM_TOKEN_INSTANCE_VARIABLE: { parser_lex(parser); - pm_node_t *node = (pm_node_t *) pm_instance_variable_read_node_create(parser, &parser->previous); + pm_node_t *node = UP(pm_instance_variable_read_node_create(parser, &parser->previous)); if (binding_power == PM_BINDING_POWER_STATEMENT && match1(parser, PM_TOKEN_COMMA)) { node = parse_targets_validate(parser, node, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); @@ -18768,32 +18130,32 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b case PM_TOKEN_INTEGER: { pm_node_flags_t base = parser->integer_base; parser_lex(parser); - return (pm_node_t *) pm_integer_node_create(parser, base, &parser->previous); + return UP(pm_integer_node_create(parser, base, &parser->previous)); } case PM_TOKEN_INTEGER_IMAGINARY: { pm_node_flags_t base = parser->integer_base; parser_lex(parser); - return (pm_node_t *) pm_integer_node_imaginary_create(parser, base, &parser->previous); + return UP(pm_integer_node_imaginary_create(parser, base, &parser->previous)); } case PM_TOKEN_INTEGER_RATIONAL: { pm_node_flags_t base = parser->integer_base; parser_lex(parser); - return (pm_node_t *) pm_integer_node_rational_create(parser, base, &parser->previous); + return UP(pm_integer_node_rational_create(parser, base, &parser->previous)); } case PM_TOKEN_INTEGER_RATIONAL_IMAGINARY: { pm_node_flags_t base = parser->integer_base; parser_lex(parser); - return (pm_node_t *) pm_integer_node_rational_imaginary_create(parser, base, &parser->previous); + return UP(pm_integer_node_rational_imaginary_create(parser, base, &parser->previous)); } case PM_TOKEN_KEYWORD___ENCODING__: parser_lex(parser); - return (pm_node_t *) pm_source_encoding_node_create(parser, &parser->previous); + return UP(pm_source_encoding_node_create(parser, &parser->previous)); case PM_TOKEN_KEYWORD___FILE__: parser_lex(parser); - return (pm_node_t *) pm_source_file_node_create(parser, &parser->previous); + return UP(pm_source_file_node_create(parser, &parser->previous)); case PM_TOKEN_KEYWORD___LINE__: parser_lex(parser); - return (pm_node_t *) pm_source_line_node_create(parser, &parser->previous); + return UP(pm_source_line_node_create(parser, &parser->previous)); case PM_TOKEN_KEYWORD_ALIAS: { if (binding_power != PM_BINDING_POWER_STATEMENT) { pm_parser_err_current(parser, PM_ERR_STATEMENT_ALIAS); @@ -18817,7 +18179,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_parser_err_node(parser, old_name, PM_ERR_ALIAS_ARGUMENT); } - return (pm_node_t *) pm_alias_global_variable_node_create(parser, &keyword, new_name, old_name); + return UP(pm_alias_global_variable_node_create(parser, &keyword, new_name, old_name)); } case PM_SYMBOL_NODE: case PM_INTERPOLATED_SYMBOL_NODE: { @@ -18827,7 +18189,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } PRISM_FALLTHROUGH default: - return (pm_node_t *) pm_alias_method_node_create(parser, &keyword, new_name, old_name); + return UP(pm_alias_method_node_create(parser, &keyword, new_name, old_name)); } } case PM_TOKEN_KEYWORD_CASE: { @@ -18860,7 +18222,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_node_list_free(¤t_block_exits); pm_parser_err_token(parser, &case_keyword, PM_ERR_CASE_MISSING_CONDITIONS); - return (pm_node_t *) pm_case_node_create(parser, &case_keyword, predicate, &parser->previous); + return UP(pm_case_node_create(parser, &case_keyword, predicate, &parser->previous)); } // At this point we can create a case node, though we don't yet know @@ -18888,7 +18250,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_node_t *expression = parse_value_expression(parser, PM_BINDING_POWER_DEFINED, false, false, PM_ERR_EXPECT_EXPRESSION_AFTER_STAR, (uint16_t) (depth + 1)); pm_splat_node_t *splat_node = pm_splat_node_create(parser, &operator, expression); - pm_when_node_conditions_append(when_node, (pm_node_t *) splat_node); + pm_when_node_conditions_append(when_node, UP(splat_node)); if (PM_NODE_TYPE_P(expression, PM_MISSING_NODE)) break; } else { @@ -18927,7 +18289,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } } - pm_case_node_condition_append(case_node, (pm_node_t *) when_node); + pm_case_node_condition_append(case_node, UP(when_node)); } // If we didn't parse any conditions (in or when) then we need @@ -18937,7 +18299,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } pm_static_literals_free(&literals); - node = (pm_node_t *) case_node; + node = UP(case_node); } else { pm_case_match_node_t *case_node = pm_case_match_node_create(parser, &case_keyword, predicate, &end_keyword); @@ -18974,11 +18336,11 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (accept1(parser, PM_TOKEN_KEYWORD_IF_MODIFIER)) { pm_token_t keyword = parser->previous; pm_node_t *predicate = parse_value_expression(parser, PM_BINDING_POWER_COMPOSITION, true, false, PM_ERR_CONDITIONAL_IF_PREDICATE, (uint16_t) (depth + 1)); - pattern = (pm_node_t *) pm_if_node_modifier_create(parser, pattern, &keyword, predicate); + pattern = UP(pm_if_node_modifier_create(parser, pattern, &keyword, predicate)); } else if (accept1(parser, PM_TOKEN_KEYWORD_UNLESS_MODIFIER)) { pm_token_t keyword = parser->previous; pm_node_t *predicate = parse_value_expression(parser, PM_BINDING_POWER_COMPOSITION, true, false, PM_ERR_CONDITIONAL_UNLESS_PREDICATE, (uint16_t) (depth + 1)); - pattern = (pm_node_t *) pm_unless_node_modifier_create(parser, pattern, &keyword, predicate); + pattern = UP(pm_unless_node_modifier_create(parser, pattern, &keyword, predicate)); } // Now we need to check for the terminator of the in node's @@ -19007,7 +18369,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // Now that we have the full pattern and statements, we can // create the node and attach it to the case node. - pm_node_t *condition = (pm_node_t *) pm_in_node_create(parser, pattern, statements, &in_keyword, &then_keyword); + pm_node_t *condition = UP(pm_in_node_create(parser, pattern, statements, &in_keyword, &then_keyword)); pm_case_match_node_condition_append(case_node, condition); } @@ -19017,7 +18379,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_parser_err_token(parser, &case_keyword, PM_ERR_CASE_MISSING_CONDITIONS); } - node = (pm_node_t *) case_node; + node = UP(case_node); } accept2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON); @@ -19039,7 +18401,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } parser_warn_indentation_mismatch(parser, opening_newline_index, &case_keyword, false, false); - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CASE_TERM); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CASE_TERM, &case_keyword); if (PM_NODE_TYPE_P(node, PM_CASE_NODE)) { pm_case_node_end_keyword_loc_set((pm_case_node_t *) node, &parser->previous); @@ -19072,7 +18434,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_begin_node_t *begin_node = pm_begin_node_create(parser, &begin_keyword, begin_statements); parse_rescues(parser, opening_newline_index, &begin_keyword, begin_node, PM_RESCUES_BEGIN, (uint16_t) (depth + 1)); - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_BEGIN_TERM); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_BEGIN_TERM, &begin_keyword); begin_node->base.location.end = parser->previous.end; pm_begin_node_end_keyword_set(begin_node, &parser->previous); @@ -19080,7 +18442,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pop_block_exits(parser, previous_block_exits); pm_node_list_free(¤t_block_exits); - return (pm_node_t *) begin_node; + return UP(begin_node); } case PM_TOKEN_KEYWORD_BEGIN_UPCASE: { pm_node_list_t current_block_exits = { 0 }; @@ -19097,7 +18459,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t opening = parser->previous; pm_statements_node_t *statements = parse_statements(parser, PM_CONTEXT_PREEXE, (uint16_t) (depth + 1)); - expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_BEGIN_UPCASE_TERM); + expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_BEGIN_UPCASE_TERM, &opening); pm_context_t context = parser->current_context->context; if ((context != PM_CONTEXT_MAIN) && (context != PM_CONTEXT_PREEXE)) { pm_parser_err_token(parser, &keyword, PM_ERR_BEGIN_UPCASE_TOPLEVEL); @@ -19106,7 +18468,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b flush_block_exits(parser, previous_block_exits); pm_node_list_free(¤t_block_exits); - return (pm_node_t *) pm_pre_execution_node_create(parser, &keyword, &opening, statements, &parser->previous); + return UP(pm_pre_execution_node_create(parser, &keyword, &opening, statements, &parser->previous)); } case PM_TOKEN_KEYWORD_BREAK: case PM_TOKEN_KEYWORD_NEXT: @@ -19123,29 +18485,35 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_binding_power_t binding_power = pm_binding_powers[parser->current.type].left; if (binding_power == PM_BINDING_POWER_UNSET || binding_power >= PM_BINDING_POWER_RANGE) { + pm_token_t next = parser->current; parse_arguments(parser, &arguments, false, PM_TOKEN_EOF, (uint16_t) (depth + 1)); + + // Reject `foo && return bar`. + if (!accepts_command_call && arguments.arguments != NULL) { + PM_PARSER_ERR_TOKEN_FORMAT(parser, next, PM_ERR_EXPECT_EOL_AFTER_STATEMENT, pm_token_type_human(next.type)); + } } } switch (keyword.type) { case PM_TOKEN_KEYWORD_BREAK: { - pm_node_t *node = (pm_node_t *) pm_break_node_create(parser, &keyword, arguments.arguments); + pm_node_t *node = UP(pm_break_node_create(parser, &keyword, arguments.arguments)); if (!parser->partial_script) parse_block_exit(parser, node); return node; } case PM_TOKEN_KEYWORD_NEXT: { - pm_node_t *node = (pm_node_t *) pm_next_node_create(parser, &keyword, arguments.arguments); + pm_node_t *node = UP(pm_next_node_create(parser, &keyword, arguments.arguments)); if (!parser->partial_script) parse_block_exit(parser, node); return node; } case PM_TOKEN_KEYWORD_RETURN: { - pm_node_t *node = (pm_node_t *) pm_return_node_create(parser, &keyword, arguments.arguments); + pm_node_t *node = UP(pm_return_node_create(parser, &keyword, arguments.arguments)); parse_return(parser, node); return node; } default: assert(false && "unreachable"); - return (pm_node_t *) pm_missing_node_create(parser, parser->previous.start, parser->previous.end); + return UP(pm_missing_node_create(parser, parser->previous.start, parser->previous.end)); } } case PM_TOKEN_KEYWORD_SUPER: { @@ -19160,10 +18528,10 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b arguments.arguments == NULL && ((arguments.block == NULL) || PM_NODE_TYPE_P(arguments.block, PM_BLOCK_NODE)) ) { - return (pm_node_t *) pm_forwarding_super_node_create(parser, &keyword, &arguments); + return UP(pm_forwarding_super_node_create(parser, &keyword, &arguments)); } - return (pm_node_t *) pm_super_node_create(parser, &keyword, &arguments); + return UP(pm_super_node_create(parser, &keyword, &arguments)); } case PM_TOKEN_KEYWORD_YIELD: { parser_lex(parser); @@ -19178,11 +18546,12 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // yield node. if (arguments.block != NULL) { pm_parser_err_node(parser, arguments.block, PM_ERR_UNEXPECTED_BLOCK_ARGUMENT); + pm_node_unreference(parser, arguments.block); pm_node_destroy(parser, arguments.block); arguments.block = NULL; } - pm_node_t *node = (pm_node_t *) pm_yield_node_create(parser, &keyword, &arguments.opening_loc, arguments.arguments, &arguments.closing_loc); + pm_node_t *node = UP(pm_yield_node_create(parser, &keyword, &arguments.opening_loc, arguments.arguments, &arguments.closing_loc)); if (!parser->parsing_eval && !parser->partial_script) parse_yield(parser, node); return node; @@ -19209,18 +18578,18 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_node_t *statements = NULL; if (!match4(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE, PM_TOKEN_KEYWORD_ELSE, PM_TOKEN_KEYWORD_END)) { pm_accepts_block_stack_push(parser, true); - statements = (pm_node_t *) parse_statements(parser, PM_CONTEXT_SCLASS, (uint16_t) (depth + 1)); + statements = UP(parse_statements(parser, PM_CONTEXT_SCLASS, (uint16_t) (depth + 1))); pm_accepts_block_stack_pop(parser); } if (match2(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { assert(statements == NULL || PM_NODE_TYPE_P(statements, PM_STATEMENTS_NODE)); - statements = (pm_node_t *) parse_rescues_implicit_begin(parser, opening_newline_index, &class_keyword, class_keyword.start, (pm_statements_node_t *) statements, PM_RESCUES_SCLASS, (uint16_t) (depth + 1)); + statements = UP(parse_rescues_implicit_begin(parser, opening_newline_index, &class_keyword, class_keyword.start, (pm_statements_node_t *) statements, PM_RESCUES_SCLASS, (uint16_t) (depth + 1))); } else { parser_warn_indentation_mismatch(parser, opening_newline_index, &class_keyword, false, false); } - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CLASS_TERM); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CLASS_TERM, &class_keyword); pm_constant_id_list_t locals; pm_locals_order(parser, &parser->current_scope->locals, &locals, false); @@ -19231,7 +18600,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b flush_block_exits(parser, previous_block_exits); pm_node_list_free(¤t_block_exits); - return (pm_node_t *) pm_singleton_class_node_create(parser, &locals, &class_keyword, &operator, expression, statements, &parser->previous); + return UP(pm_singleton_class_node_create(parser, &locals, &class_keyword, &operator, expression, statements, &parser->previous)); } pm_node_t *constant_path = parse_expression(parser, PM_BINDING_POWER_INDEX, false, false, PM_ERR_CLASS_NAME, (uint16_t) (depth + 1)); @@ -19267,18 +18636,18 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (!match4(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE, PM_TOKEN_KEYWORD_ELSE, PM_TOKEN_KEYWORD_END)) { pm_accepts_block_stack_push(parser, true); - statements = (pm_node_t *) parse_statements(parser, PM_CONTEXT_CLASS, (uint16_t) (depth + 1)); + statements = UP(parse_statements(parser, PM_CONTEXT_CLASS, (uint16_t) (depth + 1))); pm_accepts_block_stack_pop(parser); } if (match2(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { assert(statements == NULL || PM_NODE_TYPE_P(statements, PM_STATEMENTS_NODE)); - statements = (pm_node_t *) parse_rescues_implicit_begin(parser, opening_newline_index, &class_keyword, class_keyword.start, (pm_statements_node_t *) statements, PM_RESCUES_CLASS, (uint16_t) (depth + 1)); + statements = UP(parse_rescues_implicit_begin(parser, opening_newline_index, &class_keyword, class_keyword.start, (pm_statements_node_t *) statements, PM_RESCUES_CLASS, (uint16_t) (depth + 1))); } else { parser_warn_indentation_mismatch(parser, opening_newline_index, &class_keyword, false, false); } - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CLASS_TERM); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CLASS_TERM, &class_keyword); if (context_def_p(parser)) { pm_parser_err_token(parser, &class_keyword, PM_ERR_CLASS_IN_METHOD); @@ -19297,7 +18666,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pop_block_exits(parser, previous_block_exits); pm_node_list_free(¤t_block_exits); - return (pm_node_t *) pm_class_node_create(parser, &locals, &class_keyword, constant_path, &name, &inheritance_operator, superclass, statements, &parser->previous); + return UP(pm_class_node_create(parser, &locals, &class_keyword, constant_path, &name, &inheritance_operator, superclass, statements, &parser->previous)); } case PM_TOKEN_KEYWORD_DEF: { pm_node_list_t current_block_exits = { 0 }; @@ -19374,37 +18743,37 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b switch (identifier.type) { case PM_TOKEN_CONSTANT: - receiver = (pm_node_t *) pm_constant_read_node_create(parser, &identifier); + receiver = UP(pm_constant_read_node_create(parser, &identifier)); break; case PM_TOKEN_INSTANCE_VARIABLE: - receiver = (pm_node_t *) pm_instance_variable_read_node_create(parser, &identifier); + receiver = UP(pm_instance_variable_read_node_create(parser, &identifier)); break; case PM_TOKEN_CLASS_VARIABLE: - receiver = (pm_node_t *) pm_class_variable_read_node_create(parser, &identifier); + receiver = UP(pm_class_variable_read_node_create(parser, &identifier)); break; case PM_TOKEN_GLOBAL_VARIABLE: - receiver = (pm_node_t *) pm_global_variable_read_node_create(parser, &identifier); + receiver = UP(pm_global_variable_read_node_create(parser, &identifier)); break; case PM_TOKEN_KEYWORD_NIL: - receiver = (pm_node_t *) pm_nil_node_create(parser, &identifier); + receiver = UP(pm_nil_node_create(parser, &identifier)); break; case PM_TOKEN_KEYWORD_SELF: - receiver = (pm_node_t *) pm_self_node_create(parser, &identifier); + receiver = UP(pm_self_node_create(parser, &identifier)); break; case PM_TOKEN_KEYWORD_TRUE: - receiver = (pm_node_t *) pm_true_node_create(parser, &identifier); + receiver = UP(pm_true_node_create(parser, &identifier)); break; case PM_TOKEN_KEYWORD_FALSE: - receiver = (pm_node_t *) pm_false_node_create(parser, &identifier); + receiver = UP(pm_false_node_create(parser, &identifier)); break; case PM_TOKEN_KEYWORD___FILE__: - receiver = (pm_node_t *) pm_source_file_node_create(parser, &identifier); + receiver = UP(pm_source_file_node_create(parser, &identifier)); break; case PM_TOKEN_KEYWORD___LINE__: - receiver = (pm_node_t *) pm_source_line_node_create(parser, &identifier); + receiver = UP(pm_source_line_node_create(parser, &identifier)); break; case PM_TOKEN_KEYWORD___ENCODING__: - receiver = (pm_node_t *) pm_source_encoding_node_create(parser, &identifier); + receiver = UP(pm_source_encoding_node_create(parser, &identifier)); break; default: break; @@ -19439,7 +18808,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b expect2(parser, PM_TOKEN_DOT, PM_TOKEN_COLON_COLON, PM_ERR_DEF_RECEIVER_TERM); operator = parser->previous; - receiver = (pm_node_t *) pm_parentheses_node_create(parser, &lparen, expression, &rparen, 0); + receiver = UP(pm_parentheses_node_create(parser, &lparen, expression, &rparen, 0)); // To push `PM_CONTEXT_DEF_PARAMS` again is for the same // reason as described the above. @@ -19458,6 +18827,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t rparen; pm_parameters_node_t *params; + bool accept_endless_def = true; switch (parser->current.type) { case PM_TOKEN_PARENTHESIS_LEFT: { parser_lex(parser); @@ -19493,6 +18863,10 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b rparen = not_provided(parser); params = parse_parameters(parser, PM_BINDING_POWER_DEFINED, false, false, true, true, false, (uint16_t) (depth + 1)); + // Reject `def * = 1` and similar. We have to specifically check + // for them because they create ambiguity with optional arguments. + accept_endless_def = false; + context_pop(parser); break; } @@ -19514,13 +18888,30 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (token_is_setter_name(&name)) { pm_parser_err_token(parser, &name, PM_ERR_DEF_ENDLESS_SETTER); } + if (!accept_endless_def) { + pm_parser_err_previous(parser, PM_ERR_DEF_ENDLESS_PARAMETERS); + } + if ( + parser->current_context->context == PM_CONTEXT_DEFAULT_PARAMS && + parser->current_context->prev->context == PM_CONTEXT_BLOCK_PARAMETERS + ) { + PM_PARSER_ERR_FORMAT(parser, def_keyword.start, parser->previous.end, PM_ERR_UNEXPECTED_PARAMETER_DEFAULT_VALUE, "endless method definition"); + } equal = parser->previous; context_push(parser, PM_CONTEXT_DEF); pm_do_loop_stack_push(parser, false); - statements = (pm_node_t *) pm_statements_node_create(parser); + statements = UP(pm_statements_node_create(parser)); + + bool allow_command_call; + if (parser->version >= PM_OPTIONS_VERSION_CRUBY_4_0) { + allow_command_call = accepts_command_call; + } else { + // Allow `def foo = puts "Hello"` but not `private def foo = puts "Hello"` + allow_command_call = binding_power == PM_BINDING_POWER_ASSIGNMENT || binding_power < PM_BINDING_POWER_COMPOSITION; + } - pm_node_t *statement = parse_expression(parser, PM_BINDING_POWER_DEFINED + 1, binding_power < PM_BINDING_POWER_COMPOSITION, false, PM_ERR_DEF_ENDLESS, (uint16_t) (depth + 1)); + pm_node_t *statement = parse_expression(parser, PM_BINDING_POWER_DEFINED + 1, allow_command_call, false, PM_ERR_DEF_ENDLESS, (uint16_t) (depth + 1)); if (accept1(parser, PM_TOKEN_KEYWORD_RESCUE_MODIFIER)) { context_push(parser, PM_CONTEXT_RESCUE_MODIFIER); @@ -19529,7 +18920,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_node_t *value = parse_expression(parser, pm_binding_powers[PM_TOKEN_KEYWORD_RESCUE_MODIFIER].right, false, false, PM_ERR_RESCUE_MODIFIER_VALUE, (uint16_t) (depth + 1)); context_pop(parser); - statement = (pm_node_t *) pm_rescue_modifier_node_create(parser, statement, &rescue_keyword, value); + statement = UP(pm_rescue_modifier_node_create(parser, statement, &rescue_keyword, value)); } pm_statements_node_body_append(parser, (pm_statements_node_t *) statements, statement, false); @@ -19552,13 +18943,13 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (!match4(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE, PM_TOKEN_KEYWORD_ELSE, PM_TOKEN_KEYWORD_END)) { pm_accepts_block_stack_push(parser, true); - statements = (pm_node_t *) parse_statements(parser, PM_CONTEXT_DEF, (uint16_t) (depth + 1)); + statements = UP(parse_statements(parser, PM_CONTEXT_DEF, (uint16_t) (depth + 1))); pm_accepts_block_stack_pop(parser); } if (match3(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE, PM_TOKEN_KEYWORD_ELSE)) { assert(statements == NULL || PM_NODE_TYPE_P(statements, PM_STATEMENTS_NODE)); - statements = (pm_node_t *) parse_rescues_implicit_begin(parser, opening_newline_index, &def_keyword, def_keyword.start, (pm_statements_node_t *) statements, PM_RESCUES_DEF, (uint16_t) (depth + 1)); + statements = UP(parse_rescues_implicit_begin(parser, opening_newline_index, &def_keyword, def_keyword.start, (pm_statements_node_t *) statements, PM_RESCUES_DEF, (uint16_t) (depth + 1))); } else { parser_warn_indentation_mismatch(parser, opening_newline_index, &def_keyword, false, false); } @@ -19566,7 +18957,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_accepts_block_stack_pop(parser); pm_do_loop_stack_pop(parser); - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_DEF_TERM); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_DEF_TERM, &def_keyword); end_keyword = parser->previous; } @@ -19575,7 +18966,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_parser_scope_pop(parser); /** - * If the final character is @. As is the case when defining + * If the final character is `@` as is the case when defining * methods to override the unary operators, we should ignore * the @ in the same way we do for symbols. */ @@ -19584,7 +18975,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b flush_block_exits(parser, previous_block_exits); pm_node_list_free(¤t_block_exits); - return (pm_node_t *) pm_def_node_create( + return UP(pm_def_node_create( parser, name_id, &name, @@ -19598,7 +18989,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b &rparen, &equal, &end_keyword - ); + )); } case PM_TOKEN_KEYWORD_DEFINED: { parser_lex(parser); @@ -19615,7 +19006,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b lparen = parser->previous; if (newline && accept1(parser, PM_TOKEN_PARENTHESIS_RIGHT)) { - expression = (pm_node_t *) pm_parentheses_node_create(parser, &lparen, NULL, &parser->previous, 0); + expression = UP(pm_parentheses_node_create(parser, &lparen, NULL, &parser->previous, 0)); lparen = not_provided(parser); rparen = not_provided(parser); } else { @@ -19636,13 +19027,13 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } context_pop(parser); - return (pm_node_t *) pm_defined_node_create( + return UP(pm_defined_node_create( parser, &lparen, expression, &rparen, - &PM_LOCATION_TOKEN_VALUE(&keyword) - ); + &keyword + )); } case PM_TOKEN_KEYWORD_END_UPCASE: { if (binding_power != PM_BINDING_POWER_STATEMENT) { @@ -19660,12 +19051,12 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t opening = parser->previous; pm_statements_node_t *statements = parse_statements(parser, PM_CONTEXT_POSTEXE, (uint16_t) (depth + 1)); - expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_END_UPCASE_TERM); - return (pm_node_t *) pm_post_execution_node_create(parser, &keyword, &opening, statements, &parser->previous); + expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_END_UPCASE_TERM, &opening); + return UP(pm_post_execution_node_create(parser, &keyword, &opening, statements, &parser->previous)); } case PM_TOKEN_KEYWORD_FALSE: parser_lex(parser); - return (pm_node_t *) pm_false_node_create(parser, &parser->previous); + return UP(pm_false_node_create(parser, &parser->previous)); case PM_TOKEN_KEYWORD_FOR: { size_t opening_newline_index = token_newline_index(parser); parser_lex(parser); @@ -19684,12 +19075,12 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b name = parse_expression(parser, PM_BINDING_POWER_INDEX, false, false, PM_ERR_EXPECT_EXPRESSION_AFTER_STAR, (uint16_t) (depth + 1)); } - index = (pm_node_t *) pm_splat_node_create(parser, &star_operator, name); + index = UP(pm_splat_node_create(parser, &star_operator, name)); } else if (token_begins_expression_p(parser->current.type)) { index = parse_expression(parser, PM_BINDING_POWER_INDEX, false, false, PM_ERR_EXPECT_EXPRESSION_AFTER_COMMA, (uint16_t) (depth + 1)); } else { pm_parser_err_token(parser, &for_keyword, PM_ERR_FOR_INDEX); - index = (pm_node_t *) pm_missing_node_create(parser, for_keyword.start, for_keyword.end); + index = UP(pm_missing_node_create(parser, for_keyword.start, for_keyword.end)); } // Now, if there are multiple index expressions, parse them out. @@ -19724,9 +19115,9 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } parser_warn_indentation_mismatch(parser, opening_newline_index, &for_keyword, false, false); - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_FOR_TERM); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_FOR_TERM, &for_keyword); - return (pm_node_t *) pm_for_node_create(parser, index, collection, statements, &for_keyword, &in_keyword, &do_keyword, &parser->previous); + return UP(pm_for_node_create(parser, index, collection, statements, &for_keyword, &in_keyword, &do_keyword, &parser->previous)); } case PM_TOKEN_KEYWORD_IF: if (parser_end_of_line_p(parser)) { @@ -19766,7 +19157,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } } - return (pm_node_t *) undef; + return UP(undef); } case PM_TOKEN_KEYWORD_NOT: { parser_lex(parser); @@ -19775,13 +19166,27 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_arguments_t arguments = { 0 }; pm_node_t *receiver = NULL; + // If we do not accept a command call, then we also do not accept a + // not without parentheses. In this case we need to reject this + // syntax. + if (!accepts_command_call && !match1(parser, PM_TOKEN_PARENTHESIS_LEFT)) { + if (match1(parser, PM_TOKEN_PARENTHESIS_LEFT_PARENTHESES)) { + pm_parser_err(parser, parser->previous.end, parser->previous.end + 1, PM_ERR_EXPECT_LPAREN_AFTER_NOT_LPAREN); + } else { + accept1(parser, PM_TOKEN_NEWLINE); + pm_parser_err_current(parser, PM_ERR_EXPECT_LPAREN_AFTER_NOT_OTHER); + } + + return UP(pm_missing_node_create(parser, parser->current.start, parser->current.end)); + } + accept1(parser, PM_TOKEN_NEWLINE); if (accept1(parser, PM_TOKEN_PARENTHESIS_LEFT)) { pm_token_t lparen = parser->previous; if (accept1(parser, PM_TOKEN_PARENTHESIS_RIGHT)) { - receiver = (pm_node_t *) pm_parentheses_node_create(parser, &lparen, NULL, &parser->previous, 0); + receiver = UP(pm_parentheses_node_create(parser, &lparen, NULL, &parser->previous, 0)); } else { arguments.opening_loc = PM_LOCATION_TOKEN_VALUE(&lparen); receiver = parse_expression(parser, PM_BINDING_POWER_COMPOSITION, true, false, PM_ERR_NOT_EXPRESSION, (uint16_t) (depth + 1)); @@ -19796,7 +19201,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b receiver = parse_expression(parser, PM_BINDING_POWER_NOT, true, false, PM_ERR_NOT_EXPRESSION, (uint16_t) (depth + 1)); } - return (pm_node_t *) pm_call_node_not_create(parser, receiver, &message, &arguments); + return UP(pm_call_node_not_create(parser, receiver, &message, &arguments)); } case PM_TOKEN_KEYWORD_UNLESS: { size_t opening_newline_index = token_newline_index(parser); @@ -19822,14 +19227,14 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_node_list_free(¤t_block_exits); pm_token_t missing = (pm_token_t) { .type = PM_TOKEN_MISSING, .start = parser->previous.end, .end = parser->previous.end }; - return (pm_node_t *) pm_module_node_create(parser, NULL, &module_keyword, constant_path, &missing, NULL, &missing); + return UP(pm_module_node_create(parser, NULL, &module_keyword, constant_path, &missing, NULL, &missing)); } while (accept1(parser, PM_TOKEN_COLON_COLON)) { pm_token_t double_colon = parser->previous; expect1(parser, PM_TOKEN_CONSTANT, PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT); - constant_path = (pm_node_t *) pm_constant_path_node_create(parser, constant_path, &double_colon, &parser->previous); + constant_path = UP(pm_constant_path_node_create(parser, constant_path, &double_colon, &parser->previous)); } // Here we retrieve the name of the module. If it wasn't a constant, @@ -19846,13 +19251,13 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (!match4(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE, PM_TOKEN_KEYWORD_ELSE, PM_TOKEN_KEYWORD_END)) { pm_accepts_block_stack_push(parser, true); - statements = (pm_node_t *) parse_statements(parser, PM_CONTEXT_MODULE, (uint16_t) (depth + 1)); + statements = UP(parse_statements(parser, PM_CONTEXT_MODULE, (uint16_t) (depth + 1))); pm_accepts_block_stack_pop(parser); } if (match3(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE, PM_TOKEN_KEYWORD_ELSE)) { assert(statements == NULL || PM_NODE_TYPE_P(statements, PM_STATEMENTS_NODE)); - statements = (pm_node_t *) parse_rescues_implicit_begin(parser, opening_newline_index, &module_keyword, module_keyword.start, (pm_statements_node_t *) statements, PM_RESCUES_MODULE, (uint16_t) (depth + 1)); + statements = UP(parse_rescues_implicit_begin(parser, opening_newline_index, &module_keyword, module_keyword.start, (pm_statements_node_t *) statements, PM_RESCUES_MODULE, (uint16_t) (depth + 1))); } else { parser_warn_indentation_mismatch(parser, opening_newline_index, &module_keyword, false, false); } @@ -19861,7 +19266,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_locals_order(parser, &parser->current_scope->locals, &locals, false); pm_parser_scope_pop(parser); - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_MODULE_TERM); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_MODULE_TERM, &module_keyword); if (context_def_p(parser)) { pm_parser_err_token(parser, &module_keyword, PM_ERR_MODULE_IN_METHOD); @@ -19870,15 +19275,15 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pop_block_exits(parser, previous_block_exits); pm_node_list_free(¤t_block_exits); - return (pm_node_t *) pm_module_node_create(parser, &locals, &module_keyword, constant_path, &name, statements, &parser->previous); + return UP(pm_module_node_create(parser, &locals, &module_keyword, constant_path, &name, statements, &parser->previous)); } case PM_TOKEN_KEYWORD_NIL: parser_lex(parser); - return (pm_node_t *) pm_nil_node_create(parser, &parser->previous); + return UP(pm_nil_node_create(parser, &parser->previous)); case PM_TOKEN_KEYWORD_REDO: { parser_lex(parser); - pm_node_t *node = (pm_node_t *) pm_redo_node_create(parser, &parser->previous); + pm_node_t *node = UP(pm_redo_node_create(parser, &parser->previous)); if (!parser->partial_script) parse_block_exit(parser, node); return node; @@ -19886,17 +19291,17 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b case PM_TOKEN_KEYWORD_RETRY: { parser_lex(parser); - pm_node_t *node = (pm_node_t *) pm_retry_node_create(parser, &parser->previous); + pm_node_t *node = UP(pm_retry_node_create(parser, &parser->previous)); parse_retry(parser, node); return node; } case PM_TOKEN_KEYWORD_SELF: parser_lex(parser); - return (pm_node_t *) pm_self_node_create(parser, &parser->previous); + return UP(pm_self_node_create(parser, &parser->previous)); case PM_TOKEN_KEYWORD_TRUE: parser_lex(parser); - return (pm_node_t *) pm_true_node_create(parser, &parser->previous); + return UP(pm_true_node_create(parser, &parser->previous)); case PM_TOKEN_KEYWORD_UNTIL: { size_t opening_newline_index = token_newline_index(parser); @@ -19927,9 +19332,9 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } parser_warn_indentation_mismatch(parser, opening_newline_index, &keyword, false, false); - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_UNTIL_TERM); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_UNTIL_TERM, &keyword); - return (pm_node_t *) pm_until_node_create(parser, &keyword, &do_keyword, &parser->previous, predicate, statements, 0); + return UP(pm_until_node_create(parser, &keyword, &do_keyword, &parser->previous, predicate, statements, 0)); } case PM_TOKEN_KEYWORD_WHILE: { size_t opening_newline_index = token_newline_index(parser); @@ -19961,26 +19366,60 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } parser_warn_indentation_mismatch(parser, opening_newline_index, &keyword, false, false); - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_WHILE_TERM); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_WHILE_TERM, &keyword); - return (pm_node_t *) pm_while_node_create(parser, &keyword, &do_keyword, &parser->previous, predicate, statements, 0); + return UP(pm_while_node_create(parser, &keyword, &do_keyword, &parser->previous, predicate, statements, 0)); } case PM_TOKEN_PERCENT_LOWER_I: { parser_lex(parser); pm_token_t opening = parser->previous; pm_array_node_t *array = pm_array_node_create(parser, &opening); + pm_node_t *current = NULL; while (!match2(parser, PM_TOKEN_STRING_END, PM_TOKEN_EOF)) { accept1(parser, PM_TOKEN_WORDS_SEP); if (match1(parser, PM_TOKEN_STRING_END)) break; - if (match1(parser, PM_TOKEN_STRING_CONTENT)) { + // Interpolation is not possible but nested heredocs can still lead to + // consecutive (disjoint) string tokens when the final newline is escaped. + while (match1(parser, PM_TOKEN_STRING_CONTENT)) { pm_token_t opening = not_provided(parser); pm_token_t closing = not_provided(parser); - pm_array_node_elements_append(array, (pm_node_t *) pm_symbol_node_create_current_string(parser, &opening, &parser->current, &closing)); + + // Record the string node, moving to interpolation if needed. + if (current == NULL) { + current = UP(pm_symbol_node_create_current_string(parser, &opening, &parser->current, &closing)); + parser_lex(parser); + } else if (PM_NODE_TYPE_P(current, PM_INTERPOLATED_SYMBOL_NODE)) { + pm_node_t *string = UP(pm_string_node_create_current_string(parser, &opening, &parser->current, &closing)); + parser_lex(parser); + pm_interpolated_symbol_node_append((pm_interpolated_symbol_node_t *) current, string); + } else if (PM_NODE_TYPE_P(current, PM_SYMBOL_NODE)) { + pm_symbol_node_t *cast = (pm_symbol_node_t *) current; + pm_token_t bounds = not_provided(parser); + + pm_token_t content = { .type = PM_TOKEN_STRING_CONTENT, .start = cast->value_loc.start, .end = cast->value_loc.end }; + pm_node_t *first_string = UP(pm_string_node_create_unescaped(parser, &bounds, &content, &bounds, &cast->unescaped)); + pm_node_t *second_string = UP(pm_string_node_create_current_string(parser, &opening, &parser->previous, &closing)); + parser_lex(parser); + + pm_interpolated_symbol_node_t *interpolated = pm_interpolated_symbol_node_create(parser, &opening, NULL, &closing); + pm_interpolated_symbol_node_append(interpolated, first_string); + pm_interpolated_symbol_node_append(interpolated, second_string); + + xfree(current); + current = UP(interpolated); + } else { + assert(false && "unreachable"); + } } - expect1(parser, PM_TOKEN_STRING_CONTENT, PM_ERR_LIST_I_LOWER_ELEMENT); + if (current) { + pm_array_node_elements_append(array, current); + current = NULL; + } else { + expect1(parser, PM_TOKEN_STRING_CONTENT, PM_ERR_LIST_I_LOWER_ELEMENT); + } } pm_token_t closing = parser->current; @@ -19992,7 +19431,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } pm_array_node_close_set(array, &closing); - return (pm_node_t *) array; + return UP(array); } case PM_TOKEN_PERCENT_UPPER_I: { parser_lex(parser); @@ -20027,13 +19466,13 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // If we hit content and the current node is NULL, then this is // the first string content we've seen. In that case we're going // to create a new string node and set that to the current. - current = (pm_node_t *) pm_symbol_node_create_current_string(parser, &opening, &parser->current, &closing); + current = UP(pm_symbol_node_create_current_string(parser, &opening, &parser->current, &closing)); parser_lex(parser); } else if (PM_NODE_TYPE_P(current, PM_INTERPOLATED_SYMBOL_NODE)) { // If we hit string content and the current node is an // interpolated string, then we need to append the string content // to the list of child nodes. - pm_node_t *string = (pm_node_t *) pm_string_node_create_current_string(parser, &opening, &parser->current, &closing); + pm_node_t *string = UP(pm_string_node_create_current_string(parser, &opening, &parser->current, &closing)); parser_lex(parser); pm_interpolated_symbol_node_append((pm_interpolated_symbol_node_t *) current, string); @@ -20045,8 +19484,8 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t bounds = not_provided(parser); pm_token_t content = { .type = PM_TOKEN_STRING_CONTENT, .start = cast->value_loc.start, .end = cast->value_loc.end }; - pm_node_t *first_string = (pm_node_t *) pm_string_node_create_unescaped(parser, &bounds, &content, &bounds, &cast->unescaped); - pm_node_t *second_string = (pm_node_t *) pm_string_node_create_current_string(parser, &opening, &parser->previous, &closing); + pm_node_t *first_string = UP(pm_string_node_create_unescaped(parser, &bounds, &content, &bounds, &cast->unescaped)); + pm_node_t *second_string = UP(pm_string_node_create_current_string(parser, &opening, &parser->previous, &closing)); parser_lex(parser); pm_interpolated_symbol_node_t *interpolated = pm_interpolated_symbol_node_create(parser, &opening, NULL, &closing); @@ -20054,7 +19493,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_interpolated_symbol_node_append(interpolated, second_string); xfree(current); - current = (pm_node_t *) interpolated; + current = UP(interpolated); } else { assert(false && "unreachable"); } @@ -20069,7 +19508,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // node to a new interpolated string. pm_token_t opening = not_provided(parser); pm_token_t closing = not_provided(parser); - current = (pm_node_t *) pm_interpolated_symbol_node_create(parser, &opening, NULL, &closing); + current = UP(pm_interpolated_symbol_node_create(parser, &opening, NULL, &closing)); } else if (PM_NODE_TYPE_P(current, PM_SYMBOL_NODE)) { // If we hit an embedded variable and the current node is a string // node, then we'll convert the current into an interpolated @@ -20078,11 +19517,11 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t closing = not_provided(parser); pm_interpolated_symbol_node_t *interpolated = pm_interpolated_symbol_node_create(parser, &opening, NULL, &closing); - current = (pm_node_t *) pm_symbol_node_to_string_node(parser, (pm_symbol_node_t *) current); + current = UP(pm_symbol_node_to_string_node(parser, (pm_symbol_node_t *) current)); pm_interpolated_symbol_node_append(interpolated, current); interpolated->base.location.start = current->location.start; start_location_set = true; - current = (pm_node_t *) interpolated; + current = UP(interpolated); } else { // If we hit an embedded variable and the current node is an // interpolated string, then we'll just add the embedded variable. @@ -20103,7 +19542,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // node to a new interpolated string. pm_token_t opening = not_provided(parser); pm_token_t closing = not_provided(parser); - current = (pm_node_t *) pm_interpolated_symbol_node_create(parser, &opening, NULL, &closing); + current = UP(pm_interpolated_symbol_node_create(parser, &opening, NULL, &closing)); } else if (PM_NODE_TYPE_P(current, PM_SYMBOL_NODE)) { // If we hit an embedded expression and the current node is a // string node, then we'll convert the current into an @@ -20113,11 +19552,11 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t closing = not_provided(parser); pm_interpolated_symbol_node_t *interpolated = pm_interpolated_symbol_node_create(parser, &opening, NULL, &closing); - current = (pm_node_t *) pm_symbol_node_to_string_node(parser, (pm_symbol_node_t *) current); + current = UP(pm_symbol_node_to_string_node(parser, (pm_symbol_node_t *) current)); pm_interpolated_symbol_node_append(interpolated, current); interpolated->base.location.start = current->location.start; start_location_set = true; - current = (pm_node_t *) interpolated; + current = UP(interpolated); } else if (PM_NODE_TYPE_P(current, PM_INTERPOLATED_SYMBOL_NODE)) { // If we hit an embedded expression and the current node is an // interpolated string, then we'll just continue on. @@ -20153,29 +19592,48 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } pm_array_node_close_set(array, &closing); - return (pm_node_t *) array; + return UP(array); } case PM_TOKEN_PERCENT_LOWER_W: { parser_lex(parser); pm_token_t opening = parser->previous; pm_array_node_t *array = pm_array_node_create(parser, &opening); - - // skip all leading whitespaces - accept1(parser, PM_TOKEN_WORDS_SEP); + pm_node_t *current = NULL; while (!match2(parser, PM_TOKEN_STRING_END, PM_TOKEN_EOF)) { accept1(parser, PM_TOKEN_WORDS_SEP); if (match1(parser, PM_TOKEN_STRING_END)) break; - if (match1(parser, PM_TOKEN_STRING_CONTENT)) { + // Interpolation is not possible but nested heredocs can still lead to + // consecutive (disjoint) string tokens when the final newline is escaped. + while (match1(parser, PM_TOKEN_STRING_CONTENT)) { pm_token_t opening = not_provided(parser); pm_token_t closing = not_provided(parser); - pm_node_t *string = (pm_node_t *) pm_string_node_create_current_string(parser, &opening, &parser->current, &closing); - pm_array_node_elements_append(array, string); + pm_node_t *string = UP(pm_string_node_create_current_string(parser, &opening, &parser->current, &closing)); + + // Record the string node, moving to interpolation if needed. + if (current == NULL) { + current = string; + } else if (PM_NODE_TYPE_P(current, PM_INTERPOLATED_STRING_NODE)) { + pm_interpolated_string_node_append((pm_interpolated_string_node_t *) current, string); + } else if (PM_NODE_TYPE_P(current, PM_STRING_NODE)) { + pm_interpolated_string_node_t *interpolated = pm_interpolated_string_node_create(parser, &opening, NULL, &closing); + pm_interpolated_string_node_append(interpolated, current); + pm_interpolated_string_node_append(interpolated, string); + current = UP(interpolated); + } else { + assert(false && "unreachable"); + } + parser_lex(parser); } - expect1(parser, PM_TOKEN_STRING_CONTENT, PM_ERR_LIST_W_LOWER_ELEMENT); + if (current) { + pm_array_node_elements_append(array, current); + current = NULL; + } else { + expect1(parser, PM_TOKEN_STRING_CONTENT, PM_ERR_LIST_W_LOWER_ELEMENT); + } } pm_token_t closing = parser->current; @@ -20187,7 +19645,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } pm_array_node_close_set(array, &closing); - return (pm_node_t *) array; + return UP(array); } case PM_TOKEN_PERCENT_UPPER_W: { parser_lex(parser); @@ -20223,7 +19681,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t opening = not_provided(parser); pm_token_t closing = not_provided(parser); - pm_node_t *string = (pm_node_t *) pm_string_node_create_current_string(parser, &opening, &parser->current, &closing); + pm_node_t *string = UP(pm_string_node_create_current_string(parser, &opening, &parser->current, &closing)); pm_node_flag_set(string, parse_unescaped_encoding(parser)); parser_lex(parser); @@ -20246,7 +19704,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_interpolated_string_node_t *interpolated = pm_interpolated_string_node_create(parser, &opening, NULL, &closing); pm_interpolated_string_node_append(interpolated, current); pm_interpolated_string_node_append(interpolated, string); - current = (pm_node_t *) interpolated; + current = UP(interpolated); } else { assert(false && "unreachable"); } @@ -20261,7 +19719,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // interpolated string. pm_token_t opening = not_provided(parser); pm_token_t closing = not_provided(parser); - current = (pm_node_t *) pm_interpolated_string_node_create(parser, &opening, NULL, &closing); + current = UP(pm_interpolated_string_node_create(parser, &opening, NULL, &closing)); } else if (PM_NODE_TYPE_P(current, PM_STRING_NODE)) { // If we hit an embedded variable and the current // node is a string node, then we'll convert the @@ -20271,7 +19729,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t closing = not_provided(parser); pm_interpolated_string_node_t *interpolated = pm_interpolated_string_node_create(parser, &opening, NULL, &closing); pm_interpolated_string_node_append(interpolated, current); - current = (pm_node_t *) interpolated; + current = UP(interpolated); } else { // If we hit an embedded variable and the current // node is an interpolated string, then we'll just @@ -20290,7 +19748,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // interpolated string. pm_token_t opening = not_provided(parser); pm_token_t closing = not_provided(parser); - current = (pm_node_t *) pm_interpolated_string_node_create(parser, &opening, NULL, &closing); + current = UP(pm_interpolated_string_node_create(parser, &opening, NULL, &closing)); } else if (PM_NODE_TYPE_P(current, PM_STRING_NODE)) { // If we hit an embedded expression and the current // node is a string node, then we'll convert the @@ -20300,7 +19758,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t closing = not_provided(parser); pm_interpolated_string_node_t *interpolated = pm_interpolated_string_node_create(parser, &opening, NULL, &closing); pm_interpolated_string_node_append(interpolated, current); - current = (pm_node_t *) interpolated; + current = UP(interpolated); } else if (PM_NODE_TYPE_P(current, PM_INTERPOLATED_STRING_NODE)) { // If we hit an embedded expression and the current // node is an interpolated string, then we'll just @@ -20334,7 +19792,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } pm_array_node_close_set(array, &closing); - return (pm_node_t *) array; + return UP(array); } case PM_TOKEN_REGEXP_BEGIN: { pm_token_t opening = parser->current; @@ -20352,7 +19810,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b parser_lex(parser); - pm_node_t *node = (pm_node_t *) pm_regular_expression_node_create(parser, &opening, &content, &parser->previous); + pm_node_t *node = UP(pm_regular_expression_node_create(parser, &opening, &content, &parser->previous)); pm_node_flag_set(node, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING); return node; @@ -20384,8 +19842,8 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b parse_regular_expression_errors(parser, node); } - pm_node_flag_set((pm_node_t *) node, parse_and_validate_regular_expression_encoding(parser, &unescaped, ascii_only, node->base.flags)); - return (pm_node_t *) node; + pm_node_flag_set(UP(node), parse_and_validate_regular_expression_encoding(parser, &unescaped, ascii_only, FL(node))); + return UP(node); } // If we get here, then we have interpolation so we'll need to create @@ -20394,7 +19852,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t opening = not_provided(parser); pm_token_t closing = not_provided(parser); - pm_node_t *part = (pm_node_t *) pm_string_node_create_unescaped(parser, &opening, &parser->previous, &closing, &unescaped); + pm_node_t *part = UP(pm_string_node_create_unescaped(parser, &opening, &parser->previous, &closing, &unescaped)); if (parser->encoding == PM_ENCODING_US_ASCII_ENTRY) { // This is extremely strange, but the first string part of a @@ -20429,7 +19887,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } pm_interpolated_regular_expression_node_closing_set(parser, interpolated, &closing); - return (pm_node_t *) interpolated; + return UP(interpolated); } case PM_TOKEN_BACKTICK: case PM_TOKEN_PERCENT_LOWER_X: { @@ -20451,7 +19909,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b }; parser_lex(parser); - return (pm_node_t *) pm_xstring_node_create(parser, &opening, &content, &parser->previous); + return UP(pm_xstring_node_create(parser, &opening, &content, &parser->previous)); } pm_interpolated_x_string_node_t *node; @@ -20466,7 +19924,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b parser_lex(parser); if (match1(parser, PM_TOKEN_STRING_END)) { - pm_node_t *node = (pm_node_t *) pm_xstring_node_create_unescaped(parser, &opening, &content, &parser->current, &unescaped); + pm_node_t *node = UP(pm_xstring_node_create_unescaped(parser, &opening, &content, &parser->current, &unescaped)); pm_node_flag_set(node, parse_unescaped_encoding(parser)); parser_lex(parser); return node; @@ -20479,7 +19937,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_token_t opening = not_provided(parser); pm_token_t closing = not_provided(parser); - pm_node_t *part = (pm_node_t *) pm_string_node_create_unescaped(parser, &opening, &parser->previous, &closing, &unescaped); + pm_node_t *part = UP(pm_string_node_create_unescaped(parser, &opening, &parser->previous, &closing, &unescaped)); pm_node_flag_set(part, parse_unescaped_encoding(parser)); pm_interpolated_xstring_node_append(node, part); @@ -20506,7 +19964,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b } pm_interpolated_xstring_node_closing_set(node, &closing); - return (pm_node_t *) node; + return UP(node); } case PM_TOKEN_USTAR: { parser_lex(parser); @@ -20516,7 +19974,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // still lex past it though and create a missing node place. if (binding_power != PM_BINDING_POWER_STATEMENT) { pm_parser_err_prefix(parser, diag_id); - return (pm_node_t *) pm_missing_node_create(parser, parser->previous.start, parser->previous.end); + return UP(pm_missing_node_create(parser, parser->previous.start, parser->previous.end)); } pm_token_t operator = parser->previous; @@ -20526,7 +19984,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b name = parse_expression(parser, PM_BINDING_POWER_INDEX, false, false, PM_ERR_EXPECT_EXPRESSION_AFTER_STAR, (uint16_t) (depth + 1)); } - pm_node_t *splat = (pm_node_t *) pm_splat_node_create(parser, &operator, name); + pm_node_t *splat = UP(pm_splat_node_create(parser, &operator, name)); if (match1(parser, PM_TOKEN_COMMA)) { return parse_targets_validate(parser, splat, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); @@ -20546,7 +20004,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_call_node_t *node = pm_call_node_unary_create(parser, &operator, receiver, "!"); pm_conditional_predicate(parser, receiver, PM_CONDITIONAL_PREDICATE_TYPE_NOT); - return (pm_node_t *) node; + return UP(node); } case PM_TOKEN_TILDE: { if (binding_power > PM_BINDING_POWER_UNARY) { @@ -20558,7 +20016,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_node_t *receiver = parse_expression(parser, pm_binding_powers[parser->previous.type].right, false, false, PM_ERR_UNARY_RECEIVER, (uint16_t) (depth + 1)); pm_call_node_t *node = pm_call_node_unary_create(parser, &operator, receiver, "~"); - return (pm_node_t *) node; + return UP(node); } case PM_TOKEN_UMINUS: { if (binding_power > PM_BINDING_POWER_UNARY) { @@ -20570,7 +20028,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_node_t *receiver = parse_expression(parser, pm_binding_powers[parser->previous.type].right, false, false, PM_ERR_UNARY_RECEIVER, (uint16_t) (depth + 1)); pm_call_node_t *node = pm_call_node_unary_create(parser, &operator, receiver, "-@"); - return (pm_node_t *) node; + return UP(node); } case PM_TOKEN_UMINUS_NUM: { parser_lex(parser); @@ -20581,8 +20039,8 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b if (accept1(parser, PM_TOKEN_STAR_STAR)) { pm_token_t exponent_operator = parser->previous; pm_node_t *exponent = parse_expression(parser, pm_binding_powers[exponent_operator.type].right, false, false, PM_ERR_EXPECT_ARGUMENT, (uint16_t) (depth + 1)); - node = (pm_node_t *) pm_call_node_binary_create(parser, node, &exponent_operator, exponent, 0); - node = (pm_node_t *) pm_call_node_unary_create(parser, &operator, node, "-@"); + node = UP(pm_call_node_binary_create(parser, node, &exponent_operator, exponent, 0)); + node = UP(pm_call_node_unary_create(parser, &operator, node, "-@")); } else { switch (PM_NODE_TYPE(node)) { case PM_INTEGER_NODE: @@ -20592,7 +20050,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b parse_negative_numeric(node); break; default: - node = (pm_node_t *) pm_call_node_unary_create(parser, &operator, node, "-@"); + node = UP(pm_call_node_unary_create(parser, &operator, node, "-@")); break; } } @@ -20650,39 +20108,39 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b opening = parser->previous; if (!match1(parser, PM_TOKEN_BRACE_RIGHT)) { - body = (pm_node_t *) parse_statements(parser, PM_CONTEXT_LAMBDA_BRACES, (uint16_t) (depth + 1)); + body = UP(parse_statements(parser, PM_CONTEXT_LAMBDA_BRACES, (uint16_t) (depth + 1))); } parser_warn_indentation_mismatch(parser, opening_newline_index, &operator, false, false); - expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_LAMBDA_TERM_BRACE); + expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_LAMBDA_TERM_BRACE, &opening); } else { expect1(parser, PM_TOKEN_KEYWORD_DO, PM_ERR_LAMBDA_OPEN); opening = parser->previous; if (!match3(parser, PM_TOKEN_KEYWORD_END, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { pm_accepts_block_stack_push(parser, true); - body = (pm_node_t *) parse_statements(parser, PM_CONTEXT_LAMBDA_DO_END, (uint16_t) (depth + 1)); + body = UP(parse_statements(parser, PM_CONTEXT_LAMBDA_DO_END, (uint16_t) (depth + 1))); pm_accepts_block_stack_pop(parser); } if (match2(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE)) { assert(body == NULL || PM_NODE_TYPE_P(body, PM_STATEMENTS_NODE)); - body = (pm_node_t *) parse_rescues_implicit_begin(parser, opening_newline_index, &operator, opening.start, (pm_statements_node_t *) body, PM_RESCUES_LAMBDA, (uint16_t) (depth + 1)); + body = UP(parse_rescues_implicit_begin(parser, opening_newline_index, &operator, opening.start, (pm_statements_node_t *) body, PM_RESCUES_LAMBDA, (uint16_t) (depth + 1))); } else { parser_warn_indentation_mismatch(parser, opening_newline_index, &operator, false, false); } - expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_LAMBDA_TERM_END); + expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_LAMBDA_TERM_END, &operator); } pm_constant_id_list_t locals; pm_locals_order(parser, &parser->current_scope->locals, &locals, pm_parser_scope_toplevel_p(parser)); - pm_node_t *parameters = parse_blocklike_parameters(parser, (pm_node_t *) block_parameters, &operator, &parser->previous); + pm_node_t *parameters = parse_blocklike_parameters(parser, UP(block_parameters), &operator, &parser->previous); pm_parser_scope_pop(parser); pm_accepts_block_stack_pop(parser); - return (pm_node_t *) pm_lambda_node_create(parser, &locals, &operator, &opening, &parser->previous, parameters, body); + return UP(pm_lambda_node_create(parser, &locals, &operator, &opening, &parser->previous, parameters, body)); } case PM_TOKEN_UPLUS: { if (binding_power > PM_BINDING_POWER_UNARY) { @@ -20694,7 +20152,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_node_t *receiver = parse_expression(parser, pm_binding_powers[parser->previous.type].right, false, false, PM_ERR_UNARY_RECEIVER, (uint16_t) (depth + 1)); pm_call_node_t *node = pm_call_node_unary_create(parser, &operator, receiver, "+@"); - return (pm_node_t *) node; + return UP(node); } case PM_TOKEN_STRING_BEGIN: return parse_strings(parser, NULL, accepts_label, (uint16_t) (depth + 1)); @@ -20730,7 +20188,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b pm_parser_err_prefix(parser, diag_id); } - return (pm_node_t *) pm_missing_node_create(parser, parser->previous.start, parser->previous.end); + return UP(pm_missing_node_create(parser, parser->previous.start, parser->previous.end)); } } } @@ -20759,7 +20217,7 @@ parse_assignment_value(pm_parser_t *parser, pm_binding_power_t previous_binding_ pm_node_t *right = parse_expression(parser, pm_binding_powers[PM_TOKEN_KEYWORD_RESCUE_MODIFIER].right, false, false, PM_ERR_RESCUE_MODIFIER_VALUE, (uint16_t) (depth + 1)); context_pop(parser); - return (pm_node_t *) pm_rescue_modifier_node_create(parser, value, &rescue, right); + return UP(pm_rescue_modifier_node_create(parser, value, &rescue, right)); } return value; @@ -20818,7 +20276,7 @@ parse_assignment_values(pm_parser_t *parser, pm_binding_power_t previous_binding bool permitted = true; if (previous_binding_power != PM_BINDING_POWER_STATEMENT && match1(parser, PM_TOKEN_USTAR)) permitted = false; - pm_node_t *value = parse_starred_expression(parser, binding_power, previous_binding_power == PM_BINDING_POWER_ASSIGNMENT ? accepts_command_call : previous_binding_power < PM_BINDING_POWER_MATCH, diag_id, (uint16_t) (depth + 1)); + pm_node_t *value = parse_starred_expression(parser, binding_power, previous_binding_power == PM_BINDING_POWER_ASSIGNMENT ? accepts_command_call : previous_binding_power < PM_BINDING_POWER_MODIFIER, diag_id, (uint16_t) (depth + 1)); if (!permitted) pm_parser_err_node(parser, value, PM_ERR_UNEXPECTED_MULTI_WRITE); parse_assignment_value_local(parser, value); @@ -20831,7 +20289,7 @@ parse_assignment_values(pm_parser_t *parser, pm_binding_power_t previous_binding pm_array_node_t *array = pm_array_node_create(parser, &opening); pm_array_node_elements_append(array, value); - value = (pm_node_t *) array; + value = UP(array); while (accept1(parser, PM_TOKEN_COMMA)) { pm_node_t *element = parse_starred_expression(parser, binding_power, false, PM_ERR_ARRAY_ELEMENT, (uint16_t) (depth + 1)); @@ -20865,7 +20323,7 @@ parse_assignment_values(pm_parser_t *parser, pm_binding_power_t previous_binding pm_node_t *right = parse_expression(parser, pm_binding_powers[PM_TOKEN_KEYWORD_RESCUE_MODIFIER].right, accepts_command_call_inner, false, PM_ERR_RESCUE_MODIFIER_VALUE, (uint16_t) (depth + 1)); context_pop(parser); - return (pm_node_t *) pm_rescue_modifier_node_create(parser, value, &rescue, right); + return UP(pm_rescue_modifier_node_create(parser, value, &rescue, right)); } return value; @@ -20882,13 +20340,15 @@ static void parse_call_operator_write(pm_parser_t *parser, pm_call_node_t *call_node, const pm_token_t *operator) { if (call_node->arguments != NULL) { pm_parser_err_token(parser, operator, PM_ERR_OPERATOR_WRITE_ARGUMENTS); - pm_node_destroy(parser, (pm_node_t *) call_node->arguments); + pm_node_unreference(parser, UP(call_node->arguments)); + pm_node_destroy(parser, UP(call_node->arguments)); call_node->arguments = NULL; } if (call_node->block != NULL) { pm_parser_err_token(parser, operator, PM_ERR_OPERATOR_WRITE_BLOCK); - pm_node_destroy(parser, (pm_node_t *) call_node->block); + pm_node_unreference(parser, UP(call_node->block)); + pm_node_destroy(parser, UP(call_node->block)); call_node->block = NULL; } } @@ -20959,7 +20419,7 @@ pm_named_capture_escape_octal(pm_buffer_t *unescaped, const uint8_t *cursor, con } static inline const uint8_t * -pm_named_capture_escape_unicode(pm_parser_t *parser, pm_buffer_t *unescaped, const uint8_t *cursor, const uint8_t *end) { +pm_named_capture_escape_unicode(pm_parser_t *parser, pm_buffer_t *unescaped, const uint8_t *cursor, const uint8_t *end, const pm_location_t *error_location) { const uint8_t *start = cursor - 1; cursor++; @@ -20970,7 +20430,7 @@ pm_named_capture_escape_unicode(pm_parser_t *parser, pm_buffer_t *unescaped, con if (*cursor != '{') { size_t length = pm_strspn_hexadecimal_digit(cursor, MIN(end - cursor, 4)); - uint32_t value = escape_unicode(parser, cursor, length); + uint32_t value = escape_unicode(parser, cursor, length, error_location); if (!pm_buffer_append_unicode_codepoint(unescaped, value)) { pm_buffer_append_string(unescaped, (const char *) start, (size_t) ((cursor + length) - start)); @@ -20990,7 +20450,10 @@ pm_named_capture_escape_unicode(pm_parser_t *parser, pm_buffer_t *unescaped, con } size_t length = pm_strspn_hexadecimal_digit(cursor, end - cursor); - uint32_t value = escape_unicode(parser, cursor, length); + if (length == 0) { + break; + } + uint32_t value = escape_unicode(parser, cursor, length, error_location); (void) pm_buffer_append_unicode_codepoint(unescaped, value); cursor += length; @@ -21000,7 +20463,7 @@ pm_named_capture_escape_unicode(pm_parser_t *parser, pm_buffer_t *unescaped, con } static void -pm_named_capture_escape(pm_parser_t *parser, pm_buffer_t *unescaped, const uint8_t *source, const size_t length, const uint8_t *cursor) { +pm_named_capture_escape(pm_parser_t *parser, pm_buffer_t *unescaped, const uint8_t *source, const size_t length, const uint8_t *cursor, const pm_location_t *error_location) { const uint8_t *end = source + length; pm_buffer_append_string(unescaped, (const char *) source, (size_t) (cursor - source)); @@ -21018,7 +20481,7 @@ pm_named_capture_escape(pm_parser_t *parser, pm_buffer_t *unescaped, const uint8 cursor = pm_named_capture_escape_octal(unescaped, cursor, end); break; case 'u': - cursor = pm_named_capture_escape_unicode(parser, unescaped, cursor, end); + cursor = pm_named_capture_escape_unicode(parser, unescaped, cursor, end, error_location); break; default: pm_buffer_append_byte(unescaped, '\\'); @@ -21061,7 +20524,7 @@ parse_regular_expression_named_capture(const pm_string_t *capture, void *data) { // unescaped, which is what we need. const uint8_t *cursor = pm_memchr(source, '\\', length, parser->encoding_changed, parser->encoding); if (PRISM_UNLIKELY(cursor != NULL)) { - pm_named_capture_escape(parser, &unescaped, source, length, cursor); + pm_named_capture_escape(parser, &unescaped, source, length, cursor, callback_data->shared ? NULL : &call->receiver->location); source = (const uint8_t *) pm_buffer_value(&unescaped); length = pm_buffer_length(&unescaped); } @@ -21120,7 +20583,7 @@ parse_regular_expression_named_capture(const pm_string_t *capture, void *data) { // Next, create the local variable target and add it to the list of // targets for the match. - pm_node_t *target = (pm_node_t *) pm_local_variable_target_node_create(parser, &location, name, depth == -1 ? 0 : (uint32_t) depth); + pm_node_t *target = UP(pm_local_variable_target_node_create(parser, &location, name, depth == -1 ? 0 : (uint32_t) depth)); pm_node_list_append(&callback_data->match->targets, target); } @@ -21151,9 +20614,9 @@ parse_regular_expression_named_captures(pm_parser_t *parser, const pm_string_t * pm_constant_id_list_free(&callback_data.names); if (callback_data.match != NULL) { - return (pm_node_t *) callback_data.match; + return UP(callback_data.match); } else { - return (pm_node_t *) call; + return UP(call); } } @@ -21176,6 +20639,13 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t } PRISM_FALLTHROUGH case PM_CASE_WRITABLE: { + // When we have `it = value`, we need to add `it` as a local + // variable before parsing the value, in case the value + // references the variable. + if (PM_NODE_TYPE_P(node, PM_IT_LOCAL_VARIABLE_READ_NODE)) { + pm_parser_local_add_location(parser, node->location.start, node->location.end, 0); + } + parser_lex(parser); pm_node_t *value = parse_assignment_values(parser, previous_binding_power, PM_NODE_TYPE_P(node, PM_MULTI_TARGET_NODE) ? PM_BINDING_POWER_MULTI_ASSIGNMENT + 1 : binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_EQUAL, (uint16_t) (depth + 1)); @@ -21191,7 +20661,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_values(parser, previous_binding_power, PM_BINDING_POWER_MULTI_ASSIGNMENT + 1, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_EQUAL, (uint16_t) (depth + 1)); - return parse_write(parser, (pm_node_t *) multi_target, &token, value); + return parse_write(parser, UP(multi_target), &token, value); } case PM_SOURCE_ENCODING_NODE: case PM_FALSE_NODE: @@ -21225,7 +20695,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_global_variable_and_write_node_create(parser, node, &token, value); + pm_node_t *result = UP(pm_global_variable_and_write_node_create(parser, node, &token, value)); pm_node_destroy(parser, node); return result; @@ -21234,7 +20704,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_class_variable_and_write_node_create(parser, (pm_class_variable_read_node_t *) node, &token, value); + pm_node_t *result = UP(pm_class_variable_and_write_node_create(parser, (pm_class_variable_read_node_t *) node, &token, value)); pm_node_destroy(parser, node); return result; @@ -21243,7 +20713,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ, (uint16_t) (depth + 1)); - pm_node_t *write = (pm_node_t *) pm_constant_path_and_write_node_create(parser, (pm_constant_path_node_t *) node, &token, value); + pm_node_t *write = UP(pm_constant_path_and_write_node_create(parser, (pm_constant_path_node_t *) node, &token, value)); return parse_shareable_constant_write(parser, write); } @@ -21251,7 +20721,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ, (uint16_t) (depth + 1)); - pm_node_t *write = (pm_node_t *) pm_constant_and_write_node_create(parser, (pm_constant_read_node_t *) node, &token, value); + pm_node_t *write = UP(pm_constant_and_write_node_create(parser, (pm_constant_read_node_t *) node, &token, value)); pm_node_destroy(parser, node); return parse_shareable_constant_write(parser, write); @@ -21260,7 +20730,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_instance_variable_and_write_node_create(parser, (pm_instance_variable_read_node_t *) node, &token, value); + pm_node_t *result = UP(pm_instance_variable_and_write_node_create(parser, (pm_instance_variable_read_node_t *) node, &token, value)); pm_node_destroy(parser, node); return result; @@ -21270,23 +20740,23 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_local_variable_and_write_node_create(parser, node, &token, value, name, 0); + pm_node_t *result = UP(pm_local_variable_and_write_node_create(parser, node, &token, value, name, 0)); - parse_target_implicit_parameter(parser, node); + pm_node_unreference(parser, node); pm_node_destroy(parser, node); return result; } case PM_LOCAL_VARIABLE_READ_NODE: { if (pm_token_is_numbered_parameter(node->location.start, node->location.end)) { PM_PARSER_ERR_FORMAT(parser, node->location.start, node->location.end, PM_ERR_PARAMETER_NUMBERED_RESERVED, node->location.start); - parse_target_implicit_parameter(parser, node); + pm_node_unreference(parser, node); } pm_local_variable_read_node_t *cast = (pm_local_variable_read_node_t *) node; parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_local_variable_and_write_node_create(parser, node, &token, value, cast->name, cast->depth); + pm_node_t *result = UP(pm_local_variable_and_write_node_create(parser, node, &token, value, cast->name, cast->depth)); pm_node_destroy(parser, node); return result; @@ -21305,9 +20775,9 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_local_variable_and_write_node_create(parser, (pm_node_t *) cast, &token, value, constant_id, 0); + pm_node_t *result = UP(pm_local_variable_and_write_node_create(parser, UP(cast), &token, value, constant_id, 0)); - pm_node_destroy(parser, (pm_node_t *) cast); + pm_node_destroy(parser, UP(cast)); return result; } @@ -21320,7 +20790,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t // an aset expression. if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_INDEX)) { pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_index_and_write_node_create(parser, cast, &token, value); + return UP(pm_index_and_write_node_create(parser, cast, &token, value)); } // If this node cannot be writable, then we have an error. @@ -21332,7 +20802,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parse_call_operator_write(parser, cast, &token); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_AMPAMPEQ, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_call_and_write_node_create(parser, cast, &token, value); + return UP(pm_call_and_write_node_create(parser, cast, &token, value)); } case PM_MULTI_WRITE_NODE: { parser_lex(parser); @@ -21359,7 +20829,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_global_variable_or_write_node_create(parser, node, &token, value); + pm_node_t *result = UP(pm_global_variable_or_write_node_create(parser, node, &token, value)); pm_node_destroy(parser, node); return result; @@ -21368,7 +20838,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_class_variable_or_write_node_create(parser, (pm_class_variable_read_node_t *) node, &token, value); + pm_node_t *result = UP(pm_class_variable_or_write_node_create(parser, (pm_class_variable_read_node_t *) node, &token, value)); pm_node_destroy(parser, node); return result; @@ -21377,7 +20847,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ, (uint16_t) (depth + 1)); - pm_node_t *write = (pm_node_t *) pm_constant_path_or_write_node_create(parser, (pm_constant_path_node_t *) node, &token, value); + pm_node_t *write = UP(pm_constant_path_or_write_node_create(parser, (pm_constant_path_node_t *) node, &token, value)); return parse_shareable_constant_write(parser, write); } @@ -21385,7 +20855,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ, (uint16_t) (depth + 1)); - pm_node_t *write = (pm_node_t *) pm_constant_or_write_node_create(parser, (pm_constant_read_node_t *) node, &token, value); + pm_node_t *write = UP(pm_constant_or_write_node_create(parser, (pm_constant_read_node_t *) node, &token, value)); pm_node_destroy(parser, node); return parse_shareable_constant_write(parser, write); @@ -21394,7 +20864,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_instance_variable_or_write_node_create(parser, (pm_instance_variable_read_node_t *) node, &token, value); + pm_node_t *result = UP(pm_instance_variable_or_write_node_create(parser, (pm_instance_variable_read_node_t *) node, &token, value)); pm_node_destroy(parser, node); return result; @@ -21404,23 +20874,23 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_local_variable_or_write_node_create(parser, node, &token, value, name, 0); + pm_node_t *result = UP(pm_local_variable_or_write_node_create(parser, node, &token, value, name, 0)); - parse_target_implicit_parameter(parser, node); + pm_node_unreference(parser, node); pm_node_destroy(parser, node); return result; } case PM_LOCAL_VARIABLE_READ_NODE: { if (pm_token_is_numbered_parameter(node->location.start, node->location.end)) { PM_PARSER_ERR_FORMAT(parser, node->location.start, node->location.end, PM_ERR_PARAMETER_NUMBERED_RESERVED, node->location.start); - parse_target_implicit_parameter(parser, node); + pm_node_unreference(parser, node); } pm_local_variable_read_node_t *cast = (pm_local_variable_read_node_t *) node; parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_local_variable_or_write_node_create(parser, node, &token, value, cast->name, cast->depth); + pm_node_t *result = UP(pm_local_variable_or_write_node_create(parser, node, &token, value, cast->name, cast->depth)); pm_node_destroy(parser, node); return result; @@ -21439,9 +20909,9 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_local_variable_or_write_node_create(parser, (pm_node_t *) cast, &token, value, constant_id, 0); + pm_node_t *result = UP(pm_local_variable_or_write_node_create(parser, UP(cast), &token, value, constant_id, 0)); - pm_node_destroy(parser, (pm_node_t *) cast); + pm_node_destroy(parser, UP(cast)); return result; } @@ -21454,7 +20924,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t // an aset expression. if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_INDEX)) { pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_index_or_write_node_create(parser, cast, &token, value); + return UP(pm_index_or_write_node_create(parser, cast, &token, value)); } // If this node cannot be writable, then we have an error. @@ -21466,7 +20936,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parse_call_operator_write(parser, cast, &token); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_call_or_write_node_create(parser, cast, &token, value); + return UP(pm_call_or_write_node_create(parser, cast, &token, value)); } case PM_MULTI_WRITE_NODE: { parser_lex(parser); @@ -21503,7 +20973,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_global_variable_operator_write_node_create(parser, node, &token, value); + pm_node_t *result = UP(pm_global_variable_operator_write_node_create(parser, node, &token, value)); pm_node_destroy(parser, node); return result; @@ -21512,7 +20982,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_class_variable_operator_write_node_create(parser, (pm_class_variable_read_node_t *) node, &token, value); + pm_node_t *result = UP(pm_class_variable_operator_write_node_create(parser, (pm_class_variable_read_node_t *) node, &token, value)); pm_node_destroy(parser, node); return result; @@ -21521,7 +20991,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - pm_node_t *write = (pm_node_t *) pm_constant_path_operator_write_node_create(parser, (pm_constant_path_node_t *) node, &token, value); + pm_node_t *write = UP(pm_constant_path_operator_write_node_create(parser, (pm_constant_path_node_t *) node, &token, value)); return parse_shareable_constant_write(parser, write); } @@ -21529,7 +20999,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - pm_node_t *write = (pm_node_t *) pm_constant_operator_write_node_create(parser, (pm_constant_read_node_t *) node, &token, value); + pm_node_t *write = UP(pm_constant_operator_write_node_create(parser, (pm_constant_read_node_t *) node, &token, value)); pm_node_destroy(parser, node); return parse_shareable_constant_write(parser, write); @@ -21538,7 +21008,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_instance_variable_operator_write_node_create(parser, (pm_instance_variable_read_node_t *) node, &token, value); + pm_node_t *result = UP(pm_instance_variable_operator_write_node_create(parser, (pm_instance_variable_read_node_t *) node, &token, value)); pm_node_destroy(parser, node); return result; @@ -21548,23 +21018,23 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_local_variable_operator_write_node_create(parser, node, &token, value, name, 0); + pm_node_t *result = UP(pm_local_variable_operator_write_node_create(parser, node, &token, value, name, 0)); - parse_target_implicit_parameter(parser, node); + pm_node_unreference(parser, node); pm_node_destroy(parser, node); return result; } case PM_LOCAL_VARIABLE_READ_NODE: { if (pm_token_is_numbered_parameter(node->location.start, node->location.end)) { PM_PARSER_ERR_FORMAT(parser, node->location.start, node->location.end, PM_ERR_PARAMETER_NUMBERED_RESERVED, node->location.start); - parse_target_implicit_parameter(parser, node); + pm_node_unreference(parser, node); } pm_local_variable_read_node_t *cast = (pm_local_variable_read_node_t *) node; parser_lex(parser); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_local_variable_operator_write_node_create(parser, node, &token, value, cast->name, cast->depth); + pm_node_t *result = UP(pm_local_variable_operator_write_node_create(parser, node, &token, value, cast->name, cast->depth)); pm_node_destroy(parser, node); return result; @@ -21582,9 +21052,9 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t pm_constant_id_t constant_id = pm_parser_local_add_location(parser, message_loc->start, message_loc->end, 1); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - pm_node_t *result = (pm_node_t *) pm_local_variable_operator_write_node_create(parser, (pm_node_t *) cast, &token, value, constant_id, 0); + pm_node_t *result = UP(pm_local_variable_operator_write_node_create(parser, UP(cast), &token, value, constant_id, 0)); - pm_node_destroy(parser, (pm_node_t *) cast); + pm_node_destroy(parser, UP(cast)); return result; } @@ -21593,7 +21063,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t // an aset expression. if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_INDEX)) { pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_index_operator_write_node_create(parser, cast, &token, value); + return UP(pm_index_operator_write_node_create(parser, cast, &token, value)); } // If this node cannot be writable, then we have an error. @@ -21605,7 +21075,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parse_call_operator_write(parser, cast, &token); pm_node_t *value = parse_assignment_value(parser, previous_binding_power, binding_power, accepts_command_call, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_call_operator_write_node_create(parser, cast, &token, value); + return UP(pm_call_operator_write_node_create(parser, cast, &token, value)); } case PM_MULTI_WRITE_NODE: { parser_lex(parser); @@ -21627,14 +21097,14 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *right = parse_expression(parser, binding_power, parser->previous.type == PM_TOKEN_KEYWORD_AND, false, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_and_node_create(parser, node, &token, right); + return UP(pm_and_node_create(parser, node, &token, right)); } case PM_TOKEN_KEYWORD_OR: case PM_TOKEN_PIPE_PIPE: { parser_lex(parser); pm_node_t *right = parse_expression(parser, binding_power, parser->previous.type == PM_TOKEN_KEYWORD_OR, false, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_or_node_create(parser, node, &token, right); + return UP(pm_or_node_create(parser, node, &token, right)); } case PM_TOKEN_EQUAL_TILDE: { // Note that we _must_ parse the value before adding the local @@ -21649,7 +21119,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t // By default, we're going to create a call node and then return it. pm_call_node_t *call = pm_call_node_binary_create(parser, node, &token, argument, 0); - pm_node_t *result = (pm_node_t *) call; + pm_node_t *result = UP(call); // If the receiver of this =~ is a regular expression node, then we // need to introduce local variables for it based on its named @@ -21752,7 +21222,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t } pm_node_t *argument = parse_expression(parser, binding_power, false, false, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_call_node_binary_create(parser, node, &token, argument, 0); + return UP(pm_call_node_binary_create(parser, node, &token, argument, 0)); } case PM_TOKEN_GREATER: case PM_TOKEN_GREATER_EQUAL: @@ -21764,7 +21234,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser_lex(parser); pm_node_t *argument = parse_expression(parser, binding_power, false, false, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_call_node_binary_create(parser, node, &token, argument, PM_CALL_NODE_FLAGS_COMPARISON); + return UP(pm_call_node_binary_create(parser, node, &token, argument, PM_CALL_NODE_FLAGS_COMPARISON)); } case PM_TOKEN_AMPERSAND_DOT: case PM_TOKEN_DOT: { @@ -21775,7 +21245,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t // This if statement handles the foo.() syntax. if (match1(parser, PM_TOKEN_PARENTHESIS_LEFT)) { parse_arguments_list(parser, &arguments, true, false, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_call_node_shorthand_create(parser, node, &operator, &arguments); + return UP(pm_call_node_shorthand_create(parser, node, &operator, &arguments)); } switch (PM_NODE_TYPE(node)) { @@ -21831,9 +21301,9 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t arguments.opening_loc.start == NULL && match1(parser, PM_TOKEN_COMMA) ) { - return parse_targets_validate(parser, (pm_node_t *) call, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); + return parse_targets_validate(parser, UP(call), PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); } else { - return (pm_node_t *) call; + return UP(call); } } case PM_TOKEN_DOT_DOT: @@ -21845,21 +21315,21 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t right = parse_expression(parser, binding_power, false, false, PM_ERR_EXPECT_EXPRESSION_AFTER_OPERATOR, (uint16_t) (depth + 1)); } - return (pm_node_t *) pm_range_node_create(parser, node, &token, right); + return UP(pm_range_node_create(parser, node, &token, right)); } case PM_TOKEN_KEYWORD_IF_MODIFIER: { pm_token_t keyword = parser->current; parser_lex(parser); pm_node_t *predicate = parse_value_expression(parser, binding_power, true, false, PM_ERR_CONDITIONAL_IF_PREDICATE, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_if_node_modifier_create(parser, node, &keyword, predicate); + return UP(pm_if_node_modifier_create(parser, node, &keyword, predicate)); } case PM_TOKEN_KEYWORD_UNLESS_MODIFIER: { pm_token_t keyword = parser->current; parser_lex(parser); pm_node_t *predicate = parse_value_expression(parser, binding_power, true, false, PM_ERR_CONDITIONAL_UNLESS_PREDICATE, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_unless_node_modifier_create(parser, node, &keyword, predicate); + return UP(pm_unless_node_modifier_create(parser, node, &keyword, predicate)); } case PM_TOKEN_KEYWORD_UNTIL_MODIFIER: { parser_lex(parser); @@ -21867,7 +21337,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t pm_statements_node_body_append(parser, statements, node, true); pm_node_t *predicate = parse_value_expression(parser, binding_power, true, false, PM_ERR_CONDITIONAL_UNTIL_PREDICATE, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_until_node_modifier_create(parser, &token, predicate, statements, PM_NODE_TYPE_P(node, PM_BEGIN_NODE) ? PM_LOOP_FLAGS_BEGIN_MODIFIER : 0); + return UP(pm_until_node_modifier_create(parser, &token, predicate, statements, PM_NODE_TYPE_P(node, PM_BEGIN_NODE) ? PM_LOOP_FLAGS_BEGIN_MODIFIER : 0)); } case PM_TOKEN_KEYWORD_WHILE_MODIFIER: { parser_lex(parser); @@ -21875,7 +21345,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t pm_statements_node_body_append(parser, statements, node, true); pm_node_t *predicate = parse_value_expression(parser, binding_power, true, false, PM_ERR_CONDITIONAL_WHILE_PREDICATE, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_while_node_modifier_create(parser, &token, predicate, statements, PM_NODE_TYPE_P(node, PM_BEGIN_NODE) ? PM_LOOP_FLAGS_BEGIN_MODIFIER : 0); + return UP(pm_while_node_modifier_create(parser, &token, predicate, statements, PM_NODE_TYPE_P(node, PM_BEGIN_NODE) ? PM_LOOP_FLAGS_BEGIN_MODIFIER : 0)); } case PM_TOKEN_QUESTION_MARK: { context_push(parser, PM_CONTEXT_TERNARY); @@ -21895,13 +21365,13 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t // accidentally move past a ':' token that occurs after the syntax // error. pm_token_t colon = (pm_token_t) { .type = PM_TOKEN_MISSING, .start = parser->previous.end, .end = parser->previous.end }; - pm_node_t *false_expression = (pm_node_t *) pm_missing_node_create(parser, colon.start, colon.end); + pm_node_t *false_expression = UP(pm_missing_node_create(parser, colon.start, colon.end)); context_pop(parser); pop_block_exits(parser, previous_block_exits); pm_node_list_free(¤t_block_exits); - return (pm_node_t *) pm_if_node_ternary_create(parser, node, &qmark, true_expression, &colon, false_expression); + return UP(pm_if_node_ternary_create(parser, node, &qmark, true_expression, &colon, false_expression)); } accept1(parser, PM_TOKEN_NEWLINE); @@ -21914,7 +21384,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t pop_block_exits(parser, previous_block_exits); pm_node_list_free(¤t_block_exits); - return (pm_node_t *) pm_if_node_ternary_create(parser, node, &qmark, true_expression, &colon, false_expression); + return UP(pm_if_node_ternary_create(parser, node, &qmark, true_expression, &colon, false_expression)); } case PM_TOKEN_COLON_COLON: { parser_lex(parser); @@ -21939,10 +21409,10 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t pm_arguments_t arguments = { 0 }; parse_arguments_list(parser, &arguments, true, accepts_command_call, (uint16_t) (depth + 1)); - path = (pm_node_t *) pm_call_node_call_create(parser, node, &delimiter, &message, &arguments); + path = UP(pm_call_node_call_create(parser, node, &delimiter, &message, &arguments)); } else { // Otherwise, this is a constant path. That would look like Foo::Bar. - path = (pm_node_t *) pm_constant_path_node_create(parser, node, &delimiter, &parser->previous); + path = UP(pm_constant_path_node_create(parser, node, &delimiter, &parser->previous)); } // If this is followed by a comma then it is a multiple assignment. @@ -21967,10 +21437,10 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t // If this is followed by a comma then it is a multiple assignment. if (previous_binding_power == PM_BINDING_POWER_STATEMENT && match1(parser, PM_TOKEN_COMMA)) { - return parse_targets_validate(parser, (pm_node_t *) call, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); + return parse_targets_validate(parser, UP(call), PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); } - return (pm_node_t *) call; + return UP(call); } case PM_TOKEN_PARENTHESIS_LEFT: { // If we have a parenthesis following a '::' operator, then it is the @@ -21978,11 +21448,11 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t pm_arguments_t arguments = { 0 }; parse_arguments_list(parser, &arguments, true, false, (uint16_t) (depth + 1)); - return (pm_node_t *) pm_call_node_shorthand_create(parser, node, &delimiter, &arguments); + return UP(pm_call_node_shorthand_create(parser, node, &delimiter, &arguments)); } default: { expect1(parser, PM_TOKEN_CONSTANT, PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT); - return (pm_node_t *) pm_constant_path_node_create(parser, node, &delimiter, &parser->previous); + return UP(pm_constant_path_node_create(parser, node, &delimiter, &parser->previous)); } } } @@ -21994,7 +21464,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t pm_node_t *value = parse_expression(parser, binding_power, true, false, PM_ERR_RESCUE_MODIFIER_VALUE, (uint16_t) (depth + 1)); context_pop(parser); - return (pm_node_t *) pm_rescue_modifier_node_create(parser, node, &token, value); + return UP(pm_rescue_modifier_node_create(parser, node, &token, value)); } case PM_TOKEN_BRACKET_LEFT: { parser_lex(parser); @@ -22015,7 +21485,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t // assignment and we should parse the targets. if (previous_binding_power == PM_BINDING_POWER_STATEMENT && match1(parser, PM_TOKEN_COMMA)) { pm_call_node_t *aref = pm_call_node_aref_create(parser, node, &arguments); - return parse_targets_validate(parser, (pm_node_t *) aref, PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); + return parse_targets_validate(parser, UP(aref), PM_BINDING_POWER_INDEX, (uint16_t) (depth + 1)); } // If we're at the end of the arguments, we can now check if there is a @@ -22031,17 +21501,17 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t if (block != NULL) { if (arguments.block != NULL) { - pm_parser_err_node(parser, (pm_node_t *) block, PM_ERR_ARGUMENT_AFTER_BLOCK); + pm_parser_err_node(parser, UP(block), PM_ERR_ARGUMENT_AFTER_BLOCK); if (arguments.arguments == NULL) { arguments.arguments = pm_arguments_node_create(parser); } pm_arguments_node_arguments_append(arguments.arguments, arguments.block); } - arguments.block = (pm_node_t *) block; + arguments.block = UP(block); } - return (pm_node_t *) pm_call_node_aref_create(parser, node, &arguments); + return UP(pm_call_node_aref_create(parser, node, &arguments)); } case PM_TOKEN_KEYWORD_IN: { bool previous_pattern_matching_newlines = parser->pattern_matching_newlines; @@ -22058,7 +21528,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser->pattern_matching_newlines = previous_pattern_matching_newlines; pm_constant_id_list_free(&captures); - return (pm_node_t *) pm_match_predicate_node_create(parser, node, pattern, &operator); + return UP(pm_match_predicate_node_create(parser, node, pattern, &operator)); } case PM_TOKEN_EQUAL_GREATER: { bool previous_pattern_matching_newlines = parser->pattern_matching_newlines; @@ -22075,7 +21545,7 @@ parse_expression_infix(pm_parser_t *parser, pm_node_t *node, pm_binding_power_t parser->pattern_matching_newlines = previous_pattern_matching_newlines; pm_constant_id_list_free(&captures); - return (pm_node_t *) pm_match_required_node_create(parser, node, pattern, &operator); + return UP(pm_match_required_node_create(parser, node, pattern, &operator)); } default: assert(false && "unreachable"); @@ -22112,7 +21582,7 @@ static pm_node_t * parse_expression(pm_parser_t *parser, pm_binding_power_t binding_power, bool accepts_command_call, bool accepts_label, pm_diagnostic_id_t diag_id, uint16_t depth) { if (PRISM_UNLIKELY(depth >= PRISM_DEPTH_MAXIMUM)) { pm_parser_err_current(parser, PM_ERR_NESTING_TOO_DEEP); - return (pm_node_t *) pm_missing_node_create(parser, parser->current.start, parser->current.end); + return UP(pm_missing_node_create(parser, parser->current.start, parser->current.end)); } pm_node_t *node = parse_expression_prefix(parser, binding_power, accepts_command_call, accepts_label, diag_id, depth); @@ -22169,6 +21639,12 @@ parse_expression(pm_parser_t *parser, pm_binding_power_t binding_power, bool acc ) { node = parse_expression_infix(parser, node, binding_power, current_binding_powers.right, accepts_command_call, (uint16_t) (depth + 1)); + if (context_terminator(parser->current_context->context, &parser->current)) { + // If this token terminates the current context, then we need to + // stop parsing the expression, as it has become a statement. + return node; + } + switch (PM_NODE_TYPE(node)) { case PM_MULTI_WRITE_NODE: // Multi-write nodes are statements, and cannot be followed by @@ -22300,14 +21776,14 @@ wrap_statements(pm_parser_t *parser, pm_statements_node_t *statements) { pm_arguments_node_t *arguments = pm_arguments_node_create(parser); pm_arguments_node_arguments_append( arguments, - (pm_node_t *) pm_global_variable_read_node_synthesized_create(parser, pm_parser_constant_id_constant(parser, "$_", 2)) + UP(pm_global_variable_read_node_synthesized_create(parser, pm_parser_constant_id_constant(parser, "$_", 2))) ); - pm_statements_node_body_append(parser, statements, (pm_node_t *) pm_call_node_fcall_synthesized_create( + pm_statements_node_body_append(parser, statements, UP(pm_call_node_fcall_synthesized_create( parser, arguments, pm_parser_constant_id_constant(parser, "print", 5) - ), true); + )), true); } if (PM_PARSER_COMMAND_LINE_OPTION_N(parser)) { @@ -22319,46 +21795,46 @@ wrap_statements(pm_parser_t *parser, pm_statements_node_t *statements) { pm_arguments_node_t *arguments = pm_arguments_node_create(parser); pm_arguments_node_arguments_append( arguments, - (pm_node_t *) pm_global_variable_read_node_synthesized_create(parser, pm_parser_constant_id_constant(parser, "$;", 2)) + UP(pm_global_variable_read_node_synthesized_create(parser, pm_parser_constant_id_constant(parser, "$;", 2))) ); pm_global_variable_read_node_t *receiver = pm_global_variable_read_node_synthesized_create(parser, pm_parser_constant_id_constant(parser, "$_", 2)); - pm_call_node_t *call = pm_call_node_call_synthesized_create(parser, (pm_node_t *) receiver, "split", arguments); + pm_call_node_t *call = pm_call_node_call_synthesized_create(parser, UP(receiver), "split", arguments); pm_global_variable_write_node_t *write = pm_global_variable_write_node_synthesized_create( parser, pm_parser_constant_id_constant(parser, "$F", 2), - (pm_node_t *) call + UP(call) ); - pm_statements_node_body_prepend(statements, (pm_node_t *) write); + pm_statements_node_body_prepend(statements, UP(write)); } pm_arguments_node_t *arguments = pm_arguments_node_create(parser); pm_arguments_node_arguments_append( arguments, - (pm_node_t *) pm_global_variable_read_node_synthesized_create(parser, pm_parser_constant_id_constant(parser, "$/", 2)) + UP(pm_global_variable_read_node_synthesized_create(parser, pm_parser_constant_id_constant(parser, "$/", 2))) ); if (PM_PARSER_COMMAND_LINE_OPTION_L(parser)) { pm_keyword_hash_node_t *keywords = pm_keyword_hash_node_create(parser); - pm_keyword_hash_node_elements_append(keywords, (pm_node_t *) pm_assoc_node_create( + pm_keyword_hash_node_elements_append(keywords, UP(pm_assoc_node_create( parser, - (pm_node_t *) pm_symbol_node_synthesized_create(parser, "chomp"), + UP(pm_symbol_node_synthesized_create(parser, "chomp")), &(pm_token_t) { .type = PM_TOKEN_NOT_PROVIDED, .start = parser->start, .end = parser->start }, - (pm_node_t *) pm_true_node_synthesized_create(parser) - )); + UP(pm_true_node_synthesized_create(parser)) + ))); - pm_arguments_node_arguments_append(arguments, (pm_node_t *) keywords); - pm_node_flag_set((pm_node_t *) arguments, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS); + pm_arguments_node_arguments_append(arguments, UP(keywords)); + pm_node_flag_set(UP(arguments), PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS); } pm_statements_node_t *wrapped_statements = pm_statements_node_create(parser); - pm_statements_node_body_append(parser, wrapped_statements, (pm_node_t *) pm_while_node_synthesized_create( + pm_statements_node_body_append(parser, wrapped_statements, UP(pm_while_node_synthesized_create( parser, - (pm_node_t *) pm_call_node_fcall_synthesized_create(parser, arguments, pm_parser_constant_id_constant(parser, "gets", 4)), + UP(pm_call_node_fcall_synthesized_create(parser, arguments, pm_parser_constant_id_constant(parser, "gets", 4))), statements - ), true); + )), true); statements = wrapped_statements; } @@ -22402,9 +21878,10 @@ parse_program(pm_parser_t *parser) { statements = wrap_statements(parser, statements); } else { flush_block_exits(parser, previous_block_exits); - pm_node_list_free(¤t_block_exits); } + pm_node_list_free(¤t_block_exits); + // If this is an empty file, then we're still going to parse all of the // statements in order to gather up all of the comments and such. Here we'll // correct the location information. @@ -22413,7 +21890,7 @@ parse_program(pm_parser_t *parser) { pm_statements_node_location_set(statements, parser->start, parser->start); } - return (pm_node_t *) pm_program_node_create(parser, &locals, statements); + return UP(pm_program_node_create(parser, &locals, statements)); } /******************************************************************************/ @@ -22433,7 +21910,7 @@ static const char * pm_strnstr(const char *big, const char *little, size_t big_length) { size_t little_length = strlen(little); - for (const char *big_end = big + big_length; big < big_end; big++) { + for (const char *max = big + big_length - little_length; big <= max; big++) { if (*big == *little && memcmp(big, little, little_length) == 0) return big; } @@ -22623,6 +22100,12 @@ pm_parser_init(pm_parser_t *parser, const uint8_t *source, size_t size, const pm } } + // Now that we have established the user-provided options, check if + // a version was given and parse as the latest version otherwise. + if (parser->version == PM_OPTIONS_VERSION_UNSET) { + parser->version = PM_OPTIONS_VERSION_LATEST; + } + pm_accepts_block_stack_push(parser, true); // Skip past the UTF-8 BOM if it exists. @@ -22656,8 +22139,8 @@ pm_parser_init(pm_parser_t *parser, const uint8_t *source, size_t size, const pm // If the shebang does not include "ruby" and this is the main script being // parsed, then we will start searching the file for a shebang that does // contain "ruby" as if -x were passed on the command line. - const uint8_t *newline = next_newline(parser->start, parser->end - parser->start); - size_t length = (size_t) ((newline != NULL ? newline : parser->end) - parser->start); + const uint8_t *newline = next_newline(parser->current.end, parser->end - parser->current.end); + size_t length = (size_t) ((newline != NULL ? newline : parser->end) - parser->current.end); if (length > 2 && parser->current.end[0] == '#' && parser->current.end[1] == '!') { const char *engine; @@ -22676,7 +22159,7 @@ pm_parser_init(pm_parser_t *parser, const uint8_t *source, size_t size, const pm } search_shebang = false; - } else if (options->main_script && !parser->parsing_eval) { + } else if (options != NULL && options->main_script && !parser->parsing_eval) { search_shebang = true; } } @@ -22816,7 +22299,7 @@ pm_parse(pm_parser_t *parser) { * otherwise return true. */ static bool -pm_parse_stream_read(pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets) { +pm_parse_stream_read(pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets, pm_parse_stream_feof_t *stream_feof) { #define LINE_SIZE 4096 char line[LINE_SIZE]; @@ -22852,6 +22335,12 @@ pm_parse_stream_read(pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t if (strncmp(line, "__END__\r\n", 9) == 0) return false; break; } + + // All data should be read via gets. If the string returned by gets + // _doesn't_ end with a newline, then we assume we hit EOF condition. + if (stream_feof(stream)) { + break; + } } return true; @@ -22887,16 +22376,17 @@ pm_parse_stream_unterminated_heredoc_p(pm_parser_t *parser) { * can stream stdin in to Ruby so we need to support a streaming API. */ PRISM_EXPORTED_FUNCTION pm_node_t * -pm_parse_stream(pm_parser_t *parser, pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets, const pm_options_t *options) { +pm_parse_stream(pm_parser_t *parser, pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets, pm_parse_stream_feof_t *stream_feof, const pm_options_t *options) { pm_buffer_init(buffer); - bool eof = pm_parse_stream_read(buffer, stream, stream_fgets); + bool eof = pm_parse_stream_read(buffer, stream, stream_fgets, stream_feof); + pm_parser_init(parser, (const uint8_t *) pm_buffer_value(buffer), pm_buffer_length(buffer), options); pm_node_t *node = pm_parse(parser); while (!eof && parser->error_list.size > 0 && (parser->lex_modes.index > 0 || pm_parse_stream_unterminated_heredoc_p(parser))) { pm_node_destroy(parser, node); - eof = pm_parse_stream_read(buffer, stream, stream_fgets); + eof = pm_parse_stream_read(buffer, stream, stream_fgets, stream_feof); pm_parser_free(parser); pm_parser_init(parser, (const uint8_t *) pm_buffer_value(buffer), pm_buffer_length(buffer), options); @@ -22931,10 +22421,6 @@ pm_parse_success_p(const uint8_t *source, size_t size, const char *data) { #undef PM_CASE_OPERATOR #undef PM_CASE_WRITABLE #undef PM_STRING_EMPTY -#undef PM_LOCATION_NODE_BASE_VALUE -#undef PM_LOCATION_NODE_VALUE -#undef PM_LOCATION_NULL_VALUE -#undef PM_LOCATION_TOKEN_VALUE // We optionally support serializing to a binary string. For systems that don't // want or need this functionality, it can be turned off with the @@ -22988,13 +22474,13 @@ pm_serialize_parse(pm_buffer_t *buffer, const uint8_t *source, size_t size, cons * given stream into to the given buffer. */ PRISM_EXPORTED_FUNCTION void -pm_serialize_parse_stream(pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets, const char *data) { +pm_serialize_parse_stream(pm_buffer_t *buffer, void *stream, pm_parse_stream_fgets_t *stream_fgets, pm_parse_stream_feof_t *stream_feof, const char *data) { pm_parser_t parser; pm_options_t options = { 0 }; pm_options_read(&options, data); pm_buffer_t parser_buffer; - pm_node_t *node = pm_parse_stream(&parser, &parser_buffer, stream, stream_fgets, &options); + pm_node_t *node = pm_parse_stream(&parser, &parser_buffer, stream, stream_fgets, stream_feof, &options); pm_serialize_header(buffer); pm_serialize_content(&parser, node, buffer); pm_buffer_append_byte(buffer, '\0'); diff --git a/src/util/pm_constant_pool.c b/src/util/pm_constant_pool.c index 38ea01a228..922ce6a18c 100644 --- a/src/util/pm_constant_pool.c +++ b/src/util/pm_constant_pool.c @@ -264,7 +264,7 @@ pm_constant_pool_insert(pm_constant_pool_t *pool, const uint8_t *start, size_t l // constant and replace it with the shared constant. xfree((void *) constant->start); constant->start = start; - bucket->type = (unsigned int) (PM_CONSTANT_POOL_BUCKET_DEFAULT & 0x3); + bucket->type = (unsigned int) (type & 0x3); } return bucket->id; diff --git a/src/util/pm_string.c b/src/util/pm_string.c index 75422fbdf2..a7493c468b 100644 --- a/src/util/pm_string.c +++ b/src/util/pm_string.c @@ -1,5 +1,7 @@ #include "prism/util/pm_string.h" +static const uint8_t empty_source[] = ""; + /** * Returns the size of the pm_string_t struct. This is necessary to allocate the * correct amount of memory in the FFI backend. @@ -133,8 +135,7 @@ pm_string_mapped_init(pm_string_t *string, const char *filepath) { // the source to a constant empty string and return. if (file_size == 0) { pm_string_file_handle_close(&handle); - const uint8_t source[] = ""; - *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 }; + *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = empty_source, .length = 0 }; return PM_STRING_INIT_SUCCESS; } @@ -182,8 +183,7 @@ pm_string_mapped_init(pm_string_t *string, const char *filepath) { if (size == 0) { close(fd); - const uint8_t source[] = ""; - *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 }; + *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = empty_source, .length = 0 }; return PM_STRING_INIT_SUCCESS; } @@ -225,8 +225,7 @@ pm_string_file_init(pm_string_t *string, const char *filepath) { // the source to a constant empty string and return. if (file_size == 0) { pm_string_file_handle_close(&handle); - const uint8_t source[] = ""; - *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 }; + *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = empty_source, .length = 0 }; return PM_STRING_INIT_SUCCESS; } @@ -278,8 +277,7 @@ pm_string_file_init(pm_string_t *string, const char *filepath) { size_t size = (size_t) sb.st_size; if (size == 0) { close(fd); - const uint8_t source[] = ""; - *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 }; + *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = empty_source, .length = 0 }; return PM_STRING_INIT_SUCCESS; } diff --git a/templates/include/prism/ast.h.erb b/templates/include/prism/ast.h.erb index 751c0b43c2..790cf9ebb8 100644 --- a/templates/include/prism/ast.h.erb +++ b/templates/include/prism/ast.h.erb @@ -2,6 +2,8 @@ * @file ast.h * * The abstract syntax tree. + * + * -- */ #ifndef PRISM_AST_H #define PRISM_AST_H @@ -103,22 +105,6 @@ typedef uint16_t pm_node_flags_t; static const pm_node_flags_t PM_NODE_FLAG_NEWLINE = 0x1; static const pm_node_flags_t PM_NODE_FLAG_STATIC_LITERAL = 0x2; -/** - * Cast the type to an enum to allow the compiler to provide exhaustiveness - * checking. - */ -#define PM_NODE_TYPE(node) ((enum pm_node_type) (node)->type) - -/** - * Return true if the type of the given node matches the given type. - */ -#define PM_NODE_TYPE_P(node, type) (PM_NODE_TYPE(node) == (type)) - -/** - * Return true if the given flag is set on the given node. - */ -#define PM_NODE_FLAG_P(node, flag) ((((pm_node_t *)(node))->flags & (flag)) != 0) - /** * This is the base structure that represents a node in the syntax tree. It is * embedded into every node type. @@ -148,6 +134,32 @@ typedef struct pm_node { */ pm_location_t location; } pm_node_t; + +/** + * Cast the given node to the base pm_node_t type. + */ +#define PM_NODE_UPCAST(node_) ((pm_node_t *) (node_)) + +/** + * Cast the type to an enum to allow the compiler to provide exhaustiveness + * checking. + */ +#define PM_NODE_TYPE(node_) ((enum pm_node_type) (node_)->type) + +/** + * Return true if the type of the given node matches the given type. + */ +#define PM_NODE_TYPE_P(node_, type_) (PM_NODE_TYPE(node_) == (type_)) + +/** + * Return the flags associated with the given node. + */ +#define PM_NODE_FLAGS(node_) (PM_NODE_UPCAST(node_)->flags) + +/** + * Return true if the given flag is set on the given node. + */ +#define PM_NODE_FLAG_P(node_, flag_) ((PM_NODE_FLAGS(node_) & (flag_)) != 0) <%- nodes.each do |node| -%> /** @@ -210,6 +222,8 @@ typedef enum pm_<%= flag.human %> { /** <%= value.comment %> */ PM_<%= flag.human.upcase %>_<%= value.name %> = <%= 1 << (index + Prism::Template::COMMON_FLAGS_COUNT) %>, <%- end -%> + + PM_<%= flag.human.upcase %>_LAST, } pm_<%= flag.human %>_t; <%- end -%> diff --git a/templates/java/org/prism/Loader.java.erb b/templates/java/org/prism/Loader.java.erb index 629c8bbb8c..7288aecc17 100644 --- a/templates/java/org/prism/Loader.java.erb +++ b/templates/java/org/prism/Loader.java.erb @@ -101,7 +101,7 @@ public class Loader { expect((byte) 'M', "incorrect prism header"); expect((byte) 1, "prism major version does not match"); - expect((byte) 4, "prism minor version does not match"); + expect((byte) 8, "prism minor version does not match"); expect((byte) 0, "prism patch version does not match"); expect((byte) 1, "Loader.java requires no location fields in the serialized output"); diff --git a/templates/javascript/src/deserialize.js.erb b/templates/javascript/src/deserialize.js.erb index 643dd0dab5..6a09098344 100644 --- a/templates/javascript/src/deserialize.js.erb +++ b/templates/javascript/src/deserialize.js.erb @@ -1,7 +1,7 @@ import * as nodes from "./nodes.js"; const MAJOR_VERSION = 1; -const MINOR_VERSION = 4; +const MINOR_VERSION = 8; const PATCH_VERSION = 0; // The DataView getFloat64 function takes an optional second argument that diff --git a/templates/lib/prism/compiler.rb.erb b/templates/lib/prism/compiler.rb.erb index 45ed88d8de..66dbe666b9 100644 --- a/templates/lib/prism/compiler.rb.erb +++ b/templates/lib/prism/compiler.rb.erb @@ -29,13 +29,15 @@ module Prism # Visit the child nodes of the given node. def visit_child_nodes(node) - node.compact_child_nodes.map { |node| node.accept(self) } + node.each_child_node.map { |node| node.accept(self) } end <%- nodes.each_with_index do |node, index| -%> <%= "\n" if index != 0 -%> # Compile a <%= node.name %> node - alias visit_<%= node.human %> visit_child_nodes + def visit_<%= node.human %>(node) + node.each_child_node.map { |node| node.accept(self) } + end <%- end -%> end end diff --git a/templates/lib/prism/dot_visitor.rb.erb b/templates/lib/prism/dot_visitor.rb.erb index e9c81e4545..cd2998fe61 100644 --- a/templates/lib/prism/dot_visitor.rb.erb +++ b/templates/lib/prism/dot_visitor.rb.erb @@ -1,4 +1,5 @@ -require "cgi" +require "cgi/escape" +require "cgi/util" unless defined?(CGI::EscapeExt) module Prism # This visitor provides the ability to call Node#to_dot, which converts a diff --git a/templates/lib/prism/node.rb.erb b/templates/lib/prism/node.rb.erb index ceee2b0ffe..8225bfb328 100644 --- a/templates/lib/prism/node.rb.erb +++ b/templates/lib/prism/node.rb.erb @@ -184,24 +184,13 @@ module Prism queue = [self] #: Array[Prism::node] result = [] #: Array[Prism::node] + search_offset = source.line_to_byte_offset(line) + column + while (node = queue.shift) result << node - node.compact_child_nodes.each do |child_node| - child_location = child_node.location - - start_line = child_location.start_line - end_line = child_location.end_line - - if start_line == end_line - if line == start_line && column >= child_location.start_column && column < child_location.end_column - queue << child_node - break - end - elsif (line == start_line && column >= child_location.start_column) || (line == end_line && column < child_location.end_column) - queue << child_node - break - elsif line > start_line && line < end_line + node.each_child_node do |child_node| + if child_node.start_offset <= search_offset && search_offset < child_node.end_offset queue << child_node break end @@ -259,6 +248,13 @@ module Prism alias deconstruct child_nodes + # With a block given, yields each child node. Without a block, returns + # an enumerator that contains each child node. Excludes any `nil`s in + # the place of optional nodes that were not present. + def each_child_node + raise NoMethodError, "undefined method `each_child_node' for #{inspect}" + end + # Returns an array of child nodes, excluding any `nil`s in the place of # optional nodes that were not present. def compact_child_nodes @@ -335,6 +331,22 @@ module Prism }.compact.join(", ") %>] end + # def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator[Prism::node] + def each_child_node + return to_enum(:each_child_node) unless block_given? + + <%- node.fields.each do |field| -%> + <%- case field -%> + <%- when Prism::Template::NodeField -%> + yield <%= field.name %> + <%- when Prism::Template::OptionalNodeField -%> + yield <%= field.name %> if <%= field.name %> + <%- when Prism::Template::NodeListField -%> + <%= field.name %>.each { |node| yield node } + <%- end -%> + <%- end -%> + end + # def compact_child_nodes: () -> Array[Node] def compact_child_nodes <%- if node.fields.any? { |field| field.is_a?(Prism::Template::OptionalNodeField) } -%> diff --git a/templates/lib/prism/serialize.rb.erb b/templates/lib/prism/serialize.rb.erb index 104b60f484..6902df5c01 100644 --- a/templates/lib/prism/serialize.rb.erb +++ b/templates/lib/prism/serialize.rb.erb @@ -10,7 +10,7 @@ module Prism # The minor version of prism that we are expecting to find in the serialized # strings. - MINOR_VERSION = 4 + MINOR_VERSION = 8 # The patch version of prism that we are expecting to find in the serialized # strings. diff --git a/templates/lib/prism/visitor.rb.erb b/templates/lib/prism/visitor.rb.erb index 4b30a1815b..76f907724f 100644 --- a/templates/lib/prism/visitor.rb.erb +++ b/templates/lib/prism/visitor.rb.erb @@ -20,7 +20,7 @@ module Prism # Visits the child nodes of `node` by calling `accept` on each one. def visit_child_nodes(node) # @type self: _Visitor - node.compact_child_nodes.each { |node| node.accept(self) } + node.each_child_node { |node| node.accept(self) } end end @@ -34,7 +34,7 @@ module Prism # # class FooCalls < Prism::Visitor # def visit_call_node(node) - # if node.name == "foo" + # if node.name == :foo # # Do something with the node # end # @@ -47,7 +47,9 @@ module Prism <%- nodes.each_with_index do |node, index| -%> <%= "\n" if index != 0 -%> # Visit a <%= node.name %> node - alias visit_<%= node.human %> visit_child_nodes + def visit_<%= node.human %>(node) + node.each_child_node { |node| node.accept(self) } + end <%- end -%> end end diff --git a/templates/sig/prism.rbs.erb b/templates/sig/prism.rbs.erb index 2f30cbc29f..5c74cee8f8 100644 --- a/templates/sig/prism.rbs.erb +++ b/templates/sig/prism.rbs.erb @@ -2,6 +2,10 @@ module Prism BACKEND: :CEXT | :FFI VERSION: String + class CurrentVersionError < ArgumentError + def initialize: (String version) -> void + end + # Methods taking a Ruby source code string: <%- { diff --git a/templates/sig/prism/node.rbs.erb b/templates/sig/prism/node.rbs.erb index 6d6fe67336..01914b571c 100644 --- a/templates/sig/prism/node.rbs.erb +++ b/templates/sig/prism/node.rbs.erb @@ -12,6 +12,7 @@ module Prism def child_nodes: () -> Array[Prism::node?] def comment_targets: () -> Array[Prism::node | Location] def compact_child_nodes: () -> Array[Prism::node] + def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator[Prism::node] def self.fields: () -> Array[Prism::Reflection::Field] def type: () -> Symbol def self.type: () -> Symbol diff --git a/templates/src/diagnostic.c.erb b/templates/src/diagnostic.c.erb index ce98dc5acd..121dd4b2b6 100644 --- a/templates/src/diagnostic.c.erb +++ b/templates/src/diagnostic.c.erb @@ -144,6 +144,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = { [PM_ERR_CONDITIONAL_WHILE_PREDICATE] = { "expected a predicate expression for the `while` statement", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT] = { "expected a constant after the `::` operator", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_DEF_ENDLESS] = { "could not parse the endless method body", PM_ERROR_LEVEL_SYNTAX }, + [PM_ERR_DEF_ENDLESS_PARAMETERS] = { "could not parse the endless method parameters", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_DEF_ENDLESS_SETTER] = { "invalid method name; a setter method cannot be defined in an endless method definition", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_DEF_NAME] = { "unexpected %s; expected a method name", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_DEF_PARAMS_TERM] = { "expected a delimiter to close the parameters", PM_ERROR_LEVEL_SYNTAX }, @@ -184,6 +185,8 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = { [PM_ERR_EXPECT_FOR_DELIMITER] = { "unexpected %s; expected a 'do', newline, or ';' after the 'for' loop collection", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_EXPECT_IDENT_REQ_PARAMETER] = { "expected an identifier for the required parameter", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_EXPECT_IN_DELIMITER] = { "expected a delimiter after the patterns of an `in` clause", PM_ERROR_LEVEL_SYNTAX }, + [PM_ERR_EXPECT_LPAREN_AFTER_NOT_LPAREN] = { "expected a `(` immediately after `not`", PM_ERROR_LEVEL_SYNTAX }, + [PM_ERR_EXPECT_LPAREN_AFTER_NOT_OTHER] = { "expected a `(` after `not`", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_EXPECT_LPAREN_REQ_PARAMETER] = { "expected a `(` to start a required parameter", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_EXPECT_MESSAGE] = { "unexpected %s; expecting a message to send to the receiver", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_EXPECT_RBRACKET] = { "expected a matching `]`", PM_ERROR_LEVEL_SYNTAX }, @@ -298,6 +301,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = { [PM_ERR_PARAMETER_UNEXPECTED_NO_KW] = { "unexpected **nil; no keywords marker disallowed after keywords", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_PATTERN_ARRAY_MULTIPLE_RESTS] = { "unexpected multiple '*' rest patterns in an array pattern", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_PATTERN_CAPTURE_DUPLICATE] = { "duplicated variable name", PM_ERROR_LEVEL_SYNTAX }, + [PM_ERR_PATTERN_CAPTURE_IN_ALTERNATIVE] = { "variable capture in alternative pattern", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET] = { "expected a pattern expression after the `[` operator", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_PATTERN_EXPRESSION_AFTER_COMMA] = { "expected a pattern expression after `,`", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_PATTERN_EXPRESSION_AFTER_HROCKET] = { "expected a pattern expression after `=>`", PM_ERROR_LEVEL_SYNTAX }, @@ -358,6 +362,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = { [PM_ERR_UNEXPECTED_INDEX_KEYWORDS] = { "unexpected keyword arg given in index assignment; keywords are not allowed in index assignment expressions", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_UNEXPECTED_LABEL] = { "unexpected label", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_UNEXPECTED_MULTI_WRITE] = { "unexpected multiple assignment; multiple assignment is not allowed in this context", PM_ERROR_LEVEL_SYNTAX }, + [PM_ERR_UNEXPECTED_PARAMETER_DEFAULT_VALUE] = { "unexpected %s; expected a default value for a parameter", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_UNEXPECTED_RANGE_OPERATOR] = { "unexpected range operator; .. and ... are non-associative and cannot be chained", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_UNEXPECTED_SAFE_NAVIGATION] = { "&. inside multiple assignment destination", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_UNEXPECTED_TOKEN_CLOSE_CONTEXT] = { "unexpected %s, assuming it is closing the parent %s", PM_ERROR_LEVEL_SYNTAX }, diff --git a/templates/src/serialize.c.erb b/templates/src/serialize.c.erb index 3e15a11039..0f0aace445 100644 --- a/templates/src/serialize.c.erb +++ b/templates/src/serialize.c.erb @@ -315,7 +315,7 @@ pm_serialize_content(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) // buffer offset. We will add a leading 1 to indicate that this // is a buffer offset. uint32_t content_offset = pm_sizet_to_u32(buffer->length); - uint32_t owned_mask = (uint32_t) (1 << 31); + uint32_t owned_mask = 1U << 31; assert(content_offset < owned_mask); content_offset |= owned_mask; diff --git a/templates/template.rb b/templates/template.rb index 30cb60cabd..6c3efd7e6c 100755 --- a/templates/template.rb +++ b/templates/template.rb @@ -551,11 +551,14 @@ def render(name, write_to: nil) when ".rb" <<~HEADING # frozen_string_literal: true + # :markup: markdown =begin + -- This file is generated by the templates/template.rb script and should not be modified manually. See #{filepath} if you are looking to modify the template + ++ =end HEADING @@ -579,10 +582,12 @@ def render(name, write_to: nil) HEADING else <<~HEADING + /* :markup: markdown */ + /*----------------------------------------------------------------------------*/ /* This file is generated by the templates/template.rb script and should not */ /* be modified manually. See */ - /* #{filepath + " " * (74 - filepath.size) } */ + /* #{filepath.ljust(74)} */ /* if you are looking to modify the */ /* template */ /*----------------------------------------------------------------------------*/ diff --git a/test/prism/api/parse_test.rb b/test/prism/api/parse_test.rb index bbce8a8fad..bbf28201ff 100644 --- a/test/prism/api/parse_test.rb +++ b/test/prism/api/parse_test.rb @@ -119,6 +119,12 @@ def test_version assert Prism.parse_success?("1 + 1", version: "3.5") assert Prism.parse_success?("1 + 1", version: "3.5.0") + assert Prism.parse_success?("1 + 1", version: "4.0") + assert Prism.parse_success?("1 + 1", version: "4.0.0") + + assert Prism.parse_success?("1 + 1", version: "4.1") + assert Prism.parse_success?("1 + 1", version: "4.1.0") + assert Prism.parse_success?("1 + 1", version: "latest") # Test edge case @@ -140,6 +146,14 @@ def test_version end end + def test_version_current + if RUBY_VERSION >= "3.3" + assert Prism.parse_success?("1 + 1", version: "current") + else + assert_raise(CurrentVersionError) { Prism.parse_success?("1 + 1", version: "current") } + end + end + def test_scopes assert_kind_of Prism::CallNode, Prism.parse_statement("foo") assert_kind_of Prism::LocalVariableReadNode, Prism.parse_statement("foo", scopes: [[:foo]]) diff --git a/test/prism/encoding/encodings_test.rb b/test/prism/encoding/encodings_test.rb index 4ad2b465cc..b008fc3fa1 100644 --- a/test/prism/encoding/encodings_test.rb +++ b/test/prism/encoding/encodings_test.rb @@ -56,21 +56,11 @@ def assert_encoding_identifier(name, character) # Check that we can properly parse every codepoint in the given encoding. def assert_encoding(encoding, name, range) - # I'm not entirely sure, but I believe these codepoints are incorrect in - # their parsing in CRuby. They all report as matching `[[:lower:]]` but - # then they are parsed as constants. This is because CRuby determines if - # an identifier is a constant or not by case folding it down to lowercase - # and checking if there is a difference. And even though they report - # themselves as lowercase, their case fold is different. I have reported - # this bug upstream. + unicode = false + case encoding when Encoding::UTF_8, Encoding::UTF_8_MAC, Encoding::UTF8_DoCoMo, Encoding::UTF8_KDDI, Encoding::UTF8_SoftBank, Encoding::CESU_8 - range = range.to_a - [ - 0x01c5, 0x01c8, 0x01cb, 0x01f2, 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, - 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, 0x1f98, 0x1f99, 0x1f9a, 0x1f9b, - 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1fa8, 0x1fa9, 0x1faa, 0x1fab, - 0x1fac, 0x1fad, 0x1fae, 0x1faf, 0x1fbc, 0x1fcc, 0x1ffc, - ] + unicode = true when Encoding::Windows_1253 range = range.to_a - [0xb5] end @@ -79,7 +69,7 @@ def assert_encoding(encoding, name, range) character = codepoint.chr(encoding) if character.match?(/[[:alpha:]]/) - if character.match?(/[[:upper:]]/) + if character.match?(/[[:upper:]]/) || (unicode && character.match?(Regexp.new("\\p{Lt}".encode(encoding)))) assert_encoding_constant(name, character) else assert_encoding_identifier(name, character) diff --git a/test/prism/errors/3.3-3.3/circular_parameters.txt b/test/prism/errors/3.3-3.3/circular_parameters.txt new file mode 100644 index 0000000000..ef9642b075 --- /dev/null +++ b/test/prism/errors/3.3-3.3/circular_parameters.txt @@ -0,0 +1,12 @@ +def foo(bar = bar) = 42 + ^~~ circular argument reference - bar + +def foo(bar: bar) = 42 + ^~~ circular argument reference - bar + +proc { |foo = foo| } + ^~~ circular argument reference - foo + +proc { |foo: foo| } + ^~~ circular argument reference - foo + diff --git a/test/prism/errors/3.3-3.4/leading_logical.txt b/test/prism/errors/3.3-3.4/leading_logical.txt new file mode 100644 index 0000000000..2a702e281d --- /dev/null +++ b/test/prism/errors/3.3-3.4/leading_logical.txt @@ -0,0 +1,34 @@ +1 +&& 2 +^~ unexpected '&&', ignoring it +&& 3 +^~ unexpected '&&', ignoring it + +1 +|| 2 +^ unexpected '|', ignoring it + ^ unexpected '|', ignoring it +|| 3 +^ unexpected '|', ignoring it + ^ unexpected '|', ignoring it + +1 +and 2 +^~~ unexpected 'and', ignoring it +and 3 +^~~ unexpected 'and', ignoring it + +1 +or 2 +^~ unexpected 'or', ignoring it +or 3 +^~ unexpected 'or', ignoring it + +1 +and foo +^~~ unexpected 'and', ignoring it + +2 +or foo +^~ unexpected 'or', ignoring it + diff --git a/test/prism/errors/3.3-3.4/private_endless_method.txt b/test/prism/errors/3.3-3.4/private_endless_method.txt new file mode 100644 index 0000000000..8aae5e0cd3 --- /dev/null +++ b/test/prism/errors/3.3-3.4/private_endless_method.txt @@ -0,0 +1,3 @@ +private def foo = puts "Hello" + ^ unexpected string literal, expecting end-of-input + diff --git a/test/prism/errors/block_args_in_array_assignment.txt b/test/prism/errors/3.4/block_args_in_array_assignment.txt similarity index 100% rename from test/prism/errors/block_args_in_array_assignment.txt rename to test/prism/errors/3.4/block_args_in_array_assignment.txt diff --git a/test/prism/errors/dont_allow_return_inside_sclass_body.txt b/test/prism/errors/3.4/dont_allow_return_inside_sclass_body.txt similarity index 100% rename from test/prism/errors/dont_allow_return_inside_sclass_body.txt rename to test/prism/errors/3.4/dont_allow_return_inside_sclass_body.txt diff --git a/test/prism/errors/it_with_ordinary_parameter.txt b/test/prism/errors/3.4/it_with_ordinary_parameter.txt similarity index 100% rename from test/prism/errors/it_with_ordinary_parameter.txt rename to test/prism/errors/3.4/it_with_ordinary_parameter.txt diff --git a/test/prism/errors/keyword_args_in_array_assignment.txt b/test/prism/errors/3.4/keyword_args_in_array_assignment.txt similarity index 100% rename from test/prism/errors/keyword_args_in_array_assignment.txt rename to test/prism/errors/3.4/keyword_args_in_array_assignment.txt diff --git a/test/prism/errors/block_args_with_endless_def.txt b/test/prism/errors/block_args_with_endless_def.txt new file mode 100644 index 0000000000..a7242160d2 --- /dev/null +++ b/test/prism/errors/block_args_with_endless_def.txt @@ -0,0 +1,5 @@ +p do |a = def f = 1; b| end + ^~~~~~~ unexpected endless method definition; expected a default value for a parameter +p do |a = def f = 1| 2; b|c end + ^~~~~~~ unexpected endless method definition; expected a default value for a parameter + diff --git a/test/prism/errors/block_beginning_with_brace_and_ending_with_end.txt b/test/prism/errors/block_beginning_with_brace_and_ending_with_end.txt index 16af8200ec..1184b38ce8 100644 --- a/test/prism/errors/block_beginning_with_brace_and_ending_with_end.txt +++ b/test/prism/errors/block_beginning_with_brace_and_ending_with_end.txt @@ -1,5 +1,5 @@ x.each { x end ^~~ unexpected 'end', expecting end-of-input ^~~ unexpected 'end', ignoring it - ^ expected a block beginning with `{` to end with `}` + ^ expected a block beginning with `{` to end with `}` diff --git a/test/prism/errors/command_calls.txt b/test/prism/errors/command_calls.txt index 19812a1d0a..6601e5fbbc 100644 --- a/test/prism/errors/command_calls.txt +++ b/test/prism/errors/command_calls.txt @@ -1,3 +1,10 @@ [a b] ^ unexpected local variable or method; expected a `,` separator for the array elements + +[ + a b do + ^ unexpected local variable or method; expected a `,` separator for the array elements + end, +] + diff --git a/test/prism/errors/command_calls_2.txt b/test/prism/errors/command_calls_2.txt index b0983c015b..13e10f7ebf 100644 --- a/test/prism/errors/command_calls_2.txt +++ b/test/prism/errors/command_calls_2.txt @@ -1,5 +1,5 @@ {a: b c} - ^ expected a `}` to close the hash literal +^ expected a `}` to close the hash literal ^ unexpected local variable or method, expecting end-of-input ^ unexpected '}', expecting end-of-input ^ unexpected '}', ignoring it diff --git a/test/prism/errors/command_calls_24.txt b/test/prism/errors/command_calls_24.txt index 3046b36dc1..27a32ea3bf 100644 --- a/test/prism/errors/command_calls_24.txt +++ b/test/prism/errors/command_calls_24.txt @@ -1,5 +1,5 @@ ->a=b c{} ^ expected a `do` keyword or a `{` to open the lambda block ^ unexpected end-of-input, assuming it is closing the parent top level context - ^ expected a lambda block beginning with `do` to end with `end` +^~ expected a lambda block beginning with `do` to end with `end` diff --git a/test/prism/errors/command_calls_25.txt b/test/prism/errors/command_calls_25.txt index 5fddd90fdd..cf04508f87 100644 --- a/test/prism/errors/command_calls_25.txt +++ b/test/prism/errors/command_calls_25.txt @@ -4,5 +4,5 @@ ^ unexpected ')', expecting end-of-input ^ unexpected ')', ignoring it ^ unexpected end-of-input, assuming it is closing the parent top level context - ^ expected a lambda block beginning with `do` to end with `end` +^~ expected a lambda block beginning with `do` to end with `end` diff --git a/test/prism/errors/command_calls_31.txt b/test/prism/errors/command_calls_31.txt new file mode 100644 index 0000000000..e662b25444 --- /dev/null +++ b/test/prism/errors/command_calls_31.txt @@ -0,0 +1,17 @@ +true && not true + ^~~~ expected a `(` after `not` + ^~~~ unexpected 'true', expecting end-of-input + +true || not true + ^~~~ expected a `(` after `not` + ^~~~ unexpected 'true', expecting end-of-input + +true && not (true) + ^ expected a `(` immediately after `not` + ^ unexpected '(', expecting end-of-input + +true && not +true +^~~~ expected a `(` after `not` +^~~~ unexpected 'true', expecting end-of-input + diff --git a/test/prism/errors/command_calls_32.txt b/test/prism/errors/command_calls_32.txt new file mode 100644 index 0000000000..14488ca335 --- /dev/null +++ b/test/prism/errors/command_calls_32.txt @@ -0,0 +1,19 @@ +foo && return bar + ^~~ unexpected local variable or method, expecting end-of-input + +tap { foo && break bar } + ^~~ unexpected local variable or method, expecting end-of-input + +tap { foo && next bar } + ^~~ unexpected local variable or method, expecting end-of-input + +foo && return() + ^ unexpected '(', expecting end-of-input + +foo && return(bar) + ^ unexpected '(', expecting end-of-input + +foo && return(bar, baz) + ^~~~~~~~~~ unexpected write target + ^ unexpected '(', expecting end-of-input + diff --git a/test/prism/errors/command_calls_33.txt b/test/prism/errors/command_calls_33.txt new file mode 100644 index 0000000000..13e3b35c9e --- /dev/null +++ b/test/prism/errors/command_calls_33.txt @@ -0,0 +1,6 @@ +1 if foo = bar baz + ^~~ unexpected local variable or method, expecting end-of-input + +1 and foo = bar baz + ^~~ unexpected local variable or method, expecting end-of-input + diff --git a/test/prism/errors/command_calls_34.txt b/test/prism/errors/command_calls_34.txt new file mode 100644 index 0000000000..ce62bc1492 --- /dev/null +++ b/test/prism/errors/command_calls_34.txt @@ -0,0 +1,24 @@ +foo(bar 1 do end, 2) + ^ invalid comma + ^ unexpected integer; expected a `)` to close the arguments + ^ unexpected integer, expecting end-of-input + ^ unexpected ')', expecting end-of-input + ^ unexpected ')', ignoring it + +foo(bar 1 do end,) + ^ invalid comma + +foo(1, bar 2 do end) + ^ unexpected integer; expected a `)` to close the arguments + ^ unexpected integer, expecting end-of-input + ^~ unexpected 'do', expecting end-of-input + ^~ unexpected 'do', ignoring it + ^~~ unexpected 'end', ignoring it + ^ unexpected ')', ignoring it + +foo(1, bar 2) + ^ unexpected integer; expected a `)` to close the arguments + ^ unexpected integer, expecting end-of-input + ^ unexpected ')', expecting end-of-input + ^ unexpected ')', ignoring it + diff --git a/test/prism/errors/command_calls_35.txt b/test/prism/errors/command_calls_35.txt new file mode 100644 index 0000000000..45f569b117 --- /dev/null +++ b/test/prism/errors/command_calls_35.txt @@ -0,0 +1,46 @@ +p(p a, x: b => value) + ^~ unexpected '=>'; expected a `)` to close the arguments + ^ unexpected ')', expecting end-of-input + ^ unexpected ')', ignoring it + +p(p a, x: => value) + ^~ unexpected '=>'; expected a `)` to close the arguments + ^ unexpected ')', expecting end-of-input + ^ unexpected ')', ignoring it + +p(p a, &block => value) + ^~ unexpected '=>'; expected a `)` to close the arguments + ^ unexpected ')', expecting end-of-input + ^ unexpected ')', ignoring it + +p(p a do end => value) + ^~ unexpected '=>'; expected a `)` to close the arguments + ^ unexpected ')', expecting end-of-input + ^ unexpected ')', ignoring it + +p(p a, *args => value) + ^~ unexpected '=>'; expected a `)` to close the arguments + ^ unexpected ')', expecting end-of-input + ^ unexpected ')', ignoring it + +p(p a, **kwargs => value) + ^~ unexpected '=>'; expected a `)` to close the arguments + ^ unexpected ')', expecting end-of-input + ^ unexpected ')', ignoring it + +p p 1, &block => 2, &block + ^~ unexpected '=>', expecting end-of-input + ^~ unexpected '=>', ignoring it + ^ unexpected ',', expecting end-of-input + ^ unexpected ',', ignoring it + ^ unexpected '&', ignoring it + +p p p 1 => 2 => 3 => 4 + ^~ unexpected '=>', expecting end-of-input + ^~ unexpected '=>', ignoring it + +p[p a, x: b => value] + ^ expected a matching `]` + ^ unexpected ']', expecting end-of-input + ^ unexpected ']', ignoring it + diff --git a/test/prism/errors/def_with_optional_splat.txt b/test/prism/errors/def_with_optional_splat.txt new file mode 100644 index 0000000000..74a833ceec --- /dev/null +++ b/test/prism/errors/def_with_optional_splat.txt @@ -0,0 +1,6 @@ +def foo(*bar = nil); end + ^ unexpected '='; expected a `)` to close the parameters + ^ unexpected ')', expecting end-of-input + ^ unexpected ')', ignoring it + ^~~ unexpected 'end', ignoring it + diff --git a/test/prism/errors/destroy_call_operator_write_arguments.txt b/test/prism/errors/destroy_call_operator_write_arguments.txt new file mode 100644 index 0000000000..c3c72f9226 --- /dev/null +++ b/test/prism/errors/destroy_call_operator_write_arguments.txt @@ -0,0 +1,11 @@ +t next&&do end&= + ^~ unexpected 'do'; expected an expression after the operator + ^~~~ unexpected void value expression + ^~~~ unexpected void value expression +^~~~~~~~~~~~~~ unexpected write target + ^~ unexpected operator after a call with arguments + ^~ unexpected operator after a call with a block +''while= + ^~~~~ expected a predicate expression for the `while` statement + ^ unexpected '='; target cannot be written + diff --git a/test/prism/errors/endless_method_command_call.txt b/test/prism/errors/endless_method_command_call.txt new file mode 100644 index 0000000000..e6a328c294 --- /dev/null +++ b/test/prism/errors/endless_method_command_call.txt @@ -0,0 +1,3 @@ +private :m, def hello = puts "Hello" + ^ unexpected string literal, expecting end-of-input + diff --git a/test/prism/errors/endless_method_command_call_parameters.txt b/test/prism/errors/endless_method_command_call_parameters.txt new file mode 100644 index 0000000000..5dc92ce7f9 --- /dev/null +++ b/test/prism/errors/endless_method_command_call_parameters.txt @@ -0,0 +1,27 @@ +def f x: = 1 + ^ could not parse the endless method parameters + +def f ... = 1 + ^ could not parse the endless method parameters + +def f * = 1 + ^ could not parse the endless method parameters + +def f ** = 1 + ^ could not parse the endless method parameters + +def f & = 1 + ^ could not parse the endless method parameters + +def f *a = 1 + ^ could not parse the endless method parameters + +def f **a = 1 + ^ could not parse the endless method parameters + +def f &a = 1 + ^ could not parse the endless method parameters + +def f a, (b) = 1 + ^ could not parse the endless method parameters + diff --git a/test/prism/errors/heredoc_percent_q_newline_delimiter.txt b/test/prism/errors/heredoc_percent_q_newline_delimiter.txt new file mode 100644 index 0000000000..73664c071f --- /dev/null +++ b/test/prism/errors/heredoc_percent_q_newline_delimiter.txt @@ -0,0 +1,11 @@ +%q +#{<{< 1 } ^ unexpected '.'; expected a value in the hash literal - ^ expected a `}` to close the hash literal +^ expected a `}` to close the hash literal ^ unexpected '}', expecting end-of-input ^ unexpected '}', ignoring it diff --git a/test/prism/errors/label_in_interpolated_string.txt b/test/prism/errors/label_in_interpolated_string.txt new file mode 100644 index 0000000000..29af5310a1 --- /dev/null +++ b/test/prism/errors/label_in_interpolated_string.txt @@ -0,0 +1,14 @@ +case in el""Q +^~~~ expected a predicate for a case matching statement + ^ expected a delimiter after the patterns of an `in` clause + ^ unexpected constant, expecting end-of-input +^~~~ expected an `end` to close the `case` statement + !"""#{in el"":Q + ^~ unexpected 'in', assuming it is closing the parent 'in' clause + ^ expected a `}` to close the embedded expression + ^~ cannot parse the string part + ^~ cannot parse the string part + ^ cannot parse the string part + ^~~~~~~~~~~ unexpected label + ^~~~~~~~~~~ expected a string for concatenation + diff --git a/test/prism/errors/pattern-capture-in-alt-array.txt b/test/prism/errors/pattern-capture-in-alt-array.txt new file mode 100644 index 0000000000..5cb59fa328 --- /dev/null +++ b/test/prism/errors/pattern-capture-in-alt-array.txt @@ -0,0 +1,4 @@ +1 => [a, b] | 2 + ^ variable capture in alternative pattern + ^ variable capture in alternative pattern + diff --git a/test/prism/errors/pattern-capture-in-alt-hash.txt b/test/prism/errors/pattern-capture-in-alt-hash.txt new file mode 100644 index 0000000000..150b3baecc --- /dev/null +++ b/test/prism/errors/pattern-capture-in-alt-hash.txt @@ -0,0 +1,3 @@ +1 => { a: b } | 2 + ^ variable capture in alternative pattern + diff --git a/test/prism/errors/pattern-capture-in-alt-name.txt b/test/prism/errors/pattern-capture-in-alt-name.txt new file mode 100644 index 0000000000..cbf2bae85f --- /dev/null +++ b/test/prism/errors/pattern-capture-in-alt-name.txt @@ -0,0 +1,3 @@ +1 => (2 => b) | 2 + ^ variable capture in alternative pattern + diff --git a/test/prism/errors/pattern-capture-in-alt-top.txt b/test/prism/errors/pattern-capture-in-alt-top.txt new file mode 100644 index 0000000000..bdf3a7f637 --- /dev/null +++ b/test/prism/errors/pattern-capture-in-alt-top.txt @@ -0,0 +1,4 @@ +1 => a | b + ^ variable capture in alternative pattern + ^ variable capture in alternative pattern + diff --git a/test/prism/errors/pattern_arithmetic_expressions.txt b/test/prism/errors/pattern_arithmetic_expressions.txt new file mode 100644 index 0000000000..cfb3650531 --- /dev/null +++ b/test/prism/errors/pattern_arithmetic_expressions.txt @@ -0,0 +1,3 @@ +case 1; in -1**2; end + ^~~~~ expected a pattern expression after the `in` keyword + diff --git a/test/prism/errors/pattern_match_implicit_rest.txt b/test/prism/errors/pattern_match_implicit_rest.txt new file mode 100644 index 0000000000..8602c0add0 --- /dev/null +++ b/test/prism/errors/pattern_match_implicit_rest.txt @@ -0,0 +1,3 @@ +a=>b, *, + ^ expected a pattern expression after `,` + diff --git a/test/prism/errors/pattern_string_key.txt b/test/prism/errors/pattern_string_key.txt new file mode 100644 index 0000000000..41bc1fa57b --- /dev/null +++ b/test/prism/errors/pattern_string_key.txt @@ -0,0 +1,8 @@ +case:a +^~~~ expected an `end` to close the `case` statement +in b:"","#{}" + ^~~~~ expected a label after the `,` in the hash pattern + ^ expected a pattern expression after the key + ^ expected a delimiter after the patterns of an `in` clause + ^ unexpected end-of-input, assuming it is closing the parent top level context + diff --git a/test/prism/errors/shadow_args_in_lambda.txt b/test/prism/errors/shadow_args_in_lambda.txt index 2399a0ebd5..7fc78d7d8f 100644 --- a/test/prism/errors/shadow_args_in_lambda.txt +++ b/test/prism/errors/shadow_args_in_lambda.txt @@ -1,5 +1,5 @@ ->a;b{} ^ expected a `do` keyword or a `{` to open the lambda block ^ unexpected end-of-input, assuming it is closing the parent top level context - ^ expected a lambda block beginning with `do` to end with `end` +^~ expected a lambda block beginning with `do` to end with `end` diff --git a/test/prism/errors/unterminated_begin.txt b/test/prism/errors/unterminated_begin.txt new file mode 100644 index 0000000000..2733f830c9 --- /dev/null +++ b/test/prism/errors/unterminated_begin.txt @@ -0,0 +1,4 @@ +begin + ^ unexpected end-of-input, assuming it is closing the parent top level context +^~~~~ expected an `end` to close the `begin` statement + diff --git a/test/prism/errors/unterminated_begin_upcase.txt b/test/prism/errors/unterminated_begin_upcase.txt new file mode 100644 index 0000000000..5512f2089e --- /dev/null +++ b/test/prism/errors/unterminated_begin_upcase.txt @@ -0,0 +1,4 @@ +BEGIN { + ^ unexpected end-of-input, assuming it is closing the parent top level context + ^ expected a `}` to close the `BEGIN` statement + diff --git a/test/prism/errors/unterminated_block.txt b/test/prism/errors/unterminated_block.txt index 8cc772db16..db6a4aa56c 100644 --- a/test/prism/errors/unterminated_block.txt +++ b/test/prism/errors/unterminated_block.txt @@ -1,4 +1,4 @@ foo { ^ unexpected end-of-input, assuming it is closing the parent top level context - ^ expected a block beginning with `{` to end with `}` + ^ expected a block beginning with `{` to end with `}` diff --git a/test/prism/errors/unterminated_block_do_end.txt b/test/prism/errors/unterminated_block_do_end.txt new file mode 100644 index 0000000000..0b7c64965f --- /dev/null +++ b/test/prism/errors/unterminated_block_do_end.txt @@ -0,0 +1,4 @@ +foo do + ^ unexpected end-of-input, assuming it is closing the parent top level context + ^~ expected a block beginning with `do` to end with `end` + diff --git a/test/prism/errors/unterminated_class.txt b/test/prism/errors/unterminated_class.txt new file mode 100644 index 0000000000..f47a3aa7df --- /dev/null +++ b/test/prism/errors/unterminated_class.txt @@ -0,0 +1,4 @@ +class Foo + ^ unexpected end-of-input, assuming it is closing the parent top level context +^~~~~ expected an `end` to close the `class` statement + diff --git a/test/prism/errors/unterminated_def.txt b/test/prism/errors/unterminated_def.txt new file mode 100644 index 0000000000..a6212e3a21 --- /dev/null +++ b/test/prism/errors/unterminated_def.txt @@ -0,0 +1,5 @@ +def foo + ^ expected a delimiter to close the parameters + ^ unexpected end-of-input, assuming it is closing the parent top level context +^~~ expected an `end` to close the `def` statement + diff --git a/test/prism/errors/unterminated_end_upcase.txt b/test/prism/errors/unterminated_end_upcase.txt new file mode 100644 index 0000000000..ef01caa0ca --- /dev/null +++ b/test/prism/errors/unterminated_end_upcase.txt @@ -0,0 +1,4 @@ +END { + ^ unexpected end-of-input, assuming it is closing the parent top level context + ^ expected a `}` to close the `END` statement + diff --git a/test/prism/errors/unterminated_for.txt b/test/prism/errors/unterminated_for.txt new file mode 100644 index 0000000000..75978a7cae --- /dev/null +++ b/test/prism/errors/unterminated_for.txt @@ -0,0 +1,5 @@ +for x in y + ^ unexpected end-of-input; expected a 'do', newline, or ';' after the 'for' loop collection + ^ unexpected end-of-input, assuming it is closing the parent top level context +^~~ expected an `end` to close the `for` loop + diff --git a/test/prism/errors/unterminated_if.txt b/test/prism/errors/unterminated_if.txt new file mode 100644 index 0000000000..1697931773 --- /dev/null +++ b/test/prism/errors/unterminated_if.txt @@ -0,0 +1,5 @@ +if true + ^ expected `then` or `;` or '\n' + ^ unexpected end-of-input, assuming it is closing the parent top level context +^~ expected an `end` to close the conditional clause + diff --git a/test/prism/errors/unterminated_if_else.txt b/test/prism/errors/unterminated_if_else.txt new file mode 100644 index 0000000000..db7828cce8 --- /dev/null +++ b/test/prism/errors/unterminated_if_else.txt @@ -0,0 +1,5 @@ +if true +^~ expected an `end` to close the `else` clause +else + ^ unexpected end-of-input, assuming it is closing the parent top level context + diff --git a/test/prism/errors/unterminated_lambda_brace.txt b/test/prism/errors/unterminated_lambda_brace.txt new file mode 100644 index 0000000000..75474c7534 --- /dev/null +++ b/test/prism/errors/unterminated_lambda_brace.txt @@ -0,0 +1,4 @@ +-> { + ^ unexpected end-of-input, assuming it is closing the parent top level context + ^ expected a lambda block beginning with `{` to end with `}` + diff --git a/test/prism/errors/unterminated_module.txt b/test/prism/errors/unterminated_module.txt new file mode 100644 index 0000000000..4c50ba5f63 --- /dev/null +++ b/test/prism/errors/unterminated_module.txt @@ -0,0 +1,4 @@ +module Foo + ^ unexpected end-of-input, assuming it is closing the parent top level context +^~~~~~ expected an `end` to close the `module` statement + diff --git a/test/prism/errors/unterminated_pattern_bracket.txt b/test/prism/errors/unterminated_pattern_bracket.txt new file mode 100644 index 0000000000..4f35cd84af --- /dev/null +++ b/test/prism/errors/unterminated_pattern_bracket.txt @@ -0,0 +1,7 @@ +case x +^~~~ expected an `end` to close the `case` statement +in [1 + ^ expected a `]` to close the pattern expression + ^ expected a delimiter after the patterns of an `in` clause + ^ unexpected end-of-input, assuming it is closing the parent top level context + diff --git a/test/prism/errors/unterminated_pattern_paren.txt b/test/prism/errors/unterminated_pattern_paren.txt new file mode 100644 index 0000000000..426d614e61 --- /dev/null +++ b/test/prism/errors/unterminated_pattern_paren.txt @@ -0,0 +1,7 @@ +case x +^~~~ expected an `end` to close the `case` statement +in (1 + ^ expected a `)` to close the pattern expression + ^ expected a delimiter after the patterns of an `in` clause + ^ unexpected end-of-input, assuming it is closing the parent top level context + diff --git a/test/prism/errors/unterminated_until.txt b/test/prism/errors/unterminated_until.txt new file mode 100644 index 0000000000..42a0545200 --- /dev/null +++ b/test/prism/errors/unterminated_until.txt @@ -0,0 +1,5 @@ +until true + ^ expected a predicate expression for the `until` statement + ^ unexpected end-of-input, assuming it is closing the parent top level context +^~~~~ expected an `end` to close the `until` statement + diff --git a/test/prism/errors/while_endless_method.txt b/test/prism/errors/while_endless_method.txt index 6f062d89d0..cdd7ba9aba 100644 --- a/test/prism/errors/while_endless_method.txt +++ b/test/prism/errors/while_endless_method.txt @@ -1,5 +1,5 @@ while def f = g do end ^ expected a predicate expression for the `while` statement ^ unexpected end-of-input, assuming it is closing the parent top level context - ^ expected an `end` to close the `while` statement +^~~~~ expected an `end` to close the `while` statement diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb index 62bbd8458b..aa264ae5b7 100644 --- a/test/prism/errors_test.rb +++ b/test/prism/errors_test.rb @@ -1,41 +1,19 @@ # frozen_string_literal: true +return if RUBY_VERSION < "3.3.0" + require_relative "test_helper" module Prism class ErrorsTest < TestCase base = File.expand_path("errors", __dir__) - filepaths = Dir["*.txt", base: base] - - if RUBY_VERSION < "3.0" - filepaths -= [ - "cannot_assign_to_a_reserved_numbered_parameter.txt", - "writing_numbered_parameter.txt", - "targeting_numbered_parameter.txt", - "defining_numbered_parameter.txt", - "defining_numbered_parameter_2.txt", - "numbered_parameters_in_block_arguments.txt", - "numbered_and_write.txt", - "numbered_or_write.txt", - "numbered_operator_write.txt" - ] - end - - if RUBY_VERSION < "3.4" - filepaths -= [ - "it_with_ordinary_parameter.txt", - "block_args_in_array_assignment.txt", - "keyword_args_in_array_assignment.txt" - ] - end - - if RUBY_VERSION < "3.4" || RUBY_RELEASE_DATE < "2024-07-24" - filepaths -= ["dont_allow_return_inside_sclass_body.txt"] - end + filepaths = Dir["**/*.txt", base: base] filepaths.each do |filepath| - define_method(:"test_#{File.basename(filepath, ".txt")}") do - assert_errors(File.join(base, filepath)) + ruby_versions_for(filepath).each do |version| + define_method(:"test_#{version}_#{File.basename(filepath, ".txt")}") do + assert_errors(File.join(base, filepath), version) + end end end @@ -86,29 +64,38 @@ def test_invalid_message_name assert_equal :"", Prism.parse_statement("+.@foo,+=foo").write_name end - def test_circular_parameters - source = <<~RUBY - def foo(bar = bar) = 42 - def foo(bar: bar) = 42 - proc { |foo = foo| } - proc { |foo: foo| } - RUBY + def test_regexp_encoding_option_mismatch_error + # UTF-8 char with ASCII-8BIT modifier + result = Prism.parse('/Ȃ/n') + assert_includes result.errors.map(&:type), :regexp_encoding_option_mismatch - source.each_line do |line| - assert_predicate Prism.parse(line, version: "3.3.0"), :failure? - assert_predicate Prism.parse(line), :success? - end + # UTF-8 char with EUC-JP modifier + result = Prism.parse('/Ȃ/e') + assert_includes result.errors.map(&:type), :regexp_encoding_option_mismatch + + # UTF-8 char with Windows-31J modifier + result = Prism.parse('/Ȃ/s') + assert_includes result.errors.map(&:type), :regexp_encoding_option_mismatch + + # UTF-8 char with UTF-8 modifier + result = Prism.parse('/Ȃ/u') + assert_empty result.errors + end + + def test_incomplete_def_closing_loc + statement = Prism.parse_statement("def f; 123") + assert_empty(statement.end_keyword) end private - def assert_errors(filepath) + def assert_errors(filepath, version) expected = File.read(filepath, binmode: true, external_encoding: Encoding::UTF_8) source = expected.lines.grep_v(/^\s*\^/).join.gsub(/\n*\z/, "") - refute_valid_syntax(source) + refute_valid_syntax(source) if CURRENT_MAJOR_MINOR == version - result = Prism.parse(source) + result = Prism.parse(source, version: version) errors = result.errors refute_empty errors, "Expected errors in #{filepath}" diff --git a/test/prism/fixtures/3.3-3.3/block_args_in_array_assignment.txt b/test/prism/fixtures/3.3-3.3/block_args_in_array_assignment.txt new file mode 100644 index 0000000000..6d6b052681 --- /dev/null +++ b/test/prism/fixtures/3.3-3.3/block_args_in_array_assignment.txt @@ -0,0 +1 @@ +matrix[5, &block] = 8 diff --git a/test/prism/fixtures/it.txt b/test/prism/fixtures/3.3-3.3/it.txt similarity index 56% rename from test/prism/fixtures/it.txt rename to test/prism/fixtures/3.3-3.3/it.txt index 76deb68028..5410b01e71 100644 --- a/test/prism/fixtures/it.txt +++ b/test/prism/fixtures/3.3-3.3/it.txt @@ -1,3 +1,5 @@ x do it end + +-> { it } diff --git a/test/prism/fixtures/it_indirect_writes.txt b/test/prism/fixtures/3.3-3.3/it_indirect_writes.txt similarity index 100% rename from test/prism/fixtures/it_indirect_writes.txt rename to test/prism/fixtures/3.3-3.3/it_indirect_writes.txt diff --git a/test/prism/fixtures/3.3-3.3/it_read_and_assignment.txt b/test/prism/fixtures/3.3-3.3/it_read_and_assignment.txt new file mode 100644 index 0000000000..2cceeb2a54 --- /dev/null +++ b/test/prism/fixtures/3.3-3.3/it_read_and_assignment.txt @@ -0,0 +1 @@ +42.tap { p it; it = it; p it } diff --git a/test/prism/fixtures/3.3-3.3/it_with_ordinary_parameter.txt b/test/prism/fixtures/3.3-3.3/it_with_ordinary_parameter.txt new file mode 100644 index 0000000000..178b641e6b --- /dev/null +++ b/test/prism/fixtures/3.3-3.3/it_with_ordinary_parameter.txt @@ -0,0 +1 @@ +proc { || it } diff --git a/test/prism/fixtures/3.3-3.3/keyword_args_in_array_assignment.txt b/test/prism/fixtures/3.3-3.3/keyword_args_in_array_assignment.txt new file mode 100644 index 0000000000..88016c2afe --- /dev/null +++ b/test/prism/fixtures/3.3-3.3/keyword_args_in_array_assignment.txt @@ -0,0 +1 @@ +matrix[5, axis: :y] = 8 diff --git a/test/prism/fixtures/3.3-3.3/return_in_sclass.txt b/test/prism/fixtures/3.3-3.3/return_in_sclass.txt new file mode 100644 index 0000000000..f1fde5771a --- /dev/null +++ b/test/prism/fixtures/3.3-3.3/return_in_sclass.txt @@ -0,0 +1 @@ +class << A; return; end diff --git a/test/prism/fixtures/3.4/circular_parameters.txt b/test/prism/fixtures/3.4/circular_parameters.txt new file mode 100644 index 0000000000..11537023ad --- /dev/null +++ b/test/prism/fixtures/3.4/circular_parameters.txt @@ -0,0 +1,4 @@ +def foo(bar = bar) = 42 +def foo(bar: bar) = 42 +proc { |foo = foo| } +proc { |foo: foo| } diff --git a/test/prism/fixtures/3.4/it.txt b/test/prism/fixtures/3.4/it.txt new file mode 100644 index 0000000000..5410b01e71 --- /dev/null +++ b/test/prism/fixtures/3.4/it.txt @@ -0,0 +1,5 @@ +x do + it +end + +-> { it } diff --git a/test/prism/fixtures/3.4/it_indirect_writes.txt b/test/prism/fixtures/3.4/it_indirect_writes.txt new file mode 100644 index 0000000000..bb87e9483e --- /dev/null +++ b/test/prism/fixtures/3.4/it_indirect_writes.txt @@ -0,0 +1,23 @@ +tap { it += 1 } + +tap { it ||= 1 } + +tap { it &&= 1 } + +tap { it; it += 1 } + +tap { it; it ||= 1 } + +tap { it; it &&= 1 } + +tap { it += 1; it } + +tap { it ||= 1; it } + +tap { it &&= 1; it } + +tap { it; it += 1; it } + +tap { it; it ||= 1; it } + +tap { it; it &&= 1; it } diff --git a/test/prism/fixtures/3.4/it_read_and_assignment.txt b/test/prism/fixtures/3.4/it_read_and_assignment.txt new file mode 100644 index 0000000000..2cceeb2a54 --- /dev/null +++ b/test/prism/fixtures/3.4/it_read_and_assignment.txt @@ -0,0 +1 @@ +42.tap { p it; it = it; p it } diff --git a/test/prism/fixtures/4.0/endless_methods_command_call.txt b/test/prism/fixtures/4.0/endless_methods_command_call.txt new file mode 100644 index 0000000000..91a9d156d5 --- /dev/null +++ b/test/prism/fixtures/4.0/endless_methods_command_call.txt @@ -0,0 +1,8 @@ +private def foo = puts "Hello" +private def foo = puts "Hello", "World" +private def foo = puts "Hello" do expr end +private def foo() = puts "Hello" +private def foo(x) = puts x +private def obj.foo = puts "Hello" +private def obj.foo() = puts "Hello" +private def obj.foo(x) = puts x diff --git a/test/prism/fixtures/4.0/leading_logical.txt b/test/prism/fixtures/4.0/leading_logical.txt new file mode 100644 index 0000000000..feb5ee245c --- /dev/null +++ b/test/prism/fixtures/4.0/leading_logical.txt @@ -0,0 +1,21 @@ +1 +&& 2 +&& 3 + +1 +|| 2 +|| 3 + +1 +and 2 +and 3 + +1 +or 2 +or 3 + +1 +andfoo + +2 +orfoo diff --git a/test/prism/fixtures/__END__.txt b/test/prism/fixtures/__END__.txt new file mode 100644 index 0000000000..c0f4f28004 --- /dev/null +++ b/test/prism/fixtures/__END__.txt @@ -0,0 +1,3 @@ +foo +__END__ +Available in DATA constant diff --git a/test/prism/fixtures/bom_leading_space.txt b/test/prism/fixtures/bom_leading_space.txt new file mode 100644 index 0000000000..48d3ee50ea --- /dev/null +++ b/test/prism/fixtures/bom_leading_space.txt @@ -0,0 +1 @@ + p (42) diff --git a/test/prism/fixtures/bom_spaces.txt b/test/prism/fixtures/bom_spaces.txt new file mode 100644 index 0000000000..c18ad4c21a --- /dev/null +++ b/test/prism/fixtures/bom_spaces.txt @@ -0,0 +1 @@ +p ( 42 ) diff --git a/test/prism/fixtures/break.txt b/test/prism/fixtures/break.txt index 5532322c5c..d823f866df 100644 --- a/test/prism/fixtures/break.txt +++ b/test/prism/fixtures/break.txt @@ -20,6 +20,10 @@ tap { break() } tap { break(1) } +tap { (break 1) } + +tap { foo && (break 1) } + foo { break 42 } == 42 foo { |a| break } == 42 diff --git a/test/prism/fixtures/case_in_hash_key.txt b/test/prism/fixtures/case_in_hash_key.txt new file mode 100644 index 0000000000..75ac8a846f --- /dev/null +++ b/test/prism/fixtures/case_in_hash_key.txt @@ -0,0 +1,6 @@ +case 1 +in 2 + A.print message: +in 3 + A.print message: +end diff --git a/test/prism/fixtures/character_literal.txt b/test/prism/fixtures/character_literal.txt new file mode 100644 index 0000000000..920332123f --- /dev/null +++ b/test/prism/fixtures/character_literal.txt @@ -0,0 +1,2 @@ +# encoding: Windows-31J +p ?\u3042"" diff --git a/test/prism/fixtures/command_method_call_2.txt b/test/prism/fixtures/command_method_call_2.txt new file mode 100644 index 0000000000..165c45987a --- /dev/null +++ b/test/prism/fixtures/command_method_call_2.txt @@ -0,0 +1,3 @@ +foo(bar baz do end) + +foo(bar baz, bat) diff --git a/test/prism/fixtures/command_method_call_3.txt b/test/prism/fixtures/command_method_call_3.txt new file mode 100644 index 0000000000..6de0446aa9 --- /dev/null +++ b/test/prism/fixtures/command_method_call_3.txt @@ -0,0 +1,19 @@ +foo(bar 1, key => '2') + +foo(bar 1, KEY => '2') + +foo(bar 1, :key => '2') + +foo(bar 1, { baz: :bat } => '2') + +foo bar - %i[baz] => '2' + +foo(bar {} => '2') + +foo(bar baz {} => '2') + +foo(bar do end => '2') + +foo(1, bar {} => '2') + +foo(1, bar do end => '2') diff --git a/test/prism/fixtures/endless_method_as_default_arg.txt b/test/prism/fixtures/endless_method_as_default_arg.txt new file mode 100644 index 0000000000..0063d9a8fa --- /dev/null +++ b/test/prism/fixtures/endless_method_as_default_arg.txt @@ -0,0 +1,11 @@ +def foo(a = def f = 1); end + +def foo(a = def f = 1, b); end + +def foo(b, a = def f = 1); end + +def foo(a: def f = 1); end + +def foo(a = def f = 1+2); end + +->(a = def f = 1) {} diff --git a/test/prism/fixtures/endless_methods.txt b/test/prism/fixtures/endless_methods.txt index 8c2f2a30cc..7eb3bf4318 100644 --- a/test/prism/fixtures/endless_methods.txt +++ b/test/prism/fixtures/endless_methods.txt @@ -3,3 +3,5 @@ def foo = 1 def bar = A "" def method = 1 + 2 + 3 + +x = def f = p 1 diff --git a/test/prism/fixtures/heredoc_percent_q_newline_delimiter.txt b/test/prism/fixtures/heredoc_percent_q_newline_delimiter.txt new file mode 100644 index 0000000000..dbfa0bf4b4 --- /dev/null +++ b/test/prism/fixtures/heredoc_percent_q_newline_delimiter.txt @@ -0,0 +1,22 @@ +%Q +#{< ^([*a.x]) +x => ^([**a.x]) +x => ^({ a: }) diff --git a/test/prism/fixtures/rescue.txt b/test/prism/fixtures/rescue.txt index 99170fbe0f..f436463029 100644 --- a/test/prism/fixtures/rescue.txt +++ b/test/prism/fixtures/rescue.txt @@ -33,3 +33,7 @@ end foo if bar rescue baz z = x y rescue c d + +begin +rescue => A[] +end diff --git a/test/prism/fixtures/return.txt b/test/prism/fixtures/return.txt index a8b5b95fab..952fb80da8 100644 --- a/test/prism/fixtures/return.txt +++ b/test/prism/fixtures/return.txt @@ -22,3 +22,6 @@ return() return(1) +(return 1) + +foo && (return 1) diff --git a/test/prism/fixtures/string_concatination_frozen_false.txt b/test/prism/fixtures/string_concatination_frozen_false.txt new file mode 100644 index 0000000000..abe9301408 --- /dev/null +++ b/test/prism/fixtures/string_concatination_frozen_false.txt @@ -0,0 +1,5 @@ +# frozen_string_literal: false + +'foo' 'bar' + +'foo' 'bar' "baz#{bat}" diff --git a/test/prism/fixtures/string_concatination_frozen_true.txt b/test/prism/fixtures/string_concatination_frozen_true.txt new file mode 100644 index 0000000000..829777f0a7 --- /dev/null +++ b/test/prism/fixtures/string_concatination_frozen_true.txt @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +'foo' 'bar' + +'foo' 'bar' "baz#{bat}" diff --git a/test/prism/fixtures/strings.txt b/test/prism/fixtures/strings.txt index 0787152786..1419f975b7 100644 --- a/test/prism/fixtures/strings.txt +++ b/test/prism/fixtures/strings.txt @@ -99,6 +99,34 @@ bar) d ] +%w[ + foo\nbar baz\n\n\ + bat\n\\\n\foo +] + +%W[ + foo\nbar baz\n\n\ + bat\n\\\n\foo +] + +%w[foo\ + bar + baz\\ + bat + 1\n + 2 + 3\\n +] + +%W[foo\ + bar + baz\\ + bat + 1\n + 2 + 3\\n +] + %W[f\u{006f 006f}] %W[a b#{c}d e] @@ -146,6 +174,10 @@ baz %Q{abc} +%Q(\«) + +%q(\«) + %^#$^# %@#@# diff --git a/test/prism/fixtures/unary_method_calls.txt b/test/prism/fixtures/unary_method_calls.txt new file mode 100644 index 0000000000..dda85e4bdb --- /dev/null +++ b/test/prism/fixtures/unary_method_calls.txt @@ -0,0 +1,2 @@ +42.~@ +42.!@ diff --git a/test/prism/fixtures_test.rb b/test/prism/fixtures_test.rb index 3b4a502b90..7df97029d3 100644 --- a/test/prism/fixtures_test.rb +++ b/test/prism/fixtures_test.rb @@ -8,7 +8,6 @@ module Prism class FixturesTest < TestCase except = [] - if RUBY_VERSION < "3.3.0" # Ruby < 3.3.0 cannot parse heredocs where there are leading whitespace # characters in the heredoc start. @@ -25,7 +24,9 @@ class FixturesTest < TestCase except << "whitequark/ruby_bug_19281.txt" end - Fixture.each(except: except) do |fixture| + except << "command_method_call_2.txt" + + Fixture.each_for_current_ruby(except: except) do |fixture| define_method(fixture.test_name) { assert_valid_syntax(fixture.read) } end end diff --git a/test/prism/lex_test.rb b/test/prism/lex_test.rb index 2786c45a22..ea4606d2fb 100644 --- a/test/prism/lex_test.rb +++ b/test/prism/lex_test.rb @@ -6,46 +6,6 @@ module Prism class LexTest < TestCase - except = [ - # It seems like there are some oddities with nested heredocs and ripper. - # Waiting for feedback on https://bugs.ruby-lang.org/issues/19838. - "seattlerb/heredoc_nested.txt", - "whitequark/dedenting_heredoc.txt", - # Ripper seems to have a bug that the regex portions before and after - # the heredoc are combined into a single token. See - # https://bugs.ruby-lang.org/issues/19838. - "spanning_heredoc.txt", - "spanning_heredoc_newlines.txt", - # Prism emits a single :on_tstring_content in <<- style heredocs when there - # is a line continuation preceeded by escaped backslashes. It should emit two, same - # as if the backslashes are not present. - "heredocs_with_fake_newlines.txt", - ] - - if RUBY_VERSION < "3.3.0" - # This file has changed behavior in Ripper in Ruby 3.3, so we skip it if - # we're on an earlier version. - except << "seattlerb/pct_w_heredoc_interp_nested.txt" - - # Ruby < 3.3.0 cannot parse heredocs where there are leading whitespace - # characters in the heredoc start. - # Example: <<~' EOF' or <<-' EOF' - # https://bugs.ruby-lang.org/issues/19539 - except << "heredocs_leading_whitespace.txt" - except << "whitequark/ruby_bug_19539.txt" - - # https://bugs.ruby-lang.org/issues/19025 - except << "whitequark/numparam_ruby_bug_19025.txt" - # https://bugs.ruby-lang.org/issues/18878 - except << "whitequark/ruby_bug_18878.txt" - # https://bugs.ruby-lang.org/issues/19281 - except << "whitequark/ruby_bug_19281.txt" - end - - Fixture.each(except: except) do |fixture| - define_method(fixture.test_name) { assert_lex(fixture) } - end - def test_lex_file assert_nothing_raised do Prism.lex_file(__FILE__) @@ -86,16 +46,11 @@ def test_parse_lex_file end end - private - - def assert_lex(fixture) - source = fixture.read - - result = Prism.lex_compat(source) - assert_equal [], result.errors - - Prism.lex_ripper(source).zip(result.value).each do |(ripper, prism)| - assert_equal ripper, prism + if RUBY_VERSION >= "3.3" + def test_lex_compare + prism = Prism.lex_compat(File.read(__FILE__), version: "current").value + ripper = Prism.lex_ripper(File.read(__FILE__)) + assert_equal(ripper, prism) end end end diff --git a/test/prism/locals_test.rb b/test/prism/locals_test.rb index e0e9a45855..4f8d6080e8 100644 --- a/test/prism/locals_test.rb +++ b/test/prism/locals_test.rb @@ -13,11 +13,6 @@ # in comparing the locals because they will be the same. return if RubyVM::InstructionSequence.compile("").to_a[4][:parser] == :prism -# In Ruby 3.4.0, the local table for method forwarding changed. But 3.4.0 can -# refer to the dev version, so while 3.4.0 still isn't released, we need to -# check if we have a high enough revision. -return if RubyVM::InstructionSequence.compile("def foo(...); end").to_a[13][2][2][10].length != 1 - # Omit tests if running on a 32-bit machine because there is a bug with how # Ruby is handling large ISeqs on 32-bit machines return if RUBY_PLATFORM =~ /i686/ @@ -29,10 +24,13 @@ class LocalsTest < TestCase except = [ # Skip this fixture because it has a different number of locals because # CRuby is eliminating dead code. - "whitequark/ruby_bug_10653.txt" + "whitequark/ruby_bug_10653.txt", + + # https://bugs.ruby-lang.org/issues/21168#note-5 + "command_method_call_2.txt", ] - Fixture.each(except: except) do |fixture| + Fixture.each_for_current_ruby(except: except) do |fixture| define_method(fixture.test_name) { assert_locals(fixture) } end diff --git a/test/prism/magic_comment_test.rb b/test/prism/magic_comment_test.rb index ab4b5f56e5..ccfe5a5d0a 100644 --- a/test/prism/magic_comment_test.rb +++ b/test/prism/magic_comment_test.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "test_helper" +require "ripper" module Prism class MagicCommentTest < TestCase diff --git a/test/prism/ractor_test.rb b/test/prism/ractor_test.rb index 55ff723395..0e008ffb08 100644 --- a/test/prism/ractor_test.rb +++ b/test/prism/ractor_test.rb @@ -62,7 +62,11 @@ def with_ractor(*arguments, &block) if reader reader.gets.chomp else - puts(ignore_warnings { Ractor.new(*arguments, &block) }.take) + ractor = ignore_warnings { Ractor.new(*arguments, &block) } + + # Somewhere in the Ruby 4.0.* series, Ractor#take was removed and + # Ractor#value was added. + puts(ractor.respond_to?(:value) ? ractor.value : ractor.take) end end end diff --git a/test/prism/result/numeric_value_test.rb b/test/prism/result/numeric_value_test.rb index 5c89230a1f..0207fa6a86 100644 --- a/test/prism/result/numeric_value_test.rb +++ b/test/prism/result/numeric_value_test.rb @@ -6,16 +6,27 @@ module Prism class NumericValueTest < TestCase def test_numeric_value assert_equal 123, Prism.parse_statement("123").value + assert_equal 123, Prism.parse_statement("1_23").value assert_equal 3.14, Prism.parse_statement("3.14").value + assert_equal 3.14, Prism.parse_statement("3.1_4").value assert_equal 42i, Prism.parse_statement("42i").value + assert_equal 42i, Prism.parse_statement("4_2i").value assert_equal 42.1ri, Prism.parse_statement("42.1ri").value + assert_equal 42.1ri, Prism.parse_statement("42.1_0ri").value assert_equal 3.14i, Prism.parse_statement("3.14i").value + assert_equal 3.14i, Prism.parse_statement("3.1_4i").value assert_equal 42r, Prism.parse_statement("42r").value + assert_equal 42r, Prism.parse_statement("4_2r").value assert_equal 0.5r, Prism.parse_statement("0.5r").value + assert_equal 0.5r, Prism.parse_statement("0.5_0r").value assert_equal 42ri, Prism.parse_statement("42ri").value + assert_equal 42ri, Prism.parse_statement("4_2ri").value assert_equal 0.5ri, Prism.parse_statement("0.5ri").value + assert_equal 0.5ri, Prism.parse_statement("0.5_0ri").value assert_equal 0xFFr, Prism.parse_statement("0xFFr").value + assert_equal 0xFFr, Prism.parse_statement("0xF_Fr").value assert_equal 0xFFri, Prism.parse_statement("0xFFri").value + assert_equal 0xFFri, Prism.parse_statement("0xF_Fri").value end end end diff --git a/test/prism/result/source_location_test.rb b/test/prism/result/source_location_test.rb index 7bdc707658..38b971d02b 100644 --- a/test/prism/result/source_location_test.rb +++ b/test/prism/result/source_location_test.rb @@ -13,7 +13,7 @@ def test_AliasMethodNode end def test_AlternationPatternNode - assert_location(AlternationPatternNode, "foo => bar | baz", 7...16, &:pattern) + assert_location(AlternationPatternNode, "foo => 0 | 1", 7...12, &:pattern) end def test_AndNode diff --git a/test/prism/ruby/location_test.rb b/test/prism/ruby/location_test.rb index 33f844243c..5e2ab63802 100644 --- a/test/prism/ruby/location_test.rb +++ b/test/prism/ruby/location_test.rb @@ -13,19 +13,22 @@ def test_join assert_equal 0, joined.start_offset assert_equal 10, joined.length - assert_raise(RuntimeError, "Incompatible locations") do + e = assert_raise(RuntimeError) do argument.location.join(receiver.location) end + assert_equal "Incompatible locations", e.message other_argument = Prism.parse_statement("1234 + 567").arguments.arguments.first - assert_raise(RuntimeError, "Incompatible sources") do + e = assert_raise(RuntimeError) do other_argument.location.join(receiver.location) end + assert_equal "Incompatible sources", e.message - assert_raise(RuntimeError, "Incompatible sources") do + e = assert_raise(RuntimeError) do receiver.location.join(other_argument.location) end + assert_equal "Incompatible sources", e.message end def test_character_offsets diff --git a/test/prism/ruby/parameters_signature_test.rb b/test/prism/ruby/parameters_signature_test.rb index af5b54ed91..ea1eea106b 100644 --- a/test/prism/ruby/parameters_signature_test.rb +++ b/test/prism/ruby/parameters_signature_test.rb @@ -54,7 +54,7 @@ def test_keyrest_anonymous assert_parameters([[:keyrest, :**]], "**") end - if RUBY_ENGINE != "truffleruby" + if RUBY_ENGINE == "ruby" def test_key_ordering assert_parameters([[:keyreq, :a], [:keyreq, :b], [:key, :c], [:key, :d]], "a:, c: 1, b:, d: 2") end diff --git a/test/prism/ruby/parser_test.rb b/test/prism/ruby/parser_test.rb index e94f9f860d..55c12cab6f 100644 --- a/test/prism/ruby/parser_test.rb +++ b/test/prism/ruby/parser_test.rb @@ -5,8 +5,6 @@ begin verbose, $VERBOSE = $VERBOSE, nil require "parser/ruby33" - require "prism/translation/parser33" - require "prism/translation/parser34" rescue LoadError # In CRuby's CI, we're not going to test against the parser gem because we # don't want to have to install it. So in this case we'll just skip this test. @@ -56,6 +54,22 @@ def ==(other) module Prism class ParserTest < TestCase + # These files contain code with valid syntax that can't be parsed. + skip_syntax_error = [ + # alias/undef with %s(abc) symbol literal + "alias.txt", + "seattlerb/bug_215.txt", + + # %Q with newline delimiter and heredoc interpolation + "heredoc_percent_q_newline_delimiter.txt", + + # 1.. && 2 + "ranges.txt", + + # https://bugs.ruby-lang.org/issues/21168#note-5 + "command_method_call_2.txt", + ] + # These files contain code that is being parsed incorrectly by the parser # gem, and therefore we don't want to compare against our translation. skip_incorrect = [ @@ -87,18 +101,11 @@ class ParserTest < TestCase # Regex with \c escape "unescaping.txt", "seattlerb/regexp_esc_C_slash.txt", - ] - # These files are either failing to parse or failing to translate, so we'll - # skip them for now. - skip_all = skip_incorrect | [ + # https://github.com/whitequark/parser/issues/1084 + "unary_method_calls.txt", ] - # Not sure why these files are failing on JRuby, but skipping them for now. - if RUBY_ENGINE == "jruby" - skip_all.push("emoji_method_calls.txt", "symbols.txt") - end - # These files are failing to translate their lexer output into the lexer # output expected by the parser gem, so we'll skip them for now. skip_tokens = [ @@ -133,11 +140,11 @@ class ParserTest < TestCase "whitequark/space_args_block.txt" ] - Fixture.each do |fixture| + Fixture.each_for_version(except: skip_syntax_error, version: "3.3") do |fixture| define_method(fixture.test_name) do assert_equal_parses( fixture, - compare_asts: !skip_all.include?(fixture.path), + compare_asts: !skip_incorrect.include?(fixture.path), compare_tokens: !skip_tokens.include?(fixture.path), compare_comments: fixture.path != "embdoc_no_newline_at_end.txt" ) @@ -156,24 +163,44 @@ def test_non_prism_builder_class_deprecated if RUBY_VERSION >= "3.3" def test_current_parser_for_current_ruby - major, minor, _patch = Gem::Version.new(RUBY_VERSION).segments + major, minor = CURRENT_MAJOR_MINOR.split(".") # Let's just hope there never is a Ruby 3.10 or similar - expected = major * 10 + minor + expected = major.to_i * 10 + minor.to_i assert_equal(expected, Translation::ParserCurrent.new.version) end end + def test_invalid_syntax + code = <<~RUBY + foo do + case bar + when + end + end + RUBY + buffer = Parser::Source::Buffer.new("(string)") + buffer.source = code + + parser = Prism::Translation::Parser33.new + parser.diagnostics.all_errors_are_fatal = true + assert_raise(Parser::SyntaxError) { parser.tokenize(buffer) } + end + def test_it_block_parameter_syntax - it_fixture_path = Pathname(__dir__).join("../../../test/prism/fixtures/it.txt") + it_fixture_path = Pathname(__dir__).join("../../../test/prism/fixtures/3.4/it.txt") buffer = Parser::Source::Buffer.new(it_fixture_path) buffer.source = it_fixture_path.read actual_ast = Prism::Translation::Parser34.new.tokenize(buffer)[0] it_block_parameter_sexp = parse_sexp { + s(:begin, s(:itblock, s(:send, nil, :x), :it, - s(:lvar, :it)) + s(:lvar, :it)), + s(:itblock, + s(:lambda), :it, + s(:lvar, :it))) } assert_equal(it_block_parameter_sexp, actual_ast.to_sexp) @@ -190,11 +217,7 @@ def assert_equal_parses(fixture, compare_asts: true, compare_tokens: true, compa parser.diagnostics.all_errors_are_fatal = true expected_ast, expected_comments, expected_tokens = - begin - ignore_warnings { parser.tokenize(buffer) } - rescue ArgumentError, Parser::SyntaxError - return - end + ignore_warnings { parser.tokenize(buffer) } actual_ast, actual_comments, actual_tokens = ignore_warnings { Prism::Translation::Parser33.new.tokenize(buffer) } diff --git a/test/prism/ruby/ripper_test.rb b/test/prism/ruby/ripper_test.rb index d4b278c28e..6e9dcee4c9 100644 --- a/test/prism/ruby/ripper_test.rb +++ b/test/prism/ruby/ripper_test.rb @@ -1,36 +1,46 @@ # frozen_string_literal: true -return if RUBY_VERSION < "3.3" || RUBY_ENGINE == "truffleruby" +return if RUBY_VERSION < "3.3" || RUBY_ENGINE != "ruby" require_relative "../test_helper" +require "ripper" module Prism class RipperTest < TestCase # Skip these tests that Ripper is reporting the wrong results for. incorrect = [ # Ripper incorrectly attributes the block to the keyword. - "seattlerb/block_break.txt", - "seattlerb/block_next.txt", "seattlerb/block_return.txt", - "whitequark/break_block.txt", - "whitequark/next_block.txt", "whitequark/return_block.txt", - # Ripper is not accounting for locals created by patterns using the ** - # operator within an `in` clause. - "seattlerb/parse_pattern_058.txt", - # Ripper cannot handle named capture groups in regular expressions. "regex.txt", - "regex_char_width.txt", - "whitequark/lvar_injecting_match.txt", # Ripper fails to understand some structures that span across heredocs. - "spanning_heredoc.txt" + "spanning_heredoc.txt", + + # Ripper interprets circular keyword arguments as method calls. + "3.4/circular_parameters.txt", + + # Ripper doesn't emit `args_add_block` when endless method is prefixed by modifier. + "4.0/endless_methods_command_call.txt", + + # https://bugs.ruby-lang.org/issues/21168#note-5 + "command_method_call_2.txt", ] + if RUBY_VERSION.start_with?("3.3.") + incorrect += [ + "whitequark/lvar_injecting_match.txt", + "seattlerb/parse_pattern_058.txt", + "regex_char_width.txt", + ] + end + # Skip these tests that we haven't implemented yet. - omitted = [ + omitted_sexp_raw = [ + "bom_leading_space.txt", + "bom_spaces.txt", "dos_endings.txt", "heredocs_with_fake_newlines.txt", "heredocs_with_ignored_newlines.txt", @@ -51,14 +61,134 @@ class RipperTest < TestCase "whitequark/slash_newline_in_heredocs.txt" ] - Fixture.each(except: incorrect | omitted) do |fixture| - define_method(fixture.test_name) { assert_ripper(fixture.read) } + omitted_lex = [ + "comments.txt", + "heredoc_percent_q_newline_delimiter.txt", + "heredoc_with_escaped_newline_at_start.txt", + "heredocs_with_fake_newlines.txt", + "indented_file_end.txt", + "seattlerb/TestRubyParserShared.txt", + "seattlerb/class_comments.txt", + "seattlerb/module_comments.txt", + "seattlerb/parse_line_block_inline_comment_leading_newlines.txt", + "seattlerb/parse_line_block_inline_multiline_comment.txt", + "spanning_heredoc_newlines.txt", + "strings.txt", + "whitequark/dedenting_heredoc.txt", + "whitequark/procarg0.txt", + ] + + Fixture.each_for_current_ruby(except: incorrect | omitted_sexp_raw) do |fixture| + define_method("#{fixture.test_name}_sexp_raw") { assert_ripper_sexp_raw(fixture.read) } + end + + Fixture.each_for_current_ruby(except: incorrect | omitted_lex) do |fixture| + define_method("#{fixture.test_name}_lex") { assert_ripper_lex(fixture.read) } + end + + module Events + attr_reader :events + + def initialize(...) + super + @events = [] + end + + Prism::Translation::Ripper::PARSER_EVENTS.each do |event| + define_method(:"on_#{event}") do |*args| + @events << [event, *args] + super(*args) + end + end + end + + class RipperEvents < Ripper + include Events + end + + class PrismEvents < Translation::Ripper + include Events + end + + class ObjectEvents < Translation::Ripper + OBJECT = BasicObject.new + Prism::Translation::Ripper::PARSER_EVENTS.each do |event| + define_method(:"on_#{event}") { |*args| OBJECT } + end + end + + Fixture.each_for_current_ruby(except: incorrect) do |fixture| + define_method("#{fixture.test_name}_events") do + source = fixture.read + # Similar to test/ripper/assert_parse_files.rb in CRuby + object_events = ObjectEvents.new(source) + assert_nothing_raised { object_events.parse } + end + end + + def test_events + source = "1 rescue 2" + ripper = RipperEvents.new(source) + prism = PrismEvents.new(source) + ripper.parse + prism.parse + # This makes sure that the content is the same. Ordering is not correct for now. + assert_equal(ripper.events.sort, prism.events.sort) + end + + def test_lexer + lexer = Translation::Ripper::Lexer.new("foo") + expected = [[1, 0], :on_ident, "foo", Translation::Ripper::EXPR_CMDARG] + + assert_equal([expected], lexer.lex) + assert_equal(expected, lexer.parse[0].to_a) + assert_equal(lexer.parse[0].to_a, lexer.scan[0].to_a) + + assert_equal(%i[on_int on_sp on_op], Translation::Ripper::Lexer.new("1 +").lex.map(&:event)) + assert_raise(SyntaxError) { Translation::Ripper::Lexer.new("1 +").lex(raise_errors: true) } + end + + def test_tokenize + source = "foo;1;BAZ" + assert_equal(Ripper.tokenize(source), Translation::Ripper.tokenize(source)) + end + + # Check that the hardcoded values don't change without us noticing. + def test_internals + actual = Translation::Ripper.constants.select { |name| name.start_with?("EXPR_") }.sort + expected = Ripper.constants.select { |name| name.start_with?("EXPR_") }.sort + + assert_equal(expected, actual) + expected.zip(actual).each do |ripper, prism| + assert_equal(Ripper.const_get(ripper), Translation::Ripper.const_get(prism)) + end end private - def assert_ripper(source) + def assert_ripper_sexp_raw(source) assert_equal Ripper.sexp_raw(source), Prism::Translation::Ripper.sexp_raw(source) end + + def assert_ripper_lex(source) + prism = Translation::Ripper.lex(source) + ripper = Ripper.lex(source) + + # Prism emits tokens by their order in the code, not in parse order + ripper.sort_by! { |elem| elem[0] } + + [prism.size, ripper.size].max.times do |i| + expected = ripper[i] + actual = prism[i] + + # Since tokens related to heredocs are not emitted in the same order, + # the state also doesn't line up. + if expected && actual && expected[1] == :on_heredoc_end && actual[1] == :on_heredoc_end + expected[3] = actual[3] = nil + end + + assert_equal(expected, actual) + end + end end end diff --git a/test/prism/ruby/ruby_parser_test.rb b/test/prism/ruby/ruby_parser_test.rb index 03bcfafc42..4b7e9c93ed 100644 --- a/test/prism/ruby/ruby_parser_test.rb +++ b/test/prism/ruby/ruby_parser_test.rb @@ -13,23 +13,12 @@ return end -# We want to also compare lines and files to make sure we're setting them -# correctly. -Sexp.prepend( - Module.new do - def ==(other) - super && line == other.line && file == other.file # && line_max == other.line_max - end - end -) - module Prism class RubyParserTest < TestCase todos = [ + "character_literal.txt", "encoding_euc_jp.txt", - "newline_terminated.txt", "regex_char_width.txt", - "seattlerb/bug169.txt", "seattlerb/masgn_colon3.txt", "seattlerb/messy_op_asgn_lineno.txt", "seattlerb/op_asgn_primary_colon_const_command_call.txt", @@ -37,15 +26,10 @@ class RubyParserTest < TestCase "seattlerb/str_lit_concat_bad_encodings.txt", "strings.txt", "unescaping.txt", - "unparser/corpus/literal/kwbegin.txt", - "unparser/corpus/literal/send.txt", "whitequark/masgn_const.txt", "whitequark/pattern_matching_constants.txt", - "whitequark/pattern_matching_implicit_array_match.txt", "whitequark/pattern_matching_single_match.txt", "whitequark/ruby_bug_12402.txt", - "whitequark/ruby_bug_14690.txt", - "whitequark/space_args_block.txt" ] # https://github.com/seattlerb/ruby_parser/issues/344 @@ -53,6 +37,7 @@ class RubyParserTest < TestCase "alias.txt", "dsym_str.txt", "dos_endings.txt", + "heredoc_percent_q_newline_delimiter.txt", "heredocs_with_fake_newlines.txt", "heredocs_with_ignored_newlines.txt", "method_calls.txt", @@ -73,6 +58,7 @@ class RubyParserTest < TestCase "spanning_heredoc.txt", "symbols.txt", "tilde_heredocs.txt", + "unary_method_calls.txt", "unparser/corpus/literal/literal.txt", "while.txt", "whitequark/cond_eflipflop.txt", @@ -90,7 +76,20 @@ class RubyParserTest < TestCase "whitequark/ruby_bug_11989.txt", "whitequark/ruby_bug_18878.txt", "whitequark/ruby_bug_19281.txt", - "whitequark/slash_newline_in_heredocs.txt" + "whitequark/slash_newline_in_heredocs.txt", + + "3.3-3.3/block_args_in_array_assignment.txt", + "3.3-3.3/it_with_ordinary_parameter.txt", + "3.3-3.3/keyword_args_in_array_assignment.txt", + "3.3-3.3/return_in_sclass.txt", + + "3.4/circular_parameters.txt", + + "4.0/endless_methods_command_call.txt", + "4.0/leading_logical.txt", + + # https://bugs.ruby-lang.org/issues/21168#note-5 + "command_method_call_2.txt", ] Fixture.each(except: failures) do |fixture| @@ -105,10 +104,16 @@ def assert_ruby_parser(fixture, allowed_failure) source = fixture.read expected = ignore_warnings { ::RubyParser.new.parse(source, fixture.path) } actual = Prism::Translation::RubyParser.new.parse(source, fixture.path) + on_failure = -> { message(expected, actual) } if !allowed_failure - assert_equal(expected, actual, -> { message(expected, actual) }) - elsif expected == actual + assert_equal(expected, actual, on_failure) + + unless actual.nil? + assert_equal(expected.line, actual.line, on_failure) + assert_equal(expected.file, actual.file, on_failure) + end + elsif expected == actual && expected.line && actual.line && expected.file == actual.file puts "#{name} now passes" end end diff --git a/test/prism/ruby/source_test.rb b/test/prism/ruby/source_test.rb new file mode 100644 index 0000000000..afd2825765 --- /dev/null +++ b/test/prism/ruby/source_test.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +module Prism + class SourceTest < TestCase + def test_line_to_byte_offset + parse_result = Prism.parse(<<~SRC) + abcd + efgh + ijkl + SRC + source = parse_result.source + + assert_equal 0, source.line_to_byte_offset(1) + assert_equal 5, source.line_to_byte_offset(2) + assert_equal 10, source.line_to_byte_offset(3) + assert_equal 15, source.line_to_byte_offset(4) + e = assert_raise(ArgumentError) { source.line_to_byte_offset(5) } + assert_equal "line 5 is out of range", e.message + e = assert_raise(ArgumentError) { source.line_to_byte_offset(0) } + assert_equal "line 0 is out of range", e.message + e = assert_raise(ArgumentError) { source.line_to_byte_offset(-1) } + assert_equal "line -1 is out of range", e.message + end + + def test_line_to_byte_offset_with_start_line + parse_result = Prism.parse(<<~SRC, line: 11) + abcd + efgh + ijkl + SRC + source = parse_result.source + + assert_equal 0, source.line_to_byte_offset(11) + assert_equal 5, source.line_to_byte_offset(12) + assert_equal 10, source.line_to_byte_offset(13) + assert_equal 15, source.line_to_byte_offset(14) + e = assert_raise(ArgumentError) { source.line_to_byte_offset(15) } + assert_equal "line 15 is out of range", e.message + e = assert_raise(ArgumentError) { source.line_to_byte_offset(10) } + assert_equal "line 10 is out of range", e.message + e = assert_raise(ArgumentError) { source.line_to_byte_offset(9) } + assert_equal "line 9 is out of range", e.message + end + end +end diff --git a/test/prism/snapshots_test.rb b/test/prism/snapshots_test.rb index 3fbda1f86e..b63dfaa4eb 100644 --- a/test/prism/snapshots_test.rb +++ b/test/prism/snapshots_test.rb @@ -31,24 +31,22 @@ def teardown if RUBY_ENGINE == "truffleruby" except.push( "emoji_method_calls.txt", - "seattlerb/bug202.txt", - "seattlerb/magic_encoding_comment.txt" ) end - Fixture.each(except: except) do |fixture| - define_method(fixture.test_name) { assert_snapshot(fixture) } + Fixture.each_with_all_versions(except: except) do |fixture, version| + define_method(fixture.test_name(version)) { assert_snapshot(fixture, version) } end private - def assert_snapshot(fixture) + def assert_snapshot(fixture, version) source = fixture.read - result = Prism.parse(source, filepath: fixture.path) + result = Prism.parse(source, filepath: fixture.path, version: version) assert result.success? - printed = PP.pp(result.value, +"", 79) + printed = result.value.inspect snapshot = fixture.snapshot_path if File.exist?(snapshot) @@ -57,8 +55,14 @@ def assert_snapshot(fixture) # If the snapshot file exists, but the printed value does not match the # snapshot, then update the snapshot file. if printed != saved - File.write(snapshot, printed) - warn("Updated snapshot at #{snapshot}.") + if ENV["UPDATE_SNAPSHOTS"] + File.write(snapshot, printed) + else + warn("Snapshot at #{snapshot} outdated for #{version}. Run with UPDATE_SNAPSHOTS=1 " \ + "to regenerate the files. If modifying behaviour for a subset of ruby versions, " \ + "instead move the fixture and snapshot into versioned directories. For more details, " \ + "see `Prism::TestCase.ruby_versions_for`.") + end end # If the snapshot file exists, then assert that the printed value diff --git a/test/prism/snippets_test.rb b/test/prism/snippets_test.rb index 66802c5dc3..3c28d27a25 100644 --- a/test/prism/snippets_test.rb +++ b/test/prism/snippets_test.rb @@ -18,24 +18,24 @@ class SnippetsTest < TestCase "whitequark/multiple_pattern_matches.txt" ] - Fixture.each(except: except) do |fixture| - define_method(fixture.test_name) { assert_snippets(fixture) } + Fixture.each_with_all_versions(except: except) do |fixture, version| + define_method(fixture.test_name(version)) { assert_snippets(fixture, version) } end private # We test every snippet (separated by \n\n) in isolation to ensure the # parser does not try to read bytes further than the end of each snippet. - def assert_snippets(fixture) + def assert_snippets(fixture, version) fixture.read.split(/(?<=\S)\n\n(?=\S)/).each do |snippet| snippet = snippet.rstrip - result = Prism.parse(snippet, filepath: fixture.path) + result = Prism.parse(snippet, filepath: fixture.path, version: version) assert result.success? if !ENV["PRISM_BUILD_MINIMAL"] - dumped = Prism.dump(snippet, filepath: fixture.path) - assert_equal_nodes(result.value, Prism.load(snippet, dumped).value) + dumped = Prism.dump(snippet, filepath: fixture.path, version: version) + assert_equal_nodes(result.value, Prism.load(snippet, dumped, version: version).value) end end end diff --git a/test/prism/test_helper.rb b/test/prism/test_helper.rb index 0be9d1e7da..406582c0a5 100644 --- a/test/prism/test_helper.rb +++ b/test/prism/test_helper.rb @@ -2,7 +2,6 @@ require "prism" require "pp" -require "ripper" require "stringio" require "test/unit" require "tempfile" @@ -58,8 +57,12 @@ def snapshot_path File.join(File.expand_path("../..", __dir__), "snapshots", path) end - def test_name - :"test_#{path}" + def test_name(version = nil) + if version + :"test_#{version}_#{path}" + else + :"test_#{path}" + end end def self.each(except: [], &block) @@ -68,6 +71,25 @@ def self.each(except: [], &block) paths.each { |path| yield Fixture.new(path) } end + def self.each_for_version(except: [], version:, &block) + each(except: except) do |fixture| + next unless TestCase.ruby_versions_for(fixture.path).include?(version) + yield fixture + end + end + + def self.each_for_current_ruby(except: [], &block) + each_for_version(except: except, version: CURRENT_MAJOR_MINOR, &block) + end + + def self.each_with_all_versions(except: [], &block) + each(except: except) do |fixture| + TestCase.ruby_versions_for(fixture.path).each do |version| + yield fixture, version + end + end + end + def self.custom_base_path? ENV.key?("FIXTURE_BASE") end @@ -217,6 +239,36 @@ def self.windows? RbConfig::CONFIG["host_os"].match?(/bccwin|cygwin|djgpp|mingw|mswin|wince/i) end + # All versions that prism can parse + SYNTAX_VERSIONS = %w[3.3 3.4 4.0 4.1] + + # `RUBY_VERSION` with the patch version excluded + CURRENT_MAJOR_MINOR = RUBY_VERSION.split(".")[0, 2].join(".") + + # Returns an array of ruby versions that a given filepath should test against: + # test.txt # => all available versions + # 3.4/test.txt # => versions since 3.4 (inclusive) + # 3.4-4.2/test.txt # => verisions since 3.4 (inclusive) up to 4.2 (inclusive) + def self.ruby_versions_for(filepath) + return [ENV['SYNTAX_VERSION']] if ENV['SYNTAX_VERSION'] + + parts = filepath.split("/") + return SYNTAX_VERSIONS if parts.size == 1 + + version_start, version_stop = parts[0].split("-") + if version_stop + SYNTAX_VERSIONS[SYNTAX_VERSIONS.index(version_start)..SYNTAX_VERSIONS.index(version_stop)] + else + SYNTAX_VERSIONS[SYNTAX_VERSIONS.index(version_start)..] + end + end + + if RUBY_VERSION >= "3.3.0" + def test_all_syntax_versions_present + assert_include(SYNTAX_VERSIONS, CURRENT_MAJOR_MINOR) + end + end + private if RUBY_ENGINE == "ruby" && RubyVM::InstructionSequence.compile("").to_a[4][:parser] != :prism